//Resize Iframe


//Popup Padrão
function abrePopup(pagina,largura,altura,rolagem){
  var posX
  var posY
  posX = (window.screen.width - largura) / 2;
  posY = (window.screen.height - altura) / 2;
  window.open(pagina,"_blank","width="+largura+",height="+altura+",top="+posY+",left="+posX+",scrollbars="+rolagem+",toolbar=no,location=no,directories=no,menubar=no");
}
function abreFoto(id,email){
  var posX
  var posY
  var largura=470;
  var altura=450;
  posX = (window.screen.width - largura) / 2;
  posY = (window.screen.height - altura) / 2;
  window.open("http://online.viamarte.com.br/site/2008/garotadomes/index3.asp?email="+email+"&id_cadastro="+id,"_blank","width="+largura+",height="+altura+",top="+posY+",left="+posX+",scrollbars="+'yes'+",toolbar=no,location=no,directories=no,menubar=no");
}

//Manipula Div

function enquete(){
  var posX
  var posY
  var largura=470;
  var altura=450;
  posX = (window.screen.width - largura) / 2;
  posY = (window.screen.height - altura) / 2;
  window.open("regulamento/regulamento.html","_blank","width="+largura+",height="+altura+",top="+posY+",left="+posX+",scrollbars="+'yes'+",toolbar=no,location=no,directories=no,menubar=no");	
}
//ABRE CARTAO
function abreWebcard(idcartao,id,imp){
  var posX;
  var posY;
  posX = (window.screen.width - 470) / 2;
  posY = (window.screen.height - 340) / 2;
  window.open("http://www.viamarte.com.br/site2/clube/cartoesvirtuais/cartao.asp?idcartao="+idcartao+"&idchama="+id+"&imprimir="+imp,"_blank","width=470,height=340,top="+posY+",left="+posX+",scrollbars=no,toolbar=no,location=no,directories=no,menubar=no");
}

//Valida Curriculo



//Contato Institucional




//Valida Indique News



function abreFotos(pagina,largura,altura,rolagem){
  var posX;
  var posY;
  posX = (window.screen.width - largura) / 2;
  posY = (window.screen.height - altura) / 2;
  window.open(pagina,"_blank","width="+largura+",height="+altura+",top="+posY+",left="+posX+",scrollbars="+rolagem+",toolbar=no,location=no,directories=no,menubar=no,resizable=no,menubar=no");
}
function ajustaJanela()
{
	version = 0;
	
	if (navigator.appVersion.indexOf("MSIE")!=-1){
		temp = navigator.appVersion.split("MSIE");
		version = parseFloat(temp[1]);
	}
	
	if (version == 7){
		num = 75;
	} else {
		num = 50;
	}
	
    var x = document.getElementById("imag").width+7;     
    var y = document.getElementById("marker").offsetTop+num;
 	window.resizeTo(x, y);
}





function ajustaTamanhos(){
	if(window.top.frames[1].document.colecao){
		var alvo = "colecao";
	}
	
	if(window.top.frames[1].document.home){
		var alvo = "home";
	}
	if(window.top.frames[1].document.campanha){
		var alvo = "campanha";
	}

	//alert(window.top.frames[1].scrolling);
	var posy=window.innerHeight || self.innerHeight || document.body.offsetHeight+"px";
	var posx=window.innerWidth || self.innerWidth || document.body.offsetWidth+"px";

	if(parseInt(posy)>=434){
		document[alvo].height="100%";
		document.getElementById("out").style.overflowY="hidden";
		document.getElementById("bg").style.height=document.body.clientHeight+"px";

	}
	if(parseInt(posy)<434){
		document.getElementById("out").style.overflowY="scroll";
		document[alvo].height=434;
		document.getElementById("bg").style.height="434px";


	}
/*
	if(parseInt(posy)>=434){
		document.colecao.height="100%";
		document.getElementById("out").style.overflowY="hidden";
		document.getElementById("bg").style.height=document.body.clientHeight+"px";

	}
	if(parseInt(posy)<434){
		document.getElementById("out").style.overflowY="scroll";
		document.colecao.height=434;
		document.getElementById("bg").style.height="434px";


	}

*/
	
	//document.getElementById("divcarrinho").style.height=document.body.clientHeight;
}
function paraSom(){

	window.top.frames[0].document.som.TCallFrame("/", 3);
	if(window.top.frames[1].location.href.indexOf("lojista.htm")==-1){
  	document.cookie='VMSOMparado=true; expires=Mon, 31 dec 2010 23:59:59 UTC; path=/';
	}else{
	  if(getCookie("VMSOMparado")=="true"){
		  document.cookie='VMSOMparado=lojistatrue; expires=Mon, 31 dec 2010 23:59:59 UTC; path=/';
		}else{
  	  document.cookie='VMSOMparado=lojistafalse; expires=Mon, 31 dec 2010 23:59:59 UTC; path=/';
		}
	}
}

function mudaSom(numero,arquivo){
//alert(numero);
  document.cookie='VMSOMparado=false; expires=Mon, 31 dec 2010 23:59:59 UTC; path=/';
	if(numero==1){
		var qSom = "1.mp3";
	}
	if(numero==2){
		var qSom = "2.mp3";
	}	
	if(numero==3){
		var qSom = arquivo;
	}	
	
	
	window.top.frames[0].document.som.SetVariable("/:qSom", qSom);
	window.top.frames[0].document.som.TCallFrame("/", 2);	

	if(window.top.frames[1].document.menu_topo){
		var alvo = "menu_topo";
		window.top.frames[1].document[alvo].TGotoFrame("/som/botoes", numero);		
	}
	if(window.top.frames[1].document.colecao){
		var alvo = "colecao";
		window.top.frames[1].document[alvo].TGotoFrame("geral/som/botoes", numero);		
	}
	if(window.top.frames[1].document.clube){
		var alvo = "clube";
		window.top.frames[1].document[alvo].TGotoFrame("geral/som/botoes", numero);		
	}
	if(window.top.frames[1].document.home){
		var alvo = "home";
		window.top.frames[1].document[alvo].TGotoFrame("/base_esquerda/som/botoes", numero);
	}
	if(window.top.frames[1].document.campanha){
		var alvo = "campanha";
		window.top.frames[1].document[alvo].TGotoFrame("/rodape/base_esquerda/som/botoes", numero);		
	}

	window.top.frames[1].document[alvo].SetVariable("/:somAtual", numero);
	document.cookie='VMSOMqnumero='+ numero +'; expires=Mon, 31 dec 2010 23:59:59 UTC; path=/';
	
}
/*function testaCarregado(){
	if(window.top.frames[1].document.colecao){
		var alvo = window.top.frames[1].document.colecao;
	}
	else if(window.top.frames[1].document.clube){
		var alvo = window.top.frames[1].document.clube;
	}

	if ((window.top.frames[0].document.som.PercentLoaded() == 100)&&(window.top.frames[1].document.colecao.PercentLoaded() == 100)) { 
		var parado = window.top.frames[0].document.som.GetVariable("parado");
		var qNumero = window.top.frames[0].document.som.GetVariable("qNumero");	
		window.top.frames[1].document.colecao.SetVariable("/:somParado", parado);
		window.top.frames[1].document.colecao.SetVariable("/:somAtual", qNumero);
		clearInterval(tempoVerifica);
	}
	//alert("T");
}*/

function getInternetExplorerVersion()

{
  var rv = -1; // Return value assumes failure.
  if (navigator.appName == 'Microsoft Internet Explorer')
  {
    var ua = navigator.userAgent;
    var re  = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})");
    if (re.exec(ua) != null)
      rv = parseFloat( RegExp.$1 );
  }
  return rv;
 
}



function testaCarregado(){
	if(window.top.frames[1].document.menu_topo){
		var alvo = "menu_topo";
		
		
	}
	if(window.top.frames[1].document.colecao){
		var alvo = "colecao";
	}
	if(window.top.frames[1].document.clube){
		var alvo = "clube";
	}
	if(window.top.frames[1].document.home){
		var alvo = "home";
	}
	if(window.top.frames[1].document.campanha){
		var alvo = "campanha";
	}

	if ((window.top.frames[0].document.som.PercentLoaded() == 100)&&(window.top.frames[1].document[alvo].PercentLoaded() == 100)) {
		
		//var parado = window.top.frames[0].document.som.GetVariable("parado");
		//var qNumero = window.top.frames[0].document.som.GetVariable("qNumero");	



   		var parado = getCookie('VMSOMparado');
		var qNumero = getCookie('VMSOMqnumero');
		if(getInternetExplorerVersion()!=-1){
			if((parado=="false")&&(parseInt(window.top.frames[0].document.som.getVariable("/:qPosicao"))==0)){
				clearInterval(tempoVerifica);
				if(window.top.frames[1].location.href.indexOf("clube.asp")==-1){
					mudaSom(1);
				}
			}
		}
		window.top.frames[1].document[alvo].SetVariable("/:somParado", parado);
		window.top.frames[1].document[alvo].SetVariable("/:somAtual", qNumero);
		clearInterval(tempoVerifica);
	}
	//alert("parado: "+parado+" qnumero:"+qNumero);
}
var tempoVerifica
function verificaSom(){

	if(window.top.frames[0].location.href.indexOf("topo.html")==-1){
		window.top.frames[0].location.href="http://www.viamarte.com.br/20082/topo.html";
	}
	else{
		tempoVerifica = setInterval(testaCarregado,500);	
	}
//	alert(window.top.frames[1].document.colecao);
	
}
function ajustaClube(tamY){
	var corpoHTML=document.body.clientHeight;
	var corpoFLASH=tamY;

	if(corpoHTML<corpoFLASH){
		document.clube.width="100%";
		document.clube.height=tamY;

	}
	else{
		document.clube.width=document.body.clientWidth;
		document.clube.height="100%";

	}
	ajustaTamanhosClube();
}
function ajustaTamanhosClube(){
	if(window.top.frames[1].document.colecao){
		var alvo = "colecao";
	}
	if(window.top.frames[1].document.campanha){
		var alvo = "campanha";
	}
	if(window.top.frames[1].document.home){
		var alvo = "home";
	}
	if(window.top.frames[1].document.clube){
		var alvo = "clube";
	}
	document[alvo].width=document.body.clientWidth;	
	verificaSom();
//	document.clube.width=document.body.clientWidth;	
}
function seuEstilo(email,id,nome){
	var posX;
  	var posY;
	var largura = 778;
	var altura = 478;
	var rolagem = 'no';
  	posX = (window.screen.width - largura) / 2;
  	posY = (window.screen.height - altura) / 2;
  	window.open("seuestilo/seuestilo.asp?nome="+nome+"&email="+email+"&id="+id,"_blank","width="+largura+",height="+altura+",top="+posY+",left="+posX+",scrollbars="+rolagem+",toolbar=no,location=no,directories=no,menubar=no,resizable=no,menubar=no");

}
function meuWebCard(email,id,nome){
	var posX;
  	var posY;
	var largura = 794;
	var altura = 434;
	var rolagem = 'no';
  	posX = (window.screen.width - largura) / 2;
  	posY = (window.screen.height - altura) / 2;
  	window.open("meuwebcard/meuwebcard.asp?nome="+nome+"&email="+email+"&id="+id,"_blank","width="+largura+",height="+altura+",top="+posY+",left="+posX+",scrollbars="+rolagem+",toolbar=no,location=no,directories=no,menubar=no,resizable=no,menubar=no");

}

function getCookie(c_name)
{
if (document.cookie.length>0)
  {
  c_start=document.cookie.indexOf(c_name + "=");
  if (c_start!=-1)
    { 
    c_start=c_start + c_name.length+1; 
    c_end=document.cookie.indexOf(";",c_start);
    if (c_end==-1) c_end=document.cookie.length;
    return unescape(document.cookie.substring(c_start,c_end));
    } 
  }
return "";
}



