
function changeTeamIdVet(ele) 
{
    var sub_team_id = document.getElementById("priority");
    var team_id = document.getElementById("team_id");

    if (ele.value == "us")
	{
	sub_team_id.value = 'US_Vetting';
	team_id.value = '3b06e792-9e3e-c833-b7c4-46669fd176c1';/*TM00004*/
	}
	else if (ele.value == "apac")
	{
	sub_team_id.value = 'APAC_Support';
	team_id.value = '3875a57a9-ba75-b504-a3b9-4a925821debd';  /*TM00005*/	
	}
    else 
	{
	sub_team_id.value = 'EMEA_Vetting';
	team_id.value = 'c17da0af-ba63-d078-d8d9-46539c916d71';/*TM00002*/
	}
}

function populateSubjectVet()
{
	var subject = document.getElementById("name");
	var common  = window.document.WebToCaseForm.common_name_c.value; 
	var order   = window.document.WebToCaseForm.order_number_c.value;

	if(common || order != '')
	{
	common = common;
	order  = order;
	subject.value = 'V ' +common+' '+order+' ';
	}
	else{subject.value = 'V ' +' '+ 'No Common Name or Order Name';}
}

function checkFormVet() 
{
	var ccountry, cemail, reg, address, product, common;
   	with(window.document.WebToCaseForm)
	{

	ccountry = country_c;
	cemail 	 = email_address_c;
   	reg      = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	address  = email_address_c.value;
	product  = product_type_c;
	common   = common_name_c;
	}


	if (trim(ccountry.value) == '1')
   		{
      		alert('Please select your location');
      		ccountry.focus();
		ccountry.style.color = "#ff0000";
		ccountry.style.border="1px solid #ff0000";
		ccountry.style.height="22px";
      		return false;
   		}
		else {
		ccountry.style.border="1px solid #7f9db9";
		ccountry.style.color = "#000000";
		}

	if (trim(cemail.value) == '') 
   		{
      		alert('Please enter a valid Email Address');
 		
		cemail.select();
		cemail.style.color = "#ff0000";
		cemail.style.height="17px";
		cemail.style.border="1px solid #ff0000";
      		return false;
   		}
		else {
		cemail.style.border="1px solid #7f9db9";
		cemail.style.color = "#000000";
		}
	
	if(reg.test(address) == false) 
		{
      		alert('Please enter a valid Email Address');
      		cemail.select();
		cemail.style.color = "#ff0000";
     
		cemail.style.height="17px";
		cemail.style.border="1px solid #ff0000";
      		return false;
		}
		else {
		cemail.style.border="1px solid #7f9db9";
		cemail.style.color = "#000000";
		}


	if(trim(product.value) == '1') 
		{   
		alert('Please select a Product Type');
      		product.focus();
		product.style.color = "#ff0000";
		product.style.border="1px solid #ff0000";
		product.style.height="22px";
      		return false;
		}
		else {
		product.style.border="1px solid #7f9db9";
		product.style.color = "#000000";
		}

	if(trim(common.value) == '')
		{
		alert('Please enter a Common Name');
      		common.select();
		common.style.color = "#ff0000";
		common.style.border="1px solid #ff0000";
		common.style.height="17px";
      		return false;
		}
	else if(trim(common.value) != '')
		{
		common.style.border="1px solid #7f9db9";
		common.style.color = "#000000";
		}


   else
   {
      cemail   = (cemail.value);
      ccountry = (ccountry.value);
      product  = (product.value);
      common   = (common.value);
      return true;
   }
		

}

	function trim(str)
		{
   		return str.replace(/^\s+|\s+$/g,'');
		}


