// JavaScript Document




	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 = "http://www.kennametal.com/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 );
	}
 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"), "");
			}
		}
	}
}

sfIndustryhover = function() {
	if (document.getElementById("industries") != null) {
		var sfEls = document.getElementById("industries").getElementsByTagName("LI");
		for (var i=0; i<sfEls.length; i++) {
			sfEls[i].onmouseover=function() {
				this.className+=" sfIndustryhover";
			}
			sfEls[i].onmouseout=function() {
				this.className=this.className.replace(new RegExp(" sfIndustryhover\\b"), "");
			}
		}
	}
}

if (window.attachEvent) window.attachEvent("onload", sfHover);
if (window.attachEvent) window.attachEvent("onload", sfStorehover);
if (window.attachEvent) window.attachEvent("onload", sfIndustryhover);




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+'');
				}
		
//-->
