jQuery.noConflict();

jQuery(document).ready(function(){
	
	// input hint
	if(jQuery('input')[0]){
		jQuery('input').hint();
	}
	
	// main menu
	jQuery('#firstMenu li:first a').addClass("firstItem");
	jQuery('#smallMenu li:first a').addClass("lastItem");
	jQuery('#smallMenu li:last').addClass("firstItem");
	
	// home boxes
	jQuery('#leftColumnHome .homeBox:last, #rightColumnHome .homeBox:last').addClass("lastBox");
	
	// home tabs
	if(jQuery('#homeTabs')[0]){
		jQuery('#homeTabs').tabs().tabs("rotate", 5000);
	}
	
	// team
	(function($) {	 
	  
	  var $team = $('#team');
	  $('.teamItem', $team)	  
	  	.mouseenter(function () { $(this).addClass('hovered'); })
	  	.mouseleave(function () { $(this).removeClass('hovered'); });
	  
	    	  
	  
	  //Dialog Pager
	  $('.pager').each(function(_i){
	  	$a = $('.pager a');
		$teamContainer = $('#team .teamItem > .hidden');
		
		$(this).attr('index', _i);
		
		if (_i == 0) {
			$(this).find('.prev').hide();
		}
		
		if (_i == $teamContainer.length-1){
			$(this).find('.next').hide();
		}
		
		$a.live('click', function(event){
			event.preventDefault();
			_i = $(this).parent().attr('index');
			//Setting the content back
			$ajaxWindowContent = $('#TB_ajaxContent');
			//$teamContainer.eq(_i).empty().html($ajaxWindowContent.html());
			$ajaxWindowContent.empty();
			
			_length = $teamContainer.length-1;
			
			if ($(this).is('.prev')) {
			    if (_i > 0) {
					_i--
				}
				
			} else {
				if (_i < _length) {
					_i++
				}
			}
			
			$ajaxWindowContent.html($teamContainer.eq(_i).html());
		  	return false;			
		})
	  });
	  
	  
	  
	  $('#slideshow-background').show().cycle().siblings('#layout').css('background','none').parents('html')
	  	.css({
	  		'overflowX': 'hidden',
	  		'min-width': '960px'
	  	});
	  
	  jQuery('.pager').corner('7px bl br');
	  
	  $('.teamItem').each(function(index){
            var x = $('.teamItem').length - index;
            $(this).css({'z-index':x, 'position':'relative'}); 
        });
	  
	  
	})(jQuery)
	
	// cufon special fonts
	Cufon.replace('#pageCaption, .homeBox h2, #homeTabs h1, .rightBox h2, .box h2', { fontFamily: 'Dax', hover: true });
	Cufon.replace('.box-item li', { fontFamily: 'Dax Medium', hover: true });
	Cufon.replace('.itemTeam .itemContent p', { fontFamily: 'Dax Medium Italic', hover: true });

});
