
// Muda o to10
var ATUAL=0;
function M(cod){
	if(cod==ATUAL) return;
	// esconde atual
	if(ATUAL){
		Element.hide("im_"+ATUAL);
		Element.removeClassName("tp_"+ATUAL,'on');
		document['topimg'+ATUAL].src=SUBPASTA+'/img_layout/top10/top_10_'+ATUAL+'_A.gif';
	}
	//
	ATUAL = cod;
	// mostra nova
	Element.show("im_"+cod);
	Element.addClassName("tp_"+cod,'on');
	document['topimg'+cod].src=SUBPASTA+'/img_layout/top10/top_10_'+cod+'_B.gif';
}


// Muda o destaque
var ATUAL_DEST=0;
function MD(cod){
	// esconde atual
	if(ATUAL_DEST) Element.hide("bx_"+ATUAL_DEST);
	//
	ATUAL_DEST = cod;
	// mostra nova
	Element.show("bx_"+cod);
}

// Ativa o muda do destaque
var MDD_V=0;
function MDD(){
	MDD_V++;
	if(MDD_V>3) MDD_V=1;
	MD(MDD_V);
	setTimeout('MDD()',6000);
}

// Abre a foto
function Fotos(imagem,larg,alt){
	var tam = MyLib.getInnerXY();
	Element.setStyle('fotos',{ 'height':tam[1]+'px', 'width': tam[0]+'px'});
	document.foto.src=imagem;
	CentralFotos(larg,alt);
	Element.show('fotos');
}

// fecha foto
function FechaFoto(){
	CentralFotos(0,0,1);
	Element.hide('fotos');
}

// Centraliza as fotos
var tempo = false;
function CentralFotos(largura,altura,modo,noloop){
	if(modo){
		clearTimeout(tempo);
		tempo=false;
	}
	else{
		var central = MyLib.CentralArea(largura,altura);
		var tam = MyLib.getInnerXY();
		var pos = MyLib.getScrollXY();
		Element.setStyle('fotos',{ 'height':tam[1]+'px', 'width': tam[0]+'px', 'top': pos[1]+'px'});
		Element.setStyle('fotoscont',{ 'top':central[1]+'px', 'left':central[0]+'px', 'width': largura+'px', 'height': altura+'px'});
		clearTimeout(tempo);
		if(!noloop) tempo=setTimeout('CentralFotos('+largura+','+altura+',0)',100);
	}
}

// apaga os campos
function Apaga(form,nomecampo,modo){
	var form = document[form.name];
	var valor = form[nomecampo].value;
	if(modo==1){
		if(!valor) form[nomecampo].value = form[nomecampo].defaultValue;
	}
	else{
		if(valor==form[nomecampo].defaultValue) form[nomecampo].value = "";
	}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}




// inicio
function Init(modo){
	M(1);
	MDD();
}

