// JavaScript Document


function tamtela() {
var xScroll, yScroll;
if (window.innerHeight && window.scrollMaxY) {
	xScroll = document.body.scrollWidth;
	yScroll = window.innerHeight + window.scrollMaxY;
} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
	xScroll = document.body.scrollWidth;
	yScroll = document.body.scrollHeight;
} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
	xScroll = document.body.offsetWidth;
	yScroll = document.body.offsetHeight;
}
windowWidth=0, windowHeight=0;
if (self.innerHeight) {	// all except Explorer
	windowWidth = self.innerWidth;
	windowHeight = self.innerHeight;
} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
	windowWidth = document.documentElement.clientWidth;
	windowHeight = document.documentElement.clientHeight;
} else if (document.body) { // other Explorers
	windowWidth = document.body.clientWidth;
	windowHeight = document.body.clientHeight;
}
// for small pages with total height less then height of the viewport

if(!yScroll || (yScroll< windowHeight)){
	pageHeight = windowHeight;
	} else {
		pageHeight = yScroll;
	}
}

function ajustaDiv() {
	tamtela();
	altDiv=(pageHeight)+"px";
	if(windowHeight >= pageHeight) {
		var divcont = document.getElementById('container');
		divcont.style.height=altDiv;  // altura da div container
	}
	if(windowWidth<1000) {  // css para 800px
		$("body").append('<link rel="stylesheet" type="text/css" href="css/estilo800.css">');
		if (self.innerHeight) $(".box2").css({width: "47%"});
		return true;
	}
	return true;
}

$(function() {
	// fix for target=”_blank”
	$("a[@rel~='external']").click(function(){
	window.open($(this).attr("href"), 'janela','scrollbars=yes,resizable=yes,width=600,height=450');
	return false;
	});
});
function openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

$(document).ready(function() {
	$('#omenu').find('ul').hide();
	  $('#omenu').find('ul').parent().click(function() {
         var resposta = $(this).children("ul");
         if (resposta.is(':visible')) {
             resposta.slideUp();
         } else {
             resposta.slideDown();
         }
     });
});


