function showMonth (num, total) {
	for (var i=1; i <= total; i++) {
		if (num == i) {
			xDisplay('mes' + num);
			xGetElementById('lnkmes' + num).style.color				= 'white';
			xGetElementById('lnkmes' + num).style.textDecoration	= 'none';
			xGetElementById('lnkmes' + num).style.cursor				= 'text';
		} else {
			xNoDisplay('mes' + i);
			xGetElementById('lnkmes' + i).style.color				= '#DFE215';
			xGetElementById('lnkmes' + i).style.textDecoration	= 'underline';
			xGetElementById('lnkmes' + i).style.cursor			= 'pointer';
		}
	}
}

function getCookie(NameOfCookie)
{
	if (document.cookie.length > 0)
	{
		begin = document.cookie.indexOf(NameOfCookie+"=");
		if (begin != -1)
		{
			begin += NameOfCookie.length+1;
			end = document.cookie.indexOf(";", begin);
			if (end == -1)
			{
				end = document.cookie.length;
			}
			return unescape(document.cookie.substring(begin, end));
		}
	}
	return null;
}

function setCookie(NameOfCookie, value, expiredays)
{
	var ExpireDate = new Date ();
	ExpireDate.setTime(ExpireDate.getTime() + (expiredays * 24 * 3600 * 1000));
	document.cookie = NameOfCookie + "=" + escape(value) + ((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());
}


function delCookie (NameOfCookie)
{
	if (getCookie(NameOfCookie))
	{
		document.cookie = NameOfCookie + "=" + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
	}
}

function val_frm()
{
	lenUsuNome  = document.frm_contato.CON_USU_NOME.value.length;
	lenUsuEmail = document.frm_contato.CON_USU_EMAIL.value.length;
	lenMensagem = document.frm_contato.CON_MENSAGEM.value.length;
	var s_msg   = 'Por favor:\n';
	var send    = true;

	if (lenUsuNome < 1)
	{
		s_msg = '' + s_msg + '' + '\nVocê precisa informar seu nome.';
		var send = false;
	}

	if (lenMensagem < 1)
	{
		s_msg = '' + s_msg + '' + '\nQual mensagem deseja nos enviar?';
		var send = false;
	}

	if (lenUsuEmail < 1)
	{
		s_msg = '' + s_msg + '' + '\nVocê precisa informar seu e-mail corretamente.';
		var send = false;
	}

	if (send)
	{
		document.frm_contato.submit();
		return true;
	} else
	{
		alert(s_msg);
		return false;
	}
}

function val_frm_news(lang)
{
	lenUsuNome  = document.frm_news.CON_USU_NOME.value.length;
	lenUsuEmail = document.frm_news.CON_USU_EMAIL.value.length;
	var s_msg   = 'Por favor:\n';
	var send    = true;

	if (lang == 'es-es') {
		if (lenUsuNome < 1 || document.frm_news.CON_USU_NOME.value == 'Escriba su nombre')
		{
			s_msg = '' + s_msg + '' + '\nEscriba su nombre.';
			var send = false;
		}

		if (lenUsuEmail < 1 || document.frm_news.CON_USU_EMAIL.value == 'Su e-mail')
		{
			s_msg = '' + s_msg + '' + '\nEscriba su email.';
			var send = false;
		}

	} else {
		if (lenUsuNome < 1 || document.frm_news.CON_USU_NOME.value == 'Insira seu nome')
		{
			s_msg = '' + s_msg + '' + '\nInforme seu nome.';
			var send = false;
		}

		if (lenUsuEmail < 1 || document.frm_news.CON_USU_EMAIL.value == 'Seu e-mail')
		{
			s_msg = '' + s_msg + '' + '\nInforme seu e-mail corretamente.';
			var send = false;
		}
	}

	if (send)
	{
		document.frm_news.submit();
		return true;
	} else
	{
		alert(s_msg);
		return false;
	}
}

/**
* Opens a popup window
*
* @param string url
* @param int width
* @param int height
* @param boolean scroll
* @param string name
*/
function hrefPopup(url, width, height, scroll, name) {

	var win  = null;
	var winl = (screen.width - width)/2;
	var wint = (screen.height - height)/2;

	settings = 'height='+height+',width='+width+',top='+wint+',left='+winl+',scrollbars='+scroll+',toolbar=no,location=no,status=no,menubar=no,resizable=no,dependent=yes'

	if (name == '') {
		name = '_window';
	}

	win = window.open (''+url+'', ''+name+'', settings);
	if (parseInt(navigator.appVersion) >= 4) {
		win.window.focus();
	}
}

/**
* Flash library
*
* @author Juciano Araujo
* @version 0.1
*/

/* flash version */
var flashVersion = 6;

/* flash release version */
var flashRelease = "6,0,67,0";

/**
* Detects if is flash compatible
*
* @return boolean
*/
function isFlashCompatible() {
	var pluginVersion;
	if(navigator.plugins && navigator.mimeTypes.length){
		var words = navigator.plugins["Shockwave Flash"].description.split(" ");
		for (var i = 0; i < words.length; ++i) {
			if (isNaN(parseInt(words[i])))
			continue;
			pluginVersion = words[i];
		}
	}else{
		try{
			var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			for (var i=3; axo!=null; i++) {
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+i);
				pluginVersion = i;
			}
		}catch(e){
		}
	}

	return pluginVersion >= flashVersion;
}

/**
* Writes the flash code
*
* @param string swf
* @param string flashVarString
* @param int width
* @param int height
* @param string bgcolor
* @param string menu
* @param string mode
* @param string q
* @param string id
*/
function writeFlash(swf,flashVarString,w,h,bgcolor,menu,mode,q,id) {
	if (isFlashCompatible()) {
		document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" '
		+'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+flashRelease+'" '
		+'width="'+w+'" height="'+h+'" id="'+id+'" align="" />'
		+'<param name="movie" value="'+swf+'" />'
		+'<param name="menu" value="'+menu+'" /> '
		+'<param name="quality" value="'+q+'" /> '
		+'<param name="wmode" value="'+mode+'" /> '
		+'<param name="bgcolor" value="'+bgcolor+'" /> '
		+'<param name="flashvars" value="'+flashVarString+'" /> '
		+'<embed src="'+swf+'" flashvars="'+flashVarString+'" menu="'+menu+'" quality="'+q+'" wmode="'+mode+'" '
		+' bgcolor="'+bgcolor+'"  width="'+w+'" height="'+h+'" name="'+swf+'" '
		+' align=""  type="application/x-shockwave-flash" '
		+' pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object> ');
	} else {
		//behaviour for if there is no flash player
		document.write('You require Flash Player '+flashVersion+' or later to use this site. ');
		document.write('<em><a href="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank">');
		document.write('Click here to install it now.</a></em>');

		//this can be replaced by anything you want
		//e.g. document.location.replace("text.html");
	}
}