/* function EscolhaCidade(strCidade) {
	
	if (strCidade == "Salvador") { document.getElementById('tabela_salvador').style.display = 'block'; }
	else { document.getElementById('tabela_salvador').style.display = 'none';  }
	
	if (strCidade == "Recife") { document.getElementById('tabela_recife').style.display = 'block'; }
	else { document.getElementById('tabela_recife').style.display = 'none';  }
	
	if (strCidade == "Natal") { document.getElementById('tabela_natal').style.display = 'block'; }
	else { document.getElementById('tabela_natal').style.display = 'none';  }

	if (strCidade == "Fortaleza") { document.getElementById('tabela_fortaleza').style.display = 'block'; }
	else { document.getElementById('tabela_fortaleza').style.display = 'none';  }

	if (strCidade == "Maceio") { document.getElementById('tabela_maceio').style.display = 'block'; }
	else { document.getElementById('tabela_maceio').style.display = 'none';  }

}
// Verifica se data2 é maior que data1
function DataMaior(data1, data2) {
	
	if ( parseInt( data2.split( "/" )[2].toString() + data2.split( "/" )[1].toString() + data2.split( "/" )[0].toString() ) > parseInt( data1.split( "/" )[2].toString() + data1.split( "/" )[1].toString() + data1.split( "/" )[0].toString() ) ) { return true; }
	else { return false; }

}
*/
function Validar() {
	strNome = document.getElementById('nome').value;
	strEmail = document.getElementById('email').value;
	strCodigo = document.getElementById('codigo').value;
	
	if (!strNome) { alert('Informe seu nome.'); document.getElementById('nome').focus(); }
	else if (!strEmail) { alert('Informe seu email.'); document.getElementById('email').focus(); }
	else if (!strCodigo) { window.location = 'inscreva-se.php'; }
	else {
	ajaxGet('GET', 'ajax_confirmacao.php?nome='+strNome+'&email='+strEmail+'&codigo='+strCodigo, 'div100');
	}
}
function Avaliar() {
	strCompra = document.getElementById('frm_compra');
	strCupom = document.getElementById('cupom').value;
	
	if (strCupom.length == 15) {
		strCompra.action = 'inscreva-se-confirmacao.php';
	}
	else { strCompra.action = 'https://pagseguro.uol.com.br/security/webpagamentos/webpagto.aspx'; }
}
cidade_escolhida = "Recife";
function Escolha(spek, valor) {
	if (spek == 1) {
		if (cidade_escolhida == "Salvador") {
		document.getElementById('tipo1').checked = true;
		document.getElementById('tipo2').checked = false;
		}
		if (cidade_escolhida == "Fortaleza") {
		document.getElementById('tipo1f').checked = true;
		document.getElementById('tipo2f').checked = false;
		}
		if (cidade_escolhida == "Recife") {
		document.getElementById('tipo1r').checked = true;
		document.getElementById('tipo2r').checked = false;
		}
		if (cidade_escolhida == "Maceió") {
		document.getElementById('tipo1m').checked = true;
		document.getElementById('tipo2m').checked = false;
		}
		if (cidade_escolhida == "Natal") {
		document.getElementById('tipo1n').checked = true;
		document.getElementById('tipo2n').checked = false;
		}
		document.getElementById('item_descr_1').value = cidade_escolhida+' - IMRS - Ingresso Normal'; 
		document.getElementById('item_valor_1').value = valor; 
	}
	else if (spek == 2) {
		if (cidade_escolhida == "Salvador") {
		document.getElementById('tipo2').checked = true;
		document.getElementById('tipo1').checked = false;
		}
		if (cidade_escolhida == "Fortaleza") {
		document.getElementById('tipo2f').checked = true;
		document.getElementById('tipo1f').checked = false;
		}
		if (cidade_escolhida == "Recife") {
		document.getElementById('tipo2r').checked = true;
		document.getElementById('tipo1r').checked = false;
		}
		if (cidade_escolhida == "Maceió") {
		document.getElementById('tipo2m').checked = true;
		document.getElementById('tipo1m').checked = false;
		}
		if (cidade_escolhida == "Natal") {
		document.getElementById('tipo2n').checked = true;
		document.getElementById('tipo1n').checked = false;
		}
		document.getElementById('item_descr_1').value = cidade_escolhida+' - IMRS - Ingresso Estudante'; 
		document.getElementById('item_valor_1').value = valor; 
	}
}
function EscolhaCidade(cidade) {
	document.getElementById('opcaoCidades1').style.display = 'none';
	document.getElementById('opcaoCidades2').style.display = 'none';
	document.getElementById('opcaoCidades3').style.display = 'none';
	document.getElementById('opcaoCidades4').style.display = 'none';
	document.getElementById('opcaoCidades5').style.display = 'none';
	
	if (cidade == "Salvador") { 
	document.getElementById('opcaoCidades1').style.display = ''; 
	document.getElementById('btn_enviar').style.display = 'none'; 
	}
	else if (cidade == "Fortaleza") { 
	document.getElementById('opcaoCidades2').style.display = ''; 
	document.getElementById('btn_enviar').style.display = 'none'; 
	}
	else if (cidade == "Recife") { 
	document.getElementById('opcaoCidades3').style.display = ''; 
	document.getElementById('btn_enviar').style.display = ''; 
	}
	else if (cidade == "Maceió") {
	document.getElementById('opcaoCidades4').style.display = '';
	document.getElementById('btn_enviar').style.display = ''; 
	}
	else if (cidade == "Natal") {
	document.getElementById('opcaoCidades5').style.display = '';
	document.getElementById('btn_enviar').style.display = ''; 
	}
	
	cidade_escolhida = cidade;
		
		if (cidade_escolhida == "Salvador") {
		did = document.getElementById('tipo1');
		}
		if (cidade_escolhida == "Fortaleza") {
		did = document.getElementById('tipo1f');
		}
		if (cidade_escolhida == "Recife") {
		did = document.getElementById('tipo1r');
		}
		if (cidade_escolhida == "Maceió") {
		did = document.getElementById('tipo1m');
		}
		if (cidade_escolhida == "Natal") {
		did = document.getElementById('tipo1n');
		}
		
	if (did.checked == true) {
		document.getElementById('item_descr_1').value = cidade_escolhida+' - IMRS - Ingresso Normal'; 
	}
	else {
		document.getElementById('item_descr_1').value = cidade_escolhida+' - IMRS - Ingresso Estudante'; 
	}
}
function Proximo(idAlvo){
	valorAlvo = idAlvo + 1;
	alvo1 = 'setas'+idAlvo;
	alvo2 = 'setas'+valorAlvo;
	document.getElementById(alvo1).style.display='none';
	document.getElementById(alvo2).style.display='';
//	alert (alvo2);
}
function Anterior(idAlvo){
	valorAlvo = idAlvo - 1;
	alvo1 = 'setas'+idAlvo;
	alvo2 = 'setas'+valorAlvo;
	document.getElementById(alvo1).style.display='none';
	document.getElementById(alvo2).style.display='';
}
	
function Mostrar(alvo){
	alvo1='Mensagem';
	document.getElementById(alvo1).style.display='';
//	alert (alvo2);
}
function Esconder(alvo){
	alvo1='Mensagem';
	document.getElementById(alvo1).style.display='none';
//	alert (alvo2);
}

// Pop-up Dreamweaver ---------------------------------
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
//-----------------------------------------------------



// CSS Selector --------------------------------------
/*
CSS Browser Selector v0.2.7
Rafael Lima (http://rafael.adm.br)
http://rafael.adm.br/css_browser_selector
License: http://creativecommons.org/licenses/by/2.5/
Contributors: http://rafael.adm.br/css_browser_selector#contributors
*/
var css_browser_selector = function() {var ua=navigator.userAgent.toLowerCase(),is=function(t){return ua.indexOf(t) != -1;},h=document.getElementsByTagName('html')[0],b=(!(/opera|webtv/i.test(ua))&&/msie (\d)/.test(ua))?('ie ie'+RegExp.$1):is('firefox/2')?'gecko ff2':is('firefox/3')?'gecko ff3':is('gecko/')?'gecko':is('opera/9')?'opera opera9':/opera (\d)/.test(ua)?'opera opera'+RegExp.$1:is('konqueror')?'konqueror':is('applewebkit/')?'webkit safari':is('mozilla/')?'gecko':'',os=(is('x11')||is('linux'))?' linux':is('mac')?' mac':is('win')?' win':'';var c=b+os+' js'; h.className += h.className?' '+c:c;}();

//-----------------------------------------------------




// AJAX básico ---------------


function Reposicao(url) {
        var httpRequest;

        if (window.XMLHttpRequest) { // Mozilla, Safari, ...
            httpRequest = new XMLHttpRequest();
            if (httpRequest.overrideMimeType) {
                httpRequest.overrideMimeType('text/xml');
                // See note below about this line
            }
        } 
        else if (window.ActiveXObject) { // IE
            try {
                httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
                } 
                catch (e) {
                           try {
                                httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
                               } 
                             catch (e) {}
                          }
                                       }

        if (!httpRequest) {
            alert('Giving up :( Cannot create an XMLHTTP instance');
            return false;
        }
        httpRequest.onreadystatechange = function() { Escrever(httpRequest); };
        httpRequest.open('GET', url, true);
        httpRequest.send('');

    }

    function Escrever(httpRequest) {

        if (httpRequest.readyState == 4) {
            if (httpRequest.status == 200) {
                document.getElementById('ConteudoAjax').innerHTML =	httpRequest.responseText;
            } else {
                alert('There was a problem with the request.');
            }
        }

    }

//-----------------------------------------------------



// Correctly handle PNG transparency in Win IE 5.5 or higher.
// http://homepage.ntlworld.com/bobosola. Updated 02-March-2004

function correctPNG() 
   {
   for(var i=0; i<document.images.length; i++)
      {
	  var img = document.images[i]
	  var imgName = img.src.toUpperCase()
	  if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
	     {
		 var imgID = (img.id) ? "id='" + img.id + "' " : ""
		 var imgClass = (img.className) ? "class='" + img.className + "' " : ""
		 var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
		 var imgStyle = "display:inline-block;" + img.style.cssText 
		 if (img.align == "left") imgStyle = "float:left;" + imgStyle
		 if (img.align == "right") imgStyle = "float:right;" + imgStyle
		 if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle		
		 var strNewHTML = "<span " + imgID + imgClass + imgTitle
		 + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
	     + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
		 + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
		 img.outerHTML = strNewHTML
		 i = i-1
	     }
      }
   }
window.attachEvent("onload", correctPNG);

//-----------------------------------------------------