$(function(){
   
	// height of background image in pixels
	var backgroundheight = 4000;
	
	// get the current minute/hour of the day
	var now = new Date();
	var hour = now.getHours();
	var minute = now.getMinutes();
	
	// work out how far through the day we are as a percentage - e.g. 6pm = 75%
	var hourpercent = hour / 24 * 100;
	var minutepercent = minute / 60 / 24 * 100;
	var percentofday = hourpercent + minutepercent;
	
	// calculate which pixel row to start graphic from based on how far through the day we are
	var startoffset = backgroundheight / 100 * percentofday;
	
	// sraphic starts at approx 6am, so adjust offset by 1/4
	var startoffset = startoffset - 1000;
	
	// end 1x background height after the start offset so we get a smooth loop
	var endoffset = startoffset + backgroundheight;

	function scrollbackground() {
		// set the background start position
		$('#footer').css({
			backgroundPosition: '50% -' + startoffset + 'px'
		});
		// animate through to the end
		$('#footer').animate({
			backgroundPosition:'(50% -' + endoffset + 'px)'
			},
			250000,
			"linear",
			function () {
				// callback to self to loop animation
				scrollbackground();
			}
		);
	}
	var badBrowser = (/MSIE ((5\.5)|6)/.test(navigator.userAgent) && navigator.platform == "Win32");
	if (!badBrowser) {
		scrollbackground();
	}
	$.localScroll.defaults.axis = 'xy';
	$.localScroll.hash({
		target: '#contenido_movimiento',
		queue:true,
		duration:1500
	});

	$.localScroll({
		target: '#contenido_movimiento',
		queue:true,
		duration:1000,
		hash:true,
		onBefore:function( e, anchor, $target ){},
		onAfter:function( anchor, settings ){}
	});
});
ddaccordion.init({
	headerclass: "menu", //Shared CSS class name of headers group
	contentclass: "submenu", //Shared CSS class name of contents group
	revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click" or "mouseover"
	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
	defaultexpanded: [], //index of content(s) open by default [index1, index2, etc]. [] denotes no content.
	animatedefault: false, //Should contents open by default be animated into view?
	persiststate: false, //persist state of opened contents within browser session?
	toggleclass: ["", ""], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	togglehtml: ["prefix", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: "fast", //speed of animation: "fast", "normal", or "slow"
	oninit:function(expandedindices){},
	onopenclose:function(header, index, state, isuseractivated){}
});
