// JavaScript Document
function checkContact()
{
	
	var incorrect = new Array();
    var no = 0;
	var i,j;
	if(document.frmcontact.txtVisitors.value.length == 0)
		{
			incorrect[no]="1";
			no++;
		}
		var str=document.frmcontact.txtEmail.value;
		if(str)
		{
			str=document.frmcontact.txtEmail.value;
			var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
			if (!filter.test(str))
			{
				incorrect[no]="2";
				no++;
			
			}
		}
		else
		{
			incorrect[no]="2";
			no++;
		}
		if(document.frmcontact.txtCompany.value.length == 0)
		{
			incorrect[no]="3";
			no++;
		}
		if(document.frmcontact.txtPhone.value.length == 0)
		{
			incorrect[no]="4";
			no++;
		}
		if(document.frmcontact.verify_code.value.length == 0)
		{
			incorrect[no]="6";
			no++;
		}		
		
		
		
		if(no > 0) 
		{
			
		   document.getElementById("errors").innerHTML = "<span>There was an error. Please fill in the neccessary fields.</span>";
		   
			for(i=1;i<5;i++) {
				   document.getElementById(i).style.color="#000000";
			}
			
			for(j=0;j<no;j++) {
					
				   document.getElementById(incorrect[j]).style.color="#FF0000";
				   
			 }
			 
		   return false;
		}
		return true;
}
function checkRequest()
{
	
	var incorrect = new Array();
    var no = 0;
	var i,j;
	if(document.frmRequest.txtName.value.length == 0)
		{
			incorrect[no]="1";
			no++;
		}
		if(document.frmRequest.Title2.value.length == 0)
		{
			incorrect[no]="2";
			no++;
		}
		
		
	var str=document.frmRequest.txtEmail.value;
		if(str)
		{
			str=document.frmRequest.txtEmail.value;
			var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
			if (!filter.test(str))
			{
				incorrect[no]="5";
				no++;
			
			}
		}
		else
		{
			incorrect[no]="5";
			no++;
		}
		
		if(document.frmRequest.txtPhoneAreaCode.value.length == 0 || document.frmRequest.txtPhoneNumber.value.length == 0 )
		{
			incorrect[no]="6";
			no++;
		}
		if(document.frmRequest.txtItem.value.length == 0)
		{
			incorrect[no]="7";
			no++;
		}
		if(document.frmRequest.txtWeight.value.length == 0)
		{
			incorrect[no]="8";
			no++;
		}
		
		if(document.frmRequest.txtShipperCity.value.length == 0)
		{
			incorrect[no]="10";
			no++;
		}
		if(document.frmRequest.txtShipperPhoneAreaCode.value.length == 0 || document.frmRequest.txtShipperPhoneNumber.value.length == 0)
		{
			incorrect[no]="12";
			no++;
		}
		if(document.frmRequest.txtConsigneeCity.value.length == 0)
		{
			incorrect[no]="13";
			no++;
		}
		if(document.frmRequest.txtConsigneePhoneArea.value.length == 0 || document.frmRequest.txtConsigneePhoneNumber.value.length == 0)
		{
			incorrect[no]="15";
			no++;
		}
		if(document.frmRequest.verify_code.value.length == 0)
		{
			incorrect[no]="16";
			no++;
		}
		if(no > 0) 
		{
			
		   document.getElementById("errors").innerHTML = "<span>There was an error. Please fill in the neccessary fields.</span>";
		   
			for(i=1;i<17;i++) {
				   document.getElementById(i).style.color="#000000";
			}
			
			for(j=0;j<no;j++) {
					
				   document.getElementById(incorrect[j]).style.color="#FF0000";
				   
			 }
			 
		   return false;
		}
		return true;
}
function numbersonly(e){
	var unicode=e.charCode? e.charCode : e.keyCode
	if (unicode!=8){ //if the key isn't the backspace key (which we should allow)
	if (unicode<48||unicode>57) //if not a number
	return false //disable key press
	}
}