// JavaScript Document
// Functions
function showstuff(boxid){
   document.getElementById(boxid).style.display="block";
}
function hidestuff(boxid){
   document.getElementById(boxid).style.display="none";
}
function HideContent(d){
if(d.length < 1) { return; }
document.getElementById(d).style.display = "none";
}
function ShowContent(d){
if(d.length < 1) { return; }
document.getElementById(d).style.display = "block";
}
function ReverseContentDisplay(d,e){
if(d.length < 1) { return; }
if(document.getElementById(d).style.display == "none") { document.getElementById(d).style.display = "block"; document.getElementById(e).className = "productinfodrop" }
else { document.getElementById(d).style.display = "none"; document.getElementById(e).className = "productinfocollapsed" }
}
function setoptions(chosen){ 
var selbox = document.CSearch.cells; 
selbox.options.length = 0; 
if (chosen == " "){ 
selbox.options[selbox.options.length] = new Option('Select Chemistry...',''); 
} 
if (chosen == "Lithium"){
selbox.options[selbox.options.length] = new Option('Number of Cells Required...',''); 
selbox.options[selbox.options.length] = new Option('1 Cell','1'); 
selbox.options[selbox.options.length] = new Option('2 Cells','2');
selbox.options[selbox.options.length] = new Option('3 Cells','3'); 
selbox.options[selbox.options.length] = new Option('4 Cells','4');
selbox.options[selbox.options.length] = new Option('5 Cells','5'); 
} 
if (chosen == "NiMH"){
selbox.options[selbox.options.length] = new Option('Number of Cells Required...',''); 
selbox.options[selbox.options.length] = new Option('2 Cells','2'); 
selbox.options[selbox.options.length] = new Option('3 Cells','3');
selbox.options[selbox.options.length] = new Option('4 Cells','4');
selbox.options[selbox.options.length] = new Option('5 Cells','5'); 
selbox.options[selbox.options.length] = new Option('6 Cells','6');
selbox.options[selbox.options.length] = new Option('7 Cells','7');
selbox.options[selbox.options.length] = new Option('8 Cells','8'); 
selbox.options[selbox.options.length] = new Option('9 Cells','9');
selbox.options[selbox.options.length] = new Option('10 Cells','10');
selbox.options[selbox.options.length] = new Option('11 Cells','11'); 
selbox.options[selbox.options.length] = new Option('12 Cells','12');
selbox.options[selbox.options.length] = new Option('13 Cells','13');
selbox.options[selbox.options.length] = new Option('14 Cells','14'); 
selbox.options[selbox.options.length] = new Option('15 Cells','15');
selbox.options[selbox.options.length] = new Option('16 Cells','16');
selbox.options[selbox.options.length] = new Option('17 Cells','17'); 
selbox.options[selbox.options.length] = new Option('18 Cells','18');
selbox.options[selbox.options.length] = new Option('19 Cells','19');
selbox.options[selbox.options.length] = new Option('20 Cells','20');
} 
if (chosen == "LeadAcid"){ 
selbox.options[selbox.options.length] = new Option('Voltage Required...',''); 
selbox.options[selbox.options.length] = new Option('6V','6'); 
selbox.options[selbox.options.length] = new Option('12V','12');
selbox.options[selbox.options.length] = new Option('24V','24'); 
}
}
function check_contact(form){
var emailFilter=/^.+@.+\..{2,3}$/;
var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/;
var re = /\s/;									
	if (form.name.value == ''){
		alert("Please enter your name...");
		form.name.focus();
		return false;
	}
	var stripped = form.telephone.value.replace(/[\(\)\.\-\ ]/g, '');
	if (form.telephone.value == '' || isNaN(parseInt(stripped))) {
		alert("Your telephone number is incomplete or contains invalid characters...");
		form.telephone.focus();
		return false;
	}
	if (form.email.value == '' || form.email.value.match(illegalChars) || !(emailFilter.test(form.email.value))){
		alert("Please enter a valid email address...");
		form.email.focus();
		return false;
	}
	if (form.subject.value == ''){
		alert("Please enter your enquiry subject...");
		form.subject.focus();
		return false;
	}
	if (form.message.value == ''){
		alert("Please enter your enquiry...");
		form.message.focus();
		return false;
	}
	if (form.howfound.value == ''){
		alert("Please select how you found out about Haredata Electronics...");
		form.howfound.focus();
		return false;
	}
	if (form.howfound.value == 'Other'){
		if (form.howfound_other.value == ''){
			alert("Please specify Other...");
			form.howfound_other.focus();
			return false;
		}
	}
}
function check_catalogue(form){
var emailFilter=/^.+@.+\..{2,3}$/;
var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/;
var re = /\s/;									
	if (form.name.value == ''){
		alert("Please enter your name...");
		form.name.focus();
		return false;
	}
	var stripped = form.telephone.value.replace(/[\(\)\.\-\ ]/g, '');
	if (form.telephone.value == '' || isNaN(parseInt(stripped))) {
		alert("Your telephone number is incomplete or contains invalid characters...");
		form.telephone.focus();
		return false;
	}
	if (form.email.value == '' || form.email.value.match(illegalChars) || !(emailFilter.test(form.email.value))){
		alert("Please enter a valid email address...");
		form.email.focus();
		return false;
	}
	if (form.howfound.value == ''){
		alert("Please select how you found out about Haredata Electronics...");
		form.howfound.focus();
		return false;
	}
	if (form.howfound.value == 'Other'){
		if (form.howfound_other.value == ''){
			alert("Please specify Other...");
			form.howfound_other.focus();
			return false;
		}
	}
}
function check_news(form){
var emailFilter=/^.+@.+\..{2,3}$/;
var illegalChars= /[\(\)\<\>\,\;\:\\\/\"\[\]]/;
var re = /\s/;									
	if (form.name.value == ''){
		alert("Please enter your name...");
		form.name.focus();
		return false;
	}
	if (form.email.value == '' || form.email.value.match(illegalChars) || !(emailFilter.test(form.email.value))){
		alert("Please enter a valid email address...");
		form.email.focus();
		return false;
	}
}
function MM_openBrWindow(theURL,winName,features){ //v2.0
  window.open(theURL,winName,features);
}
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_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_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_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
function evaswap(obj, val){
  obj.src = val;
}
// Functions
// FlashRun_ActiveContent
var isIE=navigator.appVersion.indexOf("MSIE")!=-1?true:false,isWin=navigator.appVersion.toLowerCase().indexOf("win")!=-1?true:false,isOpera=navigator.userAgent.indexOf("Opera")!=-1?true:false;
function ControlVersion(){var a,c;try{c=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");a=c.GetVariable("$version")}catch(g){}if(!a)try{c=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");a="WIN 6,0,21,0";c.AllowScriptAccess="always";a=c.GetVariable("$version")}catch(b){}if(!a)try{c=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");a=c.GetVariable("$version")}catch(f){}if(!a)try{c=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");a="WIN 3,0,18,0"}catch(e){}if(!a)try{c=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
a="WIN 2,0,0,11"}catch(d){a=-1}return a}
function GetSwfVer(){var a=-1;if(navigator.plugins!=null&&navigator.plugins.length>0){if(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]){a=navigator.plugins["Shockwave Flash 2.0"]?" 2.0":"";a=navigator.plugins["Shockwave Flash"+a].description;a=a.split(" ");var c=a[2].split("."),g=c[0];c=c[1];var b=a[3];if(b=="")b=a[4];if(b[0]=="d")b=b.substring(1);else if(b[0]=="r"){b=b.substring(1);if(b.indexOf("d")>0)b=b.substring(0,b.indexOf("d"))}a=g+"."+c+"."+b}}else if(navigator.userAgent.toLowerCase().indexOf("webtv/2.6")!=
-1)a=4;else if(navigator.userAgent.toLowerCase().indexOf("webtv/2.5")!=-1)a=3;else if(navigator.userAgent.toLowerCase().indexOf("webtv")!=-1)a=2;else if(isIE&&isWin&&!isOpera)a=ControlVersion();return a}
function DetectFlashVer(a,c,g){versionStr=GetSwfVer();if(versionStr==-1)return false;else if(versionStr!=0){if(isIE&&isWin&&!isOpera){tempArray=versionStr.split(" ");tempString=tempArray[1];versionArray=tempString.split(",")}else versionArray=versionStr.split(".");var b=versionArray[0],f=versionArray[1],e=versionArray[2];if(b>parseFloat(a))return true;else if(b==parseFloat(a))if(f>parseFloat(c))return true;else if(f==parseFloat(c))if(e>=parseFloat(g))return true;return false}}
function AC_AddExtension(a,c){return a.indexOf("?")!=-1?a.replace(/\?/,c+"?"):a+c}function AC_Generateobj(a,c,g){var b="";if(isIE&&isWin&&!isOpera){b+="<object ";for(var f in a)b+=f+'="'+a[f]+'" ';b+=">";for(f in c)b+='<param name="'+f+'" value="'+c[f]+'" /> ';b+="</object>"}else{b+="<embed ";for(f in g)b+=f+'="'+g[f]+'" ';b+="> </embed>"}document.write(b)}
function AC_FL_RunContent(){var a=AC_GetArgs(arguments,".swf","movie","clsid:d27cdb6e-ae6d-11cf-96b8-444553540000","application/x-shockwave-flash");AC_Generateobj(a.objAttrs,a.params,a.embedAttrs)}function AC_SW_RunContent(){var a=AC_GetArgs(arguments,".dcr","src","clsid:166B1BCA-3F9C-11CF-8075-444553540000",null);AC_Generateobj(a.objAttrs,a.params,a.embedAttrs)}
function AC_GetArgs(a,c,g,b,f){var e={};e.embedAttrs={};e.params={};e.objAttrs={};for(var d=0;d<a.length;d+=2){var h=a[d].toLowerCase();switch(h){case "classid":break;case "pluginspage":e.embedAttrs[a[d]]=a[d+1];break;case "src":case "movie":a[d+1]=AC_AddExtension(a[d+1],c);e.embedAttrs.src=a[d+1];e.params[g]=a[d+1];break;case "onafterupdate":case "onbeforeupdate":case "onblur":case "oncellchange":case "onclick":case "ondblClick":case "ondrag":case "ondragend":case "ondragenter":case "ondragleave":case "ondragover":case "ondrop":case "onfinish":case "onfocus":case "onhelp":case "onmousedown":case "onmouseup":case "onmouseover":case "onmousemove":case "onmouseout":case "onkeypress":case "onkeydown":case "onkeyup":case "onload":case "onlosecapture":case "onpropertychange":case "onreadystatechange":case "onrowsdelete":case "onrowenter":case "onrowexit":case "onrowsinserted":case "onstart":case "onscroll":case "onbeforeeditfocus":case "onactivate":case "onbeforedeactivate":case "ondeactivate":case "type":case "codebase":case "id":e.objAttrs[a[d]]=
a[d+1];break;case "width":case "height":case "align":case "vspace":case "hspace":case "class":case "title":case "accesskey":case "name":case "tabindex":e.embedAttrs[a[d]]=e.objAttrs[a[d]]=a[d+1];break;default:e.embedAttrs[a[d]]=e.params[a[d]]=a[d+1]}}e.objAttrs.classid=b;if(f)e.embedAttrs.type=f;return e};
// FlashRun_ActiveContent