





jQuery.extend(jQuery.browser,{
		SafariMobile : navigator.userAgent.toLowerCase().match(/iP(hone|ad)/i) 
});


$(function(){
	
	
	var oSliderChildren = $('#slider2').children();
	
	
//--Remove repeat item in the sliders
	var oId = oSliderChildren.first().attr('rel');
	
	var toRemove = oSliderChildren
		.filter(function(){return $(this).attr('rel') == oId})
		.not(':first');
		
	if(toRemove.length > 0)
	{
		toRemove.remove();	
	}


	oSliderChildren.each(function(){
		var $e = $(this);
		
		if($.browser.SafariMobile)
		{
			$e.find('.head').find('.embed').css({display:'none'}).remove();
			$e.find('.head').find('a').css({display:'block'});
		
		} else {
			if($e.hasClass('type-video'))
			{
				$e.find('.head').find('a:first').remove();
			} else {
				$e.find('.head').find('.embed').remove();
			}	
		}
		
		
		var $intro = $e.find('.intro');
		if($intro.text().length > 20)
		{
			$intro.addClass('intro-with-content');
		}
		
	
		
	});
	
	/*
	$('#slider2').find('.type-story .head img').WaitForImgLoad({
		onload: function(){
			
			$('#slider2').find('li').each(function(){
				$(this).css({
					height: $(this).innerHeight()
				});
			});
			
	*/	
			$('#slider2').anythingSlider({
				width               : 500,   // if resizeContent is false, this is the default width if panel size is not defined
				height              : 380,   // if resizeContent is false, this is the default height if panel size is not defined
				resizeContents      : true, // If true, solitary images/objects in the panel will expand to fit the viewport
				startStopped        : true,  // If autoPlay is on, this can force it to start stopped
				buildNavigation: false,
				navigationFormatter : function(index, panel){ // Format navigation labels with text
					return ['Recipe', 'Quote', 'Image', 'Quote #2', 'Image #2'][index - 1];
				}
			});	
	/*		
		}
	});
	*/
	
	
	
	

});
