function toggleVisibility(id) {
    var e = document.getElementById(id);
    if (e.style.display == 'none')
        e.style.display = 'block';
    else
        e.style.display = 'none';
}

function showHideLayer(layer) {
	try {
		var objLayer = document.getElementById(layer);
		if (objLayer.style.visibility == 'visible') {
			objLayer.style.visibility = 'hidden';
			objLayer.style.position   = 'absolute'; 
		}
		else {
			objLayer.style.visibility = 'visible';
			objLayer.style.position   = 'static';
		}
	}
	catch(err) {
		alert(err.description);
	}
}

function showHideTab(layer,tab) {
	try {
		//Hide all tabs
		document.getElementById('layerDescription').style.display = 'none';
		document.getElementById('layerSpecification').style.display = 'none';
		document.getElementById('layerGuarantee').style.display = 'none';
		
		//Show selected tab					
		document.getElementById(layer).style.display = 'inline';
		
		//Unselect all tabs
		document.getElementById('tabDescription').className = 'productTab';
		document.getElementById('tabSpecification').className = 'productTab';
		document.getElementById('tabGuarantee').className = 'productTab';
							
		//Select selected tab
		document.getElementById(tab).className = 'productTabSelected';
	}
	catch(err) {
		alert(err.description);
	}
}

function showHelpWindow(id,title) {
		var x = window.open('/includes/showhelp.asp?PageID='+id+'&PageTitle='+title,'help','height=400,width=450');
		x.focus();
	}
 
 function HasNumeric(sText)
{
		
   var ValidChars = "0123456789";
   var HasNumber=false;
   var sChar;
 
   for (i = 0; i < sText.length && HasNumber == false; i++) 
      {      
      sChar = ValidChars.charAt(i); 
      if (sText.indexOf(sChar) != -1) 
         {
         HasNumber=true;
         }
      }
 		
 		return HasNumber;
   
   }
 
	function IsNumeric(strString)
	   //  check for valid numeric strings 
	   {
	   var strValidChars = "0123456789.-";
	   var strChar;
	   var blnResult = true;

	   if (strString.length == 0) return false;

	   //  test strString consists of valid characters listed above
	   for (i = 0; i < strString.length && blnResult == true; i++)
		  {
		  strChar = strString.charAt(i);
		  if (strValidChars.indexOf(strChar) == -1)
			 {
			 blnResult = false;
			 }
		  }
	   return blnResult;
	   }


	function validateZIP(strPC) {
		return typeof strPC=='string' ? strPC.match(/[1-9][0-9]{3} ?[a-zA-Z]{2}/)==strPC : false;
	}
	
	function echeck(str) {
	
			var at="@"
			var dot="."
			var lat=str.indexOf(at)
			var lstr=str.length
			var ldot=str.indexOf(dot)
			if (str.indexOf(at)==-1){
			   return false
			}
	
			if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
			   return false
			}
	
			if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
			    return false
			}
	
			 if (str.indexOf(at,(lat+1))!=-1){
			    return false
			 }
	
			 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
			    return false
			 }
	
			 if (str.indexOf(dot,(lat+2))==-1){
			    return false
			 }
			
			 if (str.indexOf(" ")!=-1){
			    return false
			 }
			 
	 		 return true					
		}
