// JavaScript Document

tamanho = '16'

function zoom(fsinal){

	qtd = window.parent.frames[1].window.document.getElementById('itens')
	
		if(qtd!=null){
			
			qtd = qtd.value

			if(fsinal==1){
				
				for(i=1;i<=qtd;i++){
				
				if(window.parent.frames[1].window.document.getElementById('id'+i)!=null){
					
					if(window.parent.frames[0].window.document.getElementById('tamanhoPagina').value!=''){
					
					
					window.parent.frames[1].window.document.getElementById('id'+i).style.fontSize = window.parent.frames[0].window.document.getElementById('tamanhoPagina').value+"px"
					
					
						}
					}
				}
			}

			
			if(fsinal=='+'){
				
				if(window.parent.frames[0].window.document.getElementById('tamanhoPagina').value==''){
					tamanho = '16'
				}
				
				tamanho++ 			
				fontes = tamanho+"px"
				for(i=1;i<=qtd;i++){
					
				window.parent.frames[1].window.document.getElementById('id'+i).style.fontSize = fontes
				window.parent.frames[0].window.document.getElementById('tamanhoPagina').value = tamanho								
				}
			}
			
			if(fsinal=='-'){
				
				if(window.parent.frames[0].window.document.getElementById('tamanhoPagina').value==''){
					tamanho = '16'
				}
				
				tamanho-- 			
				fontes = tamanho+"px"
				for(i=1;i<=qtd;i++){
					
				window.parent.frames[1].window.document.getElementById('id'+i).style.fontSize = fontes
				window.parent.frames[0].window.document.getElementById('tamanhoPagina').value = tamanho				
				}
			}

			
			if(fsinal=='N'){


				
				tamanho = ''
				url = window.parent.frames[1].window.location
				window.parent.frames[1].window.location = url
				window.parent.frames[0].window.document.getElementById('tamanhoPagina').value = tamanho
					
			}
			
		}
		
		
	if(tamanho<=2){
		tamanho=2
	}	
}



function AtualizarPagina(){
	
	zoom(1)

	var SkinPagina = window.parent.frames[0].window.document.getElementById('corPagina').value
	if(SkinPagina==''){
		SkinPagina = 'padrao'
	}
	
	mudarCSS(SkinPagina)

}





function mudarCSS(titleCss){

if(document.getElementById("corPagina")!=null){
	document.getElementById("corPagina").value = titleCss
}


for(i=0;(a=window.parent.frames[1].window.document.getElementsByTagName("link")[i]);i++){
	if(a.getAttribute("title")==''){
		acao = ''
	}else{
		acao = 1	
	}
}

	if(acao!=''){
		
		if(titleCss=='branco'){
			
			
			setActiveStyleSheet(titleCss)	
/*			if(window.parent.frames[1].window.document.getElementById('imagem')!=null){			
				var Url = window.parent.frames[1].window.document.getElementById('imagem').src
				Url = Url.replace('preto.png','cabec2.gif')
				window.parent.frames[1].window.document.getElementById('imagem').src = Url
			}
*/			
		}else
		if(titleCss=='preto'){
			
			setActiveStyleSheet(titleCss)	
/*			if(window.parent.frames[1].window.document.getElementById('imagem')!=null){
				var Url = window.parent.frames[1].window.document.getElementById('imagem').src
				Url = Url.replace('cabec2.gif','preto.png')
				window.parent.frames[1].window.document.getElementById('imagem').src = Url
			}
*/			
		}else 
		if(titleCss=='padrao'){
			
			setActiveStyleSheet(titleCss)	
/*			if(window.parent.frames[1].window.document.getElementById('imagem')!=null){			
				var Url = window.parent.frames[1].window.document.getElementById('imagem').src
				Url = Url.replace('preto.png','cabec2.gif')
				window.parent.frames[1].window.document.getElementById('imagem').src = Url
			}
*/		}
	}
}


function setActiveStyleSheet(title) {
var i, a, main;
for(i=0;(a=document.getElementsByTagName("link")[i]);i++)
 {
if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
a.disabled = true;
if(a.getAttribute("title") == title) a.disabled = false;
     }
   }
   
for(i=0;(a=window.parent.frames[1].window.document.getElementsByTagName("link")[i]);i++)
 {
if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
a.disabled = true;
if(a.getAttribute("title") == title) a.disabled = false;
     }
   }
}




function getActiveStyleSheet() {
var i, a;
for(i=0;(a=document.getElementsByTagName("link")[i]);i++)
 {
if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")
&& !a.disabled) return a.getAttribute("title");
  }
return null;
}



function createCookie(name,value,daes) {
if (daes) {
var date = new Date();
date.setTime(date.getTime()+(daes*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
  }
else expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}


function readCookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0)
return c.substring(nameEQ.length,c.length);
  }
return null;
}



function getPreferredStyleSheet() {
var i, a;
for(i=0;(a=document.getElementsByTagName("link")[i]);i++)
{
if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("rel").indexOf("alt") == -1 && a.getAttribute("title")
 ) 
return a.getAttribute("title");
   }
return null;
 }
 
 
 
window.onload = function(e) {
var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);
}




window.onunload = function(e) {
var title = getActiveStyleSheet();
createCookie("style", title, 365);
}