/* Admin - Desabilita CheckBox da Página de Consulta de Cursos Agendados */
function check(){
	var check = document.getElementsByTagName('input');
    for(var i=0; i < check.length;i++)
    {
       if(check[i].type == "checkbox")
          check[i].disabled = true;
    }
}


function QueryString(ID){
        var URL = document.location.href;
        if(URL.indexOf('?' + ID + '=')>-1){
        var qString = URL.split('?');
        var keyVal = qString[1].split('&');
        for(var i=0;i<keyVal.length;i++){
        if(keyVal[i].indexOf(ID + '=')==0){
        var val = keyVal[i].split('=');
        return val[1];
}
}
        return "";
}
    else
{
        return "";
}
}


function PegaCEP()
{

	var browser=navigator.appName;
	
	if (browser=="Microsoft Internet Explorer")
	{
		var cep = prompt("Por favor , informe o CEP de sua localidade (somente números)","");	
		 if (cep!=null && cep != "")
		  {
			document.forms[0].action = "http://www.cma.com.br/assinatura/series4web_resumo.asp?Area=0&Prod=" + document.getElementById("prod").value + "&Tipo=1&cep=" + cep + "&Parceiro=" + QueryString("parceiro")
			document.forms[0].submit();   
		  }
	}
	else
	{
		
		var cep = prompt("Por favor , informe o CEP de sua localidade (somente números)","");	
		document.forms[0].action = "http://www.cma.com.br/assinatura/series4web_resumo.asp?Area=0&Prod=" + document.getElementById("prod").value + "&Tipo=1&cep=" + cep + "&Parceiro=" + QueryString("parceiro")
		document.forms[0].submit();
	}
}
/* Home - Select topo da página */			
var persistmenu="yes" 
var persisttype="sitewide" 

if (document.getElementById){ 
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')
}

function SwitchMenu(obj){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("masterdiv").getElementsByTagName("span"); 
		if(el.style.display != "block"){ 
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="submenu") 
				ar[i].style.display = "none";
			}
			el.style.display = "block";
		}else{
			el.style.display = "none";
		}
	}
}

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 onloadfunction(){
    if (persistmenu=="yes"){
    var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
    var cookievalue=get_cookie(cookiename)
    if (cookievalue!="")
    document.getElementById(cookievalue).style.display="block"
    }
    
    var as = window.document.body.getElementsByTagName('a');
    
    for (k = 0; k < as.length; k++)
    {
        if (as[k].href.indexOf('javascript') != 0 && as[k].href.indexOf('mailto:') == -1 && as[k].href.indexOf('parceiro=') == -1)
        {
            if (as[k].href.indexOf('?') > -1)
            {
                if (as[k].href.indexOf('#') > -1)
                {
                    as[k].href = as[k].href.split('#')[0] + "&parceiro=" + parceiro + "#" + as[k].href.split("#")[1];
                }
                else
                {
                    as[k].href += "&parceiro=" + parceiro;
                };
            }
            else
            {
                if (as[k].href.indexOf('#') > -1)
                {
                    as[k].href = as[k].href.split('#')[0] + "?parceiro=" + parceiro + "#" + as[k].href.split("#")[1];
                }
                else
                {
                    as[k].href += "?parceiro=" + parceiro;
                };
            };
        };
    };
}

function savemenustate(){
var inc=1, blockid=""
while (document.getElementById("sub"+inc)){
if (document.getElementById("sub"+inc).style.display=="block"){
blockid="sub"+inc
break
}
inc++
}
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid
document.cookie=cookiename+"="+cookievalue
}

if (window.addEventListener)
window.addEventListener("load", onloadfunction, false)
else if (window.attachEvent)
window.attachEvent("onload", onloadfunction)
else if (document.getElementById)
window.onload=onloadfunction

if (persistmenu=="yes" && document.getElementById)
window.onunload=savemenustate


/* Página Series 4 Web Funções de Fade nos boxes */
	function FadeBoxes(){
		document.getElementById('light').style.display='block';
		document.getElementById('fade').style.display='block';
	}
	
	function FechaFades(){
		document.getElementById('light').style.display='none';
		document.getElementById('fade').style.display='none';
	}
	
	
	function FadeBoxes_dois(){
		document.getElementById('lightdois').style.display='block';
		document.getElementById('fadedois').style.display='block';
	}
	
	function FechaFades_dois(){
		document.getElementById('lightdois').style.display='none';
		document.getElementById('fadedois').style.display='none';
	}
	
	
	function FadeBoxes_tres(){
		document.getElementById('lighttres').style.display='block';
		document.getElementById('fadetres').style.display='block';
	}
	
	function FechaFades_tres(){
		document.getElementById('lighttres').style.display='none';
		document.getElementById('fadetres').style.display='none';
	}
	
	function FadeBoxes_quatro(){
		document.getElementById('lightquatro').style.display='block';
		document.getElementById('fadequatro').style.display='block';
	}
	
	function FechaFades_quatro(){
		document.getElementById('lightquatro').style.display='none';
		document.getElementById('fadequatro').style.display='none';
	}
	
	function FadeBoxes_cinco(){
		document.getElementById('lightcinco').style.display='block';
		document.getElementById('fadecinco').style.display='block';
	}
	
	function FechaFades_cinco(){
		document.getElementById('lightcinco').style.display='none';
		document.getElementById('fadecinco').style.display='none';
	}
	
	function FadeBoxes_seis(){
		document.getElementById('lightseis').style.display='block';
		document.getElementById('fadeseis').style.display='block';
	}
	
	function FechaFades_seis(){
		document.getElementById('lightseis').style.display='none';
		document.getElementById('fadeseis').style.display='none';
	}
	
	function FadeBoxes_sete(){
		document.getElementById('lightsete').style.display='block';
		document.getElementById('fadesete').style.display='block';
	}
	
	function FechaFades_sete(){
		document.getElementById('lightsete').style.display='none';
		document.getElementById('fadesete').style.display='none';
	}
	
	
	function FadeBoxes_oito(){
		document.getElementById('lightoito').style.display='block';
		document.getElementById('fadeoito').style.display='block';
	}
	
	function FechaFades_oito(){
		document.getElementById('lightoito').style.display='none';
		document.getElementById('fadeoito').style.display='none';
	}
	
	
	function FadeBoxes_nove(){
		document.getElementById('lightnove').style.display='block';
		document.getElementById('fadenove').style.display='block';
	}
	
	function FechaFades_nove(){
		document.getElementById('lightnove').style.display='none';
		document.getElementById('fadenove').style.display='none';
	}
	

function Mascara_Hora(Hora,Img){ 

    var hour;
    hour = Hora.value;
    if (hour.length == 2)
    { 
        Hora.value = hour + ':'; 
    } 
    if (hour.length == 5)
    { 
        Verifica_Hora(Hora,Img); 
    } 
} 
           
function Verifica_Hora(Hora,Img){ 
    var hrs
    var min
    hrs = (Hora.value.substring(0,2)); 
    min = (Hora.value.substring(3,5)); 
               
    estado = ""; 
    if ((hrs < 00 ) || (hrs > 23) || ( min < 00) ||( min > 59))
    { 
        estado = "errada"; 
    } 
               
    if (Hora.value == "") 
    { 
        estado = "errada"; 
    } 

    if (estado == "errada") 
    { 
        Img.src = 'http://' + location.hostname + '/educacional/images/erro_x.gif';
        Hora.focus(); 
    } 
    else
    {
        Img.src = 'http://' + location.hostname + '/educacional/images/img_transparente.gif'
    }
    
} 


function checkWeek(chk,cell,hi,hf)
{
    
    if (chk.checked)
    {
   
        cell.bgColor  = '#006699'
        hi.disabled = false
        hi.focus();
        hf.disabled = false
        return false;
    }
    else
    {
        cell.bgColor  = '#9999999'
        hi.disabled = true
        hf.disabled = true
        hi.value = ''
        hf.value = ''
        return false;
    }
    
}


function AbrePopup(pagina,nome,largura,altura)
{
 window.open(pagina,nome,'width='+largura+',height='+altura+',top=0,left=0,scrollbars=yes,toolbar=no,location=no,menubar=no,resizable=no');
}

function FechaFades_Form(){

	document.getElementById('lightForm').style.display='none';
	document.getElementById('fadeForm').style.display='none';
	var str = document.getElementById('city').value;
	document.getElementById(str).style.display = '';
	
}
function FadeBoxes_Form(obj){
    
    
    document.getElementById(obj).style.display = 'none';
    
    window.setInterval('document.getElementById("city").value="'+obj+'";', 1000);
    
    var arrayPageSize = getPageSize();
    var arrayPageScroll = getPageScroll();

    document.getElementById('fadeForm').style.height = (arrayPageSize[1] + 'px');
    document.getElementById('fadeForm').style.display='block';

    var lightboxTop = arrayPageScroll[1]; //+ ((arrayPageSize[3] - 35 - arrayPageScroll[1]) / 2);
	//var lightboxLeft = arrayPageScroll[1]//((arrayPageSize[0] - 20 - arrayPageScroll[1]) / 2);
	
			
	document.getElementById('lightForm').style.top = (lightboxTop < 0) ? "0px" : lightboxTop + "px";
	//document.getElementById('lightForm').style.left = (lightboxLeft < 0) ? "0px" : lightboxLeft + "px";

    
    document.getElementById('lightForm').style.display='block';
    
    floatingMenuId = 'lightForm';
    floatingMenu =
    {
      
        targetX: -250,
        targetY: 10,

        hasInner: typeof(document.body.clientWidth) == 'number',
        hasElement: typeof(document.body) == 'object'
            && typeof(document.body.clientWidth) == 'number',

        menu:
            document.getElementById
            ? document.getElementById(floatingMenuId)
            : document.all
              ? document.all[floatingMenuId]
              : document.layers[floatingMenuId]
    };
 
 
    floatingMenu.targetX='center';
    floatingMenu.targetY='center';
 
     floatingMenu.move = function ()  
     {  
   
         floatingMenu.menu.style.left = floatingMenu.nextX + 'px';  
         floatingMenu.menu.style.top = floatingMenu.nextY + 'px';  
     }  
       
     floatingMenu.computeShifts = function ()  
     {  
         var de = document.documentElement;  
         var scrollleft= floatingMenu.hasInner ?  document.body.scrollLeft : pageXOffset;
         var scrolltop= floatingMenu.hasInner ? document.body.scrollTop : pageYOffset;
         
         floatingMenu.shiftX =    
             floatingMenu.hasInner    
             ? scrollleft    
             : floatingMenu.hasElement    
               ? de.scrollLeft    
               : document.body.scrollLeft;    
         if (floatingMenu.targetX < 0)  
         {  
             floatingMenu.shiftX +=  
                 floatingMenu.hasElement  
                 ? de.clientWidth  
                 : document.body.clientWidth;  
         }  
       
         floatingMenu.shiftY =   
             floatingMenu.hasInner  
             ? scrolltop  
             : floatingMenu.hasElement  
               ? de.scrollTop  
               : document.body.scrollTop; 
               
         if (floatingMenu.targetY < 0)  
         {  
              
             if (floatingMenu.hasElement && floatingMenu.hasInner)  
             {  
                 // Handle Opera 8 problems  
                 floatingMenu.shiftY +=  
                     de.clientHeight > window.innerHeight  
                     ? window.innerHeight  
                     : de.clientHeight  
                   
             }  
             else  
             {  
                 floatingMenu.shiftY +=  
                     floatingMenu.hasElement  
                     ? de.clientHeight  
                     : document.body.clientHeight; 
                      
             }  
         }  
        
     }  
   
     floatingMenu.calculateCornerX = function()  
     {  
         if (floatingMenu.targetX != 'center')  
             return floatingMenu.shiftX + floatingMenu.targetX;  
       
         var width = parseInt(floatingMenu.menu.offsetWidth);  
         var scrollleft= floatingMenu.hasInner ?  document.body.scrollLeft : pageXOffset;
         var cornerX =  
             floatingMenu.hasElement  
             ? (floatingMenu.hasInner  
                ? scrollleft  
                : document.documentElement.scrollLeft) +   
               (document.body.clientWidth - width)/2  
             : document.body.scrollLeft +   
               (document.body.clientWidth - width)/2;  
               
         return cornerX;  
     };  
       
     floatingMenu.calculateCornerY = function()  
     {  
         if (floatingMenu.targetY != 'center')  
             return floatingMenu.shiftY + floatingMenu.targetY;  
       
         var height = parseInt(floatingMenu.menu.offsetHeight);  
      
         // Handle Opera 8 problems  
         var clientHeight =   
             floatingMenu.hasElement && floatingMenu.hasInner  
             && document.documentElement.clientHeight   
                 > window.innerHeight  
             ? window.innerHeight  
             : document.body.clientHeight  
         var scrolltop= floatingMenu.hasInner ? document.body.scrollTop : pageYOffset;
         var cornerY =  
             floatingMenu.hasElement  
             ? (floatingMenu.hasInner    
                ? scrolltop  
                : document.documentElement.scrollTop) +   
               (clientHeight - height)/2  
             : document.body.scrollTop +   
               (document.body.clientHeight - height)/2;  
         return cornerY;  
     };  
       
     floatingMenu.doFloat = function()  
     {  
         var stepX, stepY;  
       
         floatingMenu.computeShifts();  
       
         var cornerX = floatingMenu.calculateCornerX();  
       
         var stepX = (cornerX - floatingMenu.nextX) * .07;  
         if (Math.abs(stepX) < .5)  
         {  
             stepX = cornerX - floatingMenu.nextX;  
         }  
       
         var cornerY = floatingMenu.calculateCornerY();  
       
         var stepY = (cornerY - floatingMenu.nextY) * .07;  
         if (Math.abs(stepY) < .5)  
         {  
             stepY = cornerY - floatingMenu.nextY;  
         }  
       
         if (Math.abs(stepX) > 0 ||  
             Math.abs(stepY) > 0)  
         {  
             floatingMenu.nextX += stepX;  
             floatingMenu.nextY += stepY;  
             floatingMenu.move();  
         }  
       
         setTimeout('floatingMenu.doFloat()', 1);  
     };  
   
     // addEvent designed by Aaron Moore  
     floatingMenu.addEvent = function(element, listener, handler)  
     {  
       
         if(typeof element[listener] != 'function' ||   
            typeof element[listener + '_num'] == 'undefined')  
         {  
             element[listener + '_num'] = 0;  
             if (typeof element[listener] == 'function')  
             {  
                 element[listener + 0] = element[listener];  
                 element[listener + '_num']++;  
             }  
             element[listener] = function(e)  
             {  
                 var r = true;  
                 e = (e) ? e : window.event;  
                 for(var i = element[listener + '_num'] -1; i >= 0; i--)  
                 {  
                     if(element[listener + i](e) == false)  
                         r = false;  
                 }  
                 return r;  
             }  
         }  
   
         //if handler is not already stored, assign it  
         for(var i = 0; i < element[listener + '_num']; i++)  
             if(element[listener + i] == handler)  
                 return;  
         element[listener + element[listener + '_num']] = handler;  
         element[listener + '_num']++;  
     };  
   
     floatingMenu.init = function()  
     {  
         floatingMenu.initSecondary();  
         floatingMenu.doFloat();  
         
     };  
   
     // Some browsers init scrollbars only after  
     // full document load.  
     floatingMenu.initSecondary = function()  
     {  
        
         floatingMenu.computeShifts();  
         floatingMenu.nextX = floatingMenu.calculateCornerX();  
         floatingMenu.nextY = floatingMenu.calculateCornerY();  
         floatingMenu.move();  
     }  
     
    floatingMenu.init();
    floatingMenu.addEvent(window, 'onload',floatingMenu.initSecondary);
         
    
}
	


function getPageScroll(){

	var yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}

	arrayPageScroll = new Array('',yScroll) 
	return arrayPageScroll;
}



function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}



    var floatingMenuId = 'lightForm';
 var floatingMenu =
    {
        targetX: -250,
        targetY: 10,

        hasInner: typeof(window.innerWidth) == 'number',
        hasElement: typeof(document.documentElement) == 'object'
            && typeof(document.documentElement.clientWidth) == 'number',

        menu:
            document.getElementById
            ? document.getElementById(floatingMenuId)
            : document.all
              ? document.all[floatingMenuId]
              : document.layers[floatingMenuId]
    };
 
 floatingMenu.move = function ()  
 {  
 
     floatingMenu.menu.style.left = floatingMenu.nextX + 'px';  
     floatingMenu.menu.style.top = floatingMenu.nextY + 'px';  
 }  
   
 floatingMenu.computeShifts = function ()  
 {  
     var de = document.documentElement;  
    var scrollleft= floatingMenu.hasInner ?  document.body.scrollLeft : pageXOffset;
         var scrolltop= floatingMenu.hasInner ? document.body.scrollTop : pageYOffset;
     floatingMenu.shiftX =    
         floatingMenu.hasInner    
         ? scrollleft    
         : floatingMenu.hasElement    
           ? de.scrollLeft    
           : document.body.scrollLeft;    
     if (floatingMenu.targetX < 0)  
     {  
         floatingMenu.shiftX +=  
             floatingMenu.hasElement  
             ? de.clientWidth  
             : document.body.clientWidth;  
     }  
   
     floatingMenu.shiftY =   
         floatingMenu.hasInner  
         ? scrolltop  
         : floatingMenu.hasElement  
           ? de.scrollTop  
           : document.body.scrollTop;  
     if (floatingMenu.targetY < 0)  
     {  
         if (floatingMenu.hasElement && floatingMenu.hasInner)  
         {  
             // Handle Opera 8 problems  
             floatingMenu.shiftY +=  
                 de.clientHeight > window.innerHeight  
                 ? window.innerHeight  
                 : de.clientHeight  
         }  
         else  
         {  
             floatingMenu.shiftY +=  
                 floatingMenu.hasElement  
                 ? de.clientHeight  
                 : document.body.clientHeight;  
         }  
     }  
 }  
   
 floatingMenu.calculateCornerX = function()  
 {  
     if (floatingMenu.targetX != 'center')  
         return floatingMenu.shiftX + floatingMenu.targetX;  
   
     var width = parseInt(floatingMenu.menu.offsetWidth);  
   var scrollleft= floatingMenu.hasInner ?  document.body.scrollLeft : pageXOffset;
        
        
     var cornerX =  
         floatingMenu.hasElement  
         ? (floatingMenu.hasInner  
            ? scrollleft  
            : document.documentElement.scrollLeft) +   
           (document.documentElement.clientWidth - width)/2  
         : document.body.scrollLeft +   
           (document.body.clientWidth - width)/2;  
     return cornerX;  
 };  
   
 floatingMenu.calculateCornerY = function()  
 {  
     if (floatingMenu.targetY != 'center')  
         return floatingMenu.shiftY + floatingMenu.targetY;  
   
     var height = parseInt(floatingMenu.menu.offsetHeight);  
   
     // Handle Opera 8 problems  
     var clientHeight =   
         floatingMenu.hasElement && floatingMenu.hasInner  
         && document.documentElement.clientHeight   
             > window.innerHeight  
         ? window.innerHeight  
         : document.documentElement.clientHeight  
     var scrolltop= floatingMenu.hasInner ? document.body.scrollTop : pageYOffset;
     var cornerY =  
         floatingMenu.hasElement  
         ? (floatingMenu.hasInner    
            ? scrolltop  
            : document.documentElement.scrollTop) +   
           (clientHeight - height)/2  
         : document.body.scrollTop +   
           (document.body.clientHeight - height)/2;  
     return cornerY;  
 };  
   
 floatingMenu.doFloat = function()  
 {  
     var stepX, stepY;  
   
     floatingMenu.computeShifts();  
   
     var cornerX = floatingMenu.calculateCornerX();  
   
     var stepX = (cornerX - floatingMenu.nextX) * .07;  
     if (Math.abs(stepX) < .5)  
     {  
         stepX = cornerX - floatingMenu.nextX;  
     }  
   
     var cornerY = floatingMenu.calculateCornerY();  
   
     var stepY = (cornerY - floatingMenu.nextY) * .07;  
     if (Math.abs(stepY) < .5)  
     {  
         stepY = cornerY - floatingMenu.nextY;  
     }  
   
     if (Math.abs(stepX) > 0 ||  
         Math.abs(stepY) > 0)  
     {  
         floatingMenu.nextX += stepX;  
         floatingMenu.nextY += stepY;  
         floatingMenu.move();  
     }  
   
     setTimeout('floatingMenu.doFloat()', 0);  
 };  
   
 // addEvent designed by Aaron Moore  
 floatingMenu.addEvent = function(element, listener, handler)  
 {  
   
     if(typeof element[listener] != 'function' ||   
        typeof element[listener + '_num'] == 'undefined')  
     {  
         element[listener + '_num'] = 0;  
         if (typeof element[listener] == 'function')  
         {  
             element[listener + 0] = element[listener];  
             element[listener + '_num']++;  
         }  
         element[listener] = function(e)  
         {  
             var r = true;  
             e = (e) ? e : window.event;  
             for(var i = element[listener + '_num'] -1; i >= 0; i--)  
             {  
                 if(element[listener + i](e) == false)  
                     r = false;  
             }  
             return r;  
         }  
     }  
   
     //if handler is not already stored, assign it  
     for(var i = 0; i < element[listener + '_num']; i++)  
         if(element[listener + i] == handler)  
             return;  
     element[listener + element[listener + '_num']] = handler;  
     element[listener + '_num']++;  
 };  
   
 floatingMenu.init = function()  
 {  

     floatingMenu.initSecondary();  
     floatingMenu.doFloat();  
     
 };  
   
 // Some browsers init scrollbars only after  
 // full document load.  
 floatingMenu.initSecondary = function()  
 {  
    
     floatingMenu.computeShifts();  
     floatingMenu.nextX = floatingMenu.calculateCornerX();  
     floatingMenu.nextY = floatingMenu.calculateCornerY();  
     floatingMenu.move();  
 }  
 
 
 
function SetUniqueRadioButton(nameregex, current)
{

   re = new RegExp(nameregex);
   for(i = 0; i < document.forms[0].elements.length; i++)
   {
      elm = document.forms[0].elements[i]
      if (elm.type == 'radio')
      {
         if (re.test(elm.name))
         {
            elm.checked = false;
         }
      }
   }
   current.checked = true;
}

var arrumouLinks = false;

function arrumaLinks()
{
    //alert('arrumaLinks');
    if (arrumouLinks) return;
    
    var itensMenu;
    var itemMenu;
    var replace;
    var k;
    var j;
    
    if (window.document.getElementsByName('testeMENUBELOKOMANO').length == 0)
    {
        var rawSpans = window.document.body.getElementsByTagName('span');
        
        var spans = []; 
        for (k = 0; k < rawSpans.length; k++)
        {
	        if (rawSpans[k].name=="testeMENUBELOKOMANO")
		        spans.push(rawSpans[k]);
        };
        
        itensMenu = spans;//window.document.getElementsByName('testeMENUBELOKOMANO');
    }
    else
    {
        itensMenu = window.document.getElementsByName('testeMENUBELOKOMANO');
    };
    
    for (j = 0; j < itensMenu.length; j++)
    {
        itemMenu = itensMenu[j].parentNode.parentNode.parentNode;
        
        if (itemMenu.innerHTML.search(/document.location.href(\b)*=\'.*\';/) > -1)
        {
            replace = itemMenu.innerHTML.match(/document.location.href(\b)*=\'.*\';/)[0];
            
            try
            {
                var novoHTML = itemMenu.innerHTML.split(replace).join(replace.split('\';').join('?parceiro=' + parceiro + '&\';'));
                itemMenu.innerHTML = novoHTML;
            }
            catch (e)
            {
                try
                {
                    itemMenu.firstChild.menuclick = replace.split('\';').join('?parceiro=' + parceiro + '&\';');
                }
                catch (e2)
                {
                    return;
                };
            };
        };
    };
    
    /*
    var as = window.document.getElementsByTagName('a');
    
    alert(as.length);
    
    for (k = 0; k < as.length; k++)
    {
        if (as[k].href.indexOf('mailto:') == -1)
        {
            if (as[k].href.indexOf('?') > -1)
                as[k].href = as[k].href += '&gustavo=foda&';
            else
                as[k].href = as[k].href += '?gustavo=foda&';
        };
    };
    */
    arrumouLinks = true;
}