
function RodarFlash(path,variaveis,_width,_height)
{
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="'+_width+'" height="'+_height+'">')
		document.write('<param name="movie" value="'+path+'?'+variaveis+'">')
		document.write('<param name="quality" value="high">')
		document.write('<param name="wmode" value="transparent">')
		document.write('<embed src="'+path+'?'+variaveis+'" width="'+_width+'" height="'+_height+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent"></embed>')
	document.write('</object>')
}

var xmlhttp = null;
var arrAjaxActions = new Array('fechar');
// Conexão via XmlHttp
try {
	xmlhttp = new XMLHttpRequest();
} catch(ee) {
	try {
    	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
	} catch(e) {
    	try {
        	xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    	} catch(E) {
        	xmlhttp = false;
    	}
	}
}
	
function mostraConteudo(url, div) {	
	// Seleciona objeto
	obj_div = document.getElementById(div);
   	// Verifica se existe xmlhttp
   	if (xmlhttp) {		
		xmlhttp.open("GET", url, true);
		xmlhttp.onreadystatechange = function() {
		   	// Verifica estado da requisição
		    if (xmlhttp.readyState == 1) {
		    	obj_div.innerHTML = "<img src='/wvagencia/tam/publico/imagens/240/carregando.gif' style='margin:100px 0 0 325px;' />";
		    } else if (xmlhttp.readyState == 4) {
		    	// Verifica status da requisição
				if (xmlhttp.status == 200) {
					obj_div.innerHTML = xmlhttp.responseText;
					//tracking do google analytics
					pageTracker._trackPageview(arrAjaxActions[arrAjaxActions.length-1]);
				} else {
					obj_div.innerHTML = "<div style='color:#fff;margin:100px 0 0 310px;'>Erro ao carregar ...</div>";
					arrAjaxActions.pop();
				}
			}
		}
   	}
   	xmlhttp.send(null);
}

function mostraDivTransp(url){
	document.getElementById('fundoTransp').style.display = 'block';
	document.getElementById('conteudoJanela').style.display = 'block';

	//guarda ação
	arrAjaxActions.push(url);
	mostraConteudo(url,'conteudoJanela');
}

function fechaDivTransp(){
	document.getElementById('fundoTransp').style.display = 'none';
	document.getElementById('conteudoJanela').style.display = 'none';
	document.getElementById('conteudoJanela').innerHTML = '';
	arrAjaxActions = new Array('fechar');
}

function ajaxVoltar(){
	arrAjaxActions.pop();
	
	if(arrAjaxActions[arrAjaxActions.length-1] == 'fechar'){
		fechaDivTransp();
	}else{
		mostraConteudo(arrAjaxActions[arrAjaxActions.length-1],'conteudoJanela');
	}
}

function verificaradiobuttons(){
	if(document.formPapeis.arquivo.value == ''){
		alert("Selecione um tamanho para o Papel de Parede");
	}else{
		urlGet = document.formPapeis.action.value;
		urlGet += '?arquivo='+document.formPapeis.arquivo.value;
		urlGet += '&posicao='+document.formPapeis.posicao.value;
		urlGet += '&gravidade='+document.formPapeis.gravidade.value;
		urlGet += '&borda_cor='+document.formPapeis.borda_cor.value;
		urlGet += '&tamanho='+document.formPapeis.tamanho.value;
		urlGet += '&foto='+document.formPapeis.foto.value;
		urlGet += '&idEvento='+document.formPapeis.idEvento.value;
		
		mostraDivTransp(urlGet);
	}
}

function verifica(formul){
	if(formul.nome.value == ''){
		alert('Digite seu nome');
		formul.nome.focus();
	}else if(formul.email.value == ''){
		alert('Digite seu email');
		formul.email.focus();
	}else if(formul.destNome.value == ''){
		alert('Digite nome do destinatário');
		formul.destNome.focus();
	}else if(formul.destEmail.value == ''){
		alert('Digite o email do destinatário');
		formul.destEmail.focus();
	}else{
		urlGet = formul.action.value;
		urlGet += '?imgFile='+formul.imgFile.value;
		urlGet += '&nome='+formul.nome.value;
		urlGet += '&email='+formul.email.value;
		urlGet += '&destNome='+formul.destNome.value;
		urlGet += '&destEmail='+formul.destEmail.value;
		urlGet += '&comentarios='+formul.comentarios.value;
		
		mostraDivTransp(urlGet);
	}
}

function refazerframe(formul){
	urlGet = formul.action.value;
	urlGet += '?Time_Hour='+formul.Time_Hour.value;
	urlGet += '&Time_Minute='+formul.Time_Minute.value;
	urlGet += '&Time_Second='+formul.Time_Second.value;
	
	mostraDivTransp(urlGet);

}
