//função que para exibir o flash
function mostra_flash(url, 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+'" title="">');
	 document.write('<param name="movie" value="'+url+'" />');
	 document.write('<param name="wmode" value="transparent"> ');
	 document.write('<param name="quality" value="high" />');
	 document.write('<embed src="'+url+'" quality="high" wmode="transparent" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+largura+'" height="'+altura+'"></embed></object>'); 
}

//função para mostrar e ocultar objetos
function mostra(id){
 document.getElementById(id).style.display = '';
}
function oculta(id){
 document.getElementById(id).style.display = 'none';
}
//pop-up
function jsf_popup(url, titulo, largura, altura, scrollbar) 
{
	//alert(screen.width);
	var top = (screen.Height / 2 ) - ( largura / 2 );
	var left = (screen.width / 2 ) - ( altura / 2 );
	var myWin = window.open(url ,titulo ,'width=' + largura + ', height=' + altura +', scrollbars=' + scrollbar + ', toolbar=no, location=no, status=yes, menubar=no, resizable=no, left='+left+', top='+top);
	myWin.focus();
}

/////////////////////////////
function trocaFoto(campo)
{
    var foto = document.getElementById('img_principal').src ;
    document.getElementById('img_principal').src = document.getElementById(campo).src;
	
	document.getElementById(campo).src = foto;
	
	
	var var_link = document.getElementById(campo).src
	
	var_link = var_link.replace("_mini.",".") ;
	
	document.getElementById('link_imagem').value =  var_link;
}
//////////////////////////////////////////////////////////////
function jMascara (objForm, strField, sMask, evtKeyPress) {
    var i, nCount, sValue, fldLen, mskLen,bolMask, sCod, nTecla;

      if(window.event) { // Internet Explorer
        nTecla = evtKeyPress.keyCode; }
      else if(evtKeyPress.which) { // Nestcape
        nTecla = evtKeyPress.which;
      }

      sValue = objForm[strField].value;

      // Limpa todos os caracteres de formatação que
      // já estiverem no campo.
      sValue = sValue.toString().replace( "-", "" );
      sValue = sValue.toString().replace( "-", "" );
      sValue = sValue.toString().replace( ".", "" );
      sValue = sValue.toString().replace( ".", "" );
      sValue = sValue.toString().replace( "/", "" );
      sValue = sValue.toString().replace( "/", "" );
      sValue = sValue.toString().replace( "(", "" );
      sValue = sValue.toString().replace( "(", "" );
      sValue = sValue.toString().replace( ")", "" );
      sValue = sValue.toString().replace( ")", "" );
      sValue = sValue.toString().replace( " ", "" );
      sValue = sValue.toString().replace( " ", "" );
      fldLen = sValue.length;
      mskLen = sMask.length;

      i = 0;
      nCount = 0;
      sCod = "";
      mskLen = fldLen;

      if (nTecla != 8) { // backspace
        if (sMask.charAt(i-1) == "9") { // apenas números...
          return ((nTecla > 47) && (nTecla < 58)); } // números de 0 a 9
        else { // qualquer caracter...

		
		  while (i <= mskLen) {
	        bolMask = ((sMask.charAt(i) == "-") || (sMask.charAt(i) == ".") || (sMask.charAt(i) == "/"))
	        bolMask = bolMask || ((sMask.charAt(i) == "(") || (sMask.charAt(i) == ")") || (sMask.charAt(i) == " "))
	
	        if (bolMask) {
	          sCod += sMask.charAt(i);
	          mskLen++; }
	        else {
	          sCod += sValue.charAt(nCount);
	          nCount++;
	        }
	
	        i++;
	      }
	
	      objForm[strField].value = sCod;

          return true;
        } }
      else {
        return true;
      }
    }

/////////////////////////////////////////////////////////////////////////////////////////////////

function jCampoNumerico ( x , y , evtKeyPress )
{
// Inicializa a variavel
var nTecla = 0;
// Verifica plataforma
if (document.all)
{
// Plataformas tipo IE
nTecla = evtKeyPress.keyCode ;
}
else
{
// Plataformas tipo NETSCAPE
nTecla = evtKeyPress.which ;
}
// Verifica tecla pressionada
if ((( nTecla > 47 ) && ( nTecla < 58 ))  // numerico (0123456789)
|| ( nTecla == 8   )   // backspace
|| ( nTecla == 127 )   // delete
|| ( nTecla == 0   )   // teclas nao definidas
//|| ( nTecla == 9   )   // tabulacao
|| ( nTecla == 13  )   // enter
//|| ( nTecla == 44  )   // , (vírgula)
//|| ( nTecla == 46  ))  // . (ponto)
)
{
// Digita a tecla pressionada
return true;
}
else
{
// Ignora a tecla pressionada
return false;
}
}