// JavaScript Document



	function sendToBothCrms()

	{

		if(!validateForm("WEB2LEAD2"))

		{

			return false;

		}



		crmSite1 = "http://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" ;

		//"http://localhost/eskra/printpost.php";

		//"http://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8";

		if(document.WEB2LEAD2.SELECTWorkFlow == null){

			crmSite2 = "http://217.172.132.147/crm/eware.dll/SubmitLead?RuleID=";

			//"http://83.100.191.153/crm/eware.dll/SubmitLead?RuleID=";

		}

		else	{

			crmSite2 = "http://217.172.132.147/crm/eware.dll/SubmitLead?RuleID=" + document.WEB2LEAD.SELECTWorkFlow.options[document.WEB2LEAD.SELECTWorkFlow.selectedIndex].value;

			//"http://83.100.191.153/crm/eware.dll/SubmitLead?RuleID=" + document.WEB2LEAD.SELECTWorkFlow.options[document.WEB2LEAD.SELECTWorkFlow.selectedIndex].value;

		}



		document.getElementById('salutation').value = document.getElementById('lead_personsalutation').value;

		document.getElementById('first_name').value = document.getElementById('lead_personfirstname').value;

		document.getElementById('last_name').value = document.getElementById('lead_personlastname').value;

		document.getElementById('company').value = document.getElementById('lead_companyname').value;

		document.getElementById('email').value = document.getElementById('lead_personemail').value;

		document.getElementById('phone').value = document.getElementById('lead_personphonenumber').value;

		document.getElementById('street').value = document.getElementById('lead_companyaddress1').value +","+document.getElementById('lead_companyaddress2').value+","+document.getElementById('lead_companycity').value+","+document.getElementById('lead_companystate').value;

		document.getElementById('country').value = document.getElementById('lead_companycountry').options[document.getElementById('lead_companycountry').selectedIndex].innerText;

		document.getElementById('00N20000000iJEs').value = getRegion(document.getElementById('lead_secterr').value);

		document.getElementById('00N20000000iJEt').value = document.getElementById('lead_country_service').options[document.getElementById('lead_country_service').selectedIndex].innerText;

		document.getElementById('00N20000000iH8Z').value = document.getElementById('lead_product').options[document.getElementById('lead_product').selectedIndex].innerText;

		document.getElementById('00N20000000iJEu').value = document.getElementById('lead_dowloadspeed').options[document.getElementById('lead_dowloadspeed').selectedIndex].innerText;

		document.getElementById('00N20000000iJEv').value = document.getElementById('lead_uploadspeed').options[document.getElementById('lead_uploadspeed').selectedIndex].innerText;

		document.getElementById('00N20000000iH8K').value = document.getElementById('lead_usage_type').options[document.getElementById('lead_usage_type').selectedIndex].innerText;

		document.WEB2LEAD1.description.value = document.getElementById('lead_details').value;



		// Please let these below lines be commented. They may be needed to cross tally.

		//alert(document.getElementById('salutation').value);

		//alert(document.getElementById('first_name').value);

		//alert(document.getElementById('last_name').value);

		//alert(document.getElementById('company').value);

		//alert(document.getElementById('email').value);

		//alert(document.getElementById('phone').value);

		//alert(document.getElementById('street').value);

		//alert(document.getElementById('country').value);

		//alert(document.getElementById('00N20000000iJEs').value);

		//alert(document.getElementById('00N20000000iJEt').value);

		//alert(document.getElementById('00N20000000iH8Z').value);

		//alert(document.getElementById('00N20000000iJEu').value);

		//alert(document.getElementById('00N20000000iJEv').value);

		//alert(document.getElementById('00N20000000iH8K').value);

		//alert(document.WEB2LEAD1.description.value);

		//alert(document.getElementById('oid').value);

		//alert(document.getElementById('retURL').value);



		// Process data submit to first CRM

		document.WEB2LEAD1.action = crmSite1;

		document.WEB2LEAD1.target = 'hidden_IFRAME1';

		// document.WEB2LEAD1.submit();



		// Process data submit to second CRM

		document.WEB2LEAD2.action = crmSite2;

		document.WEB2LEAD2.target = 'hidden_IFRAME2';

		document.WEB2LEAD2.submit();

		

		window.setTimeout("sendToThanksPage()",10000);

	}

	

	function sendToThanksPage()

	{

		window.location.href = "http://www.linksystems-uk.com/thankyou.htm";

	}

	

	function getRegion(parRegionName)

	{

		if(parRegionName == '-2147483640'){	return 'Worldwide' ; }

		if(parRegionName == '1207959544') { return 'EMEA' ; }

		if(parRegionName == '1207959545') { return 'North Africa' ; }

		if(parRegionName == '1216348152') { return 'East Africa' ; }

		if(parRegionName == '1224736759') { return 'West Africa' ; }

		if(parRegionName == '1233125366') { return 'South Africa' ; }

		if(parRegionName == '1249902580') { return 'Europe' ; }

		if(parRegionName == '1258291187') { return 'Middle East' ; }

		if(parRegionName == '1342177271') { return 'Asia-America' ; }

		if(parRegionName == '1342177272') { return 'Central Asia' ; }

		if(parRegionName == '1350565879') { return 'South Asia' ; }

		if(parRegionName == '1358954486') { return 'East Asia' ; }

		if(parRegionName == '1367343093') { return 'North America' ; }

		if(parRegionName == '1375731700') { return 'Central America' ; }

		if(parRegionName == '1384120307') { return 'South America' ; }

		if(parRegionName == '1392508914') { return 'Caribbean' ; }

		if(parRegionName == '1400897521') { return 'Australia' ; }

	}

	

	function validateForm(prm_frm)

	{

		frm = document.getElementById(prm_frm);

		//

		// Check the first name field to see if any characters were entered

		//

		if (frm.lead_personfirstname.value.length == 0)

		{

			alert("Please enter your first name.");

			frm.lead_personfirstname.focus();

			return false;

		}

			//

		//

		// Check the last name field to see if any characters were entered

		//

		if (frm.lead_personlastname.value.length == 0)

		{

			alert("Please enter your last name.");

			frm.lead_personlastname.focus();

			return false;

		}



		//

		// Check the Company name field to see if any characters were entered

		//

		if (frm.lead_companyname.value.length == 0)

		{

			alert("Please enter your Company name.");

			frm.lead_companyname.focus();

			return false;

		}



		// Check the Email field to see if any characters were entered

		//

		if (frm.lead_personemail.value.length == 0)

		{

			alert("Please enter an e-mail address.");

			frm.lead_personemail.focus();

			return false;

		}

		//

		// Now check the Email field for the "@" symbol

		//

		if (frm.lead_personemail.value.indexOf("@") == -1)

		{

			alert("Please enter a valid e-mail address.");

			frm.lead_personemail.focus();

			return false;

		}



		//

		// Check the phone field to see if any characters were entered

		//

		if (frm.lead_personphonenumber.value.length == 0)

		{

			alert("Please enter your phone number.");

			frm.lead_personphonenumber.focus();

			return false;

		}



		//

		// Check the Country field to see if none is selected

		//

		if (frm.lead_companycountry.value.length == 0)

		{

			alert("Please select your country.");

			frm.lead_companycountry.focus();

			return false;

		}



		//

		// Check the Country of Service field to see if none is selected

		//

		if (frm.lead_country_service.value.length == 0)

		{

			alert("Please select your country of service.");

			frm.lead_country_service.focus();

			return false;

		}



		//

		// Now check the Region field not to be empty

		//

		if (frm.lead_secterr.value.length == 0)

		{

			alert("Please Select a valid Region for your service.");

			frm.lead_secterr.focus();

			return false;

		}



		//

		// Now check the Product field not to be empty

		//

		if (frm.lead_product.value.length == 0)

		{

			alert("Please Select a valid Product.");

			frm.lead_product.focus();

			return false;

		}

		return true;

	}