/**
* Função js para fazer chamado a arquivos em flash sem borda.
* @package index.php
* @author Murillo <webmaster2@netcompuradores.com.br>
* @version 0.0.1
* @date 2008-11-24 15:08:00
*/
function Swf($file,$height,$width,$id){
    document.writeln('    <object id="globalnav-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="' + $width + '" height="' + $height + '" id="' + $id + '" name="' + $id + '" align="top"> ');
    document.writeln('        <param name="movie" value="' + $file + '" />');
    document.writeln('        <param name="FlashVars" value="loc=en_US&htmlApp=false&gatewayURL=gwurl" />');
    document.writeln('        <param name="bgcolor" value="#ffffff" />');
    document.writeln('        <param name="menu" value="true" />');
    document.writeln('        <param name="quality" value="high" />');
    document.writeln('        <param name="salign" value="tl" />');
    document.writeln('        <param name="scale" value="noscale" />');
    document.writeln('        <param name="wmode" value="transparent"  />');
    document.writeln('        <embed id="globalnav-embed" src="' + $file + '" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="transparent" flashvars="loc=en_US&htmlApp=false&gatewayURL=gwurl" bgcolor="#ffffff" menu="false" quality="high"  align="top"  salign="tl" scale="noscale" id="' + $id + '" width="' + $width + '" height="' + $height + '"></embed>');
    document.writeln('    </object>');
}

/**
* Função js para criação de pop´s.
* @author Marcos (MKV) <webmaster@netcompuradores.com.br>
* @version 0.1.0
* @date 2008-12-04 10:12
* @Var dest = destinho
* @Var w = width
* @Var h = height
*/

function criaJanela(dest,w,h){
	window.open(dest, 'winnew', 'width='+ w +', height='+ h +'')
}



function trocaimg(destProImg,alvoProImg){
	document.getElementById("dtProimg").innerHTML = '<img src="'+ alvoProImg +'" width="214" height="214" border="0">';
}


function mascara(w,e,m,r,a){
    
	// Cancela se o evento for Backspace
    if (!e) var e = window.event
    if (e.keyCode) code = e.keyCode;
    else if (e.which) code = e.which;
    
    // Variáveis da função
    var txt  = (!r) ? w.value.replace(/[^\d]+/gi,'') : w.value.replace(/[^\d]+/gi,'').reverse();
    var mask = (!r) ? m : m.reverse();
    var pre  = (a ) ? a.pre : "";
    var pos  = (a ) ? a.pos : "";
    var ret  = "";

    if(code == 9 || code == 8 || txt.length == mask.replace(/[^#]+/g,'').length) return false;

    // Loop na máscara para aplicar os caracteres
    for(var x=0,y=0, z=mask.length;x<z && y<txt.length;){
        if(mask.charAt(x)!='#'){
            ret += mask.charAt(x); x++;
        } else{
            ret += txt.charAt(y); y++; x++;
        }
    }
    
    // Retorno da função
    ret = (!r) ? ret : ret.reverse()    
    w.value = pre+ret+pos;
}

function ValidaEmail(){
	var obj = eval("document.forms[0].email");
	var txt = obj.value;
	if ((txt.length != 0) && ((txt.indexOf("@") < 1) || (txt.indexOf('.') < 7))){
		alert('E-mail inválido');
		obj.focus();
	}
}
