function myFocus(element)
{
	if (element.value == element.defaultValue)
	{
		element.value = '';
	}
}
function myBlur(element)
{
	if (element.value == '')
	{
   		element.value = element.defaultValue;
	}
}

$(document).ready(function() {
	/* $('.fadein img:gt(0)').hide();
	setInterval(function(){$('.fadein :first-child').fadeOut(1150).next('img').fadeIn(1150).end().appendTo('.fadein');}, 6000); */
 
    $('a.popout-close').click(function(){
        $('#popout').hide('slow');
        return false;
    });
    $('#photo .ebook').click(function(){
        $('#popout').show('slow');
        return false;
    });
    $('.homeright .ebook').click(function(){
        $('#popout').show('slow');
        return false;
    });

    
	$('.homegraphic').innerfade({
		speed: 1400,
		timeout: 5000,
		type: 'sequence',
		containerheight: '516px'
	});

	$('#flash').flash({
		src: '/flash/boats.swf',
		wmode: 'transparent', 
		width: 600,
		height: 345
	});
		
	$("a.map-image").fancybox({
		'width'				: '75%',
		'height'			: '75%',
		'autoScale'     	: false,
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'type'				: 'iframe'
	});
	
	$("a.map-text").fancybox({
		'width'				: '75%',
		'height'			: '75%',
		'autoScale'     	: false,
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'type'				: 'iframe'
	});
	
	$("a.pop").fancybox({
		'width'				: '75%',
		'height'			: '75%',
		'autoScale'     	: false,
		'transitionIn'		: 'elastic',
		'transitionOut'		: 'elastic',
		'type'				: 'iframe'
	});
	
	//Footer Office Quicklinks Animation  
     $("ul.quickoffice li").mouseover(function(){  
        $('div', this).stop().show().animate({height:'202px'},{queue:false, duration:250, easing: 'easeOutQuad' })  
     });    
     $("ul.quickoffice li").mouseout(function(){  
         $('div', this).stop().animate({height:'0px'},{queue:false, duration:375, easing: 'easeOutQuad', complete: function(){ $(this).hide(); }  })  
     });
	
	jQuery('.acc_container').hide(); //Hide/close all container
	
	jQuery('.acc_trigger').click(function(){
		jQuery(this).css('display','none').next().slideUp(); //Add .acc_trigger class to clicked trigger and slide down the immediate next container
		$('.homeright').find('#read-more').css('display', 'none');
		return false; //Prevent the browser jump to the link anchor
	});
	
	//On Click
	jQuery('.acc_trigger').click(function(){
		if( jQuery(this).next().is(':hidden') ) { //If immediate next container is closed...
			$('.homeright').find('#read-more').css('display', 'block');
			jQuery('.acc_trigger').removeClass('active').next().slideUp(); //Remove all .acc_trigger classes and slide up the immediate next container
			jQuery(this).toggleClass('active').next().slideDown(); //Add .acc_trigger class to clicked trigger and slide down the immediate next container
		}
		return false; //Prevent the browser jump to the link anchor
	});
	
	/* Blog Pagination */
	$('#post-container').pajinate({items_per_page : 10, item_container_id : '.posts'});
});

function printPage()
{
	if (window.print)
		window.print()
	else
		alert("Sorry, your browser doesn't support this feature.");
}
