// início função de favoritos
function favoritos(title,url) { 
	if (window.sidebar) { 
		window.sidebar.addPanel(title, url,""); 
	} else if( document.all ) { 
		window.external.AddFavorite( url, title); 
	} else if( window.opera && window.print ) { 
		return true; 
	} 
}
// fim função de favoritos

// início da função definir como página inicial
function IS()
{
  var agent = navigator.userAgent.toLowerCase();
  this.major = parseInt(navigator.appVersion);
  this.minor = parseFloat(navigator.appVersion);
  this.ns  = ((agent.indexOf('mozilla')!=-1) && ((agent.indexOf('spoofer')==-1) && (agent.indexOf('compatible') == -1)));
  this.ns2 = (this.ns && (this.major == 2));
  this.ns3 = (this.ns && (this.major == 3));
  this.ns4b = (this.ns && (this.major == 4) && (this.minor <= 4.03));
  this.ns4 = (this.ns && (this.major >= 4));
  this.ie   = (agent.indexOf("msie") != -1);
  this.ie3  = (this.ie && (this.major == 2));
  this.ie4  = (this.ie && (this.major == 4));
  this.ie5  = (this.ie && (this.major > 4));
  this.op3 = (agent.indexOf("opera") != -1);
}
var is = new IS();
function inicial()
{
  if((is.ie && navigator.appVersion.substr(navigator.appVersion.indexOf("MSIE")+5,3)==4)||is.ns)
  {
    window.open('http://www.gambare.jp/helpInicial.php','HelpSetHomePage',('width=500,height=420,top=0,left=0,scrollbars=yes'));
  }
  else
	{
		document.body.setHomePage("http://www.gambare.jp");
	}
}
// fim da função definir como página inicial

//Alternar as colunas de notícias
function alternate(id){
	if(document.getElementById){						//check that browser has capabilities
		var table = document.getElementById(id);		//get just the selected table not all of them
		var rows = table.getElementsByTagName("dd");	//get all list elements      
    for(i = 0; i < rows.length; i++){				//alternate styles			
      //manipulate list elements	
      doMultipleDestaque(rows[i], i);
    }
	}
}

function doMultipleDestaque(row, i){
  var widths = new Array('0 15px 0 0','0 0 0 0');
  row.style.margin = widths[i % widths.length];
}

//Fim do alternar

//Alternar as colunas de tres partes
function alternateThreeParts(id){
	if(document.getElementById){						//check that browser has capabilities
		var table = document.getElementById(id);		//get just the selected table not all of them
		var rows = table.getElementsByTagName("dd");	//get all list elements      
    for(i = 0; i < rows.length; i++){				//alternate styles			
      //manipulate list elements	
      doMultipleThreeParts(rows[i], i);
    }
	}
}

function doMultipleThreeParts(row, i){
  var widths = new Array('0 10px 10px 0','0 10px 10px 0','0 0 10px 0');
  row.style.margin = widths[i % widths.length];
}
//Fim do alternar em tres partes

//Alternar as colunas de quatro partes
function alternateFourParts(id){
	if(document.getElementById){						//check that browser has capabilities
		var table = document.getElementById(id);		//get just the selected table not all of them
		var rows = table.getElementsByTagName("dd");	//get all list elements      
    for(i = 0; i < rows.length; i++){				//alternate styles			
      //manipulate list elements	
      doMultipleFourParts(rows[i], i);
    }
	}
}

function doMultipleFourParts(row, i){
  var widths = new Array('0 8px 10px 0','0 8px 10px 0','0 8px 10px 0','0 0 10px 0');
  row.style.margin = widths[i % widths.length];
}
//Fim do alternar em quatro partes

//Função setVis
function setVis(objectID,state) {
	var object = document.getElementById(objectID);
	object.style.display = state;
}
//Fim da Função setVis

//Função toogleVis
function toggleVisibility(objectID) {
	var object = document.getElementById(objectID);
	state = object.style.display;
	if (state == 'none')
		object.style.display = 'block';
	else {
		if (state == 'block')
			object.style.display = 'none'; 
	else object.style.display = 'block';
	}
}
//Fim da Função toogleVis

//funcoes para banners dhtml popup
function fecha_flash(){
  var object = document.getElementById('div_flash');
	object.style.display = 'none';
}
function fecha_tempo_flash(){
  window.setTimeout(function(){
    fecha_flash();
  }, 7000);
}
