$(document).ready(function(){
	/* clear and restore search fields */
	 $('#search input#search_term').val('Search');
	 $('input#newsletter_submit').wrap('<p id="nls_wrap"></p>');
	 $('#search_term').removeClass('clearClick').addClass('clickClear');
	 $('#newsletter_text').removeClass('clearClick').addClass('clickClear');
	 $('input.clickClear').focus(function() {
	    startText = $(this).val();
	    $(this).val('').addClass('focus');
	 });
	 $('input.clickClear').blur(function() {
	    blurText = $(this).val();
	    if (blurText == '') {
	       $(this).val(startText).removeClass('focus');
	    };
	 });   

	// color box launch
	$('#login .thickbox, #comments .thickbox').colorbox({iframe:true,width:400, height:250});
	$('#footer .thickbox').colorbox();
	$('.rsvp .thickbox ').colorbox({iframe:true,width:450, height:570});
	$('#options .thickbox,.section .thickbox, a[title=Edit Your Profile].thickbox').colorbox({iframe:true,width:500, height:570});
	
	$('#content .slideshow').colorbox({
		slideshow:true,
		photo:true,
		preloading:true,
		slideshowSpeed:5000,
		slideshowAuto:false,
		onComplete: function(){
			var caption = $("span.gallery-caption",this).text();
			if (!$('#cboxCaption').length) {
				$('#cboxContent').append('<div id="cboxCaption">'+ caption +'</div>');
			} else {
				$('#cboxCaption').text(caption);
			}
		}
	});
	
	//@end      

	$("aside #subnav > li").not("li.current").find("> a").each(function(index) {
		var $this = $(this);
	    if( $(this).attr('href') == '#' ) {
		  	$this.click(function(e){
				$this.parent().find("ul").slideToggle('fast');
				$this.parent().toggleClass("down");
				e.preventDefault();
			});
	   }
	});	
	
	
	$("#header nav ul ul").each(function(){
		$(this).find("li:last").addClass("last");
	});
	
	$(".hide").hide();
	$("h3.sitemap").click(function(){
		$(".sitemap-wrap, hr.hide").slideToggle();
	});
    
   $("#dock").hide();
}); //@end doc ready  

window.onload = function(){
	$('#dock').Fisheye({
			maxWidth: 60,
			items: 'a',
			itemsText: 'span',
			container: '.dock-container',
			itemWidth: 60,
			proximity: 60,
			alignment : 'left',
			valign: 'bottom',
			halign : 'center'
		});
    $("#dock").fadeIn(700);
}
