		$(document).ready(function(){
	
		$("#regionBoxLeft a").hover(function() {
		$(this).next("em").animate({opacity: "show", top: "-75"}, "slow");
	}, function() {
		$(this).next("em").animate({opacity: "hide", top: "-85"}, "fast");
	});
		
		//set max height
		//$('#my-dropdownCountries').sSelect({ddMaxHeight: '300px'});
		//$('#type').sSelect({ddMaxHeight: '300px'});
		//$('#budget').sSelect({ddMaxHeight: '300px'});
		//$('#city').sSelect({ddMaxHeight: '300px'});
		//$('#bedroom').sSelect({ddMaxHeight: '300px'});

		//set value on click
		$('#search').submit(function(){
			$('#budget').getSetSSValue('Sit');
			//alert('The value is: '+$('#budget').getSetSSValue());
		});

		//get value on click
		$('#getVal').click(function(){
			//alert('The value is: '+$('#my-dropdown5').getSetSSValue());
		});

		


		//alert change event
		//$('#type').sSelect().change(function(){
		//	 alert('The value is: '+$('#type').getSetSSValue());											 
		//});

		//add options to select and update
		$('#addOptions').click(function(){
			$('#my-dropdown6').append('<option value="newOpt">New Option</option>').resetSS();
		});
		
	});	
	function Display_Load()
	{
	    $("#loading").fadeIn(900,0);
		$("#loading").html("<img src='"+str_SITE_URL+"images/ajax-loader.gif' />");
			}
	//Hide Loading Image
	function Hide_Load()
	{
		$("#loading").fadeOut('slow');
	};
	
	function show(modeval) {			
			var dataString="mode="+modeval;
		
	  Display_Load();
	  //alert(dataString);
	 $.ajax({
		   type: "POST",
		   url: document.getElementById('site_url').value+"ajax/propertMode.php",
		   data: dataString,
		   cache: false,
		   error: function(){
				alert('Error loading XML document');
			},

   		   success: function(msg){
     			//alert(msg);	
	 		$('.newListSelected').hide();
		
			var msgs=msg.split('~~');

			 $('#budget').html(msgs[3]).sSelect({ddMaxHeight: '300px'});
			 $('#type').html(msgs[0]).sSelect({ddMaxHeight: '300px'});
			 $('#city').html(msgs[1]).sSelect({ddMaxHeight: '300px'});
			 $('#bedroom').html(msgs[2]).sSelect({ddMaxHeight: '300px'});
			 Hide_Load();
  		   }
 	 });
		
	};
	function propertyChange(modeval) {	
	
			var dataString="mode="+modeval;
			//alert(dataString);
			
			$.ajax({
		   type: "POST",
		   url: document.getElementById('site_url').value+"ajax/roomChange.php",
		   data: dataString,
		   cache: false,
		   error: function(){
				alert('Error loading XML document');
			},

   		   success: function(msg){
     			//alert(msg);	
	var msgs=msg.split("~~~~");
	//alert(msgs[0]);
	//alert(msgs[1]);
	if(modeval=='C'){			
			
			
			$("#residentialFeature").fadeOut('slow');
			$("#commercialFeature").fadeIn('slow');
			
		}
		if(modeval=='R'){		
			$("#commercialFeature").fadeOut('slow');
			$("#residentialFeature").fadeIn('slow');
			
			
		}
			// document.getElementById('selectproperty_type').innerHTML=' Select';
			document.getElementById("bedroom_reg1").innerHTML='<select name="bedroom_reg" id="bedroom_reg" rel="5" class="styled-text">'+msgs[0]+'</select>';	
			document.getElementById("bathroom_reg1").innerHTML='<select name="bathroom_reg" id="bathroom_reg" rel="6" class="styled-text">'+msgs[0]+'</select>';	
			document.getElementById("washroom_reg1").innerHTML=msgs[1];	

  		   }
 	 });
			
			
			
			
			
			
			
			
		
		
	  //alert(dataString);
	 $.ajax({
		   type: "POST",
		   url: document.getElementById('site_url').value+"ajax/propertType.php",
		   data: dataString,
		   cache: false,
		   error: function(){
				alert('Error loading XML document');
			},

   		   success: function(msg){
     		//	alert(msg);	
	
			// document.getElementById('selectproperty_type').innerHTML=' Select';
			 $('#property_type_reg').html(msg);		

  		   }
 	 });
		
	};
	
	function areaChangeCity() {		
			//var modeval=$('#city :selected').text();
			//var dataString="mode="+modeval;
				
	 // alert('dataString');
	 $.ajax({
		   type: "POST",
		   url: "ajax/propertType.php",
		   data: dataString,
		   cache: false,
		   error: function(){
				alert('Error loading XML document');
			},

   		   success: function(msg){
     		//	alert(msg);	
	
			 document.getElementById('selectproperty_type').innerHTML=' Select';
			 $('#property_type').html(msg);		

  		   }
 	 });
		
	};
	
	function  priceall(){
		var crores=0;
		var lacs=0;
		var thousands=0;
		if($('#crores').val()!=''){
		 crores=(10000000*$('#crores').val());
		}
		if($('#lacs').val()!=''){
		 lacs=(100000*$('#lacs').val());
		}
		if($('#thousands').val()!=''){
		 thousands=(1000*$('#thousands').val());
		}
		var price_all=crores+lacs+thousands;
		$('#price_all').val(price_all);
	}
	
	function Display_Load()
	{
	    $("#loading_aj").fadeIn(900,0);
		$("#loading_aj").html('<img src="'+str_SITE_URL+'images/ajax-loader.gif" />');
			}
	//Hide Loading Image
	function Hide_Load()
	{
		$("#loading_aj").fadeOut('slow');
	};
	
	function editProfile(id,type){
	//alert(id);	
	//alert(type);	
	if(document.getElementById('editProfileContain').style.display=='block'){
		$("#editProfileContain").slideUp('slow');
	}else{
		$("#editProfileContain").slideDown('slow');
		Display_Load();
		$("#editProfile").load(document.getElementById('site_url').value+'ajax/edit_profile.php',Hide_Load);
	}
	if(document.getElementById('editPasswordContain').style.display=='block'){
		$("#editPasswordContain").slideUp('slow');
	}
}
function editProfileClose(){
	$("#editProfileContain").slideUp('slow');
}
function editPassword(id,type){
	Display_Load();
	if(document.getElementById('editPasswordContain').style.display=='block'){
		$("#editPasswordContain").slideUp('slow');
	}else{
		$("#editPasswordContain").slideDown('slow');	
		$("#editPassword").load('ajax/edit_password.php',Hide_Load());
	}
	if(document.getElementById('editProfileContain').style.display=='block'){
		$("#editProfileContain").slideUp('slow');
	}
}
function editPasswordClose(){
	$("#editPasswordContain").slideUp('slow');
}



function upload_property_pic(id){
	Display_Load();
	if(document.getElementById('up_pic_load').style.display=='block'){
		$("#up_pic_load").slideUp('slow');
		$("#property_id").val(id);
	}else{
		$("#up_pic_load").slideDown('slow');
		$("#property_id").val();
		$("#image_box").load('ajax/picture_property.php?property_id='+id,Hide_Load());
	}
	
}
function upload_property_pic_Close(){
	$("#up_pic_load").slideUp('slow');
}
