// starting the script on page load
$(document).ready(function(){
	
	Cufon.replace('h1');
	Cufon.replace('p');
	Cufon.replace('#mainmenu li');
	
	if( jQuery.isFunction(jQuery.fn.colorbox) ){
		// function exists, so we can now call it
		$("a[rel='gallery']").colorbox({transition:'fade', opacity:.85});
	}
		
	//$("#logo").fadeTo(0,0);
	//$("#mainmenu li").fadeTo(0,0);
	//$("#logo").animate({'opacity': 1},500);
	//$("#mainmenu li").fadeTo(2000, 1);	
	
	$("#right").fadeTo(0,0);
	$("#right").animate({'top':0,'opacity': 1},{easing:'easeOutQuint',duration: 750});
	$("#right").fadeOut(0);
	$("#right").fadeIn(0);
	
	$.localScroll({hash:true,duration:400,easing:'easeOutCirc'});
	
	//Calculate Page height
	jQuery( function( $ ) 
	{
		/* Initiate Smooth Anchors, page size and footer position on window resize */
		function content_resize()
		{					
			$('#content').css({height:$(window).height()});
			$('#left').css({'top': ($(window).height() - $('#left').height())/2});
			
			rightheight = ($(window).height());
			
			$('#right').css({ 'height': rightheight });
			
			if( jQuery.isFunction(jQuery.fn.jScrollPane) ){
				// function exists, so we can now call it
				$("#right").jScrollPane();
			}
			
			$('#vert-centre').css({'top': ($(window).height() - $('#left').height())/2 -10});
			$('#vert-centre').css({ 'left': ($('#right').width()-$('#vert-centre').width())/2 });
			
		}

		$( window ).wresize( content_resize );

		content_resize();
	});
	
	if( jQuery.isFunction(jQuery.fn.colorbox) ){
		// function exists, so we can now call it
		setTimeout('$("#right").jScrollPane()',2000);
	}
	
});
