// JavaScript Document

var url = 'http://www.caribbean-unpackaged.com/';
function villaSearch(){
	var frm = window.document.frmSearch;
	var timestamp = new Date();
	
	var strURL = url+'villa_search_results.php?time=' + timestamp.getTime()+'&noBeds='+frm.noBeds.value;
	showloading();
	//alert(strURL);
	new xmlhttpPost(strURL,'villaSearch'); 
	return false;
}
function villaSearch_bkp(){
	var frm = window.document.frmSearch;
	var timestamp = new Date();
	
	var strURL = url+'villa_search_results.php?time=' + timestamp.getTime()+'&noBeds='+frm.noBeds.value+'&priceFrom='+frm.priceFrom.value+'&priceTo='+frm.priceTo.value+'&months='+frm.months.value;
	showloading();
	//alert(strURL);
	new xmlhttpPost(strURL,'villaSearch'); 
	return false;
}
function villaSearchRsp(){
	hideloading();
	document.getElementById('searchResults').innerHTML = temp;
	addTableRolloverEffect('tbl_results','highlightOverColor','highlightClickColor');
	return;
}

function shortList(id,action){
	showloading();
	prop_id =id;
	act = action;
	var timestamp = new Date();
	var strURL = url+'process-shortlist.php?time=' + timestamp.getTime() + '&action=' + action + '&prop_id='+id;
	new xmlhttpPost(strURL,'villaList');
}
function shortListRsp(){
	hideloading();
	document.getElementById('dLoad').innerHTML =temp;

	if(act=='add')
		window.opener.shortListView();
	document.getElementById('prop_'+prop_id).style.display='none'; 
}
function addShortList(id){
	showloading('dLoad_'+id);
	prop_id =id;
	var timestamp = new Date();
	var strURL = url+'process-shortlist.php?time=' + timestamp.getTime() + '&action=add&prop_id='+id;
	new xmlhttpPost(strURL,'addVillaList');
}
function addShortList2(id){
	showloading('dLoad_'+id);
	prop_id =id;
	var timestamp = new Date();
	var strURL = url+'process-shortlist.php?time=' + timestamp.getTime() + '&action=add&prop_id='+id;
	new xmlhttpPost(strURL,'addVillaList2');
}
function addShortListRsp(){
	
	hideloading('dLoad_'+prop_id);
	document.getElementById('dLoad_'+prop_id).innerHTML =temp + ' <a href="'+url+'shortlist/">View Shortlist</a>';
}
function addShortListRsp2(){
	
	hideloading('dLoad_'+prop_id);
	document.getElementById('dLoad_'+prop_id).innerHTML =temp;
	document.location='/shortlist/';
}
function shortListView(){
	showloading();
	var timestamp = new Date();
	var strURL = url+'villa_short_list.php?time=' + timestamp.getTime();
	new xmlhttpPost(strURL,'villaListView');
}
function shortListViewRsp(){
	hideloading();
	
	document.getElementById('dslist').innerHTML =temp;
	addTableRolloverEffect('tbl_results','highlightOverColor','highlightClickColor');
}

 

function showloading(div){
	//alert(div);
	if (div == undefined){
	   	div = 'dLoad';
 	}
	var msg = '<table width="200" height="17" border="0" cellpadding="0" cellspacing="0"><tr><td width="24"><img src="'+url+'images/loading.gif" width="16" height="20" /></td>                                  <td width="203" align="left" valign="middle" class="red">Please wait loading....</td> </tr></table>';	
	document.getElementById(div).innerHTML = msg ;	
}

function hideloading(div){
	if (div == undefined){
	   	div = 'dLoad';
 	}
	document.getElementById(div).innerHTML = '&nbsp;' ;
}