/*******************************************************************************
* Title:		Anne Watts								                       *
* Date:			2009-09-01                                                     *
* Author:		Jason Lemm <jason@vividual.co.uk>                              *
* License:		This work is licenced under a Creative Commons Licence         *
*				http://creativecommons.org/licenses/by-nd/2.0/uk/			   *
*                                                                              *
* Copyright:	©2009 Vividual                                                 *
*******************************************************************************/

this.screenshotPreview = function(){	
	xOffset = 10;
	yOffset = 15;
	
	$("#Map area").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? "<br/>" + this.t : "";
		$("body").append("<div id='maptag-outer'><div id='maptag-inner'>"+c+"</div></div>");								 
		$("#maptag-outer")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("fast");						
	},
	function(){
		this.title = this.t;	
		$("#maptag-outer").remove();
	});	
	$("#Map area").mousemove(function(e){
		$("#maptag-outer")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});
};

this.dropdowns = function(){	
   $("#nav-inner ul li.drop").hover(function(){
        $(this).addClass("hover");
        $('#nav-inner ul:first',this).css('display', 'block');
    	$("#nav-outer").append("<div id='darken'></div>");								 
		$("#darken")
			.css("opacity","0.8")
			.css("width",$("#nav-outer").width())
			.css("height",$("#header-outer").height()+$("#content-outer").height()+$("#footer-outer").height())
			.fadeIn(300);
    }, function(){
 		$("#darken").fadeOut(300,function(){
 			$("#darken").remove();	
		});	
        $(this).removeClass("hover");
        $('#nav-inner ul:first',this).css('display', 'none');
   
    });
};

$(document).ready(function(){
	$("#arrows img.up").click(function(){
		autoscroll(-85);
	});

	$("#arrows img.down").click(function(){
		autoscroll(85);
	});

	function autoscroll(amt) {
		$('#scroller1').animate({
			scrollTop: $('#scroller1').scrollTop()+amt
		}, 400);
	}

	if($('#gallery a').length)
		$('#gallery a').lightBox({fixedNavigation:true});
	dropdowns();
	screenshotPreview();
});
