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_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

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 open_win(Dest,features){
        win_features = features +',left=50,top=100,alwaysraised=Yes,alwaysshow=yes';
        window.open(Dest,'',win_features);
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
 
function validateRequestInfo() {
	e = true;
	alert_str = 'Your information request had the following errors:';
	
	if(document.requestForm.name.value == '') {
		alert_str += '\nMISSING Name.';
		e = false;
	}
		if(document.requestForm.address.value == '') {
		alert_str += '\nMISSING Address.';
		e = false;
	}
	if(document.requestForm.city.value == '') {
		alert_str += '\nMISSING City.';
		e = false;
	}
	if(document.requestForm.state.value == '') {
		alert_str += '\nMISSING State.';
		e = false;
	}
	if(document.requestForm.zip.value == '') {
		alert_str += '\nMISSING Zip Code.';
		e = false;
	}
	if(document.requestForm.phone.value == '') {
		alert_str += '\nMISSING Phone Number.';
		e = false;
	}
	else {
		if(document.requestForm.homephone.value.length < 7) {
			alert_str += '\nINVALID Phone Number.';
			e = false;
		}	
	}
	if(document.requestForm.email.value == '') {
	alert_str += '\nMISSING Email.';
	e = false;
	}
	else {
		if(chkEmail(document.requestForm.email) == false) {
			alert_str += '\nINVALID E-Mail Address.';
			e = false;
		}
	}
	if(e)
		return true;
	else {
		alert(alert_str);
		return false;
	}
}

function validateProdReg() {
	e = true;
	alert_str = 'Your Product Registration had the following errors:';
	if(document.prodreg.hospname.value == '') {
		alert_str += '\nMISSING Hospital Name.';
		e = false;
	}
	if(document.prodreg.contactname.value == '') {
		alert_str += '\nMISSING Contact Name.';
		e = false;
	}
		if(document.prodreg.dept.value == '') {
		alert_str += '\nMISSING Department.';
		e = false;
	}
		if(document.prodreg.address.value == '') {
		alert_str += '\nMISSING Address.';
		e = false;
	}
	if(document.prodreg.city.value == '') {
		alert_str += '\nMISSING City.';
		e = false;
	}
	if(document.prodreg.state.value == '') {
		alert_str += '\nMISSING State.';
		e = false;
	}
	if(document.prodreg.zip.value == '') {
		alert_str += '\nMISSING Zip Code.';
		e = false;
	}
	if(document.prodreg.phone.value == '') {
		alert_str += '\nMISSING Phone Number.';
		e = false;
	}
	else {
		if(document.prodreg.phone.value.length < 7) {
			alert_str += '\nINVALID Phone Number.';
			e = false;
		}	
	if(document.prodreg.email.value == '') {
	alert_str += '\nMISSING Email.';
	e = false;
	}
	if(document.prodreg.model.value == '') {
		alert_str += '\nMISSING Model Type.';
		e = false;
	}
		if(document.prodreg.serial.value == '') {
		alert_str += '\nMISSING Serial Number.';
		e = false;
	}
		if(document.prodreg.deliverdate.value == '') {
		alert_str += '\nMISSING Delivery Date.';
		e = false;
	}
}
	if(e)
		return true;
	else {
		alert(alert_str);
		return false;
	}
}
// JavaScript to interpolate random images into a page.
var ic = 2;     // Number of alternative images
var xoxo1 = new Array(ic);  // Array to hold filenames
        
xoxo1[0] = "bg/index_image_1.jpg";
xoxo1[1] = "bg/index_image_2.jpg";

function pickRandom(range) {
	if (Math.random)
		return Math.round(Math.random() * (range-1));
	else {
		var now = new Date();
		return (now.getTime() / 1000) % range;
	}
}
var choice1 = pickRandom(ic);
