 var base = document.getElementsByTagName('BASE');
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


$(document).ready(function(){
	/* Atribui classe para mostrar o dropdown - nível 1*/		
	$("#menu-principal ul li").each(function(){
		if($("ul", this).html() !== null){
			classe = this.className+" dropable";
			this.className=classe;
		}
	});
	
	/*Mostra  menu */
	$(".dropable").hover(
		function() { $('div.dropdown', this).show() },
		function() { $('div.dropdown', this).hide() }
	);

	/* Atribui classe para mostrar o dropdown - nível 1*/		
	$("#menu-principal ul li").each(
	  function(){
		if($("ul", this).html() !== null){
			classe = this.className+" dropable";
			this.className=classe;
		}
	  }
	);
	
		
	var chamadasBannersHeight = 0;	
	var menuLateralHeight = 0;	
	var contentHeight = 0;
	
	if(document.getElementById("chamadas-banners-sidebar-container")){
		chamadasBannersHeight = document.getElementById("chamadas-banners-sidebar-container").clientHeight + 180;
		
		if(document.getElementById("menu-lateral").clientHeight < document.getElementById("content").clientHeight){
			sidebarHeight = document.getElementById("content").clientHeight + chamadasBannersHeight - 245;
		}else{
			sidebarHeight = document.getElementById("content").clientHeight + chamadasBannersHeight - 130;
		}
		
		$("#sidebar-container").height(sidebarHeight);
	}
	
	var sidebarContentWidth = 0;	
	if(document.getElementById("sidebar-content") != null){
		$("#content").width(340);
	}
	
	
	$("a[rel^='prettyPopin']").prettyPopin({
			modal : false, /* true/false */
			width : 482, /* false/integer */
			height: 310, /* false/integer */
			opacity: 0.5, /* value from 0 to 1 */
			animationSpeed: 'medium', /* slow/medium/fast/integer */
			followScroll: true, /* true/false */
			loader_path: '../imagens/prettyPopin/loader.gif', /* path to your loading image */
			callback: function(){} /* callback called when closing the popin */
	});
	
	//$("a[rel^='prettyPhoto']").prettyPhoto({
	//		animationSpeed: 'normal', /* fast/slow/normal */
	//		padding: 5, /* padding for each side of the picture */
	//		opacity: 0.35, /* Value betwee 0 and 1 */
	//		showTitle: false, /* true/false */
	//		allowresize: false, /* true/false */
	//		counter_separator_label: '/', /* The separator for the gallery counter 1 "of" 2 */
	//		theme: 'light_square', /* light_rounded / dark_rounded / light_square / dark_square */
	//		callback: function(){}
	//});
	
	$("#cep").mask("99999-999");
	//$("#numero").mask("99999999");
	$("#ddd").mask("99");
	$("#telefone").mask("9999-9999");
	$("#cpf").mask("999.999.999-99");
})

function popup(url,titulo,largura,altura) {
	newwindow=window.open(url,titulo,'width='+largura+',height='+altura+',left=300,top=40,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no,resizable=no');
	if (window.focus) {newwindow.focus()}
}