var riverSlide		= 0;
var riverCount		= 0;
var entryWidth		= 293;
var maxEntries		= 0;

var flashvars = {};
	flashvars.xml_url = "/_local/xml/main_streaming.xml";
	
	var params = {};
	params.menu = "false";
	params.bgcolor = "#FFFFFF";
	params.wmode = "transparent";
	params.allowscriptaccess = "always";
	params.allowfullscreen = "true";
	
	var attributes = {};
	attributes.id = "player";
	attributes.name = "player";
	
	/* swfobject.embedSWF(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj) */
	swfobject.embedSWF("/_local/flash/preloadMain.swf", attributes.id, "440px", "23px", "9.0.45","/_local/js/swfobject/expressinstall.swf", flashvars, params, attributes);
	
$(document).ready(function() {
	$('.pg-home .secondary #s_media .s_items .s_item:first').addClass('feature');
	$('.pg-home .secondary #s_gallery .s_items ul, .secondary #s_artistbio .s_items, .secondary #s_media .s_items').addClass('clearfix');
	$('.pg-mobile .primary .s_item a.btn').fancybox({
		'width':580,
		'height':800,
		'type': 'iframe'
	});
	
	//find # of entries, which becomes the max # of entries
	$('.pagination a.prev').click(function() {
		riverCount = riverSlide + 1;
		
		if ( riverCount <= 0 ) {
			riverSlide = riverCount;
			$('#s_gallery').animate({marginLeft: (riverSlide * entryWidth) + 'px'}, 200 );
		}
		return false;
	});
	$('.pagination a.next, a.nextHolder').click(function() {
		maxEntries = $(".pg-home .secondary #s_gallery li.s_item").length;
		riverCount = riverSlide - 1;
			
		if ( riverCount > (-1 * maxEntries) ) {
			riverSlide = riverCount;
			$('#s_gallery').animate({marginLeft: (riverSlide * entryWidth) + 'px'}, 200 );
		}
		return false;
	});
	
	$(".pg-home .secondary #s_gallery li.s_item").each(function(){
		var imgCenter = ($(this).height() - $(this).find('img').height()) / 2;
		$(this).find("a").css({
			width: $(this).find('img').width(),
			height: $(this).find('img').height(),
			marginTop:(imgCenter - 40) + "px"
		});
	});
});
