// UTF8‼

$(document).ready(function(){

	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
		// IE Fix for Rotate Position
		$('#pages .page_title h2, #pages .page_title div').css({'top':'0'});
	}
	
	// Quotes
	$('#quote blockquote').hide();
	$('#quote blockquote:first').show(750);
	var quote_timer = setInterval(function(){
		$('#quote blockquote').hide(2000).eq((($('#quote blockquote:visible').index() == ($('#quote blockquote').length-1)) ? 0 : ($('#quote blockquote:visible').index()+1))).show(750);
	},10000);
	
	// Scroll Bars
	$('#pages .page_text').jScrollPane({scrollbarWidth:5,scrollbarMargin:15,showArrows:true});

	// Paging
	$('#pages > .page > .page_title').bind('click',function(){
		var $this = $(this).parent();
		// Shrink All Other Pages and Pause All Other Slide Shows
		$('#pages > .page').not($this).animate({'width':'33px'},1500,'easeOutCirc').children('.page_title').children('.page_title_bg_high').hide();
		$('#pages > .page').not($this).children('.page_image').cycle('pause');
		// Expand This Page and Resume Slide Show
		$this.stop().animate({'width':'746px'},1500,'easeOutCirc').children('.page_title').children('.page_title_bg_high').show();
		$this.children('.page_image').cycle('resume');
		// Update Anchor
		location.href = '#' + $this.attr('id').replace('_','');
	});

	// Open Specific Tab
	if (location.hash.slice(1) != '') {
		$('#_' + location.hash.slice(1) + ' .page_title').click();
	}

	// Establish All Slideshows Paused and Start Home Page Slide Show
	$('#pages .page_image').cycle({speed:2000});
	var slide_timer = setTimeout(function(){
		$('#pages .page_image').cycle('pause');
		$('#_page_home .page_image, #page_misc .page_image').cycle('resume');
	},250);
	
	// Update Page Curl Back Button
	$('#page_misc .page_curl a').text('Go Back').click(function(){
		history.back();
		return false;
	});

});
