// 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(); }
	}
	
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}