// import central online catalog js and tools.js
if (location.protocol == "https:") {
	document.write( "<scr"+"ipt language=\"JavaScript\" src=\"https://www.hella.com/produktion/HellaResources/WebSite/Applications/CentralJS/onlineCatalog.js\" type=\"text/javascript\"></scr"+"ipt>" );
	document.write( "<scr"+"ipt language=\"JavaScript\" src=\"https://www.hella.com/produktion/HellaResources/WebSite/Applications/CentralJS/tools.js\" type=\"text/javascript\"></scr"+"ipt>" );
} else {
	document.write( "<scr"+"ipt language=\"JavaScript\" src=\"http://www.hella.com/produktion/HellaResources/WebSite/Applications/CentralJS/onlineCatalog.js\" type=\"text/javascript\"></scr"+"ipt>" );
	document.write( "<scr"+"ipt language=\"JavaScript\" src=\"http://www.hella.com/produktion/HellaResources/WebSite/Applications/CentralJS/tools.js\" type=\"text/javascript\"></scr"+"ipt>" );
}

var which='';

var browserGreaterIE6 = false;
if(navigator.appVersion.indexOf('MSIE 7') != -1 || navigator.appVersion.indexOf('MSIE 8') != -1 || navigator.appVersion.indexOf('MSIE 9') != -1 || navigator.appName.indexOf('Opera') != -1) {
	browserGreaterIE6 = true;
}

// hilight images
function swop(whichButton,toButton) {
	if (navigator.appName=='Netscape' && navigator.appVersion.charAt(0)<'5') {
		if (document.navigation.document.images) {
			document.navigation.document.images[whichButton].src=toButton;
			return true;
		}
		else return false;
	}
	else
	{
		if (document.images) {
			document.images[whichButton].src=toButton;
			return true;
		}
		else return false;
	}
}

// hilight form input fields
function setFieldHi(which) {
	which.style.background='#ffffff';
}

function setFieldLo(which) {
	which.style.background='#edeef3';
}

// hilight quick search field
function setSearchHi(which) {
	which.style.background='#f8f4e0';
}

function setSearchLo(which) {
	which.style.background='#ffffff';
}

// open new window
function oeffneFenster(seitenName,instanzName,fensterBreite,fensterHoehe) {
	breiteBildschirm = screen.availWidth;
	hoeheBildschirm = screen.availHeight - 20;
	randLinks = breiteBildschirm/2-(fensterBreite/2);
	randOben = hoeheBildschirm/2-(fensterHoehe/2);
	fensterParameter = "top="+randOben+",left="+randLinks+",width="+fensterBreite+",height="+fensterHoehe+",scrollbars=no,toolbar=no,status=no,resizeable=no,location=no";
	satellitenFenster = window.open(seitenName,instanzName,fensterParameter);
	satellitenFenster.focus();
}

// prevents enter in forms
function prevendEnter( keycode ) {
	if ( keycode == '13' ) {
		event.keyCode = '9'
	}
}

// opens new window -- namo
function na_open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable) {
  toolbar_str = toolbar ? 'yes' : 'no';
  menubar_str = menubar ? 'yes' : 'no';
  statusbar_str = statusbar ? 'yes' : 'no';
  scrollbar_str = scrollbar ? 'yes' : 'no';
  resizable_str = resizable ? 'yes' : 'no';
  if (name == 'win' ) {
  	name = name+String(Math.random()).slice(2);
  }
  window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}

// flash 1
function isFlash (inVersion) {
	FlashMode =0;
	if (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] && navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin) {
		if (navigator.plugins && navigator.plugins["Shockwave Flash"] && (versionIndex = navigator.plugins["Shockwave Flash"].description.indexOf(".")) != - 1) {
			var versionString = navigator.plugins["Shockwave Flash"].description.substring(versionIndex-1, versionIndex);
			versionIndex = parseInt( versionString );
			if ( versionIndex >= inVersion ) {
				FlashMode = 1;
			}
		}
	}
	else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
	&& (navigator.userAgent.indexOf("Windows 95")>=0 || navigator.userAgent.indexOf("Windows 98")>=0 || navigator.userAgent.indexOf("Windows NT")>=0 )) {
		theStr='FlashMode = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+inVersion+'"))) \n';
		document.write('<script language=VBScript\> \n');
		document.write('on error resume next \n');
		document.write(theStr);
		document.write('</script\> \n');
	}
	return FlashMode;
}

// flash 2
function showAsset (flash_min_version, swf_pfad, swf_name, breite, hoehe, swf_fond, img_pfad,img_verweis) {
	if (isFlash(flash_min_version)) {
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"');
		document.write('codebase="http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0"');
		document.write('id="' + swf_name + '" width="' + breite + '" height="' + hoehe + '">');
		document.write('<param name=movie value="' + swf_pfad +'"> ');
		document.write('<param name=quality value=high> ');
		document.write('<param name=menu value=false> ');
		document.write('<param name=bgcolor value=#' + swf_fond + '> ');
		document.write('<embed src="' + swf_pfad +'"');
		document.write('name=' + swf_name + ' swliveconnect="TRUE" width="' + breite + '" height="' + hoehe + '"');
		document.write('quality="high" menu="false" bgcolor="#' + swf_fond + '"');
		document.write('type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">');
		document.write('</embed>');
		document.write('</object>');
	} else {
		if (img_verweis) {
			document.write('<a href="' + img_verweis + '"><img src="' + img_pfad+'" width="' + breite + '" height="' + hoehe + '" border="0"></a>');
		} else {
			document.write('<img src="' + img_pfad+'" width="' + breite + '" height="' + hoehe + '" border="0">');
		}
	}
}

// open link by drocp down box
function openPage( selectID ) {
	var tmpSelect = document.getElementById(selectID);
	var selectedValue = tmpSelect.options[ tmpSelect.options.selectedIndex ].value;
	if ( selectedValue != 'nothing' ) {
		tmpSelect.options.selectedIndex = 0;
		tmpSelect.disabled = 'yes';
		location.href = selectedValue;
	}
	tmpSelect.options.selectedIndex = 0;
}
// open link by drocp down box
function openPageHrefAndNewWindow( selectID, windowOPENIndex ) {
	var tmpSelect 		= document.getElementById(selectID);
	var selectedINDEX	= tmpSelect.options.selectedIndex;
	var selectedValue 	= tmpSelect.options[ selectedINDEX ].value;
	var openNew		= false;
	if ( selectedValue != 'nothing' ) {
		tmpSelect.options.selectedIndex = 0;
		for ( i = 0 ; i < windowOPENIndex.length; i++) {
			if ( selectedINDEX == windowOPENIndex[i]) {
				openNew = true;
				break;
			}
		}
		if ( openNew ) {
			window.open( selectedValue, 'Form' );
		} else {
			tmpSelect.disabled = 'yes';
			location.href = selectedValue;
		}
	}
	
}

// thumb functions
	function initThumbs() {
		var allDivs = document.getElementsByTagName( "DIV" );
		if ( allDivs ) {
			for ( tc=0; tc<allDivs.length; tc++ ) {
				if ( ( "" + allDivs[tc].onclick ).indexOf( "showImage" ) > -1 ) {
					allDivs[tc].innerHTML = "<span class=\"thumb\">" + allDivs[tc].innerHTML + "<br><img src='http://www.hella.nl/produktion/HellaNL/WebSite/Images/Templates/vergr.gif'></span>";
				}
			}
		}
	}
	
	function showImage( oid, website ) {
		window.open( "http://www.hella.nl/produktion/HellaNL/WebSite/Resources/ShowImage/ShowImage.jsp?" + "oid=" + oid + "&webSite=" + website, "image", "width=700, height=500, top=10, left=10" );
	}