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 mytrim(val)
{
		val1 = "";
		val2="";
		ctrr = 0;
		lngth = val.length;
		for (i=0; i<lngth; i++)
		{
		if (val.charCodeAt(i) != 32)
		{
		for(j=i;j<lngth;j++)
		{
		if (val.charCodeAt(j) != 13 && val.charCodeAt(j) != 10 )
			{
			val1 += val.charAt(j);
			}
		}
		break;
		}
		}
		if (val1 != "")
		{
		lngth = val1.length
		ctrr=lngth;
		for (k=0; k<lngth; k++)
		{
		ctrr=ctrr-1;
		if (val1.charCodeAt(ctrr) != 32)
		{
		for(l=0;l<lngth-k;l++)
		{
		val2 += val1.charAt(l);
		}
		val1=val2;
		break;
		}
		}
		}
		return val1;
}
function chkemail(email)
{
	var emailvalid=true;

		if (email.value.length < 5)
		{
			emailvalid=false;
		}
		else
		{

			var flag = "false";
			var flag1 = "false";
			var flag2="true";
			for (var i = 1; i < email.value.length; i++)
			{
				var ch = email.value.substring(i, i + 1);
				if (ch == ".")
				{
					flag = "true";
				}
				if (ch == "@")
				{
					flag1 = "true";
				}
				if (ch==" ")
				{
					flag2="false";
				}

			}
			if (flag == "false" || flag1 == "false" || flag2 == "false")
			{
				emailvalid=false;
			}
		}
		return emailvalid;
}
 function IsNumeric(sText)
 {
   var ValidChars = "0123456789";
   var IsNumber=true;
   var Char;


   for (i = 0; i < sText.length && IsNumber == true; i++)
      {
      Char = sText.charAt(i);
      if (ValidChars.indexOf(Char) == -1)
         {
         IsNumber = false;
         }
      }
   return IsNumber;

 }
function emptyvalue(x1) {

 if(x1.value=="First Name" || x1.value=="Last Name"  || x1.value=="Email Address" || x1.value=="Street Address" || x1.value=="City" || x1.value=="State" || x1.value=="Zip Code") {
  pretext=x1.value;
  	
  x1.style.color='#000000';
  x1.value="";
 } else {

  switch(x1.name) {
  
	case "firstname":
    pretext="First Name";
    break;
   case "lastname":
    pretext="Last Name";
    break;
   case "email":
    pretext="Email Address";
    break;
   case "address":
    pretext="Street Address";
    break;	
  
   case "city":
    pretext="City";
    break;
	
	 case "zip":
    pretext="Zip Code";
    break;
   case "state":
    pretext="State";
    break;
	
	
   default: pretext="";
  }
 }
}

function fillvalue(x1) {
 if (x1.value=="") {
  x1.style.color = '#000000';
  x1.value = pretext;
 }
}

function validateform()
{
	if(mytrim(document.frmform.firstname.value)=="" || mytrim(document.frmform.firstname.value)=="First Name")
		{
			  alert("Please Enter First Name");
			  document.frmform.firstname.focus();
			  return false;
		}
		if(mytrim(document.frmform.lastname.value)=="" || mytrim(document.frmform.lastname.value)=="Last Name")
		{
			  alert("Please Enter Last Name");
			  document.frmform.lastname.focus();
			  return false;
		}
		var chkFilter=/\w{1,}[@][\w\-]{1,}([.]([\w\-]{1,})){1,3}$/;
		if (!(chkFilter.test(document.frmform.email.value))) {
			  alert("Please Enter a Valid Email Address");
			  document.frmform.email.focus();
			  return false;
		}
		if(mytrim(document.frmform.address.value)=="" || mytrim(document.frmform.address.value)=="Street Address")
		{
			  alert("Please Enter Street Address");
			  document.frmform.address.focus();
			  return false;
		}
		
		if(mytrim(document.frmform.city.value)=="" || mytrim(document.frmform.city.value)=="City")
		{
			  alert("Please Enter City");
			  document.frmform.city.focus();
			  return false;
		}
		if(mytrim(document.frmform.state.value)=="" || mytrim(document.frmform.state.value)=="State")
		{
			  alert("Please Enter State");
			  document.frmform.state.focus();
			  return false;
		}
		if(mytrim(document.frmform.zip.value)=="" || mytrim(document.frmform.zip.value)=="Zip Code")
		{
			  alert("Please Enter Zip Code");
			  document.frmform.zip.focus();
			  return false;
		}
		if (!IsNumeric(document.frmform.zip.value))
		{
			alert("Please Enter Valid Zip");
			document.frmform.zip.focus();
			return false;
		}
		if (document.frmform.zip.value.length<5)
		{
			alert("Please Enter Valid Zip");
			document.frmform.zip.focus();
			return false;
		}
		if (mytrim(document.frmform.verificationcode.value)=="")
		{
			alert("Please Enter Authentication Code");
			document.frmform.verificationcode.focus();
			return false;
		}
		
}

