/*
function loseFocus( obj )
{
	obj.className="";
}
function wonFocus( obj )
{
	obj.className = "focus";
}
*/
function Mask (objeto, formato)
{
	campo = eval (objeto);

	keypress = String.fromCharCode(window.event.keyCode);
	if ((keypress.search(/[0-9]/) != -1) && campo.value.length < formato.length)
	{
		if (formato.charAt(campo.value.length).search(/[0-9]/) == -1 )
			campo.value += formato.charAt(campo.value.length);
	}
	else 
		event.returnValue = false;
}

function MaskNum (objeto)
{
	campo = eval (objeto);
	keypress = String.fromCharCode(window.event.keyCode);
	if (keypress.search(/[0-9,]/) == -1)
		event.returnValue = false;
}

/**
*	Checa os dados do form
*/
function SendForm( obj )
	{
		var oFrm = obj.form;
		
		var aCampos = {
			'nome' : 'Nome',
			'email' : 'E-mail',
			'cidade' : 'Cidade',
			'estado' : 'Estado',
			'fone' : 'Telefone',
			'assunto' : 'Assunto',
			'mensagem' : 'Mensagem'
		};

		for(id in aCampos)
		{
			if (!document.getElementById(id).value)
			{
				window.alert('Você precisa preencher o campo "'+aCampos[id]+'"');
				document.getElementById(id).focus();
				return;
			};
		};
		
	

		oFrm.submit();
	};


function AbrePop(pagina, width, height)
{
	window.open(pagina,"pop","scrollbars=yes,status=no,width="+width+",height="+height);
}
   
function openPictureWindow_Fever(imageType, imageName, imageWidth, imageHeight, alt)
{
	newWindow = window.open("","newWindow","width="+imageWidth+",height="+(imageHeight)+",scrollbars=no, statusbar=no");
	newWindow.document.open();
	newWindow.document.write('<html><title>'+alt+'</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onblur="window.close()">'); 
	if (imageType == "swf")
	{
		newWindow.document.write('<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\" width=\"'+imageWidth+'\" height=\"'+imageHeight+'\">');
		newWindow.document.write('<param name=movie value=\"'+imageName+'\"><param name=quality value=high />');
		newWindow.document.write('<embed src=\"'+imageName+'\" quality=high pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"'+imageWidth+'\" height=\"'+imageHeight+'\">');
		newWindow.document.write('</embed></object>');
	}
	else
	{
		newWindow.document.write('<img src=\"'+imageName+'\" width='+imageWidth+' height='+imageHeight+' alt=\"'+alt+'\" onclick="window.close();" />');
	}
//	newWindow.document.write('<div style="font-family: Verdana, sans-serif; font-size: 12px; color: #444;text-align:center;margin-top: 5px;">'+alt+'</div></body></html>');
	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}


function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function ImgRestore() { //v3.0
	var oFoto = document.getElementById('foto');
	AplyFilter(oFoto);
	oFoto.src = oFoto.restoreImg;
	PlayFilter(oFoto);
	document.getElementById("legenda").innerHTML = "";
}

function AplyFilter( obj )
{
	if (document.all)	// somente IE6
		if (obj.filters)
			if (obj.filters[0])
				obj.filters[0].Apply();
}
function PlayFilter( obj )
{
	if (document.all)	// somente IE6
		if (obj.filters)
			if (obj.filters[0])
				obj.filters[0].Play();
}

function SwapImage( img, legenda, credito )
{
	var oFoto = document.getElementById('foto');
	AplyFilter(oFoto);
	oFoto.restoreImg = oFoto.src;
	oFoto.src = img;
	document.getElementById("legenda").innerHTML = legenda;
	//document.getElementById("credito").innerHTML = credito;
	PlayFilter(oFoto);
}
function FechaFlash()
{
	document.getElementById("banner_campanha").style.display = "none";
	
}
