
sendRequest = function(url,params,hf,ef){
	
new Ajax.Request(
	url,
	{
		method: 'post',
		parameters: params,
		onSuccess: hf,
		onFailure: ef
		});
}

sendUpdateRequest = function(container,url,params,hf,ef){
new Ajax.Updater(
			container,url,
			{
				method: 'post',
				parameters: params,
				onSuccess: hf,
				onFailure: ef
			});
}



updateCountries = function(countryid){
	var dealid = $("deal_id").options[$("deal_id").selectedIndex].value;
var param = "deal_id="+dealid;
if(countryid>0) param+="&country_id="+countryid;
//alert(param);
var url = root + '/ajax/ajax.updateCountries.php';
var container = "country_id";
newAjax = sendUpdateRequest(container,url,param,updateCHandler,updateCError); 

}

updateCHandler = function(t){
	//alert(t.responseText);
	//$("country_id").innerHTML = t.responseText;
}

updateCError = function(){
	
}



updatePageLink = function(){
	var dealid = $("deal_id").options[$("deal_id").selectedIndex].value;
	var countryid = $("country_id").options[$("country_id").selectedIndex].value;
	var param = "deal_id="+dealid+"&country_id="+countryid;
	var url = root + '/ajax/ajax.updatePageLink.php';
	newAjax = sendRequest(url,param,updatePLHandler,updatePLError);
	
	
}

updatePLHandler = function(t){
	//console.log(t.responseText);
	$("searchform").action = t.responseText;
}

updatePLError = function(){
	
}




updateResearchPageLink = function(){
	var pageid = 4;
	var countryid = $("country_id").options[$("country_id").selectedIndex].value;
	var param = "page_id="+pageid+"&country_id="+countryid;
	var url = root + '/ajax/ajax.updateResearchPageLink.php';
	newAjax = sendRequest(url,param,updateRPLHandler,updateRPLError);
	
	
}

updateRPLHandler = function(t){
	//console.log(t.responseText);
	$("searchform").action = t.responseText;
}

updateRPLError = function(){
	
}

