$(function() {
	var nb = $('#nav-banner-wrap'); 
	var topbanheight = 500;

	//do all the nav banner stuff
	function navBannerCheck() {
		if($(window).scrollTop() > 500) {
			nb.css({'position': 'fixed', 'top':'3px'});
		}		
		else {
			nb.css({'position': 'absolute', 'top':'503px'});			
		}
	}	
	$(window).scroll(function(){
		navBannerCheck();
	});	
	navBannerCheck();

	var bm = 15; //bottom margin of li elements
	var cur = $("#service-list .current");  //the current element
	var descs = $("#service-desc-wrap .desc");
	
	$("#service-list li a").click(function(e){
		var tar = $(e.target); //event target
		var i = tar.closest("li").prevAll().size();//get li index
		//animate the slidy guy
		var toff = tar.position().top - 3; //top offset of event target
		cur.animate({'top':toff}, 400);	
		//show the correct description
		descs.hide();
		descs.eq(i).fadeIn(400);
	});
	
	$('input').each( function( i , e ) {
		var e = $(e);
		var val = e.attr('value');
		
		e.focus(function(){
			if (e.attr('value') == val) e.attr('value', '');
		});
		e.blur(function(){
			if (e.attr('value') == '') e.attr('value', val	);
		});
		
	});

	$('.client .client-img-wrap a').fancybox({
		'titleShow' : false,
		'overlayColor' : '#000'
	}).mouseenter(function(){
		$(this).fadeTo('fast', .95);

	}).mouseout(function(){
		$(this).fadeTo('fast', 0);
	});

	//smoth scrolling anchors
	$.localScroll();
	
});
