function AutoFrame(provider, zipcode, ni_var1, state)
{
	provider = provider.toLowerCase();
	var suffix = '';
	var params = '';
	
	if (zipcode.length > 0) {
		$.ajax({
		   type: "POST",
		   url: "/getStateByZip.php",
		   data: "zipcode=" + zipcode,
		   async:false,
		   success: function(msg){
		     state = msg;
		   }
		 });	
	}	
	
	switch(provider) {
		case 'moto':
			suffix = 'Instant_' + state + '_Motorcycle_Insurance_Quotes.php';
		break;
		case 'moss':
			suffix = 'autoinsurance_v1/index.php';
			params = '?zip='+zipcode+'&a=38402&campid='+ni_var1;
		break;
		default:
		case 'surehits':
			suffix = 'Instant_' + state + '_Car_Insurance_Quotes.php';
		break;
	}
	
	tgUrl = window.domainName+suffix;	
	doc_loc = tgUrl + params;
	
	$.ajax({
	   type: "GET",
	   url: '/savestat.php',
	   data: "tgUrl=" + escape(tgUrl) + '&Nivar=' + ni_var1,
	   success: function(msg){
	     document.location = doc_loc;
		 return false;
	   }
	 });	
}
