 

$(function() {
	if (typeof(onReady) == 'function') onReady();
	
	if ($.cookie('visitor') != 1) {
		$.cookie('visitor', 1, {'expires': 7});
		$('.utility-message').css('display','block').delay(3000).slideUp(250,'easeInSine');
	}
	
/* if ($('.current_page_item').position()) {
  $('.page-child').find('.sub-navigation').css('background-position',($('.current_page_item').position().left - 10) + 'px bottom');
	} */
	
	$('.content-tabs').find('.tabs').find('li:first-child a').addClass('active');
	$('.tab-content').hide();
	$('.content-tabs').find('.contents').find('.tab-content:first-child').show();
	
	$('#cycle_home').cycle({
		fx: 'scrollHorz', // choose your transition type, ex: fade, scrollUp, shuffle, etc...
		timeout: 7000,
		prev: '.left_arrow',
		next: '.right_arrow',
		pager: '#home_cycle_pager',
		timeoutFn: calculateTimeout
	});
});

function calculateTimeout(currElement, nextElement, opts, isForward) { 
    var index = opts.currSlide; 
    var isIE = navigator.appName.indexOf("Microsoft") != -1;
    if(index == 0) {
    	if(isIE){
    		$("#FlashID").restartFlash();
    	}
    } 
    return index == 0 ? 24000 : 7000; 
}
function showHideUtility() {
	$utility = $('.utility-content');
	if ($utility.is(':visible')) {
	  $utility.slideUp(250,'easeInSine');
	} else {
	  $utility.slideDown(250,'easeOutSine');
	}
}

function showHideSitemap() {
	$sitemap = $('.sitemap');
	if ($sitemap.is(':visible')) {
	  $sitemap.slideUp(500,'easeInSine');
	} else {
	  $sitemap.slideDown(500,'easeOutSine');
			$('html, body').animate({'scrollTop': $(document).height()}, 1500);
	}
}

function showTab(tabID) {
	jQuery('.content-tabs .tabs').find('a').removeClass('active');
	jQuery('.content-tabs .tabs').find('.tab-' + tabID).addClass('active');
	jQuery('.content-tabs').find('.tab-content').hide();
	jQuery('.content-tabs').find('.tab-' + tabID).show();
	sIFRReplace();
}
