function pageWidth() {return window.innerWidth != null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ?       document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null;} function pageHeight() {return  window.innerHeight != null? window.innerHeight : document.documentElement && document.documentElement.clientHeight ?  document.documentElement.clientHeight : document.body != null? document.body.clientHeight : null;} function posLeft() {return typeof window.pageXOffset != 'undefined' ? window.pageXOffset :document.documentElement && document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ? document.body.scrollLeft : 0;} function posTop() {return typeof window.pageYOffset != 'undefined' ?  window.pageYOffset : document.documentElement && document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ? document.body.scrollTop : 0;} function posRight() {return posLeft()+pageWidth();} function posBottom() {return posTop()+pageHeight();}
function click() {
if (event.button==2) {
alert("Todos os direitos reservados.");
}
}
document.onmousedown=click;

function exibeFash(swf, width, height, flashvar, wmode, cache) {
		noCache  = cache    || cache    == undefined ? "" : "?" + new Date();
		wmode    = wmode    || wmode    == undefined ? "opaque" : "transparent";
		flashvar =             flashvar == undefined ? "" : flashvar;

		monta_swf  = "";
		monta_swf += "<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=\""+ width +"\" height=\""+ height +"\" title=\"\">";
		monta_swf += "<param name=\"movie\" value=\""+ swf + noCache +"\" />";
		monta_swf += "<param name=\"quality\" value=\"high\" />";
		monta_swf += "<param name=\"menu\" value=\"false\" />";
		monta_swf += "<param name=\"scale\" value=\"noscale\" />";
		monta_swf += "<param name=\"salign\" value=\"t\" />";
		monta_swf += "<param name=\"wmode\" value=\""+ wmode +"\" />";
		monta_swf += "<param name=\"flashvars\" value=\""+ flashvar +"\" />";
		monta_swf += "<embed src=\""+ swf + noCache +"\" flashvars= \""+ flashvar +"\"quality=\"high\"  scale=\"noscale\" salign=\"t\" menu=\"false\" wmode=\""+ wmode +"\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\""+ width +"\" height=\""+ height +"\"></embed>";
		monta_swf += "</object>";

		document.write(monta_swf);
}

function SomenteNumeros(input) {
	if ((event.keyCode<48)||(event.keyCode>57))
		event.returnValue = false;
}

function camada( sId ) {
var sDiv = document.getElementById( sId );
if( sDiv.style.display == "none" ) {
sDiv.style.display = "block";
sDiv.style.position = "absolute";
} else {
sDiv.style.display = "none";
}
}

function get(elemento){
	return document.getElementById(elemento);
}

var chkimg = 0;

var errorMessages = new Array();
errorMessages[0] = "Imagem inválida. Carregue um arquivo com extensão JPG ou JPEG.";

var ext = new Array()
ext[0] = ".jpg";
ext[1] = ".jpeg";

function validar(campoimg) {

extensao = campoimg.value;
posicao = extensao.lastIndexOf(".");
tamanho = extensao.length;
extensao = extensao.substring(posicao, tamanho);

if (campoimg.value == "") {
} else {
var oCampo = document.getElementById(campoimg.name);
var oNovoCampo = oCampo.cloneNode( true );

for (var i = 0; i < ext.length; ++i){
if (ext[i] == extensao){
chkimg = 1;
}else{
}
}
if (chkimg == 0) {
alert(errorMessages[0]);
oCampo.parentNode.replaceChild( oNovoCampo, oCampo );
return false;
}else{
chkimg = 0;
}
}
}
