function getFlashMovie(movieName) {
  if (navigator.appName.indexOf("Microsoft") != -1) {
             return window[movieName];
         } else {
             return document[movieName];
         }

}
var dias=new Array()
dias["ca"]=["", "Dilluns","Dimarts","Dimecres","Dijous","Divendres","Dissabte","Diumenge"]

function verfecha(f,cambia){
//alert(f.getDate()+"/"+(f.getMonth()+1)+"/"+(f.getYear()+1900))
if(cambia==null){
$("#eventos").load("listaeventos.php",{fecha:f},function(e){
       //  alert(e)
      })
}
$("#diasemana").html(dias["ca"][f.getDay()])
var flashcal=getFlashMovie("flashcal")
try{
flashcal.cambianumero(f.getDate())
throw "er";
}
catch (err){
	}
}
 
 function veridiomas(){
	if ( $("#idiomas").is(":hidden")) {
        $("#idiomas").slideDown("fast");
      }
	 }
	 

	 var idarray=new Array();
	 idarray["es"]="Castellano";
	  idarray["en"]="English";
	 idarray["ca"]="Catalá";
	 function cambiaidioma(i,url){
		var code=i.replace("idioma_","")
document.location="switchlang.php?lang="+code+"&url="+url.replace("/rctb/","")
		//$("#idioma_"+i).remove()
	//	$("#idioma").append('<div class="idioma" id="idioma_'+code+'">'+idarray[code]+'</div>')
	 }
	 
	 
	 function fidiomas(url){
	 $(".idioma").bind("mouseenter",function(e){ 
											 $(this).removeClass("idioma")
											 $(this).addClass("idiomaover")})
	  $(".idioma").bind("mouseleave",function(e){  $(this).removeClass("idiomaover")
											 $(this).addClass("idioma")})
	  	  $("#idiomas>.idioma").bind("click",function(e){ cambiaidioma($(this).attr("id"),url)})
		  $("#idiomas").bind("mouseleave",function(e){  $(this).hide()})
	 }
	 
	 
	 
	 function calendario(i,fechas){
		 //i es el idioma
		  $('#date2').DatePicker({flat:true,mode:"multiple",format:"d-M-Y",date:fechas,current:'' ,locale: {
					days: ["Diumenge", "Dilluns","Dimarts","Dimecres","Dijous","Divendres","Dissabte","Diumenge"],
					daysShort: ["Dg", "Dl", "Dt", "Dc", "Dj", "Dv", "Ds", "Dg"],
					daysMin: ["dg", "dl", "dt", "dc", "dj", "dv", "ds", "dg"],
					months: ["gener","febrer","març","abril","maig","juny","juliol","agost","setembre","octubre","novembre","desembre"],
					monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
					weekMin: 'wk'
				}
			
 

});
		 
	 }
	 
	 function llamasuperbox(url){
		 
$('#dummyanchor').attr('href',url);
$('#dummyanchor').trigger('click')
 

 
	 }
	 $("body").append('<a rel="superbox[iframe][400x300]" id="dummyanchor"></a>');
	 
function smoothscroll(){
		 
	 $('a[href*=#]').click(function() {

   // duration in ms
   var duration=1000;

   // easing values: swing | linear
   var easing='swing';

   // get / set parameters
   var newHash=this.hash;
   var target=$(this.hash).offset().top;
   var oldLocation=window.location.href.replace(window.location.hash, '');
   var newLocation=this;

   // make sure it's the same location      
   if(oldLocation+newHash==newLocation)
   {
      // animate to target and set the hash to the window.location after the animation
      $('html:not(:animated),body:not(:animated)').animate({ scrollTop: target }, duration, easing, function() {

         // add new hash to the browser location
         window.location.href=newLocation;
      });

      // cancel default click action
      return false;
   }

});

	}