
/*** JavaScript document for DGOTDU | C 2007 Oceanlab **************/


function swapLogo (ID,WHAT,STYLE) {

	if (WHAT == 'OVER') {
		document.getElementById('logo_'+ID).src 		= 'img/logo_'+ID+'_peqOn.gif';

	}
	
	else if (WHAT == 'OUT') {
		document.getElementById('logo_'+ID).src 		= 'img/logo_'+ID+'_peqOff.gif';
	}

}

 function ShowHide(ID,SPAN){
 
	if (
		document.getElementById(ID).style.display 			== 'none') {
			document.getElementById(ID).style.display		= 'block';
			document.getElementById(SPAN).style.display  	= 'none';
			} 
		
		else {
			document.getElementById(ID).style.display 		= 'none';
			document.getElementById(SPAN).style.display  	= 'block';
			}
		}
	
	function Hide(ID){
 
	if (
		document.getElementById(ID).style.display 					== 'block') {
			document.getElementById(ID).style.display				= 'none';
			document.getElementById('saber_'+ID).style.display  	= 'inline';
			} 

		}

	function changeHighlight(elem, val)
	{
		for (i=1 ; i<=3 ; i++)
		{
			if (i == val)
			{
				if (document.getElementById(elem + i) != null) 
				{
					document.getElementById(elem + i).style.display = 'block';
				}
			}
			else
			{
				if (document.getElementById(elem + i) != null) 
					document.getElementById(elem + i).style.display = 'none';
			}
		}
		return false;
	}
	
	
	function Search()
	{
		var id = "pesquisar";
		var form = "frm";
		if (document.getElementById(id) != null && document.getElementById(id).value.length < 3)
		{
			alert(unescape("O%20crit%E9rio%20de%20pesquisa%20tem%20de%20ter%20pelo%20menos%20tr%EAs%20caracteres."));
			return false;
		}
		else
		{
			//return true;
			document.getElementById(form).submit();
		}
	}
	
	function goChannel()
	{
		if (document.getElementById("acessoRapido") != null && document.getElementById("acessoRapido").value != '')
		{	
			window.location.href = "channel.aspx?channelID=" + document.getElementById("acessoRapido").value;
		}
	}
	
	function addLoadEvent(func) {
		var oldonload = window.onload;
		if (typeof window.onload != 'function') {
			window.onload = func;
		} else {
			window.onload = function() {
			oldonload();
			func();
			}
		}
	}

/*function ShowHide(ID){
	var faq_nr 		= document.getElementById(ID); 
	var faq_nrSPAN	= document.getElementById('saber_' + ID); 
	
	
	if (!faq_nr) {
 
 		if ( faq_nr.style.display		== "none" ) {
    		 faq_nr.style.display		= 'block';
			faq_nrSPAN.style.display  	= 'none';
  	} else {
    	faq_nr.style.display		= 'none';
		faq_nrSPAN.style.display  	= 'block';
		
  }
  
  return true;
  }
}*/
  var imgact=0;
  function changeImage(dir)
	{
		var ic = document.getElementById("mosaico-container");
		if (ic == null) return;
		var imgs_mos = ic.getElementsByTagName("img");
		if (imgs_mos.length > 1)
		{
			imgs_mos[imgact].style.display = "none";
			if (dir == 1)
				imgact = imgs_mos[imgact+dir]?imgact+dir:0;
			else
				imgact = imgact>0?imgact+dir:imgs_mos.length-1;
			imgs_mos[imgact].style.display = "inline";
		}
		return false;
	}
	
	
function navigateTrim(year, trim)
{
	var channelID;
	
	//get the fixed parameter
	var get=(""+location.search).substring(1).split("&");
	window.location.GET = new Array();
	for (var i in get) {
		
		var temp=get[i].split("=");
		if(temp[0] =="channelID")
			channelID = temp[1];
		//alert("param="+temp[0] + ",val="+temp[1]);
		//window.location.GET[temp[0]]=temp.splice(1,temp.length-1).join("=");
	}
	
	location.href = '/channel.aspx?channelID='+channelID+'&year='+year+'&trim='+trim;
}
	
