﻿function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function mouseEvent(id, evnt) {
	id = id.replace(/FilhoDe/,'')
	document.getElementById(id).className = evnt;
}

// Setando as variáveis de aumento de fonte

var defaultFontSize = 110;
var maximumFontSize = 300;
var currentFontSize = defaultFontSize;

function resetFontSize() {
	resetSize = defaultFontSize - currentFontSize;
	changeFontSize(resetSize);
}

function changeFontSize(sizeDifference) {
	currentFontSize = currentFontSize + sizeDifference;

	if(currentFontSize > maximumFontSize) { alert('Você já chegou ao tamanho máximo!'); currentFontSize = 300;  }
	else if(currentFontSize < 60) { alert('Você já chegou ao tamanho mínimo!'); currentFontSize = 60;  }

	setFontSize(currentFontSize);
}

function setFontSize(fontSize){ document.getElementById('areaTexto').style.fontSize = fontSize + '%'; }


function areaTexto(x) {
	if (x == "A") { changeFontSize(10); }
	else if (x == "D") { changeFontSize(-10); }
	else { resetFontSize(); }
}

var atual = 1; //esta var guarda o valor que tá sendo exibido agora.
var timeloop; //guardará o setInterval

function muda(qual){

	//divs que estão dentro do destaques colocadas num array
    var divs = document.getElementById("destaquesRotativos").getElementsByTagName("div");
	var lis = document.getElementById("changeDest").getElementsByTagName("li");

	//formatando o qual
    var qual_num = Number(qual);
    if (qual_num < 1){ qual_num = divs.length; }
    else if (qual_num > divs.length) { qual_num = 1; }

    //colocando o zero antes se for necessário
    if (qual_num<10) {qual = "0" + qual_num} else { qual = qual_num };

    //voltando a classe de todas para o padrão que é vazio (resetando)
    for (var i = 0;i < divs.length;i++){ divs[i].className = ""; }
	for (var i = 0;i < lis.length;i++){ lis[i].className = ""; }

    //aplicando a classe exibe na que for pra exibir
    document.getElementById("dest_"+qual).className = "exibe";
	document.getElementById("item_"+qual).className = "on";

    //setando o atual
    atual = qual_num;

}

function iniciaAutomatico(){
    timeloop = setInterval("muda(Number(atual)+1)",4000);
}

function getfileextension(inputId) {
	var fileinput = inputId;
	if (!fileinput ) { return ""; }
	else {
		if (fileinput.length == 0) { return ""; }
		else {
			var dot = fileinput.lastIndexOf(".");
			if (dot == -1 ) { return ""; }
			else {
				var extension = fileinput.substr(dot,fileinput.length);
				return extension;
			}
		}
	}
}

function writeBanner(path) {
	if (getfileextension(path) == '.swf') { addFlash(path,'286','240'); }
	else { document.write('<img src="'+path+'" width="286" height="240" />') }
}

function addFlash(_src,_w,_h){
	var novoHtml = '';
 	novoHtml += '  <object height="'+_h+'" width="'+_w+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
	novoHtml += '  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ';
	novoHtml += '  align="">';
	novoHtml += '    <param name="movie"   value="'+_src+'" />';
	novoHtml += '    <param name="quality" value="high" />';
	novoHtml += '    <param name="wmode"   value="transparent" />';
	novoHtml += '    <param name="bgcolor" value="#FFFFFF" />';
	novoHtml += '    <embed wmode="transparent" src="'+_src+'" pluginspage="http://www.macromedia.com/go/getflashplayer" height="'+_h+'" width="'+_w+'"></embed>';
	novoHtml += '  </object>';
  document.write(novoHtml);
}

function writeBannerTopo(path) {
	if (getfileextension(path) == '.swf') { addFlash(path,'728','90'); }
	else { document.write('<img src="'+path+'" width="728" height="90" />') }
}

function addFlash(_src,_w,_h){
	var novoHtml = '';
 	novoHtml += '  <object height="'+_h+'" width="'+_w+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
	novoHtml += '  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ';
	novoHtml += '  align="">';
	novoHtml += '    <param name="movie"   value="'+_src+'" />';
	novoHtml += '    <param name="quality" value="high" />';
	novoHtml += '    <param name="wmode"   value="transparent" />';
	novoHtml += '    <param name="bgcolor" value="#FFFFFF" />';
	novoHtml += '    <embed wmode="transparent" src="'+_src+'" pluginspage="http://www.macromedia.com/go/getflashplayer" height="'+_h+'" width="'+_w+'"></embed>';
	novoHtml += '  </object>';
  document.write(novoHtml);
}

function writeBannerCabecalho(path) {
	if (getfileextension(path) == '.swf') { addFlash(path,'468','60'); }
	else { document.write('<img src="'+path+'" width="468" height="60" />') }
}

function addFlash(_src,_w,_h){
	var novoHtml = '';
 	novoHtml += '  <object height="'+_h+'" width="'+_w+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
	novoHtml += '  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ';
	novoHtml += '  align="">';
	novoHtml += '    <param name="movie"   value="'+_src+'" />';
	novoHtml += '    <param name="quality" value="high" />';
	novoHtml += '    <param name="wmode"   value="transparent" />';
	novoHtml += '    <param name="bgcolor" value="#FFFFFF" />';
	novoHtml += '    <embed wmode="transparent" src="'+_src+'" pluginspage="http://www.macromedia.com/go/getflashplayer" height="'+_h+'" width="'+_w+'"></embed>';
	novoHtml += '  </object>';
  document.write(novoHtml);
}

function writeBannerMini(path) {
	if (getfileextension(path) == '.swf') { addFlash(path,'120','60'); }
	else { document.write('<img src="'+path+'" width="120" height="60" />') }
}

function addFlash(_src,_w,_h){
	var novoHtml = '';
 	novoHtml += '  <object height="'+_h+'" width="'+_w+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
	novoHtml += '  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ';
	novoHtml += '  align="">';
	novoHtml += '    <param name="movie"   value="'+_src+'" />';
	novoHtml += '    <param name="quality" value="high" />';
	novoHtml += '    <param name="wmode"   value="transparent" />';
	novoHtml += '    <param name="bgcolor" value="#FFFFFF" />';
	novoHtml += '    <embed wmode="transparent" src="'+_src+'" pluginspage="http://www.macromedia.com/go/getflashplayer" height="'+_h+'" width="'+_w+'"></embed>';
	novoHtml += '  </object>';
  document.write(novoHtml);
}

function writeBannerInternaMini(path) {
	if (getfileextension(path) == '.swf') { addFlash(path,'286','60'); }
	else { document.write('<img src="'+path+'" width="286" height="60" />') }
}

function addFlash(_src,_w,_h){
	var novoHtml = '';
 	novoHtml += '  <object height="'+_h+'" width="'+_w+'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
	novoHtml += '  codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" ';
	novoHtml += '  align="">';
	novoHtml += '    <param name="movie"   value="'+_src+'" />';
	novoHtml += '    <param name="quality" value="high" />';
	novoHtml += '    <param name="wmode"   value="transparent" />';
	novoHtml += '    <param name="bgcolor" value="#FFFFFF" />';
	novoHtml += '    <embed wmode="transparent" src="'+_src+'" pluginspage="http://www.macromedia.com/go/getflashplayer" height="'+_h+'" width="'+_w+'"></embed>';
	novoHtml += '  </object>';
  document.write(novoHtml);
}

function rotativo() {
  var ic = 6;
  var imagem = new Array(ic);
  imagem[0] = "<span style=\"display:block;position:absolute;left:0px;top:0px;width:468px:height:60px;\"><script type=\"text/javascript\" src=\"http://www.submarino.com.br/afiliados/get_banner.asp?tipo=full&franq=263911\"></script></span>";
  imagem[1] = "<span style=\"display:block;position:absolute;left:0px;top:0px;width:468px:height:60px;\"><script type=\"text/javascript\" src=\"http://www.submarino.com.br/afiliados/get_banner.asp?tipo=full2&franq=263911\"></script></span>";
  imagem[2] = "<a href=\"http://www.submarino.com.br/homecache/housewares.aspx?Query=ProductPage&ProdTypeId=27&franq=263911\"><img src=\"http://i.s8.com.br/images/afiliados/banner/468x60_eletrodom.jpg\" border=\"0\"></a>";
  imagem[3] = "<a href=\"http://www.submarino.com.br/homecache/electronic.aspx?Query=ProductPage&ProdTypeId=13&franq=263911\"><img src=\"http://i.s8.com.br/images/afiliados/banner/468x60_eletronicos.jpg\" border=\"0\"></a>";
  imagem[4] = "<a href=\"http://www.submarino.com.br/homecache/homeappliances.aspx?Query=ProductPage&ProdTypeId=34&franq=263911\"><img src=\"http://i.s8.com.br/images/afiliados/banner/468x60_portateis.jpg\" border=\"0\"></a>";
  imagem[5] = "<a href=\"http://www.submarino.com.br/homecache/software.aspx?Query=ProductPage&ProdTypeId=10&franq=263911\"><img src=\"http://i.s8.com.br/images/afiliados/banner/468x60_info.jpg\" border=\"0\"></a>";
  function pickRandom(range) {
     if (Math.random) return Math.round(Math.random() * (range-1));
     else {
       var now = new Date();
       return (now.getTime() / 1000) % range; }
     }
	 var escolha = pickRandom(ic);

 document.writeln(''+imagem[escolha]+'');
}
function fncEsconderBanner()
{
  document.getElementById("bannerzao").style.display = 'none';
}
