// JavaScript Document
// <![CDATA[
function init(redirect,nome){
	try{
		if(self.parent.frames.length == 0)
			self.parent.location="index.php?pagina="+redirect;
		else if (self.parent.frames[0].name != nome) {
			//alert(self.parent.frames[0].name);
			self.parent.location="index.php?pagina="+redirect;
		}
	}
	catch(exception){}
}
// ]]>

function iframeAutoHeight(quem){
    //by Micox - elmicox.blogspot.com - elmicox.com - webly.com.br  
    if(navigator.appName.indexOf(" Internet Explorer")>-1){ //ie sucks
        var func_temp = function(){
            var val_temp = quem.contentWindow.document.body.scrollHeight + 15
            quem.style.height = val_temp + "px";
        }
        setTimeout(function() { func_temp() },100) //ie sucks
    }else{
        var val = quem.contentWindow.document.body.parentNode.offsetHeight + 15
        quem.style.height= val + "px";
    }    
}

function showhide(element,show) {
	if(show == true && element != assistindo) document.getElementById(element).style.display = 'block';
	else document.getElementById(element).style.display = 'none';
}

function showvideo(videoid, text) {
	writetext('Você está assistindo: '+ text,'assistindo');
	assistindo = videoid;
}

function writetext(text, id) {
  var txtField = document.getElementById(id);
  txtField.innerHTML = text;
  document.getElementById(id).style.display = 'block';
}

	function NewWindow(mypage, myname, w, h, scroll) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',noresizable'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
	}
