/*
Common JavaScript
*/
function lessThanThreeDigitOrderingCode(local,query)
  {
	var emtyString;
	var space;
	var caution;
	var forwarding;
	
	if (local == "cn")
	{
		emtyString = unescape("\u8BF7\u5728\u7A7A\u683C\u5185\u8F93\u5165\u5B9A\u8D2D\u4EE3\u7801\u3002\n");
		space = unescape("\u9996\u4F4D\u8F93\u5165\u5B57\u7B26\u4E0D\u80FD\u4E3A\u7A7A\u683C\u3002\n");
		caution = unescape("\u7531\u4E8E\u60A8\u8F93\u5165\u7684\u8BA2\u8D2D\u4EE3\u7801\u5C11\u4E8E3\u4E2A\u6570\u5B57\uFF0C\u641C\u7D22\u8FC7\u7A0B\u9700\u8981\u8F83\u957F\u65F6\u95F4\u3002\n\u70B9\u51FB\u53D6\u6D88\u8F93\u5165\u65B0\u7684\u8BA2\u8D2D\u4EE3\u7801\u3002\n\u70B9\u51FB\u7EE7\u7EED\u5F00\u59CB\u641C\u7D22\u3002");
	}
	else if (local == "ja")
	{
		emtyString = unescape("\u767A\u6CE8\u30B3\u30FC\u30C9\u3092\u8A18\u5165\u3057\u3066\u304F\u3060\u3055\u3044\n");
		space = unescape("\u5165\u529B\u6B04\u306E\u6587\u982D\u306B\u30B9\u30DA\u30FC\u30B9\u3092\u7A7A\u3051\u306A\u3044\u3067\u304F\u3060\u3055\u3044\n");
		caution = unescape("\u5165\u529B\u6B04\u306E\u6587\u982D\u306B\u30B9\u30DA\u30FC\u30B9\u3092\u7A7A\u3051\u306A\u3044\u3067\u304F\u3060\u3055\u3044 \u691C\u7D22\u7D50\u679C\u306E\u8868\u793A\u306B\u306F\u3001\u3057\u3070\u3089\u304F\u6642\u9593\u304C\u304B\u304B\u308B\u3053\u3068\u304C\u3042\u308A\u307E\u3059\n\u30AD\u30E3\u30F3\u30BB\u30EB\u3092\u30AF\u30EA\u30C3\u30AF\u3057\u3066\u3001\u767A\u6CE8\u30B3\u30FC\u30C9\u30923\u6841\u4EE5\u4E0A\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\nOK\u3092\u30AF\u30EA\u30C3\u30AF\u3059\u308B\u3068\u691C\u7D22\u304C\u59CB\u307E\u308A\u307E\u3059");
	}
	else if (local == "en")
	{
		emtyString = "Please enter an ordering code in the field!\n";
		space = "The space character ist not allowed at the beginning of the field!\n";
		caution ="The odering code entered includes less than 3 digits. Showing the result might take some time.\nClick Cancel to enter at least 3 digits of your ordering code.\nClick OK to start search.";
	}
	else
	{
			emtyString = "Bitte geben Sie eine Bestellnummer ein!\n";
			space = "Leerzeichen am Anfang des Feldes sind nicht erlaubt!\n";
			caution = unescape("Die eingegebene Bestellnummer hat weniger als 3 Stellen. \nDie Aufbereitung des Ergebnisses kann daher l\u00e4nger dauern.\n Klicken Sie auf Abbrechen, um die Bestellnummer genauer anzugeben.\n Klicken Sie auf OK, um die Suche trotzdem durchzuf\u00FChren.");
	}

	 if (query == "" ) {
		alert(emtyString);
		return false;
	 }
	 if (query.toString().indexOf(" ") == 0) {
		alert(space);
		return false;
	 }
	if(query.length < 4){
		 forwarding = confirm(caution);
	 if (forwarding == false)return false;
	}
	return true;
}


function writeCookieToGrantDownload()
{
	var timeout=60*60*24;
	var today = new Date();
	var the_date = new Date();
	the_date.setTime(today.getTime() + 1000 * timeout);
	var the_cookie_date = the_date.toGMTString();
	var the_cookie = "download=granted";
	var the_cookie = the_cookie + ";expires=" + the_cookie_date + ";path=/";
	document.cookie = the_cookie;
}

function writeCookieToGrantDownloadWithParams(pname,pvalue,ptime)
{	var n = pname;
	var v = pvalue;
	var t = ptime;
	if(!n || !v){return;}
	if(!t || !(t instanceof Number)){t=60*60*24;}
	var today = new Date();
	var the_date = new Date();
	the_date.setTime(today.getTime() + 1000 * t);
	var the_cookie_date = the_date.toGMTString();
	var the_cookie = n + "=" + v + ";expires=" + the_cookie_date + ";path=/";
	document.cookie = the_cookie;
}


function goComponents(menu)
{
	var url = menu[menu.selectedIndex].value;
	if (!(url=="")) window.location.href = url;
}


function goMain1(menu)
{
	var url = menu[menu.selectedIndex].value;
	if (!(url=="")) window.location.href = url;
}

/*function goMain(menu, lang, bool)
{
	if (lang==1)
	{
		var url = menuArr_d[menu.selectedIndex];
		if (!(url=="")) window.location.href = url;
	}
	else
	{
		var url = menuArr_e[menu.selectedIndex];
		if (!(url=="")) window.location.href = url;
	}
}*/

function goInt(menu)
{
	var prefs = "toolbar=yes,location=yes,directories=yes,scrollbars=yes,status=yes,menubar=yes,resizable=yes";
	var url = "";
	var nation = menu.options[menu.selectedIndex].value;
	if (nation!="")
	{
		switch (nation)
		{
			case "it": url = "http://www.epcos.it/"; break;
			case "fr": url = "http://www.epcos.fr/"; break;
			case "us": url = "http://www.usa.epcos.com/"; break;
			case "ch": url = "http://www.epcos.ch/"; break;
			case "jp": url = "http://www.epcos.co.jp/"; break;
			case "pl": url = "http://www.epcos.pl/"; break;
			case "sgp": url = "http://www.epcos.com.sg/"; break;
			case "chi": url = "http://www.epcoschina.com/"; break;
		}
		intW = window.open(url, "international", prefs);
	}
}

/*function goSearch(menu, lang)
{
	var searchType = menu.options[menu.selectedIndex].value;
	if (searchType!="")
	{
		if (lang==1)
		{
			switch (searchType)
			{
				case "param": url = "http://www.search.epcos.com/pls/prins/para_search.init?M_SPRACHID=1"; break;
				case "oc": url = "http://www.search.epcos.com/pls/prins/search.searchbnr_form?M_SPRACHID=1"; break;
				case "type": url = "http://www.search.epcos.com/pls/prins/para_search.init?M_SPRACHID=1"; break;
				case "key": url = "http://www.search.epcos.com/pls/prins/para_search.init?M_SPRACHID=1"; break;
				case "x": url = "http://www.search.epcos.com/pls/prins/para_search.init?M_SPRACHID=1"; break;
			}
			window.location.href = url;
		}
		if (lang==2)
		{
			switch (searchType)
			{
				case "param": url = "http://www.search.epcos.com/pls/prins/para_search.init?M_SPRACHID=2"; break;
				case "oc": url = "http://www.search.epcos.com/pls/prins/search.searchbnr_form?M_SPRACHID=2"; break;
				case "type": url = "http://www.search.epcos.com/pls/prins/para_search.init?M_SPRACHID=2"; break;
				case "key": url = "http://www.search.epcos.com/pls/prins/para_search.init?M_SPRACHID=2"; break;
				case "x": url = "http://www.search.epcos.com/pls/prins/para_search.init?M_SPRACHID=2"; break;
			}
			window.location.href = url;
		}

	}
}*/

  // Der Parameter M_SPRACHID ist 1 f?r Deutsch und 2 f?r Englisch
	function doSearch(lang)
  {
		index = document.headForm.M_SEARCH.selectedIndex;
	 	searchword = document.headForm.W_SEARCH.value;
	 
	 	switch (index)
		{
			case 1:
			{		  	
				document.location.href = "/web/generator/Web/Sections/ProductSearch/ProductParameter/Page,templateId=render,locale="+lang+".html"
		  	break;
			}	
			case 2:
			{
				document.location.href = "/web/generator/Web/Sections/ProductSearch/OrderingCode/Search/SearchPage,templateId=render,locale="+lang+".html";
				break;
			}	
			case 3:
			{
		  	document.location.href = "/web/generator/Web/Sections/ProductSearch/CrossReference/Overview/Page,templateId=render,locale="+lang+".html";
		  	break;
			}
			case 4:
			{
				document.location.href = "/web/generator/Web/Sections/ProductSearch/Keyword/KeywordSearch,templateId=render,locale="+lang+".html";
				break;
			}		
			default:
			{		  	
		  	break;
			}
	 	}
  }
  
  
function doExtSearch(lang)
{
		index = document.headForm.M_SEARCH.selectedIndex;
		searchword = document.headForm.W_SEARCH.value;
		
		if(searchword!="")
		{
			switch (index)
			{				
			  case 0:
			  {
					var regX = /^b[0-9]{2,}.*$/i;
		   		if (regX.test(searchword)) 
		   		{
						document.location.href = "/web/generator/Web/Sections/ProductSearch/OrderingCode/SearchResults/SearchResultsPage,templateId=render,locale="+lang+".html?M_QUERY="+searchword;
						break;
		    	}
		    	else
		    	{
						document.location.href = "/web/generator/Web/Sections/ProductSearch/Keyword/KeywordSearch,locale="+lang+".html?advanced=false&querysubmit=true&M_QUERY=&start=1&restrict_main=true&restrict_all=true&querystring="+searchword;
						break;
					}				
				}
				case 2:
				{
					document.location.href = "/web/generator/Web/Sections/ProductSearch/OrderingCode/SearchResults/SearchResultsPage,templateId=render,locale="+lang+".html?M_QUERY="+searchword;
					break;
				}
				case 4:
				{
					document.location.href = "/web/generator/Web/Sections/ProductSearch/Keyword/KeywordSearch,locale="+lang+".html?advanced=false&querysubmit=true&M_QUERY=&start=1&restrict_main=true&restrict_all=true&querystring="+searchword;
					break;
				}			
				default:
				{					
					break;
				}
			}
		}		
}  
	

function handleNaviMouseOver(active, id)
{
	if (active==1)
	{
		document.images[id].src = "/share/all/images/navipin.gif";
	}
	else
	{
		document.images[id].src = "/share/all/images/clear.gif";
	}
}

function printPreview(url)
{
	//window.alert("url: " + url + ".");
	w=window.open(url,'700x600','toolbar=yes,status=yes,menubar=yes,scrollbars=yes,width=700,height=600');
	w.focus();
	void(0);
}

function printStPreview()
{
	var curUrl = window.location.href;
	url = curUrl.substring(0, curUrl.lastIndexOf("/"))+"/print/"+curUrl.substring(curUrl.lastIndexOf("/")+1);
	//window.alert(url);
	w=window.open(url,'700x600','toolbar=yes,status=yes,menubar=yes,scrollbars=yes,width=700,height=600');
	w.focus();
	void(0);
}

var da = (document.all) ? 1 : 0;
var pr = (window.print) ? 1 : 0;
var mac = (navigator.userAgent.indexOf("Mac") != -1);

function printPage() {
  if (pr) // NS4, IE5
	 window.print()
  else if (da && !mac) // IE4 (Windows)
	 vbPrintPage()
  else // other browsers
  {
  alert("Ihr Browser unterst&uuml;tzt dieses Feature leider nicht.");
  return false;
  }
}

if (da && !pr && !mac) with (document) {
  writeln('<OBJECT ID="WB" WIDTH="0" HEIGHT="0" CLASSID="clsid:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>');
  writeln('<' + 'SCRIPT LANGUAGE="VBScript">');
  writeln('Sub window_onunload');
  writeln('  On Error Resume Next');
  writeln('  Set WB = nothing');
  writeln('End Sub');
  writeln('Sub vbPrintPage');
  writeln('  OLECMDID_PRINT = 6');
  writeln('  OLECMDEXECOPT_DONTPROMPTUSER = 2');
  writeln('  OLECMDEXECOPT_PROMPTUSER = 1');
  writeln('  On Error Resume Next');
  writeln('  WB.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER');
  writeln('End Sub');
  writeln('<' + '/SCRIPT>');
}

function loadUrl (type, url, width, height, x, y)
{
	// 0: load into current window
	if (type=="0")
	{
		window.location.href = url;
	}
	if (type=="1")
	{
		var prefs = "";
		if (arguments.length > 3) prefs += "width="+width+",height="+height;
		prefs += ",scrollbars=yes,resizable=yes";
		var mywindow = window.open(url, "popwin", prefs);
		mywindow.focus();
	}
	if (type=="2")
	{
		var prefs = "";
		if (arguments.length > 3) prefs += "width="+width+",height="+height+",screenX="+x+",screenY="+y;
		prefs += ",scrollbars=yes,resizable=yes";
		w = window.top.open(url, "popwin", prefs);
		w.moveTo(x,y);
		w.focus();
	}
	if (type=="4")
	{
		  window.opener.location.href = url;
	}
}


function handleFormMouseOver(obj, active, id)
{
	if (active==1)
	{
		var srcstr = "/share/all/images/buttons/" + id + "_1.gif";
		//window.alert(srcstr);
		obj.src = srcstr;
	}
	else
	{
		var srcstr = "/share/all/images/buttons/" + id + "_0.gif";
		//window.alert(srcstr);
		obj.src = srcstr;
	}
}

function handleImageMouseOver(name, active)
{
	if (active==1)
	{
		var oldsrc = document.images[name].src;
		var newsrc = oldsrc.substring(0, oldsrc.lastIndexOf(".")-2)+"_1.gif";
		document.images[name].src = newsrc;
	}
	else
	{
		var oldsrc = document.images[name].src;
		var newsrc = oldsrc.substring(0, oldsrc.lastIndexOf(".")-2)+"_0.gif";
		document.images[name].src = newsrc;
	}
}

function handleImageMouseOverById(id, active, name)
{
	if (active==1)
	{
		var oldsrc = document.getElementById(id).src;
		var newsrc = oldsrc.substring(0, oldsrc.lastIndexOf(".")-2)+"_1.gif";
		document.getElementById(id).src = newsrc;
	}
	else
	{
		var oldsrc = document.getElementById(id).src;
		var newsrc = oldsrc.substring(0, oldsrc.lastIndexOf(".")-2)+"_0.gif";
		document.getElementById(id).src = newsrc;
	}
}

/*function saveWindow(){
  sitemapwindow = window.opener.top;
  alert(sitemapwindow);
}*/

function showtip(current,e,layername){
	pageSetup();
	if (ie4){
		document.all[layername].style.left = ((e.clientX + 210) > page.width)? e.clientX - 210 : e.clientX + 10;
		document.all[layername].style.top = e.clientY + document.body.scrollTop - 50;
		document.all[layername].style.visibility = "visible";
		document.all[layername].style.display = "block";
	}
	else if(ie5 ||  ns6 ||  ie6 || ie7 || gebid) {
		document.getElementById(layername).style.left = ((e.clientX + 210) > page.width)? e.clientX - 210 + "px" : e.clientX + 10 + "px";
		document.getElementById(layername).style.top = e.clientY + document.body.scrollTop - 50 + "px";
		document.getElementById(layername).style.visibility = "visible";
		document.getElementById(layername).style.display = "block";
	}
	else if (ns4){
		document.layers[layername].left = ((e.pageX + 210) > page.width)? e.pageX - 210 : e.pageX + 10;
		document.layers[layername].top = e.pageY - 50;
		document.layers[layername].visibility = "show";
	}
}

function hidetip(layername){
	if (ie4){
		document.all[layername].style.visibility = "hidden";
		document.all[layername].style.display = "none";
	}
	else if(document.getElementById){
			document.getElementById(layername).style.visibility = "hidden";
			document.getElementById(layername).style.display = "none";
	}
	else if (document.layers) {
		document.layers[layername].visibility = "hidden";
	}
}

function pageSetup() {
	page = new Object();
	page.width = (document.all) ? document.body.clientWidth : innerWidth;
	page.height = (document.all) ? document.body.clientHeight : innerHeight;
}

function checkInput() {
	if (document.queryform.txtSearch.value == '')
		return false;
	 else
		document.queryform.submit();
}

function checkInputSmall() {
	if ((document.getElementsByName('txtSearch')[0].value == '') || (document.getElementsByName('txtSearch')[0].value == 'Bitte Suchbegriff eingeben') || (document.getElementsByName('txtSearch')[0].value == 'Please enter search term'))
		return false;
	 else
		document.getElementsByName('queryformSmall')[0].submit();
}

/**
* Checkt die eingabe und gibt bei Falscheingabe ein Warnungsalert aus.
* param emptyStringMessage Warnung bei leereingabe
* param leadingSpaceMessage Warnung bei space am anfang
*/
function CheckFeldWithMessages(emptyStringMessage, leadingSpaceMessage)
{
	var mquery=document.searchForm.M_QUERY.value;
	 if (mquery == "" ) {
		alert(emptyStringMessage);
		return;
	 }
	 if (mquery.toString().indexOf(" ") == 0) {
		alert(leadingSpaceMessage);
		return;
	 }
	 document.searchForm.submit();

}

/**
* Checkt das eingabefeld. Je nach �bener locale werden die Warnungen erzeugt.
*/
function CheckFeld(local)
  {
	var emtyString;
	var space;

	if (local == "en"){
		emtyString = "Please enter an ordering code in the field!\n";
		space = "The space character ist not allowed at the beginning of the field!\n";
	}else{
		emtyString = "Bitte geben Sie eine Bestellnummer ein!\n";
		space = "Leerzeichen am Anfang des Feldes sind nicht erlaubt!\n";
	}

	CheckFeldWithMessages(emtyString, space);
  }

  function ShowSearchWarning(uri, warning){
	if (confirm(warning)) 
	{
		return ShowSearchResults(uri);
	}
	return false;
  }
  
  function ShowSearchResults(uri){
	document.searchform.action = uri;
	document.searchform.view.value = '';  	  
	document.searchform.submit();
	return false;
  }
  
  function SubmitForm(uri)
  {
	document.resultsForm.action = uri;
	document.resultsForm.submit();
	return false;
  }

  function forwardUrl(locUri)
  {
	if(window.location.search != "") 
	{
	  	QUERYSTRING = window.location.search;
				
		var params = new Array();
	    params = QUERYSTRING.substring(1).split('&');
	    removeProductSearchParams = false;
	    	    
	    for (var i=0; i<params.length; i++)
	    {	        
	    	if (params[i] == 'view=searchform')
	    		removeProductSearchParams = true;
	    }
	    
	    NEWQUERYSTRING = QUERYSTRING;
	    
	    if (removeProductSearchParams)
	    {	    
	    	NEWQUERYSTRING = '?';
		    for (var i=0; i<params.length; i++)
		    {
		    	if (params[i].length<6 || params[i].substring(0, 6)!='param_')
		    	{
		    		NEWQUERYSTRING = (NEWQUERYSTRING.length>1)?NEWQUERYSTRING + '&' + params[i]:NEWQUERYSTRING + params[i];		    		
		    	}
		    }
		}
	    
	  	window.location.href = locUri + NEWQUERYSTRING;
	}
	else
	{
		window.location.href = locUri;
	}
  }

/**
 * Funktionen f?r Slideshows
 */
var slideshows=new Array();

function setTransition(imageTag)
{
	var agent 		=navigator.userAgent.toLowerCase();
	var isOpera 	=(agent.indexOf("opera") != -1);

	if ((document.all)&&(!isOpera))
	{
		imageTag.filters.blendTrans.apply();
	}
}

function playTransition(imageTag)
{
	var agent 		=navigator.userAgent.toLowerCase();
	var isOpera 	=(agent.indexOf("opera") != -1);

	if ((document.all)&&(!isOpera))
		imageTag.filters.blendTrans.play()
}

function writeBlender(slideshow,imageIndex)
{
	var text="<div style=\"position:relative;top:0px;left:0px;\">";
	text=text+"<img src=\""+slideshow[imageIndex][0]+"\" id=\"bannerADrotatorImage\" style=\"filter:blendTrans(duration=2,transition=20)\" border=0>";
	text=text+"<div style=\"position:absolute;top:0px;left:0px;\" id=\"bannerADrotatorLinkDiv\">";
	text=text+"<a href=\"javascript:openImagePopup('"+slideshow[imageIndex][5]+"',"+slideshow[imageIndex][6]+","+slideshow[imageIndex][7]+",'en');\" id=\"bannerADrotatorLink\">";
	text=text+"<img id=\"bannerADrotatorLinkImage\" src=\"/share/all/images/1x1_trans.gif\" width="+slideshow[imageIndex][1]+" height="+slideshow[imageIndex][2]+" border=0>";
	text=text+"</a></div>";
	text=text+"</div>";

	document.getElementById('slideshow-image').innerHTML=text;
}

function nextImage(slideshowid,imageIndex)
{
	slideshow=slideshows[slideshowid];

	if(imageIndex<slideshow.length-1)
		imageIndex++;
	else
		imageIndex=0;

	var imageTag		=document.getElementById('bannerADrotatorImage');
	var linkTag			=document.getElementById('bannerADrotatorLink');
	var linkImageTag	=document.getElementById('bannerADrotatorLinkImage');
	var linkDivTag		=document.getElementById('bannerADrotatorLinkDiv');

	setTransition(imageTag);

	imageTag.src			=slideshow[imageIndex][0];

	linkImageTag.width	=slideshow[imageIndex][1];
	linkImageTag.height	=slideshow[imageIndex][2];

	if(slideshow[imageIndex][5].length>0)
	{
		linkDivTag.style.visibility="visible";

		linkImageTag.title			=slideshow[imageIndex][4];
		linkTag.href					="javascript:openImagePopup('"+slideshow[imageIndex][5]+"',"+slideshow[imageIndex][6]+","+slideshow[imageIndex][7]+",'en');";
	}
	else
	{
		imageTag.title					=slideshow[imageIndex][4];
		linkDivTag.style.visibility="hidden";
	}

	document.getElementById('slideshow-text').innerHTML=slideshow[imageIndex][3];
	playTransition(imageTag);

	theTimer=setTimeout("nextImage("+slideshowid+","+imageIndex+")", 7000);
}

function startSlideShow(slideshow,slideshowid)
{
	if(slideshow.length==0)
		return;

	var imageIndex	=Math.floor(Math.random()*slideshow.length);

	var preloadedimages=new Array();
	var preloadedimagespop=new Array();

	for (i=1;i<slideshow.length;i++)
	{
		preloadedimages[i]=new Image();
		preloadedimages[i].src=slideshow[i][0];

		preloadedimagespop[i]=new Image();
		preloadedimagespop[i].src=slideshow[i][5];
	}

	slideshows[slideshowid]=slideshow;
	writeBlender(slideshow,imageIndex);
	nextImage(slideshowid,imageIndex);
}

function openImagePopup(pictureUrl,pictureWidth,pictureHeight,language)
{
	if((pictureWidth<=0)||(pictureHeight<=0))
	{
		var image=new Image();
		image.src=pictureUrl;

		pictureWidth	=image.width;
		pictureHeight	=image.height;
	}

	var popupWidth	=pictureWidth+12;
	var popupHeight=pictureHeight+64;

	if((popupWidth>1024)||(popupHeight>768))
	{
		var scalex=(1024-64)/(pictureWidth);
		var scaley=(768-72)/(pictureHeight);

		var scale=Math.min(scalex,scaley);

		popupWidth	=pictureWidth*scale+54;
		popupHeight	=pictureHeight*scale+40;

		imagePopup=window.open(pictureUrl,'Image','toolbar=0,location=0,width='+popupWidth+',height='+popupHeight+',directories=no,dependent=yes,menuBar=no,scrollbars=yes,resizable=yes');
	}
	else
	{
		var html="<html><head><title>EPCOS</title>" +
 	  	"</head><body bgcolor=white topmargin=0 leftmargin=0 marginwidth=0 topmargin=0 marginheight=0>" +
 	  	"<table cellpadding=0 cellspacing=5 border=0><tr><td align=center valign=middle>" +
 	  	"<img src='" + pictureUrl + "' border=0></td></tr>" +
     	"<TR><TD align='right'><br><a href='JavaScript:top.window.close()' " +
     	"style='color : #000000;font-size : 11px;font-family : Arial, Helvetica, sans-serif;'>";

		if(language=='de'||language=='nn')
     		html=html+"schliessen";
     	if(language=='en')
     		html=html+"close";
		if(language=='cn'){
			html=html+"\u5173\u95ED";
		}
		if(language=='ja'){
			html=html+"\u9589\u3058\u308B";
		}
     	html=html+"</a></TD></TR></table></body></html>";

		imagePopup=window.open('','Image','toolbar=0,location=0,width='+popupWidth+',height='+popupHeight+',directories=no,dependent=yes,menuBar=no,scrollbars=no,resizable=no');

		imagePopup.document.open();
		imagePopup.document.write(html);
		imagePopup.document.close()
 	}
}

function switchlayer(Layer_Name, layerSize)
{ 
  for (var i=0; i<layerSize; i++){
  	document.getElementById(Layer_Name+i).style.display=(document.all[Layer_Name+i].style.display=='block') ? 'none' : 'block';
  	document.getElementById(Layer_Name+'img').src=(document.all[Layer_Name+i].style.display=='block') ? '/share/all/images/minus.gif' : '/share/all/images/plus.gif';
  }
}

function showlayer(layerName, positionX, positionY){ 
  
   document.getElementById(layerName).style.visibility = 'visible';
   document.getElementById(layerName).style.left = positionX;
   document.getElementById(layerName).style.top = positionY;
 }

//#################################################################################
/*
JavaScript for Forms
*/ 
		function deleteForm (formRef)
		{
			formRef.reset();
		}
		
		var alertstr = "";
		var err=false;
		function checkForm (formRef, formContrRef)
		{
			err=false;
			alertstr = "";
			var reqFields = new Array();
			var mutualFields = new Array();
			var emailFields = new Array();
			var confirmationFields = new Array();
			
			if (formContrRef.elements["reqFields"].value.length>0)
				reqFields = formContrRef.elements["reqFields"].value.split("|");
			if (formContrRef.elements["emailFields"].value.length>0)
				emailFields = formContrRef.elements["emailFields"].value.split("|");
			if (formContrRef.elements["mutualFields"].value.length>0)
				mutualFields = formContrRef.elements["mutualFields"].value.split("|");
			if ((formContrRef.elements["confirmationFields"]) && (formContrRef.elements["confirmationFields"].value.length>0))
				confirmationFields = formContrRef.elements["confirmationFields"].value.split("|");
				
			var emptyAlert = formContrRef.elements["emptyAlert"].value;
			var mutualAlert = formContrRef.elements["mutualAlert"].value;
			var emailAlert = formContrRef.elements["emailAlert"].value;
			var confirmationAlert = formContrRef.elements["confirmationAlert"] ? formContrRef.elements["confirmationAlert"].value : "";
			
			var formFieldPrefix = formContrRef.elements["formFieldPrefix"].value;
			//Check empty input fields
			
			if (reqFields.length>0)
			{
				checkEmpty(formRef, reqFields, formFieldPrefix, emptyAlert);
			}
			
			if (mutualFields.length>0)
			{
				checkMutuals(formRef, mutualFields, formFieldPrefix, mutualAlert);
			}
			
			if (emailFields.length>0)
			{
				checkEmail(formRef, emailFields, formFieldPrefix, emailAlert);
			}
			
			if (confirmationFields.length>0)
			{
				checkConfirmationFields(formRef, confirmationFields, formFieldPrefix, confirmationAlert);
			}
			
			if(err){
				window.alert (alertstr);
				return;
			}
			
			/* Special Function calls */
			if(typeof doSpecial != "undefined"){
			  if(!(doSpecial(formRef,formContrRef,formFieldPrefix)))
			        return false;	
			}
			formRef.submit();
		}
		
		//check for empty fields
		function checkEmpty(formRef, reqFields, formFieldPrefix, emptyAlert)
		{
			var empty = new Array();
			var emptycnt = 0;
			for (var i=0; i<reqFields.length; i++)
			{
				var tmp = reqFields[i];
				if (formRef.elements[formFieldPrefix+tmp].type.indexOf("select")!=-1)
				{
					if (formRef.elements[formFieldPrefix+tmp][formRef.elements[formFieldPrefix+tmp].selectedIndex].value == "none")
						empty[emptycnt++] = tmp;
				}
				else
				{
					if (formRef.elements[formFieldPrefix+tmp].value == "")
						empty[emptycnt++] = tmp;
				}
			}
			// Loop through fields not filled out
			if (emptycnt>0)
			{
				alertstr += emptyAlert + "\n\n";
				for (var i=0; i<emptycnt; i++)
				{
					if (i==0)
					{
						var testIndex = empty[i].indexOf("_");
						if (testIndex > 1) {
							alertstr += "\"" + empty[i].substr(testIndex + 1, empty[i].length) + "\"";
						} else {
							alertstr += "\"" + empty[i] + "\"";
						}
					}
					else
					{
						var testIndex = empty[i].indexOf("_");
						if (testIndex > 1) {
							alertstr += ", \"" + empty[i].substr(testIndex + 1, empty[i].length) + "\"";
						} else {
							alertstr += ", \"" + empty[i] + "\"";
						}						
					}
				}
				//window.alert (alertstr);
				err=true;
				//formRef.elements[formFieldPrefix+empty[0]].focus();
				//return false;
			}
			
			//return true;
		}
		
		// function that checks all fields in passed array for non-ascii characters and displays an
		// alert box in the case of any matchings
		function checkMutuals(formRef, fields, formFieldPrefix, mutualAlert) {						
			var error = new Array();
			var errorcnt = 0;
			
			for (var i = 0; i<fields.length; i++)
			{
			  if(formRef.elements[formFieldPrefix+fields[i]] && (formRef.elements[formFieldPrefix+fields[i]].value)){								                                
				var fieldValue = formRef.elements[formFieldPrefix+fields[i]].value;
				var detected = false;
				for(var j=0; j<fieldValue.length; j++)
				{
					if (detected) continue;
					var decimalCode = parseInt(fieldValue.charCodeAt(j).toString(10));
					if (decimalCode > 128)
					{
						 error[errorcnt++] = fields[i];
						 detected = true;
					}
				}
		          }
			}
			if (errorcnt>0)
			{
				if(alertstr!="")alertstr += "\n\n\n";
				alertstr += mutualAlert+"\n\n";
				for (var i=0; i<errorcnt; i++)
				{
					if (i==0)
					{
						alertstr += "\"" + error[i] + "\"";
					}
					else
					{
						alertstr += ", \"" + error[i] + "\"";
					}
				}
				//window.alert (alertstr);
				err=true;
				//formRef.elements[formFieldPrefix+error[0]].focus();
				//return false;
			}
			//return true;
		}
		
		//function that checks for valid email adresses
		function checkEmail(formRef, emailFields, formFieldPrefix, emailAlert)
		{
			var invalid = new Array();
			var invalidcnt = 0;
			if(emailFields){
			for (var i=0; i<emailFields.length; i++)
			{				
				var tmp = emailFields[i];
				if (((formRef.elements[formFieldPrefix+emailFields[i]])&&(formRef.elements[formFieldPrefix+emailFields[i]].value.indexOf("@")==-1)&&(formRef.elements[formFieldPrefix+emailFields[i]].value.length>0)))
					invalid[invalidcnt++] = formRef.elements[formFieldPrefix+tmp];
			}
			}
			// Loop through invalid fields
			if (invalidcnt>0)
			{
				if(alertstr!="")alertstr += "\n\n\n";
				alertstr += emailAlert + "\n\n";
				for (var i=0; i<invalidcnt; i++)
				{
					if (i==0)
					{
						alertstr += "\"" + invalid[i].value + "\"";
					}
					else
					{
						alertstr += ", \"" + invalid[i].value + "\"";
					}
				}
				//window.alert (alertstr);
				err=true;
				//invalid[0].focus();
			    //return false;
			}
		        //return true;
		}
		
		function checkConfirmationFields(formRef, confirmationFields, formFieldPrefix, confirmationAlert)
		{
			if ( (confirmationFields.length == 2) )
			{
				if((formRef.elements[formFieldPrefix+confirmationFields[0]].value != formRef.elements[formFieldPrefix+confirmationFields[1]].value))
				{
				if(alertstr!="")alertstr += "\n\n\n";
				alertstr += confirmationAlert + "\n\n";
				var testIndex1 = confirmationFields[0].indexOf("_");
				var testIndex2 = confirmationFields[1].indexOf("_");

				alertstr += confirmationFields[0].substr(testIndex1 + 1, confirmationFields[0].length) +", "+confirmationFields[1].substr(testIndex2 + 1, confirmationFields[1].length);
				//window.alert (alertstr);
				err=true;
				//return false;
				}
			}
			//return true;
		}

		function doHitlist(theForm, markFilesAlertMsg) {
			
		  	var inputCount = theForm.elements.length;		  	
		  	var checkedCount = 0;
		  	for (var i=0; i<inputCount; i++) {
		  		var elementName = theForm.elements[i].name;
		  		var theElement = theForm.elements[i];  		
		  		if ( (elementName.indexOf("pdf")==0) && (theElement.type.indexOf("checkbox")!=-1) && (theElement.checked==true)) {
		  			checkedCount++;
		  		}
		  	}
		  	if (checkedCount==0) {
		  		alert(markFilesAlertMsg);
		  	/*
		  		if (language.indexOf("nn")!=-1) {
		  			alert('Bitte markieren Sie zuerst die gew??nschten PDF-Dateien.');
		  		} else {
		  			alert('Please mark the PDF files before clicking on the download button.');		  			
		  		} */
		  	} else {
		  		theForm.submit();
		  	}		  	
		}
		
		
		
		function setParamsFromQuery () 
		{
		  query = location.search.substring(1,location.search.length).split("&");
		  if (query) { 
		    for(var i=0; i<query.length; i++) {
	  			nv = query[i].split("=");
	  			if (nv[0]) { 
	  				nv[0] = unescape(decodeURI(nv[0])); 
	  			}
	  			if (nv && nv[0] && nv[1] && document.getElementsByName(nv[0])[0]) { 
	  			    document.getElementsByName(nv[0])[0].value = unescape(decodeURI(nv[1]));
	  			}
  			}
		  }
		}
		
//##########################################################################################################
/*
JavaScript for Publications
*/
var parameter, found;
var domain="leer";
var bereich = new Array();

parameter=document.location.search;

if(parameter.length >= 9) {

	for(i = 1; i <= parameter.length; i++) {

		var strin=parameter.substring(i-8, i);
		if (strin == "bereich=") {
			found="1";
			domain="";
		}
	
		if(found == "1") {

		if(!parameter.substring(i, i+1) || parameter.substring(i, i+1) == "&") {
				found="0";
			}
			else {
				domain = domain + parameter.substring(i, i+1);
			}
		}
	}
}

	
function buildArray() {
  var a = buildArray.arguments;
  for (i="0"; i<a.length; i++) {
    this[i] = a[i];
  }
  this.length = a.length;
}

// ************** News ****************

var java = navigator.javaEnabled();

var closedW = true;
var counter = 1;
var newwindow;
var options = 
        "toolbar=no,location=no,directories=no," + 
        "resizable=yes,status=no,menubar=no,scrollbars=yes,width=400,height=410";

var searchoptions = 
        "toolbar=yes,location=no,directories=yes," + 
        "resizable=yes,status=no,menubar=no,scrollbars=yes,width=620,height=500";

function newwin () {
        if (closedW) {

                //Create new Window
                
                counter++;
                newwindow=window.open('/new/d0000000.htm','Neuigkeiten', options);
                if (newwindow == null) // if something went wrong    
                        newwindow = window;
                newwindow.name = "mywindow";
        } else {
                counter++;
                window.newwindow.close ();

                newwindow=window.open('/new/d0000000.htm','Neuigkeiten', options);
                if (newwindow == null) // if something went wrong    
                        newwindow = window;
                newwindow.name = "mywindow";
        }
}

// ************** PDF-Fenster, Adobe Acrobat *************

var pfad="";
var pfadoptions = 
        "toolbar=yes,location=no,directories=yes,screenX=50,screenY=50" + 
        "resizable=yes,status=no,menubar=no,scrollbars=yes,width=740,height=540";
var html=0;

function pdfwin (pfad) {
 
                pdfwindow=window.open(pfad,'Download',pfadoptions);
                if (pdfwindow == null) // if something went wrong    
                        pdfwindow = window;
                pdfwindow.name = "mywindow";
   
}

function pdfchecker (pfad) {			// prueft, ob link zu html-seite oder pdf geht 

	for(i = 1; i <= pfad.length; i++) {

			var strin=pfad.substring(i-4, i);
			if (strin == "html") {html=1;}
	}

	if (html == 1) {
		parent.window.location=(pfad);
	}
	else {
		pdfwindow=window.open(pfad,'Download',pfadoptions);
        if (pdfwindow == null) // if something went wrong    
             pdfwindow = window;
        pdfwindow.name = "mywindow";
	}
}

// ************** Search ****************

var searchoptions = 
        "toolbar=yes,location=no,directories=yes," + 
        "resizable=yes,status=no,menubar=no,scrollbars=yes,width=620,height=500";

function search() {
        
        newwindow=window.open('','Search', searchoptions);
        if (newwindow == null) // if something went wrong    
                newwindow = window;
        newwindow.name = "search";
        document.search.submit();
}


// ********* Englisch <--> Deutsch ***********

var bereich;

function sprache(bereich) {

	if(bereich == "Allgemein") bereich="General";
	if(bereich == "EMV-Bauelemente") bereich="EMC-Components";
	if(bereich == "Ferrite") bereich="Ferrites";
	if(bereich == "Keramische-Bauelemente") bereich="Ceramic-Components";
	if(bereich == "Kondensatoren") bereich="Capacitors";
	if(bereich == "OFW-Komponenten") bereich="SAW-Components";
	if(bereich.substring(0,7) == "Widerst") bereich="Resistors";
	if(bereich == "Ableiter") bereich="Surge-arresters";

	parent.window.location=('/scripts/xlnisapi.dll/publikationen/publikationen/publikationen_engl.xml?xslsheet=publikationen:/style/english.xsl&bereich='+bereich);
}

// ********* Link ist nicht vorhanden ***********

var msg="Dieser Link ist leider noch nicht vorhanden!";

function warning() {
	alert(msg);
}

// ********* View Cart ***********

var cartoptions = 
        "toolbar=no,location=no,directories=no," + 
        "resizable=yes,status=no,menubar=no,scrollbars=yes,width=500,height=400";

/*
function open_cart(adresse) {

    newwindow=window.open(adresse,'cart', cartoptions);
    if (newwindow == null) // if something went wrong    
            newwindow = window;
    newwindow.name = "cart";

}
*/
// ********* Warenkorb ***********

function to_chart(title, bestnr, preis, sprache) {
	var adresse, tmp, i;

	tmp = title.split("&#x00df;");
	title = tmp[0];
	for (i=1; i < tmp.length;i++) {
		title = title + "&szlig;" + tmp[i];
	}

	title=escape(title);
	bestnr=escape(bestnr);
	adresse="/web/cart?cmd=add&code="+bestnr
		+"&descr="+title+"&count="+1+"&price="+preis+"&locale="+sprache;
	open_cart(adresse);
	newwindow.focus();
}

function addCart(inputname, bestnr, preis, sprache){
  //var realtitle = document.CartForm[inputname].value;    
  to_chart(inputname, bestnr, preis, sprache);
}


function open_cart(adresse, to_background) {
	
    newwindow=window.open(adresse,'cart', cartoptions);

	if (newwindow == null) // if something went wrong    
		newwindow = window;
    newwindow.name = "cart";
	newwindow.focus();
	if(to_background) {
		newwindow.blur();
		self.setTimeout("self.focus()",200);
		self.setTimeout("self.focus()",600);
	}

}

/*
JavaScript für Produkt Anfrage Spezial
*/

//
// Dieses JavaScript ist wird auch an anderen Stellen aufgerufen. Hat zwar keine wirklich Funktion dort
// kann aber zu Fehlern fuehren.
//
function doSpecial(formRef,formContrRef)
{
	//
	// hole das dropdown menue mit den laendern und emailadressen (siehe WebFormHelper.java)
	var countryDropdown;
	var firstElement = document.getElementById('webFormHelperFirstOption');
	if (firstElement)
		countryDropdown = firstElement.parentNode; 

	if(countryDropdown)
	{
	  if((typeof formRef["f23_Nation"]!= "undefined")&&(formRef["f23_Nation"].value == 0))
	  {
	  	// setze laendernamen:
	    formRef["f23_Nation"].value = countryDropdown[countryDropdown.selectedIndex].text;
		// hole den value, um im countriesarray nachzuschauen:
		var countryKey = countryDropdown[countryDropdown.selectedIndex].value;
		 	 
		// setze email adressen:
	    formRef["recipient"].value = this.countries[countryKey][2];
	    if (this.countries[countryKey][3] != null) 
	    {
	    	if (formRef["recipientCC"])
	    		formRef["recipientCC"].value = this.countries[countryKey][3];
	    }
	    /*formRef[countryfield].value = "";*/
	  }
	}

  return true;
}

var cartoptions_inquiry =
        "toolbar=no,location=no,directories=no," +
        "resizable=yes,status=no,menubar=no,scrollbars=yes,width=700,height=350";

function addInquiry(title, bestnr, sprache, count) {
    var adresse, tmp, i;

	tmp = title.split("&#x00df;");
	title = tmp[0];
	for (i=1; i < tmp.length;i++) {
		title = title + "&szlig;" + tmp[i];
	}

	title=escape(title);
	bestnr=escape(bestnr);
	adresse="/web/inquiry?locale="+sprache+"&cmd=add&code="+bestnr
		+"&descr="+title+"&count="+count+"&language="+sprache;
	open_inquiry(adresse);
	newwindow.focus();
}

function open_inquiry(adresse, to_background) {

    newwindow=window.open(adresse,'inquiry', cartoptions_inquiry);

	if (newwindow == null) // if something went wrong
		newwindow = window;
    newwindow.name = "inquiry";
	newwindow.focus();
	if(to_background) {
		newwindow.blur();
		self.setTimeout("self.focus()",200);
		self.setTimeout("self.focus()",600);
	}

}

//###########################################################
/*
JavaScript for Product search
*/
function setParameterRange(theForm, itemName) {
	// Read from an to values
	var fromvalue = theForm["tmp_"+itemName+"_rangeFrom"].value;
	var tovalue = theForm["tmp_"+itemName+"_rangeTo"].value;
	
	// Set the parameter value 'FROM:XXX#TO:YYY'
	theForm["param_"+itemName].value = "FROM:" + fromvalue + "#TO:" + tovalue;
		
	return false;	
}

		

