$(document).ready(function(){	
	
	//input labels	
	//$(":text").labelify();
	
	//site credits
	$('#credits').hover(
		function(e){
			$('#credits-info').fadeIn('fast');	
		},
		function(e){
			$('#credits-info').fadeOut('fast');	
		}
	);
	
	//drop menu
	$('#menu li').hover(
		function () {
			//show its submenu
			$('ul', this).fadeIn('fast');	
		
		},
		function () {
			//hide its submenu
			$('ul', this).fadeOut('fast');       
		}
	);
	
	//top link scrolling
	$("#top-link").find('a').click(function(){
	
		$('html, body').animate({scrollTop:0}, 'slow');
		return false;
		
	});
	
	//external links
	$("a").each( function(){
	
		if ($(this).attr("rel") == "_blank"){
			
			$(this).attr("target","_blank");
			$(this).addClass("external");
			
		}
	
	});
	
	//menu hover
	$('#menu').find('span').append( $('<span class="up"></span>') );
	$('#menu').find('span').append( $('<span class="over"></span>') );
	
	$('#menu a').hover(
		function(){ 
			$(this).find('span.over').fadeIn(500);
		},
		function(){ 
			$(this).find('span.over').fadeOut(500);
		}
	);
	
	
	$('#menu-bottom').find('a').hover(
		function(){
			$(this).find('span').fadeIn('500');//.show("slide", { direction: "left" }, 500);
		},
		function(){
			$(this).find('span').fadeOut('500');//.hide("slide", { direction: "right" }, 500);
		});
	
	//$('.photo').draggable();
	
	//photo gallery lightbox
	if ($('a.photo').length > 0){
		$('a.photo').lightBox({
			overlayOpacity:.9
		}); // Select all links with lightbox class
	}

});


$(window).load(function(){

	//slideshow
	if ($('#slideshow').length > 0){
		$('#slideshow').slideshow();
	}
	
	//interactive
	if ($('#interactive-map').length > 0){
		$('#interactive-map').interactiveMap();
	}

});
