$(document).ready(function() {
	/* Highslide */
	hs.registerOverlay({ overlayId:'closebutton', position:'top right', fade:2 });
	
	var dailymenu = document.getElementById("dailymenu")
	makeUnselectable(dailymenu);
	var scroller = new Scrollable(dailymenu, null, 395);
	
	dailymenu.startScrolling = function(){dailymenu._stopScrolling = scrollDownAnimation(scroller, 3, 80);}
	dailymenu.stopScrolling = function(){if(dailymenu._stopScrolling){dailymenu._stopScrolling(); dailymenu._stopScrolling = null;};}
	
	$(dailymenu).hover(
		function(){
			this.hovering = true;
			$(dailymenu).stop();
			scroller.sync();
			this.startScrolling();
		},
		function(){
			this.hovering = false;
			this.stopScrolling();
			$(dailymenu).animate({"top":"0px"}, 1000, function(){
				scroller.setScrollPosition(0, 0);
			});
		}
	);
	
	$(dailymenu).mousedown(function(){
		this.stopScrolling();
	});
	
	$(dailymenu).mouseup(function(){
		if(this.hovering) this.startScrolling();
	});
});

/* ----------------------
   Scripts
---------------------- */


/* Popup:
popup(URL, Width, Height, Left, Top, AutoCenter[0=False, 1=True], FullScreen[0=False, 1=True])
<a href="javascript:popUp('domain', 640, 480, 50, 50, 1, 0)">Popup!</a>
*/
function popup(URL, popWidth, popHeight, popLeft, popTop, autoCenter, fullScreen) {
	day = new Date();
	id = day.getTime();
	if ( autoCenter == 1 ) {
		var popLeft = (screen.width - popWidth) / 2;
		var popTop = (screen.height - popHeight) / 2;
	}
	if ( fullScreen == 1 ) {
		// Open in Full Screen window!
		eval("page"+id+" = window.open(URL, '"+id+"', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width="+(screen.width-10)+",height="+(screen.height-26)+",left=0,top=0');");
	} else {
		// Open in normal window!
		eval("page"+id+" = window.open(URL, '"+id+"', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width="+popWidth+",height="+popHeight+",left="+popLeft+",top="+popTop+"');");
	}
}

