// JavaScript Document
function carregaAlbum(){
	var indice = document.form1.albuns.selectedIndex;
	var valor = document.form1.albuns.options[indice].value;
	
	texto = "" + valor;
	
	location.href = "?album="+texto;
}
// JavaScript Document
function AbreAlbum(pagina)
{
        newWindow=window.open(pagina,"nova","width=637,height=470")
//        if(newWindow) return false
}
function abrirInformativo(pagina){
        newWindow=window.open(pagina,"nova",'toolbar=no,scrollbars,noresizable,width=420,height=470')
        if(newWindow)return false
    }
function abrir3etapa(pagina){
        newWindow=window.open(pagina,"nova",'toolbar=no,scrollbars,noresizable,width=500,height=470')
        if(newWindow)return false
	}
function abrirInformativoVitrine(pagina){
        newWindow=window.open(pagina,"nova",'toolbar=no,scrollbars,noresizable,width=620,height=390')
        if(newWindow)return false
	}
function abrirEvento(pagina){
        newWindow=window.open(pagina,"nova",'toolbar=no,scrollbars,noresizable,width=600,height=300')
        if(newWindow)return false
    }
function abrirPopUP(pagina,larg,alt){
		if(larg == '') larg = '400'
		if(alt == '') alt = '250'
        newWindow=window.open(pagina,"nova","width="+larg+",height="+alt)
        if(newWindow)return false
    }
function abrirRecados(pagina){
        newWindow=window.open(pagina,"nova","width=370")
        if(newWindow)return false
    }
	
function Over(opcao) {
		document.getElementById(opcao).style.backgroundColor = "#333333";
		document.getElementById(opcao).style.fontColor = "000000";
	}
function Out(opcao) {
		document.getElementById(opcao).style.backgroundColor = "#000000";
		document.getElementById(opcao).style.fontColor = "333333";
	}
function popup(pagina,larg,alt){
		if(alt == '') alt = "200";
		if(larg == '') larg = "400";
        newWindow=window.open(pagina,"nova","toolbar=no,scrollbars=auto,noresizable,width="+larg+",height="+alt)
        if(newWindow) return false
    }
function Refresh() {
		history.go(0);
	}
function mudaCombo(){
	Refresh();
	var indice = document.cadastro.categoria.selectedIndex;
	var valor = document.cadastro.categoria.options[indice].value;
	texto = "" + valor;
	
	location.href = "?categoria="+texto;
}

var reDigits = /^\d+$/;

function doDigits(pStr)
{
	if (reDigits.test(pStr)) {
		alert(pStr + " contém apenas dígitos.");
	} else if (pStr != null && pStr != "") {
		alert(pStr + " NÃO contém apenas dígitos.");
	}
}

var reDecimalPt = /^[+-]?((\d+|\d{1,3}(\.\d{3})+)(\,\d*)?|\,\d+)$/;
var reDecimalEn = /^[+-]?((\d+|\d{1,3}(\,\d{3})+)(\.\d*)?|\.\d+)$/;
var reDecimal = reDecimalPt;

function doPreco(pStr, pLang)
{
	charDec = ( pLang != "En"? ",": "." );
	eval("reDecimal = reDecimal" + pLang);
	if (reDecimal.test(pStr)) {
		//pos = pStr.indexOf(charDec);
		//decs = pos == -1? 0: pStr.length - pos - 1;
		//alert(pStr + " é um float válido (" + pLang + ") com " + decs + " decimais.");
	} else if (pStr != null && pStr != "") {
		alert("Campo \"Preço\": " + pStr + " NÃO é um valor válido.\nPreencha sempre com virgulas para separar casa decimais.");
	}
} // doDecimal

var reMoeda = /^\d{1,3}(\.\d{3})*\,\d{2}$/;

function doMoeda(pStr)
{
	if (reMoeda.test(pStr)) {
		alert(pStr + " é um valor financeiro válido.");
	} else if (pStr != null && pStr != "") {
		alert(pStr + " NÃO é um valor financeiro válido.");
	}
}

var reDate1 = /^\d{1,2}\/\d{1,2}\/\d{1,4}$/;
var reDate2 = /^[0-3]?\d\/[01]?\d\/(\d{2}|\d{4})$/;
var reDate3 = /^(0?[1-9]|[12]\d|3[01])\/(0?[1-9]|1[0-2])\/(19|20)?\d{2}$/;
var reDate4 = /^((0?[1-9]|[12]\d)\/(0?[1-9]|1[0-2])|30\/(0?[13-9]|1[0-2])|31\/(0?[13578]|1[02]))\/(19|20)?\d{2}$/;
var reDate5 = /^((0[1-9]|[12]\d)\/(0[1-9]|1[0-2])|30\/(0[13-9]|1[0-2])|31\/(0[13578]|1[02]))\/\d{4}$/;
var reDate = reDate4;

function doDate(pStr, pFmt)
{
	eval("reDate = reDate" + pFmt);
	if (reDate.test(pStr)) {
		alert(pStr + " é uma data válida.");
	} else if (pStr != null && pStr != "") {
		alert(pStr + " NÃO é uma data válida.");
	}
} // doDate

var reTime1 = /^\d{2}:\d{2}$/;
var reTime2 = /^([0-1]\d|2[0-3]):[0-5]\d$/;
var reTime3 = /^(0[1-9]|1[0-2]):[0-5]\d$/;
var reTime4 = /^\d+:[0-5]\d:[0-5]\d$/;
var reTime5 = /^\d+:[0-5]\d:[0-5]\.\d{3}\d$/;

function doTime(pStr, pFmt)
{
	eval("reTime = reTime" + pFmt);
	if (reTime.test(pStr)) {
		alert(pStr + " é um horário/tempo válido.");
	} else if (pStr != null && pStr != "") {
		alert(pStr + " NÃO é um horário/tempo válido.");
	}
} // doTime

var reEmail1 = /^[\w!#$%&'*+\/=?^`{|}~-]+(\.[\w!#$%&'*+\/=?^`{|}~-]+)*@(([\w-]+\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;
var reEmail2 = /^[\w-]+(\.[\w-]+)*@(([\w-]{2,63}\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;
var reEmail3 = /^[\w-]+(\.[\w-]+)*@(([A-Za-z\d][A-Za-z\d-]{0,61}[A-Za-z\d]\.)+[A-Za-z]{2,6}|\[\d{1,3}(\.\d{1,3}){3}\])$/;
var reEmail = reEmail3;

function doEmail(pStr, pFmt)
{
	eval("reEmail = reEmail" + pFmt);
	if (reEmail.test(pStr)) {
		alert(pStr + " é um endereço de e-mail válido.");
	} else if (pStr != null && pStr != "") {
		alert(pStr + " NÃO é um endereço de e-mail válido.");
	}
} // doEmail

function disable()
{
	document.getElementById('preco_promocao').disabled = 'true';	
}

function habilitaInputPromocao()
{
	if(!document.forms[0].promocao.checked){
		document.forms[0].preco_promocao.disabled = true;
		document.forms[0].validade_promocao.disabled = true;
	}
	if(document.forms[0].promocao.checked){
	document.forms[0].preco_promocao.disabled = false;
	document.forms[0].validade_promocao.disabled = false;
	}
}

function checaBox(){
	if(!document.forms[0].promocao.checked){
		document.forms[0].preco_promocao.disabled = true;
		document.forms[0].validade_promocao.disabled = true;
		alert('Para digitar uma valor para promoção a opção Promoção precisa estar habilitata!')
	}
}
function popUp(theURL,winName,features, myWidth, myHeight, isCenter,titulo) { //v3.0
  if(window.screen)if(isCenter)if(isCenter=="true"){
    var myLeft = (screen.width-myWidth)/2;
    var myTop = (screen.height-myHeight)/2;
    features+=(features!='')?',':'';
    features+='titlebar=' + titulo + ',left='+myLeft+',top='+myTop;
  }
  window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}

function noticia(url) {
  popUp(url,'academiaPersonalCarePopUp','toolbar=no,scrollbars,noresizable',600,450,true);
}

function artigo(url) {
  popUp(url,'academiaPersonalCarePopUp','toolbar=no,scrollbars,noresizable',600,450,true);
}
function foto(pagina){
        newWindow=window.open(pagina,"nova","width=635,height=485")
        if(newWindow)return false
    }
function indica(url) {
  popUp(url,'indicaAmigo','toolbar=no,scrollbars,resizable',500,180,true);
}

function submitform()
{
  document.form.submit();
}

function InsertSampleMovie(arquivo,largura,altura)
{
  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="' + largura + '" height="' + altura + '">\n');
  document.write('<param name="movie" value="' + arquivo + '.swf" />\n');
  document.write('<param name="quality" value="high" />\n');
  document.write('<param name="menu" value="false" />\n');
  document.write('<param name="wmode" value="transparent" />\n');
  document.write('<embed src="' + arquivo + '.swf" wmode="transparent" menu="false" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="' + largura + '" height="' + altura + '"></embed>\n');
  document.write('</object>\n');
}

function pngTransparente(arquivo)
{
		if(navigator.appName == 'Microsoft Internet Explorer') 	document.getElementById('fundoP').style.filter = ("progid:DXImageTransform.Microsoft.AlphaImageLoader(src='img/" + arquivo + ".png')");
		else 													document.getElementById('fundoP').style.backgroundImage = "url(img/" + arquivo + ".png)";
//		alert(navigator.appName);
}
//pngTransparente();
