
// JavaScript Document


//Search JavaScript

function MM_findObj(n, d) { //v4.01
	var p,i,x;  
		if(!d) d=document; 
		if((p=n.indexOf("?"))>0&&parent.frames.length) {
			d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
			if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
			for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
			if(!x && d.getElementById) x=d.getElementById(n); return x;
		}

	function MM_validateForm() { //v4.0
	  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
	  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
		if (val) { nm=val.name; if ((val=val.value)!="") {
		  if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
			if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
		  } else if (test!='R') { num = parseFloat(val);
			if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
			if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
			  min=test.substring(8,p); max=test.substring(p+1);
			  if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
		} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
	  } if (errors) alert('The following error(s) occurred:\n'+errors);
	  document.MM_returnValue = (errors == '');
	}

	function DoSearch() {
		var searchTerm = encode_utf8(document.getElementById("searchInput").value);
		var path = "/search/search_results.jhtml";
		path = path + "?N=0";
		path = path + "&Ntt=" + searchTerm;
		path = path + "&D=" + searchTerm;

		MM_validateForm('searchInput','','R');

		if (document.MM_returnValue == true) {
			window.location = path;
		}
		return false;
	}

	function encode_utf8( s ) {
	  return encodeURIComponent( s );
	}
//End Search JavaScript	
 //function MM_swapImage() { //v3.0
//  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
//   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
//}

//function MM_swapImgRestore() { //v3.0
//  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
//}



function tmt_findObj(n){
  var x,t; if((n.indexOf("?"))>0&&parent.frames.length){t=n.split("?");
  x=eval("parent.frames['"+t[1]+"'].document.getElementById('"+t[0]+"')");
  }else{x=document.getElementById(n)}return x;
}

function MM_showHideLayers() {
  var i,p,v,obj,args=MM_showHideLayers.arguments;if(document.getElementById){
   for (i=0; i<(args.length-2); i+=3){ obj=tmt_findObj(args[i]);v=args[i+2];
   v=(v=='show')?'visible':(v='hide')?'hidden':v;
   if(obj)obj.style.visibility=v;}} else{
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }}
}
function toggleProductInfo() {

  var i,p,v,obj,args=toggleProductInfo.arguments;if(document.getElementById){
   for (i=0; i<(args.length-2); i+=3){ obj=tmt_findObj(args[i]);v=args[i+2];
   v=(v=='show')?'block':(v='hide')?'none':v;
   if(obj)obj.style.display=v;}} else{
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'block':(v='hide')?'none':v; }
    obj.display=v; }}
}

var submit = false;
var timeout = 300;  // 5 minutes.

// Reset 'submit' so that the form can be submitted again.
function resetTimer()
{
  window.clearTimeout(timeoutID);
  window.status = "Enter PIN";
  submit = false;
  document.login.pin.focus();
}

function checkLogin()
{

  // This is to make sure that the form is submitted only once when
  // the user hits several times on the login button.
  if (submit)
  {
    alert("Your request is being processed.\nPlease do not hit reload or refresh.\nThis request may take up to a minute to process.");
    return false;
  }
  timeoutID = window.setTimeout("resetTimer()", timeout*1000);
  submit = true;

  return true;
}

function gotoLink(form)

{

var OptionIndex=form.currentLocale.selectedIndex;

parent.location = form.currentLocale.options[OptionIndex].value;

}





sfHover = function() {
	if (document.getElementById("nav") != null) {
		var sfEls = document.getElementById("nav").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			}
		}
	}
}

sfStorehover = function() {
	if (document.getElementById("storeNav") != null) {
		var sfEls = document.getElementById("storeNav").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfStorehover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfStorehover\\b"), "");
			}
		}
	}
}
ecathover = function() {
	if (document.getElementById("ecatDrop") != null) {
		var sfEls = document.getElementById("ecatDrop").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" ecathover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" ecathover\\b"), "");
			}
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
if (window.attachEvent) window.attachEvent("onload", ecathover);
if (window.attachEvent) window.attachEvent("onload", sfStorehover);





function getCookie(Name){
	var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
	if (document.cookie.match(re)) //if cookie found
		return document.cookie.match(re)[0].split("=")[1] //return its value
	return ""
}

function setCookie(name, value){
	document.cookie = name+"="+value
}







function buttHover(elem) {
	elem.style.backgroundPosition = '0% -25px';
	var rightEnd = elem.getElementsByTagName('input')[0];
	rightEnd.style.backgroundPosition = '100% -25px';

}

function buttOff(elem) {
	elem.style.backgroundPosition = 'top left';
	var rightEnd = elem.getElementsByTagName('input')[0];
	rightEnd.style.backgroundPosition = '100% 0%';

}



function getStyle(oElm, strCssRule){
	var strValue = "";
	if(document.defaultView && document.defaultView.getComputedStyle){
		strValue = document.defaultView.getComputedStyle(oElm, "").getPropertyValue(strCssRule);
	}
	else if(oElm.currentStyle){
		strCssRule = strCssRule.replace(/\-(\w)/g, function (strMatch, p1){
			return p1.toUpperCase();
		});
		strValue = oElm.currentStyle[strCssRule];
	}
	return strValue;
}

function toggle_visibility(id) {

var e = document.getElementById(id);
	if (getStyle(document.getElementById(id), 'display') == 'block') {
		e.style.display = 'block';
	} else {
		e.style.display = 'none';
	}
	if(e.style.display == 'block') {
		e.style.display = 'none';
	} else {
		e.style.display = 'block';
	}
return false;
}

<!--FROM FAVORITES LIST PAGE-->
<!-- Begin
		function sureDelete(val){
		  var message = ""
		  if(val == "/de"){
			message = "Sind Sie sicher, dass Sie diese Liste löschen möchten?";
		  }else if(val == "/fr"){
			message = "Etes vous sûr de vouloir supprimer cette liste?";
		  }else if(val == "/it"){
			message = "Siete sicuri che volete cancellare questa lista ?";
		  }else{
			message = "Are you sure you want to delete this list?";
		  }
		  return confirm(message);
		}
		function checkBox(chex)
		{
		  if(chex.checked == true){
			check();
		  }else{
			uncheck();
		  }
		}
		function check()
		{
			
		  document.f1.lista.checked = true;
		  if(document.f1.list.length){
			var i;
			for (i=0;i<document.f1.list.length;i++)
			  document.f1.list[i].checked=true;
		  }else{
			document.f1.list.checked = true;
		  }
		}
		function uncheck()
		{
		  document.f1.lista.checked = false;
		  if(document.f1.list.length){
			var i;
			for (i=0;i<document.f1.list.length;i++)
			  document.f1.list[i].checked=false;
		  }else{
			document.f1.list.checked = false;
		  }
		}
		//  End -->
		<!--END FROM FAVORITES LIST PAGE-->
var popUpWin=0;
		function popUpWindow(URLStr, left, top, width, height)
		{
		  if(popUpWin)
		  {
			if(!popUpWin.closed) popUpWin.close();
		  }
		  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
		}

//-->


// -----------------------------------------------------------------
// Modal Dialog Box
// copyright 8th July 2006 by Stephen Chapman
// http://javascript.about.com/
// permission to use this Javascript on your web page is granted
// provided that all of the code in this script (including these
// comments) is used without any alteration
	function pageWidth() {
		return window.innerWidth != null? window.innerWidth: document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth:document.body != null? document.body.clientWidth:null;
	}
	
	function pageHeight() {
		return window.innerHeight != null? window.innerHeight: document.documentElement && document.documentElement.clientHeight ? document.documentElement.clientHeight:document.body != null? document.body.clientHeight:null;
	}
	
	function posLeft() {
		return typeof window.pageXOffset != 'undefined' ? window.pageXOffset:document.documentElement && document.documentElement.scrollLeft? document.documentElement.scrollLeft:document.body.scrollLeft? document.body.scrollLeft:0;
	}
	
	function posTop() {
		return typeof window.pageYOffset != 'undefined' ? window.pageYOffset:document.documentElement && document.documentElement.scrollTop? document.documentElement.scrollTop: document.body.scrollTop?document.body.scrollTop:0;
	}
	
	function $(x){
		return document.getElementById(x);
	}
	
	function scrollFix(){
		var obol=$('ol');
		obol.style.top=posTop()+'px';
		obol.style.left=posLeft()+'px';
	}
	
	function sizeFix(){
		var obol=$('ol');
		obol.style.height=pageHeight()+'px';
		obol.style.width=pageWidth()+'px';
	}
	
	function kp(e){
		ky=e?e.which:event.keyCode;
		if(ky==88||ky==120)hm();
		return false
	}
	
	function inf(h){
		tag=document.getElementsByTagName('select');
		for(i=tag.length-1;	i>=0; i--)tag[i].style.visibility=h;
		tag=document.getElementsByTagName('iframe');
		for(i=tag.length-1;i>=0;i--)tag[i].style.visibility=h;
		tag=document.getElementsByTagName('object');
		for(i=tag.length-1;i>=0;i--)tag[i].style.visibility=h;
	}
	
	function sm(obl, wd, ht){
		var h='hidden';
		var b='block';
		var p='px';
		var obol=$('ol');
		var obbxd = $('mbd');
		obbxd.innerHTML = $(obl).innerHTML;
		obol.style.height=pageHeight()+p;
		obol.style.width=pageWidth()+p;
		obol.style.top=posTop()+p;
		obol.style.left=posLeft()+p;
		obol.style.display=b;
		var tp=posTop()+((pageHeight()-ht)/2)-12;
		var lt=posLeft()+((pageWidth()-wd)/2)-12;
		var obbx=$('mbox');
		obbx.style.top=(tp<0?0:tp)+p;
		obbx.style.left=(lt<0?0:lt)+p;
		obbx.style.width=wd+p;
		obbx.style.height=ht+p;
		inf(h);
		obbx.style.display=b;
		return false;
	}
	
	function hm(){
		var v='visible';
		var n='none';
		$('ol').style.display=n;
		$('mbox').style.display=n;
		inf(v);
		document.onkeypress='';
		
	}
	
	function initmb(){
		var ab='absolute';
		var n='none';
		var obody=document.getElementsByTagName('body')[0];
		var frag=document.createDocumentFragment();
		var obol=document.createElement('div');
		obol.setAttribute('id','ol');
		obol.style.display=n;
		obol.style.position=ab;
		obol.style.top=0;
		obol.style.left=0;
		obol.style.zIndex=1001;
		obol.style.width='100%';
		frag.appendChild(obol);
		var obbx=document.createElement('div');
		obbx.setAttribute('id','mbox');
		obbx.style.display=n;
		obbx.style.position=ab;
		obbx.style.zIndex=1002;
		var obl=document.createElement('span');
		obbx.appendChild(obl);
		var obbxd=document.createElement('div');
		obbxd.setAttribute('id','mbd');
		obl.appendChild(obbxd);
		frag.insertBefore(obbx,obol.nextSibling);
		obody.insertBefore(frag,obody.firstChild);
		window.onscroll = scrollFix;
		window.onresize = sizeFix;
	}
	
	window.onload = initmb;


	// JavaScript Document
	function MM_jumpMenu(targ,selObj,restore){ //v3.0
		var jumpLink = selObj.options[selObj.selectedIndex].value;
		
		if (jumpLink != "0"){	
			eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
		} else {
		}
	}
	
	
	var listVal = "0";
	function localeAlert(selObj, obl, wd, ht) {
		//alert(obl);
		listVal = selObj.options[selObj.selectedIndex].value;	
		if (listVal != "0") {
			sm(obl, wd, ht);
			
		}
	}
	
	function localeJump(remember){
		splitListVal = listVal.split("##");
		//alert(splitListVal[0]);
		if (remember == "yes") {
			document.cookie="kmtLocale=/"+splitListVal[0]+"; expires=Wed, 31 Dec 2014 23:59:59 UTC; path=/;";
			parent.location.href = '/index.jhtml';
		} else {
			document.location.href=splitListVal[1];
		}
	}
	
	function resetLanguage() {
		var x = document.getElementById("langSelector");
		//alert(x.selectedIndex);
		x.options[0].selected = true;
		
	}

// -----------------------------------------------------------------