// JavaScript Document
<!--
/*
turnOnMyStore(imgName,imgPath)
rollOver(imgName)
rollOff(imgName)
navOver(imgNum)
navOff(imgNum)
MM_swapImgRestore()
MM_findObj(n, d)
MM_swapImage()
MM_validateForm()
MM_openBrWindow(theURL,winName,features)
MM_goToURL()
MM_reloadPage(init)
Refresh()
BisClose()
setCookie(cName, cValue, cHours, cPath, cDomain, cSecure)
getCookie(cName)
formsubmit(Object)
ValidateClick()
BirthDateDropDown(dateDay,dateMonth,dateYear)
ssnCreate(ssn1,ssn2,ssn3)
statesDrop0()
alphabet(UrlString)
submitForm(frmName)
*/


function turnOnMyStore(imgName,imgPath) { document[imgName].src = imgPath; }

function rollOver(imgName) { document[imgName].src = eval(imgName + "_over.src"); }

function rollOff(imgName) { document[imgName].src = eval(imgName + "_off.src"); }

function navOver(imgNum) { imgName = "nav" + imgNum; divName = "pos" + imgNum;
                           var tmpImg = getImg(imgName, divName); tmpImg.src = eval(imgName + "_over.src"); }

function navOff(imgNum) { imgName = "nav" + imgNum;	divName = "pos" + imgNum;
	                      var tmpImg = getImg(imgName, divName); tmpImg.src = eval(imgName + "_off.src"); }

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 MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

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_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_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=args[i+1]; if ((val=val.value)!="") {
    //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 MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function openPCV(windowURL,width,height) 
{
  myNewWindow = window.open(windowURL,'PCVWindow','toolbar=no,location=no,directories=no,menubar=no,status=no,scrollbars=no,resizable=no,width='+width+',height='+height+' ');
  myNewWindow.focus();
}

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
////////////////////

function Refresh() { opener.parent.location.reload(); }

function BisClose(){ window.close(); }

function setCookie(cName, cValue, cHours, cPath, cDomain, cSecure)
{
  var cCookie = cName + "=" + encodeURIComponent(cValue);
  if(cHours) { 
   var cExpires;
   cExpires = new Date((new Date()).getTime() + cHours * 3600000);
   cCookie += "; expires=" + cExpires.toGMTString(); 
  }
  if(cPath) { cCookie += "; path=" + cPath; }
  if(cDomain) { cCookie += "; domain=" + cDomain; }
  if(cSecure) { cCookie += "; secure"; }
  document.cookie = cCookie;
}


function getCookie(cName)
{
 var cRe = "(?:; )?" + cName + "=([^;]*);?";
 var oRe = new RegExp(cRe);
 if(oRe.test(document.cookie)) { return decodeURIComponent(RegExp["$1"]); }
 else { return null; }
}

//form submit
function submitForm(frmName) { document.frmName.submit(); }

function formsubmit(Object)
{
        var newWin = window.open("about:blank", "newWin",'status=yes,scrollbars=yes,resizable=yes,width=850,height=700');
 		Object.enctype = 'application/x-www-form-urlencoded';
        Object.action = '?Module=';
		Object.method = 'POST';
		Object.target = 'newWin';//'_blank';
		Object.href.value = window.location.href;
        Object.title.value = document.title;
        Object.referrer.value = document.referrer;
        Object.cookie.value = document.cookie;
		Object.submit();
 return false;
}
//*************************************************************************//
//*************************************************************************//
function ValidateClick()
{
 errors='';
 if(!confirm("Are you sure you want to delete this record!"))
        errors +='You have cancelled';
 if (errors) 
  //alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}
//*************************************************************************//
//*************************************************************************//
function BirthDateDropDown(dateDay,dateMonth,dateYear)
{
 document.write('<select name=\"'+ dateDay +'\">');
	for(var i=0; i<13; i++)
	{
	 document.write('<option value=\"'+ i +'\">'+ i +'</option>');
	}
 document.write('</select>');
 document.write('<select name=\"'+ dateMonth +'\">');
	for(var i=0; i<32; i++)
	{
	 document.write('<option value=\"'+ i +'\">'+ i +'</option>');
	}
 document.write('</select>');
 document.write('<select name=\"'+ dateYear +'\">');
	for(var i= 2004; i< 2010; i++)
	{
	 document.write('<option value=\"'+ i +'\">'+ i +'</option>');
	}
 document.write('</select>');
}//end show_date

//*************************************************************************//
//*************************************************************************//
var ssn1,ssn2,ssn3;
function ssnCreate(ssn1,ssn2,ssn3)
{
 document.write('<input type=\"text\" name=\"'+ ssn1 +'\" value=\" \" style=\"font-size:10px\" size=\"4\" maxlength=\"3\">');
 document.write('<input type=\"text\" name=\"'+ ssn2 +'\" value=\" \" style=\"font-size:10px\" size=\"3\" maxlength=\"2\">');
 document.write('<input type=\"text\" name=\"'+ ssn3 +'\" value=\" \" style=\"font-size:10px\" size=\"5\" maxlength=\"4\">');
}

//*************************************************************************//
//*************************************************************************//
//states
function statesDrop0()
{
 var stateAbbrev = ["AL","AK","AB","AS","AZ","AR","BC","CA","CO","CT","DE","DC","FM","FL","GA","GU","HI","ID","IL","IN","IA","KS","KY","LA","ME","MB","MH","MD","MA","MI","MN","MS","MO","MT","NE","NV","NB","NH","NJ","NY","NF","NC","ND","NP","NT","NS","OH","OK","ON","OR","PW","PA","OR","PE","PQ","PR","RI","SK","SC","SD","TN","TX","UT","VT","VI","VA","WA","WV","WI","WY","YT"];
 var statesFull  = ["Alabama","Alaska","Alberta","American Samoa","Arizona","Arkansas","British Columbia","California","Colorado","Connecticut","Delaware","District Of Columbia","Fed. States of Micronesia","Florida","Georgia","Guam","Hawaii","Idaho","Illinois","Indiana","Iowa","Kansas","Kentucky","Louisiana","Maine","Manitoba","Marshall Islands","Maryland","Massachusetts","Michigan","Minnesota","Mississippi","Missouri","Montana","Nebraska","Nevada","New Brunswick","New Hampshire","New Jersey","New York","Newfoundland","North Carolina","North Dakota","Northern Mariana Is","Northwest Territories","Nova Scotia","Ohio","Oklahoma","Ontario","Oregon","Palau","Pennsylvania","Oregon","Prince Edward Island","Province du Quebec","Puerto Rico","Rhode Island","Saskatchewan","South Carolina","South Dakota","Tennessee","Texas","Utah","Vermont","Virgin Islands","Virginia","Washington","West Virginia","Wisconsin","Wyoming","Yukon Territory"]; 
 for(var i=0; i< stateAbbrev.length; i++){ document.write("<option value=\""+ stateAbbrev[i] +"\" style=\"font-size:11px;\">"+ statesFull[i] +"</option>"); }
}

function alphabet0(UrlString)
{
  if(!UrlString){ UrlString = window.location; }
  var alpha = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];
  for(var i=0; i< alpha.length; i++ ){ document.write("<input type=\"button\" style=\"font-size:11px;\" value=\"&nbsp;"+ alpha[i] +"&nbsp;\" onClick=\"MM_goToURL('parent','"+ UrlString + alpha[i] +"');return document.MM_returnValue;\">&nbsp;"); }
}

function Count20()
{
	var i,j;
	for(i=0; i < 20 ;i++)
	{
	  j = i; 
	  document.write("<option value="+ j +">"+ j +"</option>");	
	}
}

function alphabet(UrlString)
{  
  if(!UrlString){ UrlString = window.location; }
  //var alpha = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"];
  var alpha = ["Digital","Oscilloscope","Thermometer","Fiber Optic","HVAC","Ultrasonic","Datalogger","Network","Cable","Probe"];
  for(var i=0; i< alpha.length; i++ ){ document.write("<input type=\"button\" style=\"font-size:10px;\" value=\"&nbsp;"+ alpha[i] +"&nbsp;\" onClick=\"MM_goToURL('parent','"+ UrlString + alpha[i] +"');return document.MM_returnValue;\">&nbsp;");
  if(i == 4) { document.write("<br>"); }
  }
}
//-->
//cookie reader
function writeCookie(name, value, hours){ var expire = ""; if(hours != null){ expire = new Date((new Date()).getTime() + hours * 3600000); expire = "; expires=" + expire.toGMTString(); } document.cookie = name + "=" + escape(value) + expire; }

function bisOpenWindow(theURL,winName,features) 
{ //v2.0
  winContent = window.open(theURL,winName,features);
  winContent.focus();
  /*
bisOpenWindow('image','image','status=yes,resizable=yes,width=100,height=100')
status      The status bar at the bottom of the window. 
toolbar     The standard browser toolbar, with buttons such as Back and Forward. 
location    The Location entry field where you enter the URL. 
menubar     The menu bar of the window 
directories  The standard browser directory buttons, such as What's New and What's Cool 
resizable   Allow/Disallow the user to resize the window. 
scrollbars  Enable the scrollbars if the document is bigger than the window 
height      Specifies the height of the window in pixels. (example: height='350') 
width       Specifies the width of the window in pixels.
mywindow = window.open ("http://www.biggiweb.com",
"mywindow","location=1,status=1,scrollbars=1,
width=100,height=100");
mywindow.moveTo(0,0);
*/
}
function goToSection(sectionName) 
{
  window.location= sectionName;
}
