﻿// JavaScript Document
function $(id){return document.getElementById(id);}
function onKeyPress(){//onKeyPress
	if(event.keyCode<45 || event.keyCode>57){
		event.returnValue=false;
	}
}
function key_blur(){
	var kw=$("stre");
	kw.className='input_blur';
	if(kw.value.length==0){
		kw.value='Product Search';		
	}
}
function key_focus(){
	var kw=$("stre");
	kw.className='input_focus';
	if(kw.value =='Product Search'){
		kw.value="";
	}
}
function openproduct(id){
window.open("../picture.asp?id="+id,"","height=640,width=750,,top=0,left=0,resizable=no,scrollbars=yes,status=no,toolbar=no,menubar=no,location=no");
}
function menuFix(){
	var sfEls = document.getElementById("nav").getElementsByTagName("li");
	for (var i=0; i<sfEls.length; i++){
		sfEls[i].onmouseover=function() {
		this.className+=(this.className.length>0? " ": "") + "sfhover";
		}
		sfEls[i].onMouseDown=function() {
		this.className+=(this.className.length>0? " ": "") + "sfhover";
		}
		sfEls[i].onMouseUp=function() {
		this.className+=(this.className.length>0? " ": "") + "sfhover";
		}
		sfEls[i].onmouseout=function() {
		this.className=this.className.replace(new RegExp("( ?|^)sfhover\\b"),
		"");
		}
	}
}
var activeOn = new RegExp("active");
function rollOut(imgName,which){
    if (document.images) {
		var imgArr = which.getElementsByTagName("img");
		var img = imgArr[0].src;
		if(activeOn.test(img)){
			return true;
		}	    
        document[imgName].src = eval(imgName+"off.src");
    }
}
function rollIn(imgName,which) {
    if (document.images && (loaded == true)){
		var imgArr = which.getElementsByTagName("img");
		var img = imgArr[0].src;
		if(activeOn.test(img)){
			return true;
		}
		document[imgName].src = eval(imgName+"on.src");	
    }
}
function showTopNav(layerName){
	eval('$('+ "'" + layerName + "'" +').style.display = "block"');
} 	
function hideTopNav(layerName){
	eval('$('+ "'" + layerName + "'" +').style.display = "none"');
}
function SwapDisplay(id){
	var obj = $(id);
	if(obj.style.display == 'block'){
		obj.style.display = 'none';
	}else{
		obj.style.display = 'block';
	}
}