// JavaScript Document
//_________________________________________________________________________________________________________
// MUDA A ALTUTRA DA IFRAME EM FUNÇÃO DO CONTEUDO
function calcHeight()
{
	var iframeids=["displayFrame"]
	var frameheightextra = 50;
  //find the height of the internal page
  var frameheight=document.getElementById(iframeids).contentWindow.document.body.scrollHeight;

	//alert ( the_height );
  //change the height of the iframe
  document.getElementById(iframeids).height= frameheight+frameheightextra ;
	//alert ( document.getElementById('displayFrame').height );
}
//_________________________________________________________________________________________________________
// Muda os estado de visibilidade da div em função do parametro passado - ver div#display e menuitens
function targetStateChange ( targetName, stateDiv )  
{//alert (targetName + stateDiv); 
	this.IE5=this.NN4=this.NN6=false
	if(document.all)this.IE5=true
	else if(document.layers)this.NN4=true
	else if(document.getElementById)this.NN6=true
	
	if(this.NN4)this.identity=eval( "window.document." + targetName )
	if(this.IE5)this.identity=eval( "window.document.all." + targetName )
	if(this.NN6)this.identity=eval( window.document.getElementById( targetName ) )
	
	identity.className = stateDiv ; // propridades hidediv defenidas no css
}
//_________________________________________________________________________________________________________
// alterna o estado de visibilidade
function swapClass ( targetName ) 
{//alert ("bing0"); 
	this.IE5=this.NN4=this.NN6=false
	if(document.all)this.IE5=true
	else if(document.layers)this.NN4=true
	else if(document.getElementById)this.NN6=true
	
	if(this.NN4)this.identity=eval( "window.document." + targetName );
	if(this.IE5)this.identity=eval( "window.document.all." + targetName );
	if(this.NN6)this.identity=eval( window.document.getElementById( targetName ) );
	
		if ( identity.className == 'showdiv') 
		{		
			identity.className = 'hidediv' ; // propridades hidediv defenidas no css
		}
		else
		{		
			identity.className = 'showdiv' ; // propridades showdiv defenidas no css
		}
}
//_________________________________________________________________________________________________________
// Muda o conteudo da FRAME
function changeContent (targetName, newcontent ) 
{
//alert("bingo");
	this.IE5=this.NN4=this.NN6=false
	if(document.all)this.IE5=true
	else if(document.layers)this.NN4=true
	else if(document.getElementById)this.NN6=true
	
	if(this.NN4)this.identity=eval( "window.document." + targetName );
	if(this.IE5)this.identity=eval( "window.document.all." + targetName );
	if(this.NN6)this.identity=eval( window.document.getElementById( targetName ) );
	
	if(this.NN4) {
		identity.innerHTML = newcontent;
		// Couldn't get this to work inside table cell.
		//	this.obj.document.write(content)
		//	this.obj.document.close()
		//alert("I couldn't get part to work in NN4")
	} else if(this.NN6) {
		identity.innerHTML = newcontent;
	} else if(this.IE5) {
		newcontent=newcontent+"\n";	// You have to have this new line character for a bug on Mac IE.
		//identity.innerHTML = newcontent;
		identity.src = newcontent;
	}
}
//_________________________________________________________________________________________________________
// Muda
function changeClassCycle ( targetName, count , stateDiv ) 
{
	this.IE5=this.NN4=this.NN6=false
	if(document.all)this.IE5=true
	else if(document.layers)this.NN4=true
	else if(document.getElementById)this.NN6=true
	for (var i=1; i<=count; i++) // se i=0 vai dar erro de "'identity' is null or not an object" nao existe o menu0
	{
	name = targetName+i.toString();
	if(this.NN4)this.identity=eval( "window.document." + name )
	if(this.IE5)this.identity=eval( "window.document.all." + name )
	if(this.NN6)this.identity=eval(window.document.getElementById( name )) 
	
	identity.className = stateDiv;
	}
	
}
//_________________________________________________________________________________________________________
// mudar os backgrounds, chamad pelo index.php
function changeBGImage(path)
{
//alert ('change');
	if (document.body)
	{
		document.body.background = path;
	}
}
