 //Verifica qual o browser do visitante e armazena na variável púbica clientNavigator,
 //Caso Internet Explorer(IE) outros (Other)
if (navigator.appName.indexOf('Microsoft') != -1){
 	clientNavigator = "IE";
}else{
	clientNavigator = "Other";
}

function ExibeFlash(w,h,wmode,movie) {
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+w+'" height="'+h+'">');
	document.write('<param name="wmode" value="'+wmode+'"/>');
	document.write('<param name="quality" value="high"/>');
	document.write('<param name="menu" value="false"/>');
	document.write('<param name="movie" value="'+movie+'"/>');
	document.write('<embed src="'+movie+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="'+wmode+'" menu="false" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"></embed>');
	document.write('</object>');
}

function ExibeFlashNoScale(w,h,wmode,movie) {
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+w+'" height="'+h+'">');
	document.write('<param name="scale" value="noscale">');
	document.write('<param name="wmode" value="'+wmode+'">');
	document.write('<param name="quality" value="high">');
	document.write('<param name="menu" value="false">');
	document.write('<param name="movie" value="'+movie+'">');
	document.write('<embed src="'+movie+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="'+wmode+'" scale="noscale" menu="false" type="application/x-shockwave-flash" width="'+w+'" height="'+h+'"></embed>');
	document.write('</object>');
}

// Permite somente números - onkeypress="return SoNumeros(event);"
function SoNumeros(caracter) {
   var tecla = 0;
   if (caracter.keyCode != '') {
      tecla = event.keyCode;
   }
   else {
      tecla = caracter.which;
   }

  if(tecla > 47 && tecla < 58) { // numeros de 0 a 9
		return true;
   }else 
      if ((tecla == 0) || (tecla == 8) || (tecla == 13)) { // backspace e Del
        return true;
    }
      else {
         return false;
    }

}

// Mascara moeda - onKeyPress="return(Moeda(this,'.',',',event))"
function Moeda(objTextBox, SeparadorMilesimo, SeparadorDecimal, e){
    var sep = 0;
    var key = '';
    var i = j = 0;
    var len = len2 = 0;
    var strCheck = '0123456789';
    var aux = aux2 = '';
    var whichCode = (window.Event) ? e.which : e.keyCode;
    if (whichCode == 13) return true;
    key = String.fromCharCode(whichCode); // Valor para o código da Chave
    if (strCheck.indexOf(key) == -1) return false; // Chave inválida
    len = objTextBox.value.length;
    for(i = 0; i < len; i++)
        if ((objTextBox.value.charAt(i) != '0') && (objTextBox.value.charAt(i) != SeparadorDecimal)) break;
    aux = '';
    for(; i < len; i++)
        if (strCheck.indexOf(objTextBox.value.charAt(i))!=-1) aux += objTextBox.value.charAt(i);
    aux += key;
    len = aux.length;
    if (len == 0) objTextBox.value = '';
    if (len == 1) objTextBox.value = '0'+ SeparadorDecimal + '0' + aux;
    if (len == 2) objTextBox.value = '0'+ SeparadorDecimal + aux;
    if (len > 2) {
        aux2 = '';
        for (j = 0, i = len - 3; i >= 0; i--) {
            if (j == 3) {
                aux2 += SeparadorMilesimo;
                j = 0;
            }
            aux2 += aux.charAt(i);
            j++;
        }
        objTextBox.value = '';
        len2 = aux2.length;
        for (i = len2 - 1; i >= 0; i--)
        objTextBox.value += aux2.charAt(i);
        objTextBox.value += SeparadorDecimal + aux.substr(len - 2, len);
    }
    return false;
}

// Verifica data - onBlur="VerificaData(this)"
function VerificaData(data)
 { 
	if (data.value != "") {
	dia = (data.value.substring(0,2));
	mes = (data.value.substring(3,5)); 
	ano = (data.value.substring(6,10)); 
	situacao = ""; 
	if ((dia < 01)||(dia < 01 || dia > 30) && (  mes == 04 || mes == 06 || mes == 09 || mes == 11 ) || dia > 31)
	{ 
		situacao = "falsa"; 
	} 
	
	if (mes < 01 || mes > 12 )
	{ 
		situacao = "falsa"; 
	}
	
	if (mes == 2 && ( dia < 01 || dia > 29 || ( dia > 28 && (parseInt(ano / 4) != ano / 4))))
	{ 
		situacao = "falsa"; 
	} 
	
	if (ano < 2000)
	{ 
		situacao = "falsa"; 
	} 

	if (situacao == "falsa")
	{ 
		data.select();
		alert("Data inválida!"); 
	}
 }
}

//Ajusta máscara de Data e só permite digitação de números - onKeypress="return MascaraData(this, event);"
function MascaraData(input, evnt){
 	if (input.value.length == 2 || input.value.length == 5){
 		if(clientNavigator == "IE"){
 			input.value += "/";
 		}else{
 			if(evnt.keyCode == 0){
 				input.value += "/";
 			}
 		}
 	}
//Chama a função Bloqueia_Caracteres para só permitir a digitação de números
 	return SoNumeros(evnt);
}

// bloqueia seleção
// function disableselect(e){return false}
// function reEnable(){return true}
// document.onselectstart=new Function ("return false")
// if (window.sidebar){document.onmousedown=disableselect
// document.onclick=reEnable}

// oculta menu - clique inverso
//var message="";
//function clickIE() {if (document.all) {(message);return false;}}
//function clickNS(e) {if 
//(document.layers||(document.getElementByid&&!document.all)) {
//if (e.which==2||e.which==3) {(message);return false;}}}
//if (document.layers) 
//{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
//else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
//document.oncontextmenu=new Function("return false")

function Fotos(URL) {
   var width = 450;
   var height = 270;
   var left = (screen.width - width) / 2;
   var top = (screen.height - height) / 2;
   window.open(URL,'Fotos', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=1, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
}

function Fotos2(URL) {
   var width = 400;
   var height = 150;
   var left = (screen.width - width) / 2;
   var top = (screen.height - height) / 2;
   window.open(URL,'Fotos2', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
}

function Membro(Cod) {
   var width = 300;
   var height = 268;
   var left = (screen.width - width) / 2;
   var top = (screen.height - height) / 2;
   window.open('membro.asp?Membro='+Cod+'','Membro', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
}

function Inscritos(URL) {
   var width = 517;
   var height = 400;
   var left = (screen.width - width) / 2;
   var top = (screen.height - height) / 2;
   window.open(URL,'Inscritos', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=1, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
}

function Recado(URL) {
   var width = 400;
   var height = 470;
   var left = (screen.width - width) / 2;
   var top = (screen.height - height) / 2;
   window.open(URL,'Recado', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=no, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
}

function Classificado(URL) {
   var width = 417;
   var height = 410;
   var left = (screen.width - width) / 2;
   var top = (screen.height - height) / 2;
   window.open(URL,'Classificado', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=1, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
}

function Galeria(URL) {
   var width = 667;
   var height = 475;
   var left = (screen.width - width) / 2;
   var top = (screen.height - height) / 2;
   window.open(URL,'Galeria', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=1, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
}

function Videos(URL) {
   var width = 720;
   var height = 650;
   var left = (screen.width - width) / 2;
   var top = (screen.height - height) / 2;
   window.open(URL,'GaleriaVideos', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=1, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
}

function Comente(URL) {
   var width = 427;
   var height = 410;
   var left = (screen.width - width) / 2;
   var top = (screen.height - height) / 2;
   window.open(URL,'Comentario', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=1, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
}

function AddCategoria() {
   var width = 400;
   var height = 200;
   var left = (screen.width - width) / 2;
   var top = (screen.height - height) / 2;
   window.open('linkcategorias.asp','Categoria', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=1, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
}

function PoupImpressao(URL) {
   var width = 500;
   var height = 400;
   var left = (screen.width - width) / 2;
   var top = (screen.height - height) / 2;
   window.open(URL,'Impressao', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=1, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
}
