function update_brand(value)
{
	var item_brand = _eid('item_brand');
	if( value.length > 0 )
		item_brand.value = 11;
}
function check_req_form(f)
{
	var f = _eid('item_fault_reported');
	var b = _eid('item_brand');
	var nb = _eid('new_brand');
	var im = _eid('item_model');
	var ef = _eid('entry_firstname');
	var el = _eid('entry_lastname');
	var cea = _eid('customers_email_address');
	var cac = _eid('customers_email_confirm');
	var ct = _eid('customers_telephone');
	
	if( f.value.length < 1)
	{
		alert('Please enter the description of your problem.');
		f.focus();
		return false;
	}
	if( b.value.length < 1 && nb.value.length < 1)
	{
		alert('Laptop brand not selected.');
		b.focus();
		return false;
	}
	if(im.value.length < 1)
	{
		alert('Laptop model not entered.');
		im.focus();
		return false;
	}
	if(ef.value.length < 1)
	{
		alert('First name not entered.');
		ef.focus();
		return false;
	}
	if(el.value.length < 1)
	{
		alert('Last name not entered.');
		el.focus();
		return false;
	}
	if(cea.value.length < 1)
	{
		alert('E-Mail address not entered.');
		cea.focus();
		return false;
	}
	if(cac.value.length < 1)
	{
		alert('E-Mail address not re-entered.');
		cac.focus();
		return false;
	}
	if(!Validate_Email(cea.value))
	{
		  var strError ="";
		  
		  strError += "You did not enter a valid email address.";
		  
		  alert(strError);
		  
		  return false;
	}	
	if(cea.value != cac.value)
	{
		alert('E-Mail address entries do not match.');
		cac.focus();
		return false;
	}
	if(ct.value.length < 1)
	{
		alert('Primary telephone number not entered.');
		ct.focus();
		return false;
	}
	if(!Validate_Phone(ct.value))
	{
		 var strError = "";
		 
		strError += "Primary telephone must be in one of these formats:\n";
		strError += "Local: (222) 333-4444, 222-333-4444, 222.333.4444\n";
		strError += "International: +111 222 333 4444, +111-222-333-4444, +111.222.333.4444\n";
		strError += "With extension: (222)333-4444 x1234, +111.222.333.4444 x1234\n";
		strError += "You may use a space, dash, or period to separate country code, area code, exchange, and line number.\n"
		strError += "Extensions can be given with x1234 or ext1234";
		alert(strError);
		ct.focus();
		return false;
	}
}
function Validate_Phone(strPhone){
     
     //regular expression for phone number validation
     //Accepts numbers of the format:
     //        222 333 4444
     //        (222) 333 4444
     //        222-333-4444
     //        222.333.4444
     //        +111 222.333.4444
     //        222 333 4444 x1234
     //        222 333 4444 ext1234
	 var phoneRe = /^(\+\d{1,3}[-. ])?\(?([2-9]\d{2})\)?[-. ]?(\d{3})[-. ]?(\d{4})([-. ]?(x|ext)\d{1,5})?$/;
     //var phoneRe = /^(\+\d{1,3}[-])?\(?([2-9]\d{2})\)?[-]?(\d{3})[-]?(\d{4})([-]?(x|ext)\d{1,5})?$/;
     //////////////////////////////////////////////////////////////////////////////////////////////////
     return phoneRe.test(strPhone);
    
}
function Validate_Email(strEmail){

  var emailFilter=/^.+@.+\..{2,3}$/;

  return emailFilter.test(strEmail);

}