/* MENU REGIÕES */
abrirRegioes = function(){
	if(document.all && document.getElementById){
		navRoot = document.getElementById("abrirRegioes");
		for(i = 0; i < navRoot.childNodes.length; i++){
			node = navRoot.childNodes[i];
			if (node.nodeName == "LI"){
				node.onmouseover = function(){
					this.className+=" over";
				}
				node.onmouseout = function(){
					this.className = this.className.replace(" over", "");
				}
			}
		}
	}
}
/* MENU SEÇÕES */
abrirMenu = function(){
	if(document.all && document.getElementById){
		navRoot = document.getElementById("abrirMenu");
		for(i = 0; i < navRoot.childNodes.length; i++){
			node = navRoot.childNodes[i];
			if (node.nodeName == "LI"){
				node.onmouseover = function(){
					this.className+=" over";
				}
				node.onmouseout = function(){
					this.className = this.className.replace(" over", "");
				}
			}
		}
	}
}



/* Aumentar/Diminuir tamanho da fonte */
var tamanho = 12;
function fonteMais(idTitle){
   tamanho += 2;
   if(tamanho > 16) tamanho = 16;
   document.getElementById(idTitle).style.fontSize = tamanho + "px";
}
function fonteMenos(idTitle){
	tamanho -= 2;
   if(tamanho < 8) tamanho = 8;
   document.getElementById(idTitle).style.fontSize = tamanho + "px";
}

/* Adicionar aos favoritos */
function addFavoritos(url,title){
		if (window.sidebar) window.sidebar.addPanel(title, url,"");
		else if(window.opera && window.print){
			var mbm = document.createElement('a');
			mbm.setAttribute('rel','sidebar');
			mbm.setAttribute('href',url);
			mbm.setAttribute('title',title);
			mbm.click();
		}
		else if(document.all){
			window.external.AddFavorite(url, title);
	}
}

// Limpar input ao clicar
function limpar (objeto, msg) {
    if (objeto.value == msg)objeto.value = '';
}

function mostrar (objeto, msg) {
    if (objeto.value == '')objeto.value = msg;
}

/* POP UP */
// onclick="MM_openBrWindow('url.php','OPS','width=100,height=100')"
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

/* DHTML */
function fechaDHTML(){
	document.getElementById('dhtml').style.visibility = "hidden";
}

/* SKY */
function fechaSKY(){
	document.getElementById('sky').style.visibility = "hidden";
}


/* ATUALIZAR LINKS PATROCINADOS */
function devolveRq(){
	try{
		rq = new XMLHttpRequest();
	}
	catch(erro1){
		try{
			rq = new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch(erro2){
			try{
				rq = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(erro3){
				window.alert('Seu navegador não tem suporte a Ajax');
				rq = false;
			}
		}
	}
	return rq;
}
var ajax = devolveRq();

function atualizaLinks(){
	var rand = parseInt(Math.random()*999999999999);
	var url = "shopping/atualiza_links.php?r="+rand;
	ajax.open("GET", url, true);
	ajax.onreadystatechange = RespostaLinks;
	ajax.send(null);
}

function RespostaLinks(){
	if(ajax.readyState == 4){
		if(ajax.status == 200){
			var Resp = ajax.responseText;
			document.getElementById("atualizaLinks").innerHTML = Resp;
		}else{
			window.alert('ERRO: '+ ajax.statusText);
		}
	}else{
		document.getElementById("atualizaLinks").innerHTML = "<img src='images/loading.gif' alt='' border='0' width='50' height='50' style='margin:5px 70px;' /><p style='font-size:10px; font-weight:bold; text-align:center;'>Carregando...</p>";
	}
}
