$(document).ready(function(){		
	alCinema = new slider();
	alCinema.slide('sliderOffset1','',1,6,960);	

	hpConcerti = new slider();
	hpConcerti.slide('sliderOffset2','',2,6,960);		
});	

function openLayer(action){
	if(action == 'open')
		$('#boxRicerca').slideDown("normal");
	else{
		$('#boxRicerca').slideUp("normal");
	}
}

function makeToolbar(LEVEL1,LEVEL2){
	if(LEVEL1 == 'spettacoli'){
		$("li#"+LEVEL1+" > a:first-child").attr("class","tabActiveSpettacoli" );
	}
	else{
		$("li#"+LEVEL1+" > a:first-child").attr("class","tabActive" );	
	}
	$("li#"+LEVEL1+" > ul").css({'display':''});	
	$("ul > li#"+LEVEL2+" > a:first-child").attr("class","subActive" );	
}

function $f(id){
	return document.getElementById(id);
}

function image(id){
   //$("img[src="+id+"]").css("display","none");
   id.style.display = 'none';
}

function radioCinema(){
radio=window.open('/v006/inc/radioCinema/popup.html', 'RadioCinema', 'height=500,width=530,menubar=no,resizable=no,scrollbars=yes, toolbar=no');
}



	var j = 1
	var htmlArray=new Array();
	function $f(id){
		return document.getElementById(id);
	}

	function stopTime(){
		clearTimeout(timer);
	}
	
	function cLabel(id,action,pa){
		
		for(i=1; i<=4; i++){
			if(id == i){
				$f('ppNav_'+id+'').className = 'Active';
			}
			else{
				$f('ppNav_'+i+'').className = 'noActive';
				
			}
		}
 	    j=j+1; 
		if (j > (4)) j=1
		if(action == 'auto')timer = setTimeout("cLabel("+j+",'auto',1)",10000); 
		if(action == 'stop')stopTime();		
		if(pa != 0){
			$("#innerPp").fadeOut("fast", function(){
			   htmlLoad(id);
			});
		}

		//htmlLoad(id);		
	}

/*
function htmlLoad(id){
$.ajax({		
	type: "GET",
	url: whr+"/hpSpettacoli/"+id+".html",
	data:"",
	dataType: "html",
	beforeSend  :function(){
		$("#innerPp").html('<div class="wait"><img src="/v006/img/loadinfo.gif"/></div>');
	},
	success: function(html){
		$("#innerPp").html(html);	
	}
	
});	
$("#innerPp").fadeIn("fast");
}
*/

function htmlLoad(id){
  if (htmlArray[id]==undefined){
      htmlArray[id]=$.ajax({
		  type: "GET",
		  url: whr+"/hpSpettacoli/"+id+".html",
	      data:"",
	      dataType: "html",
	      async: false,
	      beforeSend  :function(){
	      	$("#innerPp").html('<div class="wait"><img src="/v006/img/loadinfo.gif"/></div>');
	      }
      }).responseText;
  }
  $("#innerPp").html(htmlArray[id]);
  $("#innerPp").fadeIn("fast");
}

