// JavaScript Document

// Load Content Via POST

	function loadContent(div, url, id) {
	  
	  new Ajax.Updater(div, url, {method: 'post', postBody:'content='+ id +''});
	}
	
// Load Content Via POST with Action

	function loadContent(div, url, action, id) {
	  
	  new Ajax.Updater(div, url, {method: 'post', postBody:''+action+'='+ id +''});
	}
	
	function postContent(div, url, id) {
	  
	  new Ajax.Updater(div, url, {method: 'post', postBody:'content='+ id +''});
	}
	


// Update Search Results via AJAX //

	function refineContent(url, searchby, where, pricemin, pricemax, bedsmin) {
		
	function startLoading() {
	 Effect.ScrollTo('container-top');
	 Element.show('dx_refine_updating');
	}
	function finishLoading() {
	 setTimeout("Effect.toggle('dx_refine_updating');", 1000);
	}

	  startLoading();
	  new Ajax.Updater('dx_where', '../../../../../../../../../../components/com_properties/dx.ajax-searchbox.php', {method: 'post', postBody:''+'ajax=1&where='+ where +'&searchby=' + searchby + ''});
	  new Ajax.Updater('dx_props_avail', '../../../../../../../../../../components/com_properties/dx.ajax-areaavail.php', {method: 'post', postBody:''+'ajax=1&where='+ where +'&searchby=' + searchby + ''});
	  new Ajax.Updater('dx_refine_h1', '../../../../../../../../../../components/com_properties/dx.ajax-h1.php', 
					   {method: 'post', postBody:''+'ajax=1&where='+ where +'&searchby=' + searchby + '&pricemin=' + pricemin + '&pricemax=' + pricemax + '&bedsmin=' + bedsmin});
	  
	  new Ajax.Updater('dx_refine_right', '../../../../../../../../../../modules/mod_refinesearch/dx.refinesearch.php', 
					   {method: 'post', postBody:''+'ajax=1&where='+ where +'&searchby=' + searchby + '&pricemin=' + pricemin + '&pricemax=' + pricemax + '&bedsmin=' + bedsmin});
	  
	  new Ajax.Updater('dx_refine_results', '../../../../../../../../../../components/com_properties/dx.results-'+searchby+'.php', 
					   {method: 'post', postBody:''+'ajax=1&where='+ where +'&searchby=' + searchby + '&pricemin=' + pricemin + '&pricemax=' + pricemax + '&bedsmin=' + bedsmin});
	  
	  new Ajax.Updater('dx_search_menu', '../../../../../../../../../../components/com_properties/dx.ajax-searchmenu.php', 
					   {method: 'post', postBody:''+'ajax=1&where='+ where +'&searchby=' + searchby + '&pricemin=' + pricemin + '&pricemax=' + pricemax + '&bedsmin=' + bedsmin});
	  
	  
	  
	  finishLoading();
	}
	
// Update Search Results via AJAX //

	function thankYou() {
		
	function startLoading() {
	 Element.show('dx_thank_you');
	}
	function finishLoading() {
	 setTimeout("Effect.toggle('dx_thank_you');", 2000);
	}

	 finishLoading();
	}
	

	
	
// Load Content Via GET

	function getContent(div, url, id) {
	  
	  new Ajax.Updater(div, url, {method: 'get', postBody:'content='+ id +''});
	}
	
// Load Content Via POST
	function postContent(div, url, id) {
	  
	  new Ajax.Updater(div, url, {method: 'post', postBody:'content='+ id +''});
	}


function SwitchDiv(Switch,SwitchID)
	{
		if (Switch=='On')
		{
			document.getElementById(''+SwitchID).style.display = '';
			 
			
			
		
		}
		else
		{
			document.getElementById(''+SwitchID).style.display = 'none';
		}
		
	}

// To Open Google Maps on Results Lists ??

function SwitchHeight(Switch,SwitchID)
	{
		if (Switch=='On')
		{
			document.getElementById(''+SwitchID).style.height = '324px';
			 
			
			
		
		}
		else
		{
			document.getElementById(''+SwitchID).style.height = '0px';
		}
		
	}


// Check All TickBoxes ///

function CheckAll(FormAll)
{
count = document.formlist.elements.length;
    for (i=0; i < count; i++) 
	{
    if(document.formlist.elements[i].checked == 1)
    	{document.formlist.elements[i].checked = 0; }
    else {document.formlist.elements[i].checked = 1;}
	}
}
	
	
// Close all pop ups on full details ///

function CloseElements()
{
	
	document.getElementById('dx_epc').style.display = 'none';
	document.getElementById('dx_floorplan').style.display = 'none';
	document.getElementById('dx_form_enquire').style.display = 'none';
	document.getElementById('dx_form_call').style.display = 'none';
	document.getElementById('dx_form_friend').style.display = 'none';
	
	

}
	
function CloseButtons()
{
	
	document.getElementById('BtnEPC1').style.display = 'none';
	document.getElementById('BtnPlan1').style.display = 'none';
	
	document.getElementById('BtnEPC0').style.display = '';
	document.getElementById('BtnPlan0').style.display = '';
	
}

// Print Pop Up ///

function PrintPop(pageref,win_name) {
	var remote = window.open(pageref,win_name,"width=850,height=550,left=10,top=10,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no");	
	if (remote.opener == null) remote.opener = window; 
	remote.opener.name = "parent_window";
	
}



// Print Button ///

function PrintThis()
{
	
	document.getElementById('PrintThis').style.display = 'none';
	window.print();
	
	

}