function compre(a,b){
	document.getElementById(a).src="../img/botao/"+b+".gif";	
}

function Menu(a, _on){
	document.getElementById(a).src="../img/menu/"+_on+".gif";	
}


function Aba(){
	
   this.qtdAba=0;
   this.nomeAba = Array();
   this.display = Array();
   this.textoAba = Array();
   this.evento = Array();
   this.hide;
   this.styleOn;
   this.styleOff;
   
   
   
   this.addAba = function(id,texto,display,evento){
	         
			 
			 this.nomeAba[this.qtdAba] = id;
			 this.textoAba[this.qtdAba] = texto;
			 this.display[this.qtdAba] = display;
			 this.evento[this.qtdAba] = evento;
			 this.qtdAba++;
			
   }
   this.executaAba = function(){
	    
		var hideOn = '';
		
		//Montando on e off das abas
		for(var cont = 0 ; cont < this.nomeAba.length ; cont++){
		    abaAtual = this.nomeAba[cont];
			var hideOn = 'onclick="';
		
			
			//Escondendo todos os elementos
			for(var aux = 0 ; aux < this.nomeAba.length ; aux++){
				aba = this.nomeAba[aux];
				abaOff = this.nomeAba[aux];
				
		    	hideOn += 'document.getElementById(\'';
				hideOn +=aba;
				hideOn +='on\').style.display=\'none\'; ';
				
				hideOn += 'document.getElementById(\''+abaOff+'off\').style.display=\'none\'; ';
				hideOn += 'document.getElementById(\''+this.display[aux]+'\').style.display=\'none\'; ';
				
			}	
			//Mostrando os elementos
			for(var aux = 0 ; aux < this.nomeAba.length ; aux++){
		    	if(this.nomeAba[aux] == abaAtual){
				   aba = this.nomeAba[aux];
				   hideOn += 'document.getElementById(\''+aba+'on\').style.display=\'block\'; ';
				   hideOn += 'document.getElementById(\''+this.display[aux]+'\').style.display=\'block\'; ';
				}else{
					aba = this.nomeAba[aux];
					hideOn += 'document.getElementById(\''+aba +'off\').style.display=\'block\'; ';
				
				}
				
				
			}
			hideOn +='"';
			this.hide = hideOn;
			
				
			if(cont == 0){
			  this.styleOn = '; display: block';
			}else{
			  this.styleOn = '; display: none';
			}
			if(cont == 0){
			  this.styleOff = '; display: none';
			}else{
			  this.styleOff = '; display: block';
			}
			
			this.mostraAba(abaAtual,this.textoAba[cont],this.evento[cont]);
			
		}
	   
   }
   //id da aba, texto que aparece na aba,controle de hide and show
   this.mostraAba = function(id,texto,evento){
	     //Aba ativa
		 document.write('<div style="float:left; margin-left:1px '+this.styleOn+' " id="'+id+'on" '+evento+' >');
		 document.write('<div style="float:left;  height:22px;">');
		 document.write('<img src="img/aba/esquerda_on.jpg" title="'+texto+'" />');
		 document.write('</div><div style="float:left; padding:6px 4px 2px 4px; height:18px; background-image:url(img/aba/meio_on.jpg); font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; font-weight:bold; color:#cc0000;" '+this.hide+' ><a href="#" onclick="return false;" style="color:#cc0000; text-decoration:underline; ">'+texto+'</a></div>');
		 document.write('<div style="float:left;  height:22px; "><img src="img/aba/direita_on.jpg" alt="" /></div> </div> ');
		 //Aba Inativa
		 document.write('<div style="float:left; margin-left:1px; '+this.styleOff+'" id="'+id+'off"  '+evento+' >');
		 
		 document.write('<div style="float:left;  height:22px;"><img src="img/aba/esquerda_off.jpg" title="'+texto+'"  /></div> ');
		 document.write('<div style="float:left; padding:6px 4px 2px 4px; height:18px; background-image:url(img/aba/meio_off.jpg); font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; font-weight:bold; color:#666666;" '+this.hide+' ><a href="#" onclick="return false;" style="color:#666666">'+texto+'</a></div> <div style="float:left;  height:22px; "><img src="img/aba/direita_off.jpg" alt="" /></div></div>');
	      
   }
    
	
}


//tamanho da fonte

function getCookieVal (offset) {
	var endstr = document.cookie.indexOf (";", offset);
	if (endstr == -1) { endstr = document.cookie.length; }
	return unescape(document.cookie.substring(offset, endstr));
	}

function GetCookie (name) {
	var arg = name + "=";
	var alen = arg.length;
	var clen = document.cookie.length;
	var i = 0;
	while (i < clen) {
		var j = i + alen;
		if (document.cookie.substring(i, j) == arg) {
			return getCookieVal (j);
			}
		i = document.cookie.indexOf(" ", i) + 1;
		if (i == 0) break; 
		}
	return null;
	}

function DeleteCookie (name,path,domain) {
	if (GetCookie(name)) {
		document.cookie = name + "=" +
		((path) ? "; path=" + path : "") +
		((domain) ? "; domain=" + domain : "") +
		"; expires=Thu, 01-Jan-70 00:00:01 GMT";
		}
	}

function SetCookie (name,value,expires,path,domain,secure) {
	expires = new Date;
	expires.setMonth(expires.getMonth()+9);
  document.cookie = name + "=" + escape (value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
	}
	


var THEME_KEY = "theme";	
var DEFAULT_THEME = "estilos";	



function changeStyleSheet() {
	var s = GetCookie(THEME_KEY);	
	if (s == null) s = DEFAULT_THEME;	
	document.getElementById('default').href = "src/"+s+".css";	
}

function setTheme(name) {
	DeleteCookie(THEME_KEY);					
	SetCookie(THEME_KEY, name);
	self.location = self.location;	
}
	
changeStyleSheet(); 
