this.imagePreview = function(){
	xOffset = 10;
	yOffset = 30;
	$("a.preview").hover(function(e){
		this.t = this.title;
		this.title = "";
		var c = (this.t != "") ? "<br/>" + this.t : "";
		$("body").append("<p id='preview'><img src='"+ this.rel +"' alt='image preview' />"+ c +"</p>");
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");
    },
	function(){
		this.title = this.t;
		$("#preview").remove();
    });
	$("a.preview").mousemove(function(e){
		$("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});
};

function js_load_bigimage(url){
	$("#thumbs a").removeClass();
	$(this).addClass('imagecurrent');		
	$('#bigimage').fadeOut(200, function() {
		$('#bigimage').load(url);
		setTimeout(function(){
			$("#bigimage").fadeIn("slow");
		}, 300);
	});	
}





$(document).ready(function(){
	
	if( currentpage != 'bars'){
	
	if ($('#date1').val()!=''){
		$('#date2').datePicker(
				{
					showYearNavigation :false,
					startDate: $('#date1').val()
				}
			);
	}
	$('#date1').datePicker(
		{
			showYearNavigation :false
		}
	)
	.bind('dateSelected',function()
		{
			$('#date2').datePicker(
				{
					showYearNavigation :false,
					startDate: $('#date1').val()
				}
			);
		}
	);
	}
	
	
	imagePreview();

	closetimer = 0;
	if($("#menu")) {
		$("#menu b").mouseover(function() {
		clearTimeout(closetimer);
			if(this.className.indexOf("clicked") != -1) {
				$(this).parent().next().slideUp(600);
				$(this).removeClass("clicked");
			}
			else {
				$("#menu b").removeClass();
				$(this).addClass("clicked");
				$("#menu ul:visible").slideUp(600);
				$(this).parent().next().slideDown(900);
			}
			return false;
		});
		$("#menu").mouseover(function() {
		clearTimeout(closetimer);
		});
		$("#menu").mouseout(function() {
			closetimer = window.setTimeout(function(){
			$("#menu ul:visible").slideUp(600);
			$("#menu b").removeClass("clicked");
			}, 900);
		});
	};

	$("a.opendiv").click(function(){
		$('div#signbox').toggle(200);
		return false;
	});
});


/* SCROLL */
var timer = null;
function ScrollStart( dir , div ) {
	stopScroller();
	timer = window.setInterval( function() { scrollIt( dir , div ) }, 10);
	document.onmouseup=stopScroller;
}
function scrollIt( dir , div ) {
	var obj = document.getElementById(div);
	switch( dir )
	{
		case 'up': obj.scrollTop-=1; break;
		default: obj.scrollTop+=1; break;
	}
}
function stopScroller() {
	window.clearInterval( timer );
}
/* end SCROLL */