// JavaScript Document
<!--
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_openBrWindow(theURL,winName,features) { //v2.0
  newWindow = window.open(theURL,winName,features);
  newWindow.focus();
}

function popupWindow(url) {
  newWindow = window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,width=470,height=300,screenX=150,screenY=150,top=150,left=150');
  newWindow.focus();
}

function popupWindow2(url) {
  newWindow = window.open(url,'popupWindow2','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width=470,height=470,screenX=150,screenY=150,top=150,left=150');
  newWindow.focus();
}

function popupHome(url) {
  newWindow = window.open(url,'popupWindow2','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width=570,height=450,screenX=150,screenY=150,top=150,left=150');
  newWindow.focus();
}


function printWindow() {
	bV = parseInt(navigator.appVersion);
	if (bV >= 4) window.print();
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

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();
 }
 
 MM_reloadPage(true);
 
 function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function isValidEmail(strEmail) {		
	if (strEmail.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
		return true;
	else
		return false;
}

function isNumeric(input) {
   var vChars = "0123456789";
   var IsNumber=true;
   var Char;
 
   for (i = 0; i < input.length && IsNumber == true; i++) 
      { 
      Char = input.charAt(i); 
     	 if (vChars.indexOf(Char) == -1) 
         {
         	IsNumber = false;
         }
      }
   return IsNumber;   
   }
   
   function isInt (str) {
	var i = parseInt (str);

	if (isNaN (i))
		return false;

	i = i . toString ();
	if (i != str)
		return false;

	return true;
}

function validstr(str) {	
	var len = str.length;	
	var i;
	var flag = 0 ;
	for(i=0;i<len;i++)
	{
		if((str.charAt(i) >= 'a' && str.charAt(i) <= 'z' )|| (str.charAt(i) >= 'A' && str.charAt(i) <= 'Z') || str.charAt(i)==" " || str.charAt(i)=="-")
		{
			continue;						
		}
		else
		{
			 flag = 1;			
		}			
	}
//	alert(flag);
	if(flag == 1)
		 return false;
	else
		return true;
}




function checkContact()
{
	var msg;
	var fobj;
	var bln;	
	msg = "There were errors with the information you  submitted.\n\n";
	bln = true;
	
	if(document.frmContact.fname.value == "")
	{
		msg += "Please enter your first name.\n";		
		fobj = document.frmContact.fname;	
		bln = false;
	}
	
	if(document.frmContact.lname.value == "")
	{
		msg += "Please enter your last name.\n";		
		if(bln)
		fobj = document.frmContact.lname;	
		bln = false;
	}
	
	if(document.frmContact.hospital.value == "")
	{
		msg += "Please enter the name of your hospital / practice.\n";		
		if(bln)
		fobj = document.frmContact.hospital;	
		bln = false;
	}
	
	if(document.frmContact.address1.value == "")
	{
	   msg += "Please enter your address.\n";
	   if(bln) {
	   fobj = document.frmContact.address1;
	   bln = false;
	   }
	}
	
	if(document.frmContact.city.value == "")
	{
	   msg += "Please enter your city.\n";
	   if(bln) {
	   fobj = document.frmContact.city;
	   bln = false;
	   }
   }
   
   if (document.frmContact.state.value == "")
   {
      msg += "Please select your state.\n";
      if(bln) {
      fobj = document.frmContact.state;
      bln = false;
      }
   }
	
	if(document.frmContact.zip.value == "")
	{
		msg += "Please enter your zip code.\n";
		if(bln) {				
		fobj = document.frmContact.zip;	
		bln = false;
		}
	}
	
	if(document.frmContact.country.value == "")
	{
	   msg += "Please select your country.\n";
	   if(bln) {
	   fobj = document.frmContact.zip;
	   bln = false;
	   }
   }
	
	if(document.frmContact.email.value == "")
	{
		msg += "Please enter your email address.\n";		
		if(bln)
		fobj = document.frmContact.email;	
		bln = false;
	}
	else
	{
		if(!isValidEmail(document.frmContact.email.value))
		{
			msg += "Your email address must be in the form of you@yourdomain.com\n";
			if(bln) 
				fobj = document.frmContact.email;	
			bln = false;
			document.frmContact.email.value="";
		}	   
	}		
		
	
if(document.frmContact.phone.value == "")
	{
		msg += "Please enter your phone number.\n";		
		if(bln) {		
		fobj = document.frmContact.phone;	
		bln = false;
		}
	}	
		
	if(bln == false)
	{
		alert(msg);
		fobj.focus();
	}
	else
	{	
		document.frmContact.action = "order.php";
		document.frmContact.submit();
	}
}



function textCounter(field,cntfield,maxlimit) {  // limit total characters
	if (field.value.length > maxlimit) { 
		field.value = field.value.substring(0, maxlimit);		
	} else {
		cntfield.value = maxlimit - field.value.length;
	}
}

