function validateIns(f){
	
	var hostPrefix = window.location.host == 'quotecarinsurance' ? 'http://quotecarinsurance/' : 'http://' + window.location.host + '/';
	var srcid = 'landingpage1';

	if(f.srcid.value != ''){
		srcid = f.srcid.value;
	}

	if(srcid == 'get-quotes-results800'){
		if(f.statecode.value == ''){
			alert('Please select a state.');
			return false;
		}
	}

	if(srcid != 'landingpage1' && srcid != 'get-quotes-results800'){
		if(f.zipcode.value == ''){
			if(srcid == 'landingpage2' || srcid == 'landingpage8002' || srcid == 'landingpage8003'){
				alert('Please select a state.');
			} else {
				alert('Please enter your zipcode.');
			}
			f.zipcode.focus();
			return false;
		} else if(!validZIP(f.zipcode.value)){
			alert('Please enter valid 5-digits zipcode.');
			f.zipcode.focus();
			return false;
		} else if (!existingZIP(f.zipcode.value)) {
			alert('This zipcode does not exist.');
			f.zipcode.focus();
			return false;
		}
	}

	if(srcid == 'auto' || srcid == 'landingpage8002' || srcid == 'landingpage2' || srcid == 'landingpage')
	{
		tgUrl = hostPrefix + 'autoinsurancequotes.php';
		_url = tgUrl + '?zipcode=' + f.zipcode.value + '&ni_var1=' + f.ni_var1.value;
		document.location = _url;				
		return false;
	}
	else if(srcid == 'landingpage1')
	{
		var str = f.zipcode.value;
		state = str.split("#");
		tgUrl = hostPrefix + 'Cheap-' + state[1] + "-Car-Insurance.php";
		document.location = tgUrl;
		return false;
	}
	
	else if(srcid == 'landingpage8003')
	{
		var client = '';

		if(f.quoteType.value == 'home'){
			client = '173909';
		} else if(f.quoteType.value == 'life'){
			client = '161283';
		} else if(f.quoteType.value == 'health'){
			client = '2436';
		} else {
			//client = '176295';	// by default -> auto
			client = '197650';
		}

		tgUrl = hostPrefix + 'get-quotes8003.php';
		_url = tgUrl + '?zip=' + f.zipcode.value + '&a=38402&c=' + f.ni_var1.value + '&t=396&client=' + client;
		document.location = _url;
		return false;
	}
	else if(srcid == 'get-quotes-results800')
	{
		//tgUrl = hostPrefix + 'get-quotes.php';
		tgUrl = hostPrefix + 'get-quotes-results800.php';
		_url = tgUrl + '?statecode=' + f.statecode.value + '&a=38402&c=' + f.ni_var1.value + '&t=396';
		document.location = _url;
		return false;
	}
}




function validateGetAutoInsurance(f)
{	
	var hostPrefix = window.location.host == 'quotecarinsurance' ? 'http://quotecarinsurance/' : 'http://' + window.location.host + '/';
	if(f.zipcode.value == '')
	{
		alert('Please enter your zipcode.');
		f.zipcode.focus();
		
		return false;
	} 
	else if(!validZIP(f.zipcode.value))
	{
		alert('Please enter valid 5-digits zipcode.');
		f.zipcode.focus();
		
		return false;
	} 
	else if(!existingZIP(f.zipcode.value))
	{
		alert('This zipcode does not exist.');
		f.zipcode.focus();
		
		return false;
	}
	
	
	var zipcode = f.zipcode.value;
	ni_var1 = f.ni_var1.value;		
	document.location = hostPrefix + 'autoinsurancequotes.php?zip=' + zipcode + '&ni_var1=' + ni_var1;	
	return false;
}
