$(document).ready(function(){
	$('.sblockche').focus(function(){
		if($(this).val()==$(this).attr('id')){
			$(this).val('');
		}
	});
	$(".sblockche").bind("blur", function(){
		if($(this).val() == "") $(this).val(this.id);
	});
	
	$("#picsScrolling").cycle({
		fx: "fade"
	});
	/*
   $("#picsScrolling").cycle({
		fx:     'turnLeft',
		delay:  -4000
	});
	*/
	$("#searchRegion").bind("change", function(){
		var region_id = $(this).val();
		$("#citiesHolder2").empty();
		$.ajax({
			type: "post",
			url: "getCities.php",
			data: "region_id="+region_id,
			success: function(html){
				$("#citiesHolder2").empty();
				$("#citiesHolder2").append(html);
			}
		});
	});
	
	$("#sendToAFriend").bind("click", function(){
		if ($("#sendToAFriendFormContent").css("display") == "none"){
			$.ajax({
				type: "GET",
				url: "sendToAFriend.php",
				success: function(data){
					$("#sendToAFriendFormContent").empty();
					$("#sendToAFriendFormContent").append(data);
				}
			});
			$("#sendToAFriendFormContent").slideDown("fast");
		}else{
			$("#sendToAFriendFormContent").slideUp("fast");
		}
	});
	
	
	$("#showImages").bind("click", function(){
		$("#picturesRest").slideDown("slow");
		$(this).hide();
		$("#hideImages").show();
	});
	$("#hideImages").bind("click", function(){
		$("#picturesRest").slideUp("slow");
		$(this).hide();
		$("#showImages").show();
	});
	
	$("#showFloorplans").bind("click", function(){
		$("#hiddenFloors").slideDown("slow");
		$(this).hide();
		$("#hideFloorplans").show();
	});
	$("#hideFloorplans").bind("click", function(){
		$("#hiddenFloors").slideUp("slow");
		$(this).hide();
		$("#showFloorplans").show();
	});
});

function onBefore() { 
    $('#output').html( this.src); 
} 
function onAfter() { 
    $('#output').html( this.src) 
        .append( this.alt ); 
}

$(document).ready(function(){
	$("#infoMenu li").hover(
		function(){ $("ul", this).fadeIn("slow"); }, 
		function() { } 
	);
	if (document.all) {
		$("#infoMenu li").hoverClass ("sfHover");
	}
	$("#categoryMenu li").hover(
		function(){ $("ul", this).fadeIn("slow"); }, 
		function() { } 
	);
	if (document.all) {
		$("#categoryMenu li").hoverClass ("sfHover2");
	}
});

$.fn.hoverClass = function(c) {
	return this.each(function(){
		$(this).hover( 
			function() { $(this).addClass(c);  },
			function() { $(this).removeClass(c); }
		);
	});
};	  

