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.0
  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 && document.getElementById) x=document.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(selObj){ 
  if((selObj.options[selObj.selectedIndex].value)!=""){
window.location = (selObj.options[selObj.selectedIndex].value)
}
  }


function OpenWindow(url, w, h, scrollbars)
	{
	winl = (screen.width-w)/2;
	wint = (screen.height-h)/2;
	var newWind=window.open(url,"",",menubar=no,location=no,toolbar=no,status=no,resizable=yes,scrollbars=" + scrollbars + ",width=" + w + ",height=" + h + ",left=" + winl + ",top=" + wint);
    }

function openNewWindow(URLtoOpen, windowName, windowFeatures) { newWindow=window.open(URLtoOpen, windowName, windowFeatures); }



function isblank(string)
{
    if(string == null) return true;
    for(var i=0;i<string.length;i++) {
	var ch = string.charAt(i);
	if((ch != ' ' && ch != '\n' && ch != '\t')) 
	    return false;
    }
    return true;
}

function validEmail(email){
	invalidChars="/:,;";
	if (email == ""){
		return true;
	}
	for (i=0; i<invalidChars.length; i++){
		badChar = invalidChars.charAt(i);
		if (email.indexOf(badChar, 0)!=-1) {
			return false
		}
	}
	atPos = email.indexOf("@",1);
	if (atPos == -1){
	 	return false
	}
	if (email.indexOf("@", atPos+1)!= -1){
		return false
	}
	periodPos=email.indexOf(".", atPos);
	if (periodPos == -1){
		return false
	}
	if (periodPos+3>email.length){
		return false
	}
	return true
}

function isNum(number){  
	if (number == ""){
		return true;
	}
	for (i=0;i<number.length;i++){
		var ch = number.charAt(i);
		if ((ch<"0")&&(ch!=" ")&&(ch!="-")){
			return false
		}
		if ((ch>"9")&&(ch!=" ")&&(ch!="-")){
		 	return false
		}
	}
	return true
}
	

function verify(form)
{
    var error_msg = "";
    var invalid_msg = "";
	 	 
	for(var i=0;i<form.length;i++) {
	var elem = form.elements[i];

	if(elem.optional) {
	    continue;
	}

	if(elem.type == "text"){
	    if (isblank(elem.value)){
	    error_msg += "\n        " + elem.name;
	    }
		 else{
		   if((elem.name == "EmailAddress") && (validEmail(elem.value) == false)){
		 		invalid_msg += "\n        " + elem.name;	
			}			
	      if((elem.name=="FaxNumber") && (isNum(elem.value) == false)){
		 		invalid_msg += "\n        " + elem.name;	
         }					
		 }
	} 
	else if(elem.type == "textarea" && isblank(elem.value)) {
	    error_msg += "\n        " + elem.name;
     } 
   }
	 
    
	var title = "";
	title += "________________________________________________________\n\n";
	title += "Please corrected the following error(s) and hit the \n";
	title += "Send button again\n";
	title += "________________________________________________________\n\n";
	if(error_msg||invalid_msg){
		if (error_msg){
			title += "Missing Fields:\n" + error_msg+"\n\n";
		}
		if (invalid_msg) {
			title += "Invalid Fields:\n"+invalid_msg;
		}
	alert(title );
   return false;
	}
   
    return true;
}

function mysubmit()
{
    self.document.Information_request.Title.optional = true;
    self.document.Information_request.CompanyName.optional = true;
    self.document.Information_request.PhoneNumber.optional = true;
    self.document.Information_request.Comments.optional = true;
	  
    if (self.document.Information_request.IsEmailAddress.checked==false) {
	 self.document.Information_request.EmailAddress.optional = true;
	 }
	 if (self.document.Information_request.IsFaxNumber.checked==false){
    self.document.Information_request.FaxNumber.optional = true;
	 }		 
	 if(verify(self.document.Information_request)) {
	 self.document.Information_request.submit();
	 }
	 self.document.Information_request.EmailAddress.optional = false;
    self.document.Information_request.FaxNumber.optional = false;	
}






function togOn(id,count)
{
var L = document.getElementById("L"+id);
  
if (L.style.display == "" || L.style.display == "none") {
    L.style.display = "block";
    
   n = 1;
   upper = count + 1
   while( n < upper ) {
	if (n != id){	
   var H = document.getElementById("L"+n);
   H.style.display = "none";
	}
   n ++;
	} 
  }
  else { 
    L.style.display = "none";
    }
      
}