
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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 MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


if ((navigator.appName.indexOf('Microsoft')+1)) {
document.write('<style type="text/css"> .opacity1 {filter:alpha(opacity=40)} .opacity2 {filter:alpha(opacity=100)} </style>'); }
if ((navigator.appName.indexOf('Netscape')+1)) {
document.write('<style type="text/css"> .opacity1 {-moz-opacity:0.5} .opacity2 {-moz-opacity:1} </style>'); }
else {
document.write(''); }

/* ----------------------------------------------------------------------------------- */
/* Show date */
function show_date () {
	var now = new Date(); var year = now.getUTCFullYear();
	var month = now.getMonth();	var day = now.getDate(); var ar = new Array(12);
	ar[0] = "Janeiro"; ar[1] = "Fevereiro"; ar[2] = 'Mar\347o';	ar[3] = "Abril";
	ar[4] = "Maio";	ar[5] = "Junho"; ar[6] = "Julho"; ar[7] = "Agosto";
	ar[8] = "Setembro";	ar[9] = "Outubro"; ar[10] = "Novembro";	ar[11] = "Dezembro";
	var totalDate = day + " " + ar[month] + " " + year;	document.write(totalDate);
}
/* ----------------------------------------------------------------------------------- */
/* Begin BuildQueryString */
  function BuildQueryString(formName)
   {
   var theForm = eval("document." + formName);
   var action = theForm.action; 

   // if action's url has a querystring
   if (action.indexOf("?") > 0)
   {
      // get the Querystring from the action url
      var querystr = action.split("?")[1]; 
      // reset the action of the url without the querystring
      action = action.split("?")[0]; 
      // split the querystring into its parts (separated by the "&")
      var parts = querystr.split("&");
      var partName = "";

      for (var part = 0; part < parts.length; part++)
      {
         partName = parts[part].split("=")[0];
         // check the query part's names and add to the action url 
         // querystring only what is needed for the .Net page
         if ((partName.toLowerCase() == "show")||(partName.toLowerCase() == "asp_page")
            ||(partName.toLowerCase() == "src"))
         {
            action += (action.indexOf("?") < 0) ? "?" : "&";
            action += parts[part];
         }
      }
   }

   // add the form elements to the action url querystring 
   for (var i = 0; i < theForm.elements.length; i++) {
      var name = escape(theForm.elements[i].name);
      if (name != "") {
         action += (action.indexOf("?") < 0) ? "?" : "&"; 
         var str = name + "=" + escape(theForm.elements[i].value);
         action += str;
      }
   }

   theForm.action = action;
   return true;
   }


function eventTrigger (evt) {
if (!evt) { var e= (window.event) ? window.event : evt } return e;
}
function MO(e) {
if (!e) {var e = eventTrigger(e);}
var S = (e.target) ? e.target : e.srcElement;
while (S.tagName!="TD") {S=S.parentNode;}
S.className="generic_module_text_hover";
}
function MU(e) {
if (!e) {var e = eventTrigger(e);}
var S = (e.target) ? e.target : e.srcElement;
while (S.tagName!="TD") {S=S.parentNode;}
S.className="generic_module_text";
}
function HO(e) {
if (!e) { var e = eventTrigger(e); }
var S = (e.target) ? e.target : e.srcElement;
while (S.tagName!="TD") {S=S.parentElement;}
S.className="header_menu_background_hover";
}
function HU(e) {
if (!e) { var e = eventTrigger(e); }
var S = (e.target) ? e.target : e.srcElement;
while (S.tagName!="TD") {S=S.parentElement;}
S.className="header_menu_background";
}
function FO(e) {
if (!e) { var e = eventTrigger(e); }
var S = (e.target) ? e.target : e.srcElement;
while (S.tagName!="TD") {S=S.parentElement;}
S.className="celllightblue";
}
function FU(e) {
if (!e) { var e = eventTrigger(e); }
var S = (e.target) ? e.target : e.srcElement;
while (S.tagName!="TD") {S=S.parentElement;}
S.className="celldarkblue";
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
function OpenWindow(url) {
	window.open(url,"","resizable=yes,width=520,height=465");
}
function OpenWindowResize(url, width, height){
	var props = "toolbar=no,menubar=no,scrollbars=yes,top=100,left=100,height=" + height + ",width=" + width;
	window.open(url,"",props)
}
// Description: Used for the Search functionality
function setFirstSubmit(frm, PageFirst) {
	frm.first.value = PageFirst;
	frm.submit();
}
function setFirstZero(frm) {
	frm.first.value = 0;
}
function setFirstZeroSubmit(frm) {
	setFirstSubmit(frm, 0);
}
function setShowAndSubmit(frm, show) {
	frm.show.value = show;	
	setFirstZeroSubmit(frm);
}
// Begin of Banner section
function Random(array) {
	var maxi = 0; var len = array.length;
	for (i=0; i < len; i++) { maxi = maxi + array[i][1];}
	var rnd = Math.floor(Math.random()*maxi); var counter = 0; i=0;
	while ((counter + array[i][1]) < rnd) {	counter = (counter + array[i][1]); i++;}
	return new Array(array[i], i);
}
function GetUrlBanner(arrPos) {
	var array = rBanner[arrPos];
	if (array[9] == "mainFrame") {document.location.href = array[7];}
	else if (array[9] == "newWindow") {
	window.open(array[7],"",'height='+array[2]+',width='+array[3]+',location, resizable, menubar, toolbar,left=30,top=30,scrollbars, status');}
}
function GetUrlAnim(arrPos, type) {
	var array = "";	array = rFlash[arrPos];
	if (array[9] == "mainFrame") { document.location.href = array[7];}
	else if (array[9] == "newWindow") {
	window.open(array[7],"",'height="'+array[4]+'",width="'+array[5]+'",location, resizable, menubar, toolbar,left=30,top=30,scrollbars, status');
	}
}
function GetBanner() {
	var arrayA = Random(rBanner);
	var array = arrayA[0];
	var pos = arrayA[1];
	var bannerHTML = '';
	if (array[6] == "flash") {
		bannerHTML +='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="468" height="60">';
		bannerHTML +='<param name="movie" value="/images/'+array[0]+'?clickTAG='+pos+'">';
		bannerHTML +='<param name="quality" value="high">';
		bannerHTML +='<embed src="/images/'+array[0]+'?clickTAG='+pos+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="468" height="60"></embed>';
		bannerHTML +='</object>';
		document.write(bannerHTML);
	}
	else if (array[6] == "image") {
		document.write('<A HREF="javascript:GetUrlBanner('+pos+');"><IMG SRC="/images/'+array[0]+'" ALT="'+array[8]+'" WIDTH="'+array[4]+'" HEIGHT="'+array[5]+'" BORDER=0 TARGET="'+array[9]+'"></A>');
	}	
}

function GetFlash() 
{

	if ((navigator.appVersion.indexOf("MSIE") != -1) && (navigator.appVersion.indexOf("Windows") != -1)) 
	{
		GetFlash_ie();
	}
	else
	{
		GetFlash_ff();
	}
		
	
}


function GetFlash_ff() {
	var ShockMode = 0; 
	var cWidth = document.body.clientWidth;
	var cHeight = document.body.clientHeight;

		if ((get_cookie("transAnimation")!="True") || (repeat == "on")) {
			document.cookie="transAnimation="+"True";
			var arrayA = Random(rFlash);
			var array = arrayA[0];
			var pos = arrayA[1];
			var transHTML = '';
			
									
			transHTML += '<div id="TransAds" style="position:absolute; left:0px; top:150px; width:'+cWidth+'px; height:'+cHeight+'px; z-index:1" align="center" >';
			transHTML += '<script type="text/javascript" src="/script/swfobject.js"></script>';
			transHTML += '<div id="flashcontent_pop"><noscript><div align="center">Caso não tenha o flash player 9.0, acesse <a href="http://www.adobe.com" target="_blank">http://www.adobe.com</a> e baixe o plugin.&nbsp; <BR><BR> </div></noscript></div>';			
			transHTML += '<script type="text/javascript">var so = new SWFObject("/images/'+array[0]+'?clickTAG='+pos+'", "TransAdsMovie", "'+array[4]+'", "'+array[5]+'", "2", "");so.addParam("movie", "/images/'+array[0]+'?clickTAG='+pos+'");so.addParam("quality", "high");so.addParam("wmode", "transparent");so.addParam("scale", "showall");so.write("flashcontent_pop");</script>'
			transHTML += '</div>';

			document.write(transHTML);
			
		}
	
}


function GetFlash_ie() {
	var ShockMode = 0; 
	var cWidth = document.body.clientWidth;
	var cHeight = document.body.clientHeight;
	if ((navigator.appVersion.indexOf("MSIE") != -1) && (navigator.appVersion.indexOf("Windows") != -1)) {
		ShockMode = 1;
	}
	if (ShockMode ==1) { 
	//set document cookie
		if ((get_cookie("transAnimation")!="True") || (repeat == "on")) {
			document.cookie="transAnimation="+"True";
			var arrayA = Random(rFlash);
			var array = arrayA[0];
			var pos = arrayA[1];
			var transHTML = '';
			transHTML += '<div id="TransAds" style="position:absolute; left:0px; top:150px; width:'+cWidth+'px; height:'+cHeight+'px; z-index:1" align="center" >';
			transHTML += '<object ID=TransAdsMovie classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="'+array[4]+'" height="'+array[5]+'">';
			transHTML += '<param name=movie value="/images/'+array[0]+'?clickTAG='+pos+'"> ';
			transHTML += '<param name="wmode" value="transparent"> ';
			transHTML += '<param name=quality value=high> ';
			transHTML += '<param name=scale value=showall> ';
			transHTML += '<embed NAME=TransAdsMovie  swliveconnect=true  src="/images/'+array[0]+'?clickTAG='+pos+'" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="'+array[4]+'" height="'+array[5]+'">';
			transHTML += '</embed></object></div>';
			document.write(transHTML);
			
		}
	} 
	else if (!(navigator.appName && navigator.appName.indexOf("Netscape")>=0 && navigator.appVersion.indexOf("2.")>=0)) {
		//can write something else if you want, or just leave blank
	} 
}
function get_cookie(Name) {
	var search = Name + "="; var returnvalue = "";
	if (document.cookie.length > 0) { 
		offset = document.cookie.indexOf(search);
		if (offset != -1) {
			offset += search.length; 
			end = document.cookie.indexOf(";", offset);
			if (end == -1) end = document.cookie.length;
		returnvalue=unescape(document.cookie.substring(offset, end))
		}
	}
	return returnvalue;
} 
function removeDiv() {
	document.getElementById('TransAds').style.display = 'none';
}
function popUpWH(URL, m_W, m_H)	{
	var H, W; W = m_W; H = m_H;
	var intScrWidth=(window.screen.width/2) - ((W/2)+10);
	var intScrHeight=(window.screen.height/2) - ((H/2)+60);
	memFenetre=window.open(URL, "artikels", "height=" + H + ",width=" + W + ",scrollbars=no,resizable=yes,screenX=" + intScrWidth + ",screenY=" + intScrHeight + ",left=" + intScrWidth + ",top=" +intScrHeight);
}
function getFlashMovieObject() {
   if (navigator.appName.indexOf("Microsoft Internet")!=-1) { return window.TransAdsMovie; }
   else { return window.document.TransAdsMovie; }     
}
// End of Banner Section

// Begin of Themes section

//Images
var imgSeeMoreItems = new Image();
imgSeeMoreItems.src = '/site_images/botao_rest.jpg';
var imgSeeLessItems = new Image();
imgSeeLessItems.src = '/site_images/botao_rest.jpg';

//	Show/Hide related functions

var prefixHidden = 'div_';
var prefixButton = 'butt_';
var defaultShown = 3;
var currentItemType = '';
var currentTypeShown = 0;
var itemsCounter = 0;

function SetItemType(typeName, itemsToBeShown)
{
	if(itemsToBeShown == null) 	currentTypeShown = defaultShown;
	else currentTypeShown = itemsToBeShown;
	currentItemType = typeName;
	itemsCounter = 0;
}

function AddItem(nodeid, text, date, attachAccess, attach, itemAccess, attachText, target)
{
	var strItem = '';
	if(itemsCounter == currentTypeShown) {
		strItem += '<div id="' + prefixHidden + currentItemType + '" style="DISPLAY: none;">';
	}
	strItem +='<table width="100%"  border="0" cellpadding="0" cellspacing="0">';
	strItem +='<tr ><td class="linkthemeitemmargin">';
	strItem +='<table width="100%"  border="0" cellpadding="0" cellspacing="0">';
	strItem +='<tr><td class="linkthemeitem">';
	if  (currentItemType == 'Dossier')
	{
		strItem +='<a href="/map/show/168886/src/' + nodeid + '.htm">';
	}
	else if (currentItemType == 'Audio')
	{
		strItem +='<a href="/map/show/161731/src/' + nodeid + '.htm">';
	}
	else
	{
		strItem +='<a href="/map/src/' + nodeid + '.htm">';	
	}
	
	
	strItem += text + '</a>';
	strItem +='</td><td width="100" align="right"><span >'+date+'</span>';
	strItem += '</td></tr></table>';
	strItem +='</td></tr><tr><td height="3" class="divisao"><img src="/site_images/1px.gif" width="1" height="1" /></td></tr></table>';
	document.write(strItem);
	itemsCounter++;
}

function AddItemCalc(nodeid, text, date, attachAccess, attach, itemAccess, attachText, target)
{
	var strItem = '';
	if(itemsCounter == currentTypeShown) {
		strItem += '<div id="' + prefixHidden + currentItemType + '" style="DISPLAY: none;">';
	}
	strItem +='<table width="100%"  border="0" cellpadding="0" cellspacing="0">';
	strItem +='<tr ><td class="linkthemeitemmargin">';
	strItem +='<table width="100%"  border="0" cellpadding="0" cellspacing="0">';
	strItem +='<tr><td>';
	strItem +='<span class="linkthemeitem"><a href="' + nodeid +'">';
	strItem += text + '</a><span>';
	strItem +='</td><td width="100" align="right"><span >'+date+'</span>';
	strItem += '</td></tr></table>';
	strItem +='</td></tr><tr><td height="3" class="divisao"><img src="/site_images/1px.gif" width="1" height="1" /></td></tr></table>';
	document.write(strItem);
	itemsCounter++;
}


function AddItemSilverContent(url, text, date, attachAccess, attach, itemAccess, attachText, target)
{
	var strItem = '';
	if(itemsCounter == currentTypeShown) {
		strItem += '<div id="' + prefixHidden + currentItemType + '" style="DISPLAY: none;">';
	}
	strItem +='<table width="100%"  border="0" cellpadding="0" cellspacing="0">';
	strItem +='<tr ><td class="linkthemeitemmargin">';
	strItem +='<table width="100%"  border="0" cellpadding="0" cellspacing="0">';
	strItem +='<tr><td class="linkthemeitem">';
	strItem +='<a href="' + url + '">';
	strItem += text + '</a>';
	strItem +='</td>';
	strItem += '</tr></table>';
	strItem +='</td></tr><tr><td height="3" class="hr_dashed"><img src="/site_images/1px.gif" width="1" height="1" /></td></tr></table>';
	document.write(strItem);
	itemsCounter++;
}



function AddItem_Audio(nodeid, text, date, theme, attachAccess, attach, itemAccess, attachText, target)
{
	var strItem = '';
	if(itemsCounter == currentTypeShown) {
		strItem += '<div id="' + prefixHidden + currentItemType + '" style="DISPLAY: none;">';
	}

	strItem +='<table width="100%"  border="0" cellpadding="0" cellspacing="0">';
	strItem +='<tr><td class="linkthemeitem">';
	strItem +='<a href="/map/show/161731/src/' + nodeid + '.htm">';
	strItem += text + '</a>';
	strItem +='</td>';
	strItem += '</tr><tr><td height="3" class="divisao"><img src="/site_images/1px.gif" width="1" height="1" /></td></tr></table>';
	
	document.write(strItem);
	itemsCounter++;
}



function AddItemMultimidia(nodeid, text, date, attachAccess, attach, itemAccess, attachText, target)
{
	var strItem = '';
	if(itemsCounter == currentTypeShown) {
		strItem += '<div id="' + prefixHidden + currentItemType + '" style="DISPLAY: none;">';
	}
	strItem +='<table width="100%"  border="0" cellpadding="0" cellspacing="0">';
	strItem +='<tr ><td class="linkthemeitemmargin">';
	strItem +='<table width="100%"  border="0" cellpadding="0" cellspacing="0">';
	strItem +='<tr><td>';
	strItem +='<span class="linkthemeitem"><a href="' + nodeid +'">';
	strItem += text + '</a></span> &nbsp;&nbsp;( ' + attachAccess + ' )';
	strItem +='</td><td width="100" align="right"><span >'+date+'</span>';
	strItem += '</td></tr></table>';
	strItem +='</td></tr><tr><td height="3" class="divisao"><img src="/site_images/1px.gif" width="1" height="1" /></td></tr></table>';
	document.write(strItem);
	itemsCounter++;
}


function AddItemCartas(titulo, teaser, attach, img)					   
{
	var strItem = '';
	if(itemsCounter == currentTypeShown) {
		strItem += '<div id="' + prefixHidden + currentItemType + '" style="DISPLAY: none;">';
	}
	strItem +='<table width="100%"  border="0" cellpadding="0" cellspacing="0">';
	strItem +='<tr><td class="linkthemeitemmargin">';
	
	strItem +='<table width="100%"  border="0" cellpadding="0" cellspacing="0">';
	strItem +='<tr><td colspan="2" height="30" class="linkthemeitem">';
	strItem +='<a href="' + attach + '"  target="_blank">';
	strItem += '<span class="linklaranja"><strong>' + titulo + '</strong><span></a></td></tr>';
	strItem +='<tr><td width="5%"><a href="' + attach + '" target="_blank"><img src="/site_images/' + img + '.jpg" border="0" align="center"/></a></td>' ;
	strItem += '<td width="95%">' + teaser + '</td></tr>';
	strItem += '<tr><td colspan="2" height="3" class="divisao"><img src="/site_images/1px.gif" width="1" height="1" /></td></tr></table>';
	
	strItem += '</td></tr></table>';
	
	//strItem +='</td></tr><tr><td height="3" class="divisao"><img src="/site_images/1px.gif" width="1" height="1" /></td></tr></table>';
	document.write(strItem);
	itemsCounter++;
}




function Finalize()
{
	if(itemsCounter > currentTypeShown)
	{
		if((itemsCounter - currentTypeShown) == 0)
		{
			document.write('</div><scr' + 'ipt>ShowHide(\'' + currentItemType + '\');</scr' + 'ipt>');
			document.write('<p></p>');
		}
		else
		{
			
			document.write('<div class="botaorestantes1"><a href="javascript:ShowHide(\'' + currentItemType + '\', false);">Esconder</a></div>');
			document.write('<p></p>');
			document.write('</div>');
			document.write('<div class="botaorestantes" id="' + prefixButton + currentItemType + '"><a href="javascript:ShowHide(\'' + currentItemType + '\', true);" >Ver restante' + (((itemsCounter - currentTypeShown) == 1)?' ':'s ')  + (itemsCounter - currentTypeShown) + '</a></div>');
			document.write('<p></p>');
		}
	}
	else {
		document.write('<p></p>');
	}
}

function ShowHide(localItemType, forceVisible)
{
	var myObj = document.getElementById(prefixHidden + localItemType);
	var myButton = document.getElementById(prefixButton + localItemType);
	if(myObj == null) return;

	var display = new Boolean();
	if(forceVisible != null) display = forceVisible;	// if visibility/invisibility required by parameter
	else display = (myObj.style.display != '');			// if not required, behaviour is to toggle visibility

	if (display)
	{
		myObj.style.display = '';
		if(myButton != null) myButton.style.display = 'none';
	}else{
		myObj.style.display = 'none';
		if(myButton != null) myButton.style.display = '';
	}
}

//Begin of Dossier module functions

// Dossier specific functions used for roll-over fx on menu items
var highlightedTheme;
var highlightedThemeColor;
var themeMenuPrefix = 't_';
var highlightedMenuItem;
var highlightedDosMenuItem;
var menuItemPrefix = 'm_';
// onMouseOver
function DosMenuItemOn(obj) {
	obj.style.color = '#9C4702';
	obj.style.cursor='hand';
	obj.style.fontWeight = "bold";
	obj.style.textDecoration = "none";
}
// onMouseOut
function DosMenuItemOff(obj) {
	if(highlightedDosMenuItem != obj) {	obj.style.backgroundPosition='left top'; }
}
function HighlightDosMenuItem(NodeId)
{
	var obj; 
	if(document.all) {obj = document.all(menuItemPrefix + NodeId);}
	if(document.getElementById)	{obj = document.getElementById(menuItemPrefix + NodeId);}
	if(obj != null)	{highlightedDosMenuItem = obj; DosMenuItemOn(obj);}
}
// this function returns the NodeId taken from the URL
function ReturnUrlNodeId()
{
	var urlNodeId = '';	var temp = document.URL;
	var p = temp.indexOf(".htm");
	if (p >= 0)	{temp = temp.substring(0, p);}
	p = temp.lastIndexOf("/");
	if (p >= 0)	{temp = temp.substr(p + 1);}
	urlNodeId = temp; return urlNodeId;
}
// End of dossier module functions

// Begin of zebra tables functions
function hasClass(obj) {
     var result = false;
     if (obj.getAttributeNode("class") != null) {
         result = obj.getAttributeNode("class").value;
     }
     return result;
  }   
function loopStripe(obj) {
	var tables = document.body.getElementsByTagName("TABLE");
	for (i=0; i < tables.length; i++) {
			var table = tables[i].id;
			if (table.indexOf("brasilzebra_") >= 0) {
				stripe(table, '#fff', '#f5f5f5');
			}			
	}
}
function stripe(id) {
    var even = false;
    var evenColor = arguments[1] ? arguments[1] : "#fff";
    var oddColor = arguments[2] ? arguments[2] : "#eee";
    var table = document.getElementById(id);
    if (! table) { return; }
    var tbodies = table.getElementsByTagName("tbody");
    for (var h = 0; h < tbodies.length; h++) {
      var trs = tbodies[h].getElementsByTagName("tr");
      for (var i = 0; i < trs.length; i++) {
        if (! hasClass(trs[i]) &&
            ! trs[i].style.backgroundColor) {
          var tds = trs[i].getElementsByTagName("td");
          for (var j = 0; j < tds.length; j++) {
            var mytd = tds[j];
            if (! hasClass(mytd) &&
                ! mytd.style.backgroundColor) {
              mytd.style.backgroundColor =
                even ? evenColor : oddColor;
            }
          }
        }
        even =  ! even;
      }
    }
}
// End of zebra tables functions

// features panel
function hideFriend(){
	document.getElementById("friendhide").style.display = "none";
	document.getElementById("friendshow").style.display = "block";
	document.getElementById("commenthide").style.display = "none";
	document.getElementById("commentshow").style.display = "block";
	document.getElementById("dAmigo").style.display = "none";
	document.getElementById("escreva").style.display = "none";
}
function showFriend(){
	document.getElementById("commenthide").style.display = "none";
	document.getElementById("commentshow").style.display = "block";
	document.getElementById("friendhide").style.display = "block";
	document.getElementById("friendshow").style.display = "none";
	document.getElementById("dAmigo").style.display = "block";
	document.getElementById("escreva").style.display = "none";
}
function hideWrite(){
	document.getElementById("commenthide").style.display = "none";
	document.getElementById("commentshow").style.display = "block";
	document.getElementById("dAmigo").style.display = "none";
	document.getElementById("escreva").style.display = "none";
}
function showWrite(){
	document.getElementById("friendhide").style.display = "none";
	document.getElementById("friendshow").style.display = "block";
	document.getElementById("commenthide").style.display = "block";
	document.getElementById("commentshow").style.display = "none";
	document.getElementById("dAmigo").style.display = "none";
	document.getElementById("escreva").style.display = "block";
}
// end features panel

//begin calculations functions
function CCA(CB,noHL){
if (!noHL)
{
if (CB.value != "")
hL(CB);
else
dL(CB);
}
}
function hL(E){
while (E.tagName!="TR")
{E=E.parentElement;}
E.className="calc_tr_hover";
}
function dL(E){
while (E.tagName!="TR")
{E=E.parentElement;}
E.className="";
}
//end calculations functions

//generic validation
function checkEmail(wbaddr) {
	var atpos = wbaddr.indexOf("@");
	var lastat = wbaddr.lastIndexOf("@");
	var lastdot = wbaddr.lastIndexOf(".");
	var length = wbaddr.length-1;
	var networkaddr = wbaddr.substring( (lastat+1) , wbaddr.length );
	networkaddr = networkaddr.toLowerCase();
	var notld = wbaddr.substring( (lastat+1) , lastdot );
	var domain = notld.substring( (notld.lastIndexOf(".")+1), notld.length);
	var legalchars = "abcdefghijklmnopqrstuvwxyz1234567890-.";
	var networkerror = 0;
	var dotpos = -1;
	if((domain.length < 2) || (domain.length > (26 - (length - lastdot)))) {return false;}
	for(var i=0 ; i < networkaddr.length ; i++) {
		if(legalchars.indexOf(networkaddr.charAt(i)) == -1) {return false;}
		if((networkaddr.charAt(i) == ".") && ((dotpos+1) == i)) {doterror = 1; dotpos = i;}
	}
	if (lastdot <= atpos) {return false;}
	if (((length - lastdot) > 3) || ((length - lastdot) < 2)) {return false};
	if ((atpos <= 0) || (lastat != atpos)) {return false;}
	return true;
}
function removeLeadingZeros(str) {
	if ((str.substring(0,1) == '0') && (str.length > 1)) {
		str = str.substring(1, str.length)
		str = removeLeadingZeros(str)
	}
	return str;
}
function IsCorrectMemberNr(frmval)
{
	var subscr_number = frmval;
	var subscr_number_length = subscr_number.length;
	var i = null;
	var counter = 0;
	var leftdigit = null;
	var rightdigit = null;
	var ind = 0;
	var oke = 1;
	for(i=0;i<subscr_number_length;i++) {
		var character = null;
		character = subscr_number.charAt(i);
		if(character == "-") {
			counter++;
			ind = parseInt(i);
		}
		else {
			if (character == " ") {oke = 0;}
		}
	}
	if ((counter == 1) && (oke == 1)) {
		leftdigit = subscr_number.substring(0,ind);
		rightdigit = subscr_number.substring((ind+1),subscr_number_length);
		leftdigit = removeLeadingZeros(leftdigit);
		rightdigit = removeLeadingZeros(rightdigit);
		if(parseInt(leftdigit)%97 == parseInt(rightdigit)%97) {return (true);}
		else {return (false);}
	}
	else {return (false);}
}
function isSpace(val) {
	if ((val == ' ') || (val == '\t') || (val == '\n') || (val == '\r')) {return true;}
	else {return false;}
}
function LTrim(val){
	var c, i, j = -1;
	for(i=0;i<val.length;++i) {
		c = val.charAt(i);
		if(!isSpace(c)) {j = i;break;}
	}
	if(j != -1) {return val.substring(j, val.length);}
	else {return '';}
}
function RTrim(val){
	var c, i, j = -1;
	for(i=val.length-1;i>=0;--i){
		c = val.charAt(i);
		if(!isSpace(c)){j = i; break;}
	}
	if(j != -1) {return val.substring(0, j + 1);}
	else {return '';}
}
function Trim(val){
	return LTrim(RTrim(val));
}
function bookmarksite(title, url){
if (document.all)
window.external.AddFavorite(url, title);
else if (window.sidebar)
window.sidebar.addPanel(title, url, "")
}
// get tag contents
function fGTC(s,di) {
	var a = '<'+di+'>';
	var b = '</'+di+'>';
	u = s.substring(s.indexOf(a)+a.length);
	return (u.substring(0, u.indexOf(b)));
}
/*
Form field Limiter script- By Dynamic Drive
For full source code and more DHTML scripts, visit http://www.dynamicdrive.com
This credit MUST stay intact for use
*/

var ns6=document.getElementById&&!document.all

function restrictinput(maxlength,e,placeholder){
if (window.event&&event.srcElement.value.length>=maxlength)
return false
else if (e.target&&e.target==eval(placeholder)&&e.target.value.length>=maxlength){
var pressedkey=/[a-zA-Z0-9\.\,\/]/ //detect alphanumeric keys
if (pressedkey.test(String.fromCharCode(e.which)))
e.stopPropagation()
}
}

function countlimit(maxlength,e,placeholder){
var theform=eval(placeholder)
var lengthleft=maxlength-theform.value.length
var placeholderobj=document.all? document.all[placeholder] : document.getElementById(placeholder)
if (window.event||e.target&&e.target==eval(placeholder)){
if (lengthleft<0)
theform.value=theform.value.substring(0,maxlength)
placeholderobj.innerHTML=lengthleft
}
}


function displaylimit(thename, theid, thelimit){
var theform=theid!=""? document.getElementById(theid) : thename
var limit_text='<br>Restam <b><span id="'+theform.toString()+'">'+thelimit+'</span></b> caracteres para atingir o limite da sua mensagem.'
if (document.all||ns6)
document.write(limit_text)
if (document.all){
eval(theform).onkeypress=function(){ return restrictinput(thelimit,event,theform)}
eval(theform).onkeyup=function(){ countlimit(thelimit,event,theform)}
}
else if (ns6){
document.body.addEventListener('keypress', function(event) { restrictinput(thelimit,event,theform) }, true); 
document.body.addEventListener('keyup', function(event) { countlimit(thelimit,event,theform) }, true); 
}
}
function replaceSubstring(inputString, fromString, toString) {
   // Goes through the inputString and replaces every occurrence of fromString with toString
   var temp = inputString;
   if (fromString == "") {
      return inputString;
   }
   if (toString.indexOf(fromString) == -1) { // If the string being replaced is not a part of the replacement string (normal situation)
      while (temp.indexOf(fromString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(fromString));
         var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
         temp = toTheLeft + toString + toTheRight;
      }
   } else { // String being replaced is part of replacement string (like "+" being replaced with "++") - prevent an infinite loop
      var midStrings = new Array("~", "`", "_", "^", "#");
      var midStringLen = 1;
      var midString = "";
      // Find a string that doesn't exist in the inputString to be used
      // as an "inbetween" string
      while (midString == "") {
         for (var i=0; i < midStrings.length; i++) {
            var tempMidString = "";
            for (var j=0; j < midStringLen; j++) { tempMidString += midStrings[i]; }
            if (fromString.indexOf(tempMidString) == -1) {
               midString = tempMidString;
               i = midStrings.length + 1;
            }
         }
      } // Keep on going until we build an "inbetween" string that doesn't exist
      // Now go through and do two replaces - first, replace the "fromString" with the "inbetween" string
      while (temp.indexOf(fromString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(fromString));
         var toTheRight = temp.substring(temp.indexOf(fromString)+fromString.length, temp.length);
         temp = toTheLeft + midString + toTheRight;
      }
      // Next, replace the "inbetween" string with the "toString"
      while (temp.indexOf(midString) != -1) {
         var toTheLeft = temp.substring(0, temp.indexOf(midString));
         var toTheRight = temp.substring(temp.indexOf(midString)+midString.length, temp.length);
         temp = toTheLeft + toString + toTheRight;
      }
   } // Ends the check to see if the string being replaced is part of the replacement string or not
   return temp; // Send the updated string back to the user
} // Ends the "replaceSubstring" function

var stopPage = true;