// JavaScript Document

//=====================================================================
//  DOM Image Rollover v3 (hover)
//
//  Demo: http://chrispoole.com/scripts/dom_image_rollover_hover
//  Script featured on: Dynamic Drive (http://www.dynamicdrive.com)
//=====================================================================
//  copyright Chris Poole
//  http://chrispoole.com
//  This software is licensed under the MIT License 
//  <http://opensource.org/licenses/mit-license.php>
//=====================================================================

function domRollover() {
	if (navigator.userAgent.match(/Opera (\S+)/)) {
		var operaVersion = parseInt(navigator.userAgent.match(/Opera (\S+)/)[1]);
	}
	if (!document.getElementById||operaVersion <7) return;
	var imgarr=document.getElementsByTagName('img');
	var imgPreload=new Array();
	var imgSrc=new Array();
	var imgClass=new Array();
	for (i=0;i<imgarr.length;i++){
		if (imgarr[i].className.indexOf('domroll')!=-1){
			imgSrc[i]=imgarr[i].getAttribute('src');
			imgClass[i]=imgarr[i].className;
			imgPreload[i]=new Image();
			if (imgClass[i].match(/domroll (\S+)/)) {
				imgPreload[i].src = imgClass[i].match(/domroll (\S+)/)[1]
			}
			imgarr[i].setAttribute('xsrc', imgSrc[i]);
			imgarr[i].onmouseover=function(){
				this.setAttribute('src',this.className.match(/domroll (\S+)/)[1])
			}
			imgarr[i].onmouseout=function(){
				this.setAttribute('src',this.getAttribute('xsrc'))
			}
		}
	}
}
domRollover();

function CheckData(arg1){
  var error=true
  var theAlert="Please enter the required fields:"
  var fields=new Array("How did you hear about sample requests","First Name","Last Name","Company Name","Street Address","City","State","Zip","Country","Email_Address","Phone Number");
  var fields_name=new Array("How did you hear about sample requests","First Name","Last Name","Company Name","Street Address","City","State","Zip","Country","Email_Address","Phone Number");
   for(i=0;i<=7;i++){
		if(arg1.elements[fields[i]].value==""){
			 error=false
			 theAlert=theAlert+"\n"+fields_name[i]
								   }
								   }
									if(error!=true){
									alert(theAlert)
									return false
									}else{
									return true
									}
									alert(theAlert)
}


function CheckData2(arg1){
  var error=true
  var theAlert="Please enter the required fields:"
  var fields=new Array("Name","Company","Address1","City","State","Zip","Country","Email");
  var fields_name=new Array("Name","Company","Address1","City","State","Zip","Country","Email");
   for(i=0;i<=7;i++){
		if(arg1.elements[fields[i]].value==""){
			 error=false
			 theAlert=theAlert+"\n"+fields_name[i]
								   }
								   }
									if(error!=true){
									alert(theAlert)
									return false
									}else{
									return true
									}
									alert(theAlert)
}


function ResetItems(arg){
switch (arg.name) {
	case "medical": 
		document.forms[1].industrial.selectedIndex=0;
		document.forms[1].general.selectedIndex=0; 
	break;
	case "industrial": 
		document.forms[1].medical.selectedIndex=0;
		document.forms[1].general.selectedIndex=0; 
	break;
	case "general": 
		document.forms[1].industrial.selectedIndex=0;
		document.forms[1].medical.selectedIndex=0; 
	break;
	default: 
		document.forms[1].industrial.selectedIndex=0;
		document.forms[1].medical.selectedIndex=0;
		document.forms[1].general.selectedIndex=0;
	break;
}
}

/*/* Script taken from http://www.leemessenger.co.uk - Please do not remove this line */
function ChangeCSSBgImg() {
	if (!document.getElementById) return false;
	
	var MyElement = "wrapperHome" //The ID of the element you want to change
	var ImgPath = "/_images-home/" //The file path to your images
	
	if (!document.getElementById(MyElement)) return false;
	
	var random_images = new Array ();
	random_images[0] = "background-1.jpg"; // Don't forget to increase the array number each time
	random_images[1] = "background-2.jpg";
	random_images[2] = "background-3.jpg";
	random_images[3] = "background-4.jpg";
	
	var $header = document.getElementById(MyElement);
	var $backgroundurl = $header.style.backgroundImage;
	var ImgURL = "url(" + ImgPath + random_images[rand(random_images.length)] + ")";
	
	if ($backgroundurl != ImgURL) {
		$header.style.backgroundImage = ImgURL;	
	}
	
	movement = setTimeout("ChangeCSSBgImg()",14000);
}

/* random number generator */
function rand(n) {
  return ( Math.floor ( Math.random ( ) * n ) );
}

/* Custom onload function */
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      oldonload();
      func();
    }
  }
}
/* trigger onload */
addLoadEvent(ChangeCSSBgImg);*