// JavaScript Document

var xmlhttp;

function alternaMenu(celula){
      document.getElementById('td_destaque').className='guiaout'; 
      document.getElementById('td_noticias').className='guiaout'; 
      document.getElementById('td_galeria').className='guiaout'; 
      document.getElementById('td_cursos').className='guiaout'; 
      document.getElementById(celula).className='guiasel'; 
}

function carrega(div, n, func){
    recarregar = true;
    document.getElementById(div).innerHTML='<p>&nbsp;</p><p align="center"><img src="images/carregando.gif"></p>';
    atual=n
    xmlhttp.open("GET", n,true);
    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4){
            var texto=xmlhttp.responseText
            texto=texto.replace(/\+/g," ")
            texto=unescape(texto)
            document.getElementById(div).innerHTML=texto;
				eval(func);
        }
    }
    xmlhttp.send(null);
}

function carrega2(div, n, func){
    recarregar = true;
    document.getElementById(div).innerHTML='<p>&nbsp;</p><p align="center"><img src="images/carregando.gif"></p>';
    atual=n
    xmlhttp.open("GET", n,true);
    xmlhttp.onreadystatechange=function() {
        if (xmlhttp.readyState==4){
            var texto=xmlhttp.responseText
            texto=texto.replace(/\+/g," ")
            texto=unescape(texto)
            document.getElementById(div).innerHTML=texto;
				eval(func);
        }
    }
    xmlhttp.send(null);
}

function iniciar() {
//   alternaMenu('td_destaque');
//   carrega('destaque','portlet_destaque.asp','');
//   carrega('menuv','tabmenuvajax.asp?idMenu=<%'=request("idMenu")%>','');
opacidade(document.getElementById('floater'), 100);
document.getElementById('floater').style.visibility = "visible";
document.getElementById('floater').style.left = ((document.body.clientWidth-document.getElementById('floater').width)/2)+"px";
//alert((document.body.clientWidth-300)/2);
timerFloater=setInterval('intervaloOn()',3000);
}

function intervaloOn(){
   clearInterval(timerFloater);
   document.getElementById('floater').style.visibility = "visible";
   timerFloater=setInterval('intervaloOff()',5000);
}

function intervaloOff(){
   clearInterval(timerFloater);
   document.getElementById('floater').style.visibility = "hidden";
}

function fecharFloater() {
	document.getElementById('floater').style.visibility = "hidden";
}

function opacidade(elem, valor) {
   var isIE= document.all ? true : false;
	 //alert(isIE);
	 if (!isIE) elem.style.opacity=(valor/100); 
	 else elem.style.filter="alpha(opacity="+valor+");";
   
}

function inicializarAjax() {
	try{
			xmlhttp = new XMLHttpRequest();
	}catch(ee){
			try{
					xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			}catch(e){
					try{
							xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
					}catch(E){
							xmlhttp = false;
					}
			}
	}
}

jQuery(document).ready(function() {

	inicializarAjax();																
	
	jQuery('body').bind('load', iniciar);
	
	var w1 = jQuery(window).width();
	var posX = (w1 - 400) / 2;

	jQuery('.open-webradio').popupWindow({ 
		height:220, 
		width:400, 
		top:50, 
		left:50 
	}); 
	
  jQuery('#img-rotator a img').css('display', 'inline');
	jQuery('#img-rotator').cycle({
    fx:   'shuffle', 
    shuffle: { 
        top:  80, 
        left:  221 
    }
	});
	

	/*if (jQuery('#popup').length > 0) {
	
		jQuery('#popup').modal({
			close:false,
			position: ["30%", posX],
			overlayId:'popupModalOverlay',
			containerId:'popupModalContainer',
			
			onShow: function (dialog){
	
				dialog.data.find('.open-webradio').bind('click', function(e) {
					e.preventDefault();
					jQuery.modal.close();
				})
			
			},
	
			onClose: function (dialog) {
				jQuery.modal.close();
			}
	
		});
		
	}*/
	
});

