	var listMenu = new FSMenu('listMenu', true, 'display', 'block', 'none');
	listMenu.animations[listMenu.animations.length] = FSMenu.animFade;
	var arrow = null;
	if (document.createElement && document.documentElement)
	{
	 arrow = document.createElement('span');
	 arrow.appendChild(document.createTextNode('>'));
	 // Feel free to replace the above two lines with these for a small arrow image...
	 //arrow = document.createElement('img');
	 //arrow.src = 'arrow.gif';
	 //arrow.style.borderWidth = '0';
	 arrow.className = 'subind';
	}


var col = (function () {
    var keys = [], values = [];
    return {
        get: function (key) {
            var at = keys.indexOf(key);
            if (at >= 0) {
                return value[at];
            }
        },
        set: function (key, value) {
            var at = keys.indexOf(key);
            if (at < 0) {
                at = keys.length;
            }
            keys[at] = key;
            value[at] = value;
	    alert("key:"+key+", value:"+value);
        },
        remove: function (key) {
            var at = keys.indexOf(key);
            if (at >= 0) {
                keys.splice(at, 1);
                value.splice(at, 1);
            }
        }
    };
}());


window.onload=function()
{
		//listMenu.activateMenu("listMenuRoot", arrow);
}



$.dpText = {
	TEXT_PREV_YEAR		:	'Any anterior',
	TEXT_PREV_MONTH		:	'Mes anterior',
	TEXT_NEXT_YEAR		:	'Any següent',
	TEXT_NEXT_MONTH		:	'Mes següent',
	TEXT_CLOSE			:	'Tancar',
	TEXT_CHOOSE_DATE	:	'Escollir data'
}

$.dpConst.SHOW_HEADER_SHORT=false;



function EnllacarAgenda()
{

	$('#setmana').datePicker({inline:false,selectWeek:true,startDate:'01/01/2009',createButton:false})
	/*
	.bind(
		'click',
		function()
		{
			alert('You ' + (state ? '' : 'un') // wrap
				+ 'selected ' + selectedDate);
				return false;
		}
	)
	*/
	.bind(
		'click',
		function()
		{
			$(this).dpDisplay();
			this.blur();
			return false;
		}
	)

	
	
	.bind(
		'dateSelected',
		function(e, selectedDate, $td, state)
		{
			//alert($(this.button).attr('title'));//='quetal';
			//$but = $(this.button);
			//$but.attr('title', selectedDate.asString());
			//$(this.button).attr('title',selectedDate.asString());
			//alert('You ' + (state ? '' : 'un') // wrap
			//	+ 'selected ' + selectedDate);
			//alert (this.innerHTML);
			
			//window.location='?DataInici='+selectedDate.asString();

			//Set cursor to hourglass
			document.body.style.cursor = "wait";

			


			$.post("link.php?DataInici="+selectedDate.asString(),function(data){ eval(data);document.body.style.cursor = "default"; });
			//this.innerHTML= 'Setmana del '+selectedDate.asString();
			
		}
	)
	//.dpSetSelected('09/02/2009')
	//.val('09/02/2009').trigger('change')
	;


	$('#setmanaanterior')
	.bind(
		'click',
		function()
		{
			//alert("link.php?DataInici="+DataInici+"&Accio=SetmanaAnterior");
			document.body.style.cursor = "wait";
			$.post("link.php?DataInici="+DataInici+"&Accio=SetmanaAnterior",function(data){ eval(data);document.body.style.cursor = "default";  });
			return false;
		}
	)
	;

	$('#setmanaseguent')
	.bind(
		'click',
		function()
		{
			document.body.style.cursor = "wait";
			$.post("link.php?DataInici="+DataInici+"&Accio=SetmanaSeguent",function(data){ eval(data);document.body.style.cursor = "default";  });
			return false;
		}
	)
	;


	
}


function CapturarBack(hash){
	var h;
	if (!($.browser.msie)) 
		h=document.location.hash;
	else
	{
		h=$("iframe").get(0).contentWindow.document.location.hash;
		document.location.hash=h;
	}
	if (!h.length)
		h=document.location.search;

	//$("body").css("cursor", "progress");
	//$("#agenda table a").css("cursor", "progress");
	$.post("link.php?"+h.substring(1),function(dt) { eval(dt);$("body").css("cursor", "auto"); $("#agenda table a").css("cursor", "hand");} );

	/*		
	else
	{
		h=document.location.search.substring(1);
		if (!($.browser.msie)) 
			document.location.hash=h;
		else
		{
			$("iframe").get(0).contentWindow.document.location.hash=h;
		}
	}
	*/
	//alert("link.php?"+document.location.hash.substring(1));
}

function CapturarClick(){
	//alert("link.php"+$(this).attr("href"));
	$.post("link.php"+$(this).attr("href"),function(data){ eval(data); });
	//$.post("link.php"+$(this).attr("href"),function(data){$("#Contingut").html(data); });
	if (!($.browser.msie)) {
		document.location.hash=($(this).attr("href")).slice(1);
		//$("body").css("cursor", "progress");
		//$("#agenda table a").css("cursor", "progress");
		//$.post("link.php?"+$(this).attr("href").slice(1),function(dt) { eval(dt);$("body").css("cursor", "auto"); $("#agenda table a").css("cursor", "hand");} );
		return false;
	}

}




$(document).ready(function() {
	//col("Hola")=10;
/*
 $('ul.gallery').galleria({
 			onImage   : function(image,caption,thumb) { // let's add some image effects for demonstration purposes
				
				// fade in the image & caption
				if(! ($.browser.mozilla && navigator.appVersion.indexOf("Win")!=-1) ) { // FF/Win fades large images terribly slow
					image.css('display','none').fadeIn(1000);
				}
				caption.css('display','none').fadeIn(1000);
				
				// fetch the thumbnail container
				var _li = thumb.parents('li');
				
				// fade out inactive thumbnail
				_li.siblings().children('img.selected').fadeTo(500,0.3);
				
				// fade in active thumbnail
				thumb.fadeTo('fast',1).addClass('selected');
				
				// add a title for the clickable image
				image.attr('title','Next image >>');
			},
			onThumb : function(thumb) { // thumbnail effects goes here
				
				// fetch the thumbnail container
				var _li = thumb.parents('li');
				
				// if thumbnail is active, fade all the way.
				var _fadeTo = _li.is('.active') ? '1' : '0.3';
				
				// fade in the thumbnail when finnished loading
				thumb.css({display:'none',opacity:_fadeTo}).fadeIn(1500);
				
				// hover effects
				thumb.hover(
					function() { thumb.fadeTo('fast',1); },
					function() { _li.not('.active').children('img').fadeTo('fast',0.3); } // don't fade out if the parent is active
				)
			}

		}); 

*/

	if (!($.browser.msie)) {
	$("#agenda table a").history(CapturarBack);
	$("#agenda table a").click(CapturarClick);
	}
	EnllacarAgenda();
	$('#slider').s3Slider({
            timeOut: 3000,
			 mOver: true
        });
	
});





