//Set Font Styles for page
Cufon.replace('p a', { fontFamily: 'Gotham Condensed Book', hover: true });	
Cufon.replace('p', { fontFamily: 'Gotham Condensed Book' });
Cufon.replace('li', { fontFamily: 'Gotham Condensed Book', hover: true });
Cufon.replace('.link', { fontFamily: 'Gotham Condensed Book' });
Cufon.replace('.footer_menu_item', { fontFamily: 'Gotham Condensed Book' });
Cufon.replace('.menu_item', { fontFamily: 'Gotham Condensed Book', hover: true });
Cufon.replace('.menu_item_store', { fontFamily: 'Gotham Condensed Book', hover: true });
Cufon.replace('.submenu_item', { fontFamily: 'Gotham Condensed Book', hover: true });
Cufon.replace('.schedule_item', { fontFamily: 'Gotham Condensed Book' });
Cufon.replace('.results_item', { fontFamily: 'Gotham Condensed Book' });
Cufon.replace('.sm_link', { fontFamily: 'Gotham Condensed Book', hover: true });

Cufon.replace('h1', { fontFamily: 'Gotham Thin' });
Cufon.replace('.h1_title', { fontFamily: 'Gotham Thin' });
Cufon.replace('#twitter_update', { fontFamily: 'Gotham Thin', hover: true });	
Cufon.replace('.photo_title', { fontFamily: 'Gotham Thin' });

Cufon.replace('h2', { fontFamily: 'Gotham Condensed Bold' });
Cufon.replace('h3', { fontFamily: 'Gotham Condensed Bold' });
Cufon.replace('h4', { fontFamily: 'Gotham Condensed Bold' });
Cufon.replace('h5', { fontFamily: 'Gotham Condensed Bold' });
Cufon.replace('.blk_title', { fontFamily: 'Gotham Condensed Bold' });
Cufon.replace('.wht_title', { fontFamily: 'Gotham Condensed Bold' });
Cufon.replace('.results_title', { fontFamily: 'Gotham Condensed Bold' });

//no conflict jquery 
jQuery.noConflict();

jQuery(document).ready(function(){ 
			
	//Find the height and width of the page
	var pageHeight = jQuery(window).height();
	var pageWidth = jQuery(window).width();
	var contentHeight = jQuery("#page-wrap").height();
	var contentPadding = Math.round(contentHeight - 86 - 516 - 36);
	var homeContentPadding = Math.round(contentHeight - 61 - 519 - 36);
	if (contentPadding > 0) {
		jQuery("#horizontal_content").css("padding-top", contentPadding);
		jQuery("#main_content").css("margin-top", homeContentPadding + 55);
	} else {
		jQuery("#horizontal_content").css("padding-top", 25);
		jQuery("#main_content").css("margin-top", 55);
	}
	
	var twitter_content_left = (pageWidth * 760) / 1158;
	var twitter_content_top = (pageHeight * 200) / 768;
	jQuery(".twitter_content").css("left", twitter_content_left);
	jQuery(".twitter_content").css("top", twitter_content_top);
	
	//If the window is resized, adjust the position of the markers
	jQuery(window).resize(function() {
		
		pageHeight = jQuery(window).height();
		pageWidth = jQuery(window).width();
		contentHeight = jQuery("#page-wrap").height();
		contentPadding = Math.round(contentHeight - 86 - 516 - 36);
		homeContentPadding = Math.round(contentHeight - 61 - 519 - 36);
		if (contentPadding > 0) {
			jQuery("#horizontal_content").css("padding-top", contentPadding);
			jQuery("#main_content").css("margin-top", homeContentPadding + 55);
		} else {
			jQuery("#horizontal_content").css("padding-top", 25);
			jQuery("#main_content").css("margin-top", 55);
		}
		
		twitter_content_left = (pageWidth * 760) / 1158;
		twitter_content_top = (pageHeight * 200) / 768;
		jQuery(".twitter_content").css("left", twitter_content_left);
		jQuery(".twitter_content").css("top", twitter_content_top);
		
	});
	
	//Set the main menu item as active for each page
	var parent = window.location.pathname.split("/");  //Get the URL path of the current page
	
	jQuery("#menu_items").children().each(function() {
		child = jQuery(this); 
		var elem = child.find("a");
		var child = elem.attr("href").split("/");
		if(parent[1] != "") {
			if(jQuery.inArray(parent[1], child) != -1) {
				elem.addClass('active');
				Cufon.refresh('.menu_item');
			} 
		}
	});
	
	jQuery("#menu_items_store").children().each(function() {
		child = jQuery(this); 
		var elem = child.find("a");
		var child = elem.attr("href").split("/");
		if(parent[1] != "") {
			if(jQuery.inArray(parent[1], child) != -1) {
				elem.addClass('active');
				Cufon.refresh('.menu_item_store');
			} 
		}
	});
	jQuery("#submenu_items").children().each(function() {
		child = jQuery(this); 
		var elem = child.find("a");
		if(elem.attr("href") == window.location.pathname) {
			elem.addClass('active');
			Cufon.refresh('.submenu_item');
		} 
	});
	
	//Setup the scrolling content
	jQuery('div.lightbox_content').scrollTo(0);
	jQuery.scrollTo(0);
	
	var scrollContent = jQuery('#blk_box');
	
	jQuery('#lightbox_scroll_up').click(function(){
		scrollContent.stop().scrollTo( {top:'-=350px',left:'0'}, 500 );
	});
	jQuery('#lightbox_scroll_down').click(function(){
		scrollContent.stop().scrollTo( {top:'+=350px',left:'0'}, 500 );
	});
	
	//Setup the scrolling content for news articles
	jQuery('div.article_content').scrollTo(0);
	jQuery.scrollTo(0);
	
	var scrollContent = jQuery('#article');
	
	jQuery('#article_scroll_up').click(function(){
		scrollContent.stop().scrollTo( {top:'-=350px',left:'0'}, 500 );
	});
	jQuery('#article_scroll_down').click(function(){
		scrollContent.stop().scrollTo( {top:'+=350px',left:'0'}, 500 );
	});
	
	//Setup the vertical scrolling content
	jQuery('#scroll_up').hide();
	jQuery('#sponsors').serialScroll({
		items:'li',
		prev:'#scroll_up a',
		next:'#scroll_down a',
		axis:'y',
		start:0,
		step:3,
		duration:800,
		force:true,
		stop:true,
		lock:false,
		cycle:false,
		easing:'easeinout',
		onBefore:function( e, elem, $pane, $items, pos ){
			jQuery('#scroll_up,#scroll_down').show();
			if( pos == 0 )
				jQuery('#scroll_up').hide();
			else if( pos == $items.length-1 )
				jQuery('#scroll_down').hide();
		}
	});

	//Setup the horizontal scrolling content
	jQuery('#scroll_left').hide();
	jQuery('#career').serialScroll({
		items:'li',
		prev:'#scroll_left a',
		next:'#scroll_right a',
		offset:-5,
		start:0, 
		step:3,
		duration:800,
		force:true,
		stop:true,
		lock:false,
		cycle:false,
		easing:'easeinout',
		onBefore:function( e, elem, $pane, $items, pos ){
			jQuery('#scroll_left,#scroll_right').show();
			if( pos == 0 )
				jQuery('#scroll_left').hide();
			else if( pos == $items.length-1 )
				jQuery('#scroll_right').hide();
		}
	});
	jQuery('#gallery').serialScroll({
		items:'li',
		prev:'#scroll_left a',
		next:'#scroll_right a',
		offset:-5,
		start:0, 
		step:3,
		duration:800,
		force:true,
		stop:true,
		lock:false,
		cycle:false,
		easing:'easeinout',
		onBefore:function( e, elem, $pane, $items, pos ){
			jQuery('#scroll_left,#scroll_right').show();
			if( pos == 0 )
				jQuery('#scroll_left').hide();
			else if( pos == $items.length-1 )
				jQuery('#scroll_right').hide();
		}
	});
	
	//Schedule Toggle (Show/Hide extra content)
	jQuery(".schedule_extra").hide();

	jQuery("#item_more").toggle(function(){
		jQuery(this).text("[-]");
		}, function () {
		jQuery(this).text("[+]"); 
	});
	
	jQuery(".schedule_container").click(function(){
		jQuery(this).next(".schedule_extra").slideToggle("slow");
	});
	
	//Results Toggle (Show/Hide extra content)
	jQuery(".results_extra").hide();

	jQuery("#results_more").toggle(function(){
		jQuery(this).text("[-]"); 
		}, function () {
		jQuery(this).text("[+]"); 
	});
	
	jQuery(".results_container").click(function(){
		jQuery(this).next(".results_extra").slideToggle("slow");
	});
		
	//Footer Menu Hover Effects
	jQuery(".footer_menu_item").hover(
		function () {
		  jQuery(this).children("div").animate({opacity: "0"}, "slow");
		}, 
		function () {
		  jQuery(this).children("div").animate({opacity: "1"}, "slow");
		}
	);
	
	//Page Links Hover Effects
	jQuery(".link").hover(
		function () {
		  jQuery(this).children("div").animate({opacity: "0"}, "slow");
		}, 
		function () {
		  jQuery(this).children("div").animate({opacity: "1"}, "slow");
		}
	);
		
});
