// JavaScript Document


$(document).ready(function() {		
		
	//Execute the slideShow	
	$('.slideshow').cycle({
		fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	});
	
		//////////////////////////////////////////////////////////////////////////////
		
		$("ul.subnav").parent().append("<span></span>"); //Only shows drop down trigger when js is enabled (Adds empty span tag after ul.subnav*)  
  
    $("ul.topnav li span").mouseover(function() { //When trigger is clicked...  
  
        //Following events are applied to the subnav itself (moving subnav up and down)  
        $(this).parent().find("ul.subnav").slideDown('slow').show(); //Drop down the subnav on click  
  
        $(this).parent().hover(function() {  
        }, function(){  
            $(this).parent().find("ul.subnav").slideUp('fast'); //When the mouse hovers out of the subnav, move it back up  
        });  
  
        //Following events are applied to the trigger (Hover events for the trigger)  
        }).hover(function() {  
            $(this).addClass("subhover"); //On hover over, add class "subhover"  
        }, function(){  //On Hover Out  
            $(this).removeClass("subhover"); //On hover out, remove class "subhover"  
    });  
		
		
});

function selectforsell(chk)
{
	if($("input[@name='Add_Type']:checked").val()=="Rent")
	{
	if(chk=="Select")
	rangeforrent(30000,400000,10000);
	else if(chk=="Apartment")
	rangeforrent(30000,400000,10000);
	else if(chk=="Commercial")
	onclick=rangeforrent(50000,2000000,100000);
	else if(chk=="Land")
	onclick=rangeforrent(50000,2000000,100000);
	else if(chk=="Villa")
	rangeforrent(30000,800000,50000);
	}
}


function rangeforsell()
{
	gb_min=0.5;
	gb_max=20;
	
	$("#slider-range").slider('destroy');

	$("#slider-range").slider({
			range: true,
			min: gb_min,
			max: gb_max,
			values: [0, 20],
			slide: function(event, ui) {
				
				if(ui.values[1]==20)
				$("#amount").val('AED ' + ui.values[0] + ' m - AED ' + ui.values[1] +' m +');
				else
				$("#amount").val('AED ' + ui.values[0] + ' m - AED ' + ui.values[1] +' m ');
				
				$("#Price_Min").val(ui.values[0]);
				$("#Price_Max").val(ui.values[1]);
				
			}
		});
		$("#amount").val('AED ' + $("#slider-range").slider("values", 0) + ' m   -   AED ' + $("#slider-range").slider("values", 1)+' m +' );	
}

function rangeforrent(gb_min,gb_max,gb_step)
{


	$("#slider-range").slider('destroy');
	$("#slider-range").slider({
			range: true,
			min: gb_min,
			max: gb_max,
			step: gb_step,
			values: [gb_min, gb_max],
			slide: function(event, ui) {
	
				
				if(ui.values[1]==gb_max)
				$("#amount").val('AED ' + ui.values[0]  + ' - AED ' +  ui.values[1] + ' +');
				else
				$("#amount").val('AED ' + ui.values[0] + ' - AED ' + ui.values[1]);
				
				$("#Price_Min").val(ui.values[0]);
				$("#Price_Max").val(ui.values[1]);
				
			}
		});

								  
		$("#amount").val('AED ' + gb_min + ' -   AED '+ gb_max +' +' );
}


////////////////////////////// FOR MENU ////////////////////////////////

 
    
  
