$.globals = new Array();
$(document).ready(function(){
	over_menu();
	over_item_brands();
	markSection();
	$(".colorboxFichaEmprendimiento").colorbox({
		width:630,
		height:640,
		scrolling:false,
		close:"VOLVER"
	});
	$(".colorboxFicha").colorbox({
		width:630,
		height:900,
		scrolling:false,
		close:"VOLVER"
	});
	$("div.button a.submit").click(function(){
	  $(this).parents("form").submit();
	});
});

function markSection(){
	var thisurl = window.location.href;
	thisurl = thisurl.split("/");
	thisurl = thisurl[thisurl.length-1];
	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 "emprendimientos.php":
		case "avanzada.php":
		case "financiacion.php":
		case "gestion_credito.php":
		case "tasacion.php":
		case "realizados.php":
			$("#navigation ul li a[href='venta_alquiler.php']").addClass("menu_over");	
			break;
		case "sucursales.php":
		case "comercializacion.php":
		case "consultoria.php":
		case "relocacion.php":
		case "construccion.php":
			$("#navigation ul li a[href='perfil_empresa.php']").addClass("menu_over");	
			break;
		case "links_interes.php":
		case "notas_interes.php":
			$("#navigation ul li a[href='notas_interes.php']").addClass("menu_over");	
			break;
		case "form_contacto.php":
			$("#navigation ul li a[href='contacto.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 over_menu(){
	$('#navigation ul#menu li').hover(
	function() { 
		$('a', this).addClass("menu_over");
		markSection();
	},
	function() {
		$('a', this).removeClass("menu_over"); 
			markSection();
	});
}
