function click() {
	if (event.button==2||event.button==3) {
		oncontextmenu='return false';
	}
}

document.onmousedown=click
document.oncontextmenu = new Function("return false;")

if(Browser == undefined){
	var Browser = {
		isIE: function(){ return (window.ActiveXObject && document.all && navigator.userAgent.toLowerCase().indexOf("msie") > -1  && navigator.userAgent.toLowerCase().indexOf("opera") == -1) ? true : false; }
	}
}

var Flash = function(movie, id, width, height, initParams){

	this.html = "";
	this.attributes = this.params = this.variables = null;
	
	this.variables = new Array();
	this.attributes = {
		"classid": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",
		"codebase": "http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab#version=8,0,22,0",
		"type": "application/x-shockwave-flash"
	}
	this.params = { "pluginurl": "http://www.macromedia.com/go/getflashplayer_br" };
	
	if(movie) {
		this.addAttribute("data", movie);
		this.addParameter("movie", movie);
	}
	
	if(id && id != null) this.addAttribute("id", id);
	if(width) this.addAttribute("width", width);
	if(height) this.addAttribute("height", height);
	
	if(initParams != undefined){
		for(var i in initParams){
			this.addParameter(i.toString(), initParams[i]);
		}
	}
	
}
Flash.version = "1.2b";
Flash.getObjectByExceptions = function(obj, excep){
	var tempObj = {};
	for(var i in obj){
		var inclui = true;
		for(var j=0; j<excep.length; j++)
			if(excep[j] == i.toString()) { inclui = false; break; };
		if(inclui) tempObj[i] = obj[i];
	}
	return tempObj;
}
Flash.prototype.addAttribute = function(prop, val){ this.attributes[prop] = val; }
Flash.prototype.addParameter = function(prop, val){ this.params[prop] = val; }
Flash.prototype.addVariable = function(prop, val){ this.variables.push([prop, val]); }
Flash.prototype.getFlashVars = function(){
	var tempString = new Array();
	
	for(var i=0; i<this.variables.length; i++)
		tempString.push(this.variables[i].join("="));
		
	return tempString.join("&");
}
Flash.prototype.toString = function(){
	
	this.params.flashVars = this.getFlashVars();
	if(Browser.isIE()){
		//IE
		this.html = "<object";
		var attr = Flash.getObjectByExceptions(this.attributes, ["type", "data"]);
		for(var i in attr) if(i.toString() != "extend") this.html += " " + i.toString() + " = \"" + attr[i] + "\"";
		this.html += "> ";
		var params = Flash.getObjectByExceptions(this.params, ["pluginurl", "extend"]);
		for(var i in params) if(i.toString() != "extend") this.html += "<param name=\"" + i.toString() + "\" value=\"" + params[i] + "\" /> ";
		this.html += " </object>";
	} else {
		//non-IE
		this.html = "<!--[if !IE]> <--> <object";
		var attr = Flash.getObjectByExceptions(this.attributes, ["classid", "codebase"]);
		for(var i in attr) if(i.toString() != "extend") this.html += " " + i.toString() + " = \"" + attr[i] + "\"";
		this.html += "> ";
		var params = Flash.getObjectByExceptions(this.params, ["extend"]);
		for(var i in params) if(i.toString() != "extend") this.html += "<param name=\"" + i.toString() + "\" value=\"" + params[i] + "\" /> ";
		this.html += " </object> <!--> <![endif]-->";
	}

	return this.html;
	
}
Flash.prototype.write = Flash.prototype.outIn = Flash.prototype.writeIn = function(w){
	if(typeof w == "string" && document.getElementById) var w = document.getElementById(w);
	if( w != undefined && w ) w.innerHTML = this.toString();
	else document.write( this.toString() );
}

function movepage(x,y){
	document.form1.action=x;
	document.form1.bt.value=y;
	document.form1.submit();
}

function cad() {
	if(document.form1.nome.value==''){
		alert('Informe o seu Nome');
		document.form1.nome.focus();
		return false;
	}
	if(document.form1.email.value==''){
		alert('Informe o seu E-mail');
		document.form1.email.focus();
		return false;
	}
	document.form1.submit();
	return true;
}

function Formatasalario(campo,tammax,teclapres,caracter){
	if(teclapres == null || teclapres == "undefined"){
		var tecla = -1;
	}else{
		var tecla = teclapres.keyCode;
	}
	if(caracter == null || caracter == "undefined"){
		caracter = ".";
	}

	vr = campo.value;
	if(caracter != ""){
		vr = troca(vr,caracter,"");
	}
	vr = troca(vr,"/","");
	vr = troca(vr,",","");
	vr = troca(vr,".","");

	tam = vr.length;
	if(tecla > 0){
		if(tam < tammax && tecla != 18){
			tam = vr.length + 1;
		}
	    		
		if(tecla == 18){
			tam = tam - 1;
		}
	}
	
	if(tecla == -1 || tecla == 18 || tecla >= 48 && tecla <= 57 || tecla >= 96 && tecla <= 105){
		if(tam <= 2){ 
			campo.value = vr;
		}
		if((tam > 2) && (tam <= 5)){
			campo.value = vr.substr(0, tam - 2) + ',' + vr.substr(tam - 2, tam);
		}
		if((tam >= 6) && (tam <= 8)){
			campo.value = vr.substr(0, tam - 5) + caracter + vr.substr(tam - 5, 3) + ',' + vr.substr(tam - 2, tam);
		}
		if((tam >= 9) && (tam <= 11)){
			campo.value = vr.substr(0, tam - 8) + caracter + vr.substr(tam - 8, 3) + caracter + vr.substr(tam - 5, 3) + ',' + vr.substr(tam - 2, tam);
		}
		if((tam >= 12) && (tam <= 14)){
			campo.value = vr.substr(0, tam - 11) + caracter + vr.substr(tam - 11, 3) + caracter + vr.substr(tam - 8, 3) + caracter + vr.substr(tam - 5, 3) + ',' + vr.substr(tam - 2, tam);
		}
		if((tam >= 15) && (tam <= 17)){
			campo.value = vr.substr(0, tam - 14) + caracter + vr.substr(tam - 14, 3) + caracter + vr.substr(tam - 11, 3) + caracter + vr.substr(tam - 8, 3) + caracter + vr.substr(tam - 5, 3) + ',' + vr.substr(tam - 2, tam);
		}
	}
}


function troca(str,strsai,strentra){
	while(str.indexOf(strsai)>-1){
		str = str.replace(strsai,strentra);
	}
	return str;
}

function BlockKeybord(){
	if((event.keyCode < 48) || (event.keyCode > 57)){
		event.returnValue = false;
	}
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

//#####################################
//Funcoes de validação
//#####################################
function chkdt(x,k,t){
	if (k!=9) {
		if(k!=8 && k!=46 && k!=16 &&  !(k>36 && k<41)){ 
			if ((k>=48 && k<=57) || (k>=96 && k<=105)){
				if (x.value.length == 2 || x.value.length == 5) {
					x.value = x.value+"/";
				}
			} else {
				if (t=="up") {
					if (x.value.length==0) {
						x.value = "";
					} else {	
						x.value = x.value.substring(0,x.value.length-1);
					}
				}
			}
		}
		x.focus();
	}
} 

function vldt(x) {
	var erro=0;
	if (x.value.length>0){
		d = x.value.substring(0, 2);
		m = x.value.substring(3, 5);
		a = x.value.substring(6, 10);
		if (d<1 || d>31 || m<1 || m>12 || a<1880) {erro=1;}
		if (m==4 || m==6 || m==9 || m==11){
			if (d==31) {erro=1;}
		}
		if (m==2){
			var b=parseInt(a/4);
			//if (isnan(b)) {erro=1;}
			if (d>29 || d==29 && ((a/4)!=parseInt(a/4))) {erro=1;} 
		}
	}
	if (erro==1) {
		alert('Data Incorreta: '+ x.value);
		x.value = "";
		x.focus();
	}
}
