$(document).ready(function() {
	$("#twitter").getTwitter({
		userName: "HFX_Winterfest",
		numTweets: 3,
		loadText: "Loading",
		slideIn: false,
		showHeading: true,
		headingText: "Twitter Feed",
		showProfileLink: false
	});
	
	function cleanImage(n){
		n = n.replace(/[^a-zA-Z]/gi,'');
		n = n.toLowerCase();
		return n;
	}
	function imageReplace(n, p){ //n=image p=imageheight
		$img = cleanImage(n.text());
		$last = $img.lastIndexOf("/");		
		// setup rollover. 
		n.text("").html("<img src='/images/menu_"+ $img +".gif' />");		
		n.children("img").css({marginTop:"0px"});
		n.css({display: "block", overflow: "hidden", height: ""+ p + "px"});
		n.hover(function(){
				n.children("img").css({marginTop:"-"+ p + "px"});
			},function(){
				n.children("img").css({marginTop:"0px"});
		});
	}

	$("#addmenu ul a").each(function(){imageReplace($(this), 16);});
	$("#days ul a:first").each(function(){imageReplace($(this), 61);});
	$("#days ul a:eq(1)").each(function(){imageReplace($(this), 65);});
	$("#days ul a:last").each(function(){imageReplace($(this), 68);});
	$("#news").jScrollPane({
		scrollbarWidth: 11,
		dragMaxHeight: 22
	});

	//create outter transpartent border.

	$("#container").before("<div id='shadow'></div>");
	var conH = $("#container").height();
	var conW = $("#container").width();
	$("#shadow").css({
		backgroundColor: "#000012",
		position: "relative",
		width: conW+18,
		height: conH+18,
		margin: "0 auto 0px auto",
		left: "0px",
		top: "60px",
		opacity: "0.8",
		zIndex: "-1"
		});
	$("#container").css('marginTop', -((conH+9)-60));
	//add scarf
	
	$("#shadow").before("<div id='scarf'></div>");
	//var docWidth = $(window).width();
	$("#scarf").css({
		width: "100%",
		backgroundImage: "url('/images/bg-scarf.jpg')",
		backgroundRepeat: "no-repeat",
		backgroundPosition: "center top",
		height: "387px",
		position: "absolute",
		zIndex: "-2",
		top:"0px",
		left:"0px"
	});
	$("#map a").lightBox();
});

