function AbreJanela(link,x,y,s) {
	var t = (screen.height - y) / 2;
	var e = (screen.width - x) / 2;

	window.open(link,x+y,'width=' + x + ',height=' + y + ',scrollbars=' + s + ',toolbar=0,location=0,status=0,menubar=0,resizable=0,left=' + e + ',top=' + t + '');
}

var PopUp = null
function FocaJanela(){
	if (PopUp!=null && !PopUp.closed){
		PopUp.focus();
	}
}

function Fecha(Tipo){
	if(Tipo=='C'){
		if(confirm('Deseja cancelar esta operação?')){
			window.close()
			window.opener.location.reload();
		}else{
			return false;
		}
	}else if(Tipo=='F'){
		window.close()
		window.opener.location.reload();
	}else{
		window.close();
	}
}

function PageLoad(){
	window.opener.location.reload();
}

function Voltar(){
	history.back(0);
}

// ******************************************************
// *********** mostra determinada area ************
// ******************************************************
function ShowHide(IdObjeto){
	if (document.getElementById(IdObjeto).style.display == 'block'){
		document.getElementById(IdObjeto).style.display = 'none';
	} else {
		document.getElementById(IdObjeto).style.display = 'block';
	}
}
function Show(IdObjeto){
	document.getElementById(IdObjeto).style.display = '';
}
function Hide(IdObjeto){
	document.getElementById(IdObjeto).style.display = 'none';
}

function Confirma(Msg,Url){
	if(confirm(Msg)){
		location.href = Url
		return false;
	}else{
		return false;
	}
}


function ExibeImg(Valor,ObjDestino){
	document.getElementById(ObjDestino).src = Valor;
}
function FrmEnvia(Confirma,Msg,ObjId){
	if(Confirma==1){
		if(confirm(Msg)){
			document.getElementById(ObjId).submit();
		}
	}else{
		document.getElementById(ObjId).submit();
	}
	return false;
}

function GridFoto(NomeClass,IdObj,idCheck){
	var CheckBox = document.getElementById(idCheck).checked;
	if(CheckBox == false){
		document.getElementById(IdObj).className = NomeClass;
	}
}
function ClicaFoto(IdObj,idCheck){
	CheckBox = document.getElementById(idCheck).checked;
	if(CheckBox == false){
		document.getElementById(idCheck).checked = true;
		document.getElementById(IdObj).className = 'FotoC';
	}else{
		document.getElementById(idCheck).checked = false;
		document.getElementById(IdObj).className = 'FotoA';
	}
	//alert(document.getElementById(idCheck).checked);
}

function GridCategoria(NomeClass,IdObj,idCheck){
	var CheckBox = document.getElementById(idCheck).checked;
	if(CheckBox == false){
		document.getElementById(IdObj).className = NomeClass;
	}
}
function ClicaCategoria(IdObj,idCheck){
	CheckBox = document.getElementById(idCheck).checked;
	if(CheckBox == false){
		document.getElementById(idCheck).checked = true;
		document.getElementById(IdObj).className = 'CategoriaC';
	}else{
		document.getElementById(idCheck).checked = false;
		document.getElementById(IdObj).className = 'CategoriaA';
	}
	//alert(document.getElementById(idCheck).checked);
}











function GridSelecionar(){
	CheckBox = document.getElementsByTagName('input');
	for (var i=0;i<CheckBox.length;i++){
		if(CheckBox[i].type=='checkbox'){
			CheckBox[i].checked = true;
		}
	}
}

function Base(){
	document.getElementById('Base').style.bottom = '0px';
}
//window.onresize = Base;

function WSize(W,H){
	window.resizeTo(W,H)
	
	var t = (screen.height - H) / 2;
	var e = (screen.width - W) / 2;
	
	window.moveTo(e,t);
}


FonteI = 14
function Fonte(Tipo,idObj){
	if(Tipo=='Mais' && FonteI<24){
		FonteI++
	}else if(Tipo=='Menos' && FonteI>8){
		FonteI--
	}
	document.getElementById(idObj).style.fontSize = FonteI+"px";
	//alert(FonteI)
}

function IsEmail(pVal){
	var reTipo = /^[\w!#$%&'*+\/=?^`{|}~-]+(\.[\w!#$%&'*+\/=?^`{|}~-]+)*@(([\w-]+\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;
	return reTipo.test(pVal);
}
function ValidaIndique(){
	SeuNome = document.getElementById('SeuNome');
	SeuEmail = document.getElementById('SeuEmail');
	NomeAmigo = document.getElementById('NomeAmigo');
	EmailAmigo = document.getElementById('EmailAmigo');
	
	if(SeuNome.value==''){
		alert('Informe seu nome.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		SeuNome.focus();
		return false;
	}
	
	if(SeuEmail.value==''){
		alert('Informe seu E-mail.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		SeuEmail.focus();
		return false;
	}

	if(IsEmail(SeuEmail.value)==false){
		alert('Seu E-mail é inválido.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		SeuEmail.focus();
		return false;
	}

	if(NomeAmigo.value==''){
		alert('Informe o nome de seu amigo.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		NomeAmigo.focus();
		return false;
	}

	if(EmailAmigo.value==''){
		alert('Informe o e-mail de seu amigo.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		EmailAmigo.focus();
		return false;
	}

	if(IsEmail(EmailAmigo.value)==false){
		alert('O E-mail de seu amigo é inválido.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		EmailAmigo.focus();
		return false;
	}

	return true;
}

function ValidaMural(){
	MuralDe = document.getElementById('MuralDe');
	MuralEmail = document.getElementById('MuralEmail');
	MuralDeCidade = document.getElementById('MuralDeCidade');
	MuralPara = document.getElementById('MuralPara');
	MuralParaCidade = document.getElementById('MuralParaCidade');
	MuralRecado = document.getElementById('MuralRecado');

	
	if(MuralDe.value==''){
		alert('Informe seu nome.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		MuralDe.focus();
		return false;
	}
	
	if(MuralEmail.value==''){
		alert('Informe seu E-mail.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		MuralEmail.focus();
		return false;
	}

	if(IsEmail(MuralEmail.value)==false){
		alert('Seu E-mail é inválido.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		MuralEmail.focus();
		return false;
	}

	if(MuralDeCidade.value==''){
		alert('Informe sua cidade.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		MuralDeCidade.focus();
		return false;
	}

	if(MuralPara.value==''){
		alert('Informe o nome do destinatário.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		MuralPara.focus();
		return false;
	}

	if(MuralParaCidade.value==''){
		alert('Informe a cidade do destinatário.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		MuralParaCidade.focus();
		return false;
	}

	if(MuralRecado.value==''){
		alert('Informe seu recado.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		MuralRecado.focus();
		return false;
	}

	return true;
}

function ValidaPedidoMusical(){
	SeuNome = document.getElementById('SeuNome');
	SeuEmail = document.getElementById('SeuEmail');
	Cidade = document.getElementById('Cidade');
	Bairro = document.getElementById('Bairro');
	EnviarPara = document.getElementById('EnviarPara');
	Programa = document.getElementById('Programa');
	Musicas = document.getElementById('Musicas');
	
	if(SeuNome.value==''){
		alert('Informe seu nome.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		SeuNome.focus();
		return false;
	}
	
	if(SeuEmail.value==''){
		alert('Informe seu E-mail.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		SeuEmail.focus();
		return false;
	}

	if(IsEmail(SeuEmail.value)==false){
		alert('Seu E-mail é inválido.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		SeuEmail.focus();
		return false;
	}

	if(Cidade.value==''){
		alert('Informe sua cidade.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		Cidade.focus();
		return false;
	}
	
	if(Bairro.value==''){
		alert('Informe seu Bairro.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		Bairro.focus();
		return false;
	}
	

	if(EnviarPara.value==''){
		alert('Informe o campo "Enviar para".');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		EnviarPara.focus();
		return false;
	}

	if(Programa.value=='0'){
		alert('Selecione um programa.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		Programa.focus();
		return false;
	}

	if(Musicas.value==''){
		alert('Informe a(s) música(s) que deseja pedir.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		Musicas.focus();
		return false;
	}

	return true;
}

function ValidaContato(){
	Nome = document.getElementById('Nome');
	Email = document.getElementById('Email');
	Assunto = document.getElementById('Assunto');
	Mensagem = document.getElementById('Mensagem');
	
	if(Nome.value==''){
		alert('Informe seu nome.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		Nome.focus();
		return false;
	}
	
	if(Email.value==''){
		alert('Informe seu E-mail.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		Email.focus();
		return false;
	}

	if(IsEmail(Email.value)==false){
		alert('Seu E-mail é inválido.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		Email.focus();
		return false;
	}

	if(Assunto.value==''){
		alert('Informe o assunto.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		Assunto.focus();
		return false;
	}
	
	if(Mensagem.value==''){
		alert('Informe a mensagem.');
		//SeuNome.style.backgroundColor = '#FFE6E6';
		Mensagem.focus();
		return false;
	}
	

	return true;
}

function ValidaPromocao(){
	ParticipanteNome = document.getElementById('ParticipanteNome');
	ParticipanteTelefone = document.getElementById('ParticipanteTelefone');
	ParticipanteEmail = document.getElementById('ParticipanteEmail');
	ParticipanteEstado = document.getElementById('ParticipanteEstado');
	ParticipanteCidade = document.getElementById('ParticipanteCidade');
	ParticipanteBairro = document.getElementById('ParticipanteBairro');
	ParticipanteRua = document.getElementById('ParticipanteRua');
	ParticipanteNumero = document.getElementById('ParticipanteNumero');
	ParticipanteResposta = document.getElementById('ParticipanteResposta');
	
	if(ParticipanteNome.value==''){
		alert('Informe seu nome.');
		ParticipanteNome.style.backgroundColor = '#FFE6E6';
		ParticipanteNome.focus();
		return false;
	}else{
		ParticipanteNome.style.backgroundColor = '#E4E9EC';
	}
	
	if(ParticipanteTelefone.value==''){
		alert('Informe seu telefone.');
		ParticipanteTelefone.style.backgroundColor = '#FFE6E6';
		ParticipanteTelefone.focus();
		return false;
	}else{
		ParticipanteTelefone.style.backgroundColor = '#E4E9EC';
	}

	if(ParticipanteEmail.value==''){
		alert('Informe seu E-mail.');
		ParticipanteEmail.style.backgroundColor = '#FFE6E6';
		ParticipanteEmail.focus();
		return false;
	}else{
		ParticipanteEmail.style.backgroundColor = '#E4E9EC';
	}

	if(IsEmail(ParticipanteEmail.value)==false){
		alert('Seu E-mail é inválido.');
		ParticipanteEmail.style.backgroundColor = '#FFE6E6';
		ParticipanteEmail.focus();
		return false;
	}else{
		ParticipanteEmail.style.backgroundColor = '#E4E9EC';
	}

	if(ParticipanteEstado.value==''){
		alert('Informe seu estado.');
		ParticipanteEstado.style.backgroundColor = '#FFE6E6';
		ParticipanteEstado.focus();
		return false;
	}else{
		ParticipanteEstado.style.backgroundColor = '#E4E9EC';
	}
	
	if(ParticipanteCidade.value==''){
		alert('Informe sua cidade.');
		ParticipanteCidade.style.backgroundColor = '#FFE6E6';
		ParticipanteCidade.focus();
		return false;
	}else{
		ParticipanteCidade.style.backgroundColor = '#E4E9EC';
	}

	if(ParticipanteBairro.value==''){
		alert('Informe seu bairro.');
		ParticipanteBairro.style.backgroundColor = '#FFE6E6';
		ParticipanteBairro.focus();
		return false;
	}else{
		ParticipanteBairro.style.backgroundColor = '#E4E9EC';
	}

	if(ParticipanteRua.value==''){
		alert('Informe sua rua.');
		ParticipanteRua.style.backgroundColor = '#FFE6E6';
		ParticipanteRua.focus();
		return false;
	}else{
		ParticipanteRua.style.backgroundColor = '#E4E9EC';
	}

	if(ParticipanteNumero.value==''){
		alert('Informe seu número.');
		ParticipanteNumero.style.backgroundColor = '#FFE6E6';
		ParticipanteNumero.focus();
		return false;
	}else{
		ParticipanteNumero.style.backgroundColor = '#E4E9EC';
	}

	if(ParticipanteResposta.value==''){
		alert('Informe a resposta da promoção.');
		ParticipanteResposta.style.backgroundColor = '#FFE6E6';
		ParticipanteResposta.focus();
		return false;
	}else{
		ParticipanteResposta.style.backgroundColor = '#E4E9EC';
	}	
	return true;
}


function ConteudoFlash(swf,largura,altura,VSpace,HSpace){
	STRFlash = '<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="'+largura+'" height="'+altura+'" vspace="'+VSpace+'" hspace="'+HSpace+'">'
	STRFlash += '<param name="movie" value="'+swf+'" />'
    STRFlash += '<param name="quality" value="high" />'
    STRFlash += '<param name="wmode" value="transparent" />'
	STRFlash += '<embed src="'+swf+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+largura+'" height="'+altura+'" wmode="transparent" vspace="'+VSpace+'" hspace="'+HSpace+'"></embed>'
	STRFlash += '</object>'
	document.write(STRFlash);
}


function ValidaEnquete(){
	var controle = 0;
	for (i=0;i<document.FrmEnquete.elements.length;i++){
		if (document.FrmEnquete.elements[i].type == "radio"){
			if (document.FrmEnquete.elements[i].checked == true){
			controle++;
			}
		}
	}
	if (controle <= 0){
		alert("Selecione uma das opções");
		return false;
	}
	//alert(controle);
}
