$.globals = {};
$(document).ready(function(){
	over_menu();
	over_item_brands();
	markSection();
	$(".button .submit").click(FORM_Submit);
	$(".colorboxFicha").colorbox({
		initialWidth:270,
		initialHeight:210,
		maxWidth:'100%',
		maxHeight:'100%',
		photo:true
	});
});

function FORM_Submit()
{
	$(this).parents("form").submit();
	return false;
}

function markSection(){
	var thisurl = window.location.href;
	thisurl = thisurl.split("/");
	thisurl = thisurl[thisurl.length-1];
	thisurl = thisurl.split("?");
	thisurl = thisurl[0];
	if(thisurl.length>1){
		$("#navigation ul li a[href=\""+thisurl+"\"]").addClass("menu_over");
	}else{
		$("#navigation ul li:first a").addClass("menu_over");
	}
	switch(thisurl)
	{
		case "propiedades_detalle.php":
			$("#navigation ul li a[href='propiedades.php']").addClass("menu_over");	
			break;
	}
}

/* FORM VALIDATE */
function validate()
{
	if($("#form").valid()){
		$("#form").submit();
	}else{
		$("label.error").remove();
	};
	return false;
}
function over_item_brands(){
	$("ul#brands li").hover(function() {
		$(this).addClass("over_brand");
	},function() {
		$(this).removeClass("over_brand"); 
	});
}

function SEARCH_Cleaner(obj)
{
	$("input",obj).attr("checked",false);
}

function over_menu(){
	$('#navigation ul#menu li').hover(
	function() { 
		$('a', this).addClass("menu_over");
		markSection();
	},
	function() {
		$('a', this).removeClass("menu_over"); 
			markSection();
	});
}
