// JavaScript Document

function reload(form){
	if (form.country_id.value!='') {
		var country_id=form.country_id.options[form.country_id.options.selectedIndex].value; 
		var type_id=form.type_id.options[form.type_id.options.selectedIndex].value; 
		var pricefrom = form.pricefrom.value;
		var priceto = form.priceto.value;
		var url = '?act=search&country_id=' + country_id + '&type_id=' + type_id + '&pricefrom=' + pricefrom + '&priceto=' + priceto;

		var rentsaleid = "undefined";
		for (var i=0; i < form.rentsaleid.length; i++) {
		   if (form.rentsaleid[i].checked) {
			  rentsaleid = form.rentsaleid[i].value;
		   }
		}
		if (rentsaleid != "undefined") {
			url =  url + '&rentsaleid=' + rentsaleid;
		}
		
		self.location=url;
	}
}

function reload2(form){
	if (form.country_id.value!='') {
		var country_id=form.country_id.options[form.country_id.options.selectedIndex].value; 
		var type_id=form.type_id.options[form.type_id.options.selectedIndex].value; 
		var pricefrom = form.pricefrom.value;
		var priceto = form.priceto.value;
		var bedsfrom = form.bedsfrom.value;
		var bedsto = form.bedsto.value;
		var url = 'salerent.php?country_id=' + country_id + '&type_id=' + type_id + '&pricefrom=' + pricefrom + '&priceto=' + priceto + '&bedsfrom=' + bedsfrom + '&bedsto=' + bedsto;

		
		for (var i=0; i < form.rentsaleid.length; i++) {
		   if (form.rentsaleid[i].checked) {
			  var rentsaleid = form.rentsaleid[i].value;
		   }
		}
		if (rentsaleid!='undefined') {
			url =  url + '&rentsaleid=' + rentsaleid;
		}
		
		self.location=url;
	}
}

function redirect(form) {
	if (form.country_id.options[form.country_id.options.selectedIndex].value=='') {
		alert('Choose Country');
	} else {
		var country_id=form.country_id.options[form.country_id.options.selectedIndex].value;
		var url = '../../../redirect.php?country_id=' + country_id;
		self.location=url;
	}
}

function verify_country(form) {
	if (form.country_id.value=='') {
		alert('Choose Country First');
	}
}

function reload_edit(form){
	if (form.country_id.value!='') {
		var country_id=form.country_id.options[form.country_id.options.selectedIndex].value; 
		var id = form.id.value;
		var url = '?action=edit&country_id=' + country_id + '&id=' + id;
		
		self.location=url;
	}
}
function reload_add(form){
	if (form.country_id.value!='') {
		var country_id=form.country_id.options[form.country_id.options.selectedIndex].value; 
		var url = '?action=add&country_id=' + country_id;
		
		self.location=url;
	}
}


