// JavaScript Document

$(document).ready(function(){

	$("#nicemenu img.arrow").click(function(){

		$("span.head_menu").removeClass('active');

		submenu = $(this).parent().parent().find("div.sub_menu");

		if(submenu.css('display')=="block"){
			$(this).parent().removeClass("active");
			submenu.hide();
			$(this).attr('src','images/arrow_hover.png');
		}else{
			$(this).parent().addClass("active");
			submenu.fadeIn();
			$(this).attr('src','images/arrow_select.png');
		}

		$("div.sub_menu:visible").not(submenu).hide();
		$("#nicemenu img.arrow").not(this).attr('src','images/arrow.png');

	})
	.mouseover(function(){ $(this).attr('src','images/arrow_hover.png'); })
	.mouseout(function(){
		if($(this).parent().parent().find("div.sub_menu").css('display')!="block"){
			$(this).attr('src','images/arrow.png');

		}else{
			$(this).attr('src','images/arrow_select.png');
		}
	});

	$("#nicemenu span.head_menu").mouseover(function(){ $(this).addClass('over')})
								 .mouseout(function(){ $(this).removeClass('over') });

	$("#nicemenu div.sub_menu").mouseover(function(){ $(this).fadeIn(); })
							   .blur(function(){
							   		$(this).hide();
									$("span.head_menu").removeClass('active');
								});

	$(document).click(function(event){
			var target = $(event.target);
			if (target.parents("#nicemenu").length == 0) {
				$("#nicemenu span.head_menu").removeClass('active');
				$("#nicemenu div.sub_menu").hide();
				$("#nicemenu img.arrow").attr('src','images/arrow.png');
			}
	});


      $('a.lightbox').lightBox(); // linea solo del light box

      
       
  
});


function esconde_anuncio(divId)
{ if (document.layers) document.layers[divId].visibility = 'hide';
else if (document.all) document.all[divId].style.visibility = 'hidden';
else if (document.getElementById) document.getElementById(divId).style.visibility = 'hidden';
}
function mostrar_anuncio(divId)
{ state=typeof topPos;
if(state=='undefined') topPos=-260;
if(topPos < 75)
{ topPos+=3;
if (document.layers) document.layers[divId].top = topPos;
else if (document.all) document.all[divId].style.top = topPos;
else if (document.getElementById) document.getElementById(divId).style.top = topPos;

setTimeout("mostrar_anuncio('pop');",25);
}
}




function alerta(alerta){
    if(alerta!="" && alerta != "null"){
        alert(alerta);
    }


}

function abrirVentana(url, ancho, alto)
{
var sHeight, sWidth;
sHeight = screen.height;
sWidth = screen.width;
var sLeft, sTop;
sLeft=(screen.width - ancho) / 2;
sTop=(screen.height - alto) / 2;
window.open(url, '_blank','top='+sTop+', left='+sLeft+', height='+alto+', width='+ancho+', status=no, menubar=no, resizable=no, scrollbars=no, toolbar=no, location=no, directories=no');
}


function mostrarPopup(){
$(document).ready( function() {
    $("#popup").show();
    $("#popup").animate({
      top: "30%",
      }, 5000 );
    });
}







