$(document).ready(function() {
	// fire lightbox
	  //      $(document).pngFix(); 
	//clean out images for links
	function cleanImage(n){
		n = n.replace(/ /g,'');
		n = n.toLowerCase();
		return n;
	}
	function imageReplace(n, p){ //n=image p=imageheight
		$img = cleanImage(n.text());
		$last = $img.lastIndexOf("/");		
		// setup rollover.  CSS must be set to overview hidden. 
		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"});
		});

	}
	// fire image replace on the menu items
//	$("#mainmenu a").each(function(){imageReplace($(this), 27);});
	
	// make header clickable.
	$("h1").click(function(){
		location = "/";
		});
	$("h1").css({cursor: "pointer"});	
	//subnav subitems dropdown.
	$("#nav_sub ul").hide();
	$("#nav_sub li").hover(
		function(){
			if($(this).children("ul").css("display") == "none"){
			}
		},
		function(){
	});
	$("#homenews ul li:last").css({paddingLeft: "18px", width: "160px"});
	// make the entire lastest news boxes clickable
	$("#homenews ul li").each(function(){
		var link = $(this).children("a").attr("href");
		$(this).css({cursor: "pointer"});
		$(this).click(function(){
			location.href = link;
			});
	});
	//bookmarks
	$("#social li img").each(function(){
		$(this).css({'opacity':'0.4', marginTop: "10px"});
		$(this).hover(function(){
			$(this).animate({opacity: 1, marginTop: "0px"}, {queue:false,duraction:500});
		},function(){
			$(this).animate({opacity: 0.3, marginTop: "10px"}, {queue:false,duraction:500});
			
		});
	});

});
