function menu_on(i){
	// if(typeof mto != 'undefined' ) clearTimeout(mto);
	 switch_menu(i,2);
}

function menu_out(i){
	// mto = setTimeout('switch_menu('+i+','+b+')',100);
	// alert("si "+i);
	 switch_menu(i,1);
}

function switch_menu(i,m){
	document.getElementById('ul'+i).style.display =  ( m==2 ? 'block' : 'none' );
	document.getElementById('li'+i).style.borderColor =  ( m==2 ? 'red' : 'blue' );
}

function veureDiv(identi, x,y) {

  if (document.getElementById(identi).style.display=="none") {
   document.getElementById(identi).style.display="block";
   document.getElementById(x).style.display="none";
   document.getElementById(y).style.display="none";
  }

 }
function veureCondicions(identi) {

  if (document.getElementById('div'+identi+'Tot').style.display=="none") {
   document.getElementById('div'+identi+'Tot').style.display="block";
   document.getElementById('div'+identi+'Parcial').style.display="none";
  } else {
   document.getElementById('div'+identi+'Tot').style.display="none";
   document.getElementById('div'+identi+'Parcial').style.display="block";
  }

 }
function change_disp(obrir, tancar){
	
	if( $('#items_'+tancar).css('display') == 'block' ){
		$('#items_'+tancar).slideUp("");
	}
	
	if( $('#items_'+obrir).css('display') == 'none' ){
		$('#items_'+obrir).slideDown("");
	}else{
		$('#items_'+obrir).slideUp("");
	}
}

function put_center_timetable(who, id){
	
	document.getElementById(who).value = id; 
	document.getElementById('items_'+who+'_selected').innerHTML = document.getElementById('items_'+who+'_'+id).innerHTML; // Puts name of the center
	document.getElementById('items_'+who).style.display = 'none'; // Like a slideUp
	
	// carguem el seguent select
	if (who == 'local'){
		$.get("form.php",{ value: id }, function(data){
		  	//alert("Data Loaded: " + data);
		  	//$("#items_feina").html(data);
		  	$("#items_feina_selected").empty();
		  	$("#items_feina").empty();
		  	$("#items_feina").append(data);
		  	
	     });
	}
} 
function mycarousel_initCallback(carousel)
{
    // Disable autoscrolling if the user clicks the prev or next button.
    carousel.buttonNext.bind('click', function() {
        carousel.startAuto(0);
    });

    carousel.buttonPrev.bind('click', function() {
        carousel.startAuto(0);
    });

    // Pause autoscrolling if the user moves with the cursor over the clip.
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};

// jquery
$(document).ready(function(){
    
    jQuery('#mycarousel').jcarousel({
        auto: 2,
        scroll: 1,
        wrap: 'last',
        initCallback: mycarousel_initCallback
    });
    $("#carrusel").css("visibility",  "visible");
	
	$("#localitzacio").change(function () {
        var value = $(this).val();
		//$("#local").val(value);
		$.get("form.php",{ value: value }, function(data){
		  	//alert("Data Loaded: " + data);
		  	$("#treball").html(data);
    	 });
 	})
 	
 	$("#treball").change(function () {
        var value = $(this).val();
		//$("#treb").val(value);
 	})
 });
