// JavaScript Document


function SearchSwitch(type) {

	if(type=='sales') {
		
	Effect.Fade('formlettings', {duration:0.2});
	Effect.Appear('formsales', {duration:0.2, delay:0.2});
	
	} else { 
	
	Effect.Fade('formsales', {duration:0.2});
	Effect.Appear('formlettings', {duration:0.2, delay:0.2});
	}
	
}

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 = '327px';
			 
			
			
		
		}
		else
		{
			document.getElementById(''+SwitchID).style.height = '0px';
		}
		
	}

// Update Search Results via AJAX //

	function RefineResults(dx_searchtype, dx_min, dx_max, dx_beds, dx_type, dx_area, dx_display) {
		
	function startLoading() {
	 Effect.ScrollTo('shadow');
	 Element.hide('left-inner');
	 Element.show('refine-updating');
	}
	function finishLoading() {
	 Effect.Fade('refine-updating', { duration: 0.5, delay:1.5 });
	}

	  startLoading();
	  new Ajax.Updater('results', '../../../../../../../../../../components/com_properties/dx.properties-results-' + dx_display + '.php', {
					   method: 'post', postBody:''+'dx_inc=1&dx_ajax=1&dx_searchtype='+ dx_searchtype +'&dx_min=' + dx_min + '&dx_max=' + dx_max + '&dx_beds=' + dx_beds + '&dx_type=' + dx_type + '&dx_area=' + dx_area + '&display=' + dx_display 			}
					   
	);
	  
	  
	  finishLoading();
	}
	

function SwitchExtra(id) {
	
	Element.hide('map');
	Element.hide('floorplan');
	Element.hide('epc');
	Element.show(id);
	Effect.ScrollTo('detail-links');
	
	document.getElementById('link-map').className = '';
	document.getElementById('link-floorplan').className = '';
	document.getElementById('link-epc').className = '';
	
	document.getElementById('link-' + id).className = 'selected';
	
	
}


///////////////////////////// ENQUIRY FORM SWITCHES //////////////

	function SwitchEnq(Switch,SwitchID)
	{
		if (Switch=='On')
		{
			document.getElementById('FullOverlay').style.display = '';
			//Effect.Appear('FullOverlay', { duration:0.5});
			document.getElementById('div_enq_border').style.display = '';
			document.getElementById(SwitchID).style.display = '';
			Effect.ScrollTo('FullOverlay');
			
		
		}
		else
		{
			document.getElementById('FullOverlay').style.display = 'none';
			document.getElementById(SwitchID).style.display = 'none';
			document.getElementById('div_enq_border').style.display = 'none';
		}
		
	}

function ConvertCurrency(amount,id) {
new Ajax.Updater('conversion', '../../../../../../../../../../components/com_properties/dx.ajax-currency.php', {   method: 'post', postBody:''+'currency=' + id +'&amount=' + amount	});

}


/** Slideshow **/

var ii = 1; var wait = 4500;

function SlideShow(total, name) {

Effect.Fade((name+ii), { duration:0.5, from:1.0, to:0.0 }); 

ii++;
 if (ii == total+1) ii = 1; 


Effect.Appear((name+ii), { duration:0.5, from:0.0, to:1.0 });
 } 


function start_slides(total, name) {   setInterval('SlideShow('+total+', \''+name+'\')',wait); }
