function setClass(objectID,newClass) {
	var dom = findDOM(objectID,0);
	dom.className= newClass;
}

//EXTRAFENSTER spezial | (c) by dE 2001 | v1
//changed ab, 3.0, deactivate java plugin window if cookie "toc.javaplugin.warning.deactivate" is "true"
function openWindow(getURL,WinTitleName,WinWidth,WinHeight,WinFeatures,WinPosLeft,WinPosTop,WinFocus){
eval("var "+WinTitleName);
	// Fenster öffnen
	//alert("window: "+WinTitleName);
	// check java plugin deactivate cookie
	if (WinTitleName == "DownloadJavaPlugin") {
		//alert("Check Java Plugin cookie");
		var deactivateString = getCookie("toc.javaplugin.warning.deactivate");
		if (deactivateString == "true") {
			return;
		}
	}

	if(eval(WinTitleName) == null||eval(WinTitleName+".closed")){                                 // wenn das Fenster nicht vorhanden ((WinTitleName)==null) ist  oder  geschlossen (WinTitleName+".closed") ist
	
		if (WinPosLeft == 0.1) {ScreenWidth = screen.width;xpos = (ScreenWidth/2-WinWidth/2);}    // WinPosLeft == 0.1 --> Fenster auf x-Achse zentrieren
			else {xpos = WinPosLeft;}                                                             // nimm den angegebenen Wert für die x-Achse
		if (WinPosTop == 0.1) {ScreenHeight = screen.height;ypos = (ScreenHeight/2-WinHeight/2);} // WinPosTop == 0.1 --> Fenster auf y-Achse zentrieren
			else {ypos = WinPosTop;}                                                              // nimm den angegebenen Wert für die y-Achse
		WinPos = "screenX="+xpos+",screenY="+ypos+",left="+xpos+",top="+ypos;
		eval(WinTitleName+"=window.open('"+getURL+"','"+WinTitleName+"','width="+WinWidth+",height="+WinHeight+","+WinFeatures+","+WinPos+"')");
		eval(WinTitleName+".focus()");
		}

	// Fenster nur focusieren
	else if (WinFocus){ // WinFocus = 1 --> Fester focusieren
					    // WinFocus = 0 --> Fester nicht focusieren
		eval(WinTitleName+".focus()");
		}

	// Fenster öffnen
	else{
		if (WinPosLeft == 0.1) {ScreenWidth = screen.width;xpos = (ScreenWidth/2-WinWidth/2);}    // WinPosLeft == 0.1 --> Fenster auf x-Achse zentrieren
			else {xpos = WinPosLeft;}                                                             // nimm den angegebenen Wert für die x-Achse
		if (WinPosTop == 0.1) {ScreenHeight = screen.height;ypos = (ScreenHeight/2-WinHeight/2);} // WinPosTop == 0.1 --> Fenster auf y-Achse zentrieren
			else {ypos = WinPosTop;}                                                              // nimm den angegebenen Wert für die y-Achse
		WinPos = "screenX="+xpos+",screenY="+ypos+",left="+xpos+",top="+ypos;
		eval(WinTitleName+"=window.open('"+getURL+"','"+WinTitleName+"','width="+WinWidth+",height="+WinHeight+","+WinFeatures+","+WinPos+"')");
		eval(WinTitleName+".focus()");
	}
	return eval(WinTitleName);
}

function closeWindow(){
	var win = top.FrameLogo.win;
        var d=(win==null||win.closed);
        if(!d){win.close();}
}


function jumpMenuManufacturer(baseUrl) {
	document.Manufacturer.submit();
	document.Manufacturer.TTNr.value="";
/*	parent.FrameContentCriteria.location.href = "emty_content.jsp";
	parent.FrameContentTypes.location.href = type;
	parent.FrameContentDlgFooter.location.href = "emty_content.jsp";
	*/
	var urlLoadCrit = baseUrl + "?dlg=DlgCtrCarSelection&action=MmLoadCriteria&reset=true";
	//parent.FrameContentCriteria.location.href = urlLoadCrit;
	parent.FrameContentCriteria.location.href = "emty_content.jsp";
	parent.FrameContentTypes.location.href = "emty_content.jsp";
	parent.FrameContentDlgFooter.location.href = "emty_content.jsp";
}

function jumpAxlesManufacturer(baseUrl) {
	document.Manufacturer.submit();
	parent.FrameContentTypes.location.href = "emty_content.jsp";
	parent.FrameContentDlgFooter.location.href = "emty_content.jsp";
}

function jumpMenuModels(baseUrl) {
	document.Models.submit();
	var urlLoadCrit = baseUrl + "?dlg=DlgCtrCarSelection&action=MmLoadCriteria&reset=true";
	parent.FrameContentCriteria.location.href = urlLoadCrit;
	parent.FrameContentDlgFooter.location.href = "emty_content.jsp";
}

function jumpAxlesMenuModels(baseUrl) {
	parent.FrameContentTypes.location.href = "emty_content.jsp";
	parent.FrameContentDlgFooter.location.href = "emty_content.jsp";
}

function loadAddressType() {
	document.Address.submit();
	
}



function loadTypeList(baseUrl){
	var type = baseUrl + "?dlg=DlgCtrCarSelection&action=LoadTypeList&process=CarSelection";
	parent.FrameContentTypes.location.href = type;
}

function loadTypeListHeaderMC (baseUrl) {
	parent.FrameContentMCFooter.location.href = baseUrl + "?dlg=DlgCtrCarSelection&action=McLoadTypesHeader&process=CarSelection";
}

function jumpMCManufacturer() {
	document.CriteriaMC.SellsTerm.value = '';
	parent.FrameContentMotorlist.location.href = "emty_content.jsp";
	parent.FrameContentTypes.location.href = "emty_content.jsp";
  parent.FrameContentDlgFooter.location.href = "emty_content.jsp";
}

var sc_id;
function setShortCuts(sc_id,UrlSessionID){
  var baseUrl = UrlSessionID; //LinkTag mit process-Attribut -> schon Fragezeichen in UrlSessionID enthalten
  
	var url = baseUrl + "&dlg=DlgCtrAssemblyGroupSelection&action=SetShortcut&shortId=" + sc_id;
	
	parent.FrameTree.location.href = url; 
}

// begin block - alle Checkboxfelder aktivieren bzw. deaktivieren
function checkBoxesKriteriendialog (form) {
	if (document.checkboxcontroler.allesodernichts.checked) { check = true; }
	if (!document.checkboxcontroler.allesodernichts.checked) { check = false; }
	for (var c = 0; c < form.elements.length; c++)
	if (form.elements[c].type == 'checkbox')
	form.elements[c].checked = check;
}
// end block - alle Checkboxfelder aktivieren bzw. deaktivieren

// end block - Einstellungen
//hz 11.10.01
function jumpMenuArticleDirectSearchManufacturer(BaseUrl) {
  	top.FrameLogo.selectedArticleDirectSearchIndex = -1;
  var newURL = "";
  var queryStr = "?dlg=DlgCtrArticleDirectSearch&action=SetManufacturer&process=ArticleDirectSearch&manIndex=";
	var newURI = document.jumpList.Manufacturer.selectedIndex;
	newURL = document.jumpList.Manufacturer.options[newURI].value;
	newURL = BaseUrl + queryStr + newURL;
  	parent.FrameContentCsgFrameset.location.href= newURL;
}

function jumpMenuArticleDirectSearchProductgroup(BaseUrl) {
  	top.FrameLogo.selectedArticleDirectSearchIndex = -1;
  var newURL = "";
	var newURI = document.jumpList.Productgroup.selectedIndex;
	newURL = document.jumpList.Productgroup.options[newURI].value;
	var queryStr = "?dlg=DlgCtrArticleDirectSearch&action=SetProductgroup&process=ArticleDirectSearch&prodIndex=";
	newURL = BaseUrl + queryStr + newURL;
  	parent.FrameContentCsgFrameset.location.href= newURL;
}

function ArticleDirectSearchManufacturer(BaseUrl) { // Sortierung nach Hersteller
  	top.FrameLogo.selectedArticleDirectSearchIndex = -1;
	var queryStr = "?dlg=DlgCtrArticleDirectSearch&action=SortManufacturer&process=ArticleDirectSearch"
	var url = BaseUrl + queryStr;
	parent.FrameContentCsgFrameset.location.href=url;
}

function ArticleDirectSearchProductgroup(BaseUrl) { // Sortierung nach Produktruppe
  	top.FrameLogo.selectedArticleDirectSearchIndex = -1;
	var queryStr = "?dlg=DlgCtrArticleDirectSearch&action=SortProductgroup&process=ArticleDirectSearch"
	var url = BaseUrl + queryStr;
	parent.FrameContentCsgFrameset.location.href=url;
}

var flagId;

function jumpMenu() {
	var newURI = document.jumpList.List.selectedIndex;
	//document.jumpList.List.selectedIndex = "0";
 	if (newURI > "0") {
 		top.frames['FrameContent'].location.href = document.jumpList.List.options[newURI].value;
 	}
}

function resetMA() { // reset MotorSelection (reset all input fields besides MotorManufacturer and motor nr
	document.CriteriaMA.Motorcode.value = "";
	document.CriteriaMA.SellsTerm.value = "";
	document.CriteriaMA.YearOfConstruction.value = "";
	document.CriteriaMA.CylinderCapacity.value = "";
	document.CriteriaMA.Power.value = "";
	document.CriteriaMA.SellsTerm.value = "";
	document.CriteriaMA.SellsTerm.value = "";
	document.CriteriaMA.CylinderCapacityTolerance.checked = false;
	document.CriteriaMA.PowerTolerance.checked = false;

	var fueltype = document.CriteriaMA.Fueltype;
	if (fueltype != null)
		fueltype.selectedIndex = 0;
	document.CriteriaMA.PowerUnit.selectedIndex = 0;
	
//	parent.FrameContentMotors.location.href="emty_content.jsp";
//	parent.FrameContentDlgFooter.location.href="emty_content.jsp";
}

// update selection company type in dialog "new user" and "edit user"
// only one form per file !!!
function aB_updateCompanyType() {
	var index = document.forms[0].companyTypeList.selectedIndex;
	var actCompType = document.forms[0].companyTypeList.options[index].text;
	document.forms[0].selectedCompanyType.value = actCompType;
}


function redirectToArticleOverview(UrlSessionID){
  var baseUrl = UrlSessionID;
  top.opener.top.frames['FrameContent'].location.href = baseUrl + "?dlg=DlgCtrAssemblyGroupSelection&action=SetCriteria";
  parent.close();
}

function redirectToShoppingBasket(UrlSessionID){
  var baseUrl = UrlSessionID;
  top.opener.top.FrameContent.FrameContentBasketTable.location.href = baseUrl + "?dlg=DlgCtrShoppingBasket&process=ShoppingBasket&action=LoadTableContent";
  parent.close();
}

// name - name of the cookie
// value - value of the cookie
// [expires] - expiration date of the cookie (defaults to end of current session)
// [path] - path for which the cookie is valid (defaults to path of calling document)
// [domain] - domain for which the cookie is valid (defaults to domain of calling document)
// [secure] - Boolean value indicating if the cookie transmission requires a secure transmission
// * an argument defaults when it is assigned null as a placeholder
// * a null placeholder is not required for trailing omitted arguments
function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

// name - name of the desired cookie
// * return string containing value of specified cookie or null if cookie does not exist
function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

// name - name of the cookie
// [path] - path of the cookie (must be same as path used to create cookie)
// [domain] - domain of the cookie (must be same as domain used to create cookie)
// * path and domain default if assigned null or omitted if no explicit argument proceeds
function deleteCookie(name, path, domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" + 
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

// date - any instance of the Date object
// * hand all instances of the Date object to this function for "repairs"
function fixDate(date) {
  var base = new Date(0);
  var skew = base.getTime();
  if (skew > 0)
    date.setTime(date.getTime() - skew);
}

function ltrim ( s )
{
	return s.replace( /^\s*/, "" )
}

function rtrim ( s )
{
	return s.replace( /\s*$/, "" );
}

function trim ( s )
{
	return rtrim(ltrim(s));
}
