Cufon.replace('.mainlnk');
Cufon.replace('h1', { fontFamily: 'Century Gothic' });
Cufon.replace('.foreground h1 span', { fontFamily: 'calibri'});
Cufon.replace('h2', { fontFamily: 'calibri' });
Cufon.replace('h3', { fontFamily: 'Century Gothic' });
Cufon.replace('#hd p');
/*Cufon.replace('.prompt');*/
Cufon.replace('div.sub');
Cufon.replace('p.title');
Cufon.replace('li p.articleTitle');
Cufon.replace('li div.date');
Cufon.replace('#portNav');
Cufon.replace('.portrequest');
//Cufon.replace('li.lTitle');
//Cufon.replace('a.projectLink');

$(document).ready(function($) {
	// Main menu subnav dropdowns
	$('#main li').mouseover(function(){
		$(this).children('ul').fadeIn('fast');
	}).mouseleave(function(){
		$(this).children('ul').fadeOut('fast');
	});
	
	// Startup Facebox
	$('a[rel*=facebox]').facebox(); 
	
	
	// Check to see if we're on the homepage so we can start the slideshow.
	//#####################################################################
	if(page==='home'){

		// Remove the black border from slider .png in IE
		$("#slideImages img").fixPNG();
		
		//Prepare the slide by adding some initial classes
		$('#slideImages li:first-child').addClass('start first');
		$('#slideImages li:last-child').addClass('last');
		$('#slideBullets li:last-child').addClass('bulletActive');
		
		// Loop through the list and fade/show each banner.
		var startSlide='';
		function slider(){
			startSlide = setInterval(function(){
				$('li.start').fadeOut(1000, function(){ $(this).removeClass('start'); });
				$('li.bulletActive').removeClass('bulletActive').prev().addClass('bulletActive');
	
				if($('li.start').hasClass('last')){
					$('li.first').fadeIn(1000).addClass('start');
					$('#slideBullets li:last-child').addClass('bulletActive');
				}else{
					$('li.start').next().fadeIn(1000).addClass('start');
				}
			}, 5000);
		}
		
		// Catch button clicks to stop our slider.
		$('#slideBullets li').click(function(){
			clearInterval(startSlide);
			
			// Get the image to fade in based on id from disc li and fade the current one out.
			var id = $(this).attr('id');
			$('#slideImages li').removeClass('start').fadeOut(1000);
			$('#slideImages li#'+id).addClass('start').fadeIn(1000);
			
			// Clear the current disc and set the appropriate one active.
			$('#slideBullets li').removeClass('bulletActive');
			$(this).addClass('bulletActive');
			
			// Wait 1/2 a second and then start the slider up again.
			setTimeout(function(){ slider(); }, 500);
		});
		
		// Call our slider function to get it going.
		slider();
		
		// For slider panels on homepage.
		$('.serviceBlock').mouseenter(function(){
			$(this).children('.slider').animate({top: '105px'}, 200);
		}).mouseleave(function(){
			$(this).children('.slider').animate({top: '13px'}, 200);
		});

	} // End homepage scripts.
	
	// 10 Years Banner Hover
	//###########################################
	$('#tenyears').mouseenter(function(){
		$(this).animate({width: '180px'}, 200); _gaq.push(['_trackPageview', '/celebrate/trophy_mouseover']);
	}).mouseleave(function(){
		$(this).animate({width: '26px'}, 200);
	});
	
	// Check to see if we're on a content page.
	//#########################################
	if(page==='content'){
		// Setup the portfolio slider snippet
		$('#sliderWindow li:first-child').addClass('current first');
		$('#sliderWindow li:last-child').addClass('last');
		$('div.portSlider a.next').click(function(){
			if($('#sliderWindow li.current').hasClass('last')){
				$('#sliderWindow').animate({left: '8px'}, 200);
				$('#sliderWindow li.current').removeClass('current');
				$('#sliderWindow li:first-child').addClass('current');
			}else{
				$('#sliderWindow').animate({left: '-=207px'}, 200);
				$('#sliderWindow li.current').removeClass('current').next('li').addClass('current');
			}
			return false;
		});
		
	} // End content page scripts.
	
	// Dream Team
	$(".employee-name").mouseenter(function(){
		$(this).stop();
		$(".employee-name.yolk").removeClass('yolk');
		$(this).addClass("yolk");
		
		var which = $(this).attr("id");
		content = $("#hidden-egg-info ."+which).clone();
		$("#employee-info").empty().html(content);
		/*Cufon.replace('.prompt');*/
		//Cufon.replace('h2');
		$('a[rel=facebox]').facebox(); 
		$("#employee-eggs img").attr("src", "../images/img_egg-"+which+".jpg");
		which = "";
		content = "";
	});
	
	$("#facebox .close").click(function(){
		$("#facebox .content").empty();
	});
	
	// Process
	if($('#process').length > 0){
		$('#process a').mouseover(function(){
			show = $(this).attr('rel');
			$('.'+show).slideDown('fast');
		}).mouseleave(function(){
			hide = $(this).attr('rel');
			$('.'+hide).slideUp('fast');
		});
	}
	
	// Contact Page Rollovers
	if( $('.contact-left').length > 0){
		$('.wrap').mouseover(function(){
			show = $(this).attr('id');
			$('#'+show+'pop').fadeIn('fast');
		}).mouseleave(function(){
			hide = $(this).attr('id');
			$('#'+hide+'pop').fadeOut('fast');
		});
	}
	
	// Columnizer for <ul>
	if ( $("ul.columnize").length ){
		$(".threeCol").columnize({ columns: 3 });
	}
	
	// SEO Client Slideshow
	if ( $(".slideshow").length ){
		$("#slideshow-seo-clients").cycle({speed: 500});	
	}
});



function howdy(url){
  /*alert($("#player").attr("rel"));
  e = setTimeout(function(){
  jwplayer('player').setup({
    'flashplayer': '/js/jwplayer/player.swf',
    'width': '480',
    'height': '360',
    'file': ''+url+'',
    'controlbar': 'bottom'
  });}, 200);*/
   var flashvars = {
      'file': url,
      'controlbar': 'bottom'
   };
   var params = {
      'allowfullscreen': 'true',
      'allowscriptaccess': 'always'
   }; 
   var attributes = {
      'id': 'playerID',
      'name': 'playerID'
   };
   swfobject.embedSWF('http://alterimaging.com/js/jwplayer/player.swf', 'player', '480', '360', '9', 'false', flashvars, params, attributes);
}


