$(function(){
	$("a#fancybox_trigger").fancybox({
										titlePosition: "outside",
										overlayOpacity: .95,
										titleFormat: formatTitle,
										overlayColor: '#333',
										autoDimensions: false,
										width: 640,
										height: 360
									 });
});

var flashvars = {};
var params = {wmode: "transparent"};
var attributes = {};
//*
swfobject.embedSWF("main.swf", "flash_content", "950", "1200", "10.0.0", "swf/expressInstall.swf", flashvars, params, attributes);
swffit.fit("flash_content");
//*/

function playVideo(id, credits){
	SlideShowProVideo({
		attributes: {
			id: "player",
			width: 640,
			height: 360,
			autoStart: true
		},
		params: {
			bgcolor: "#000000",
			allowfullscreen: true
		},
		flashvars: {
			apiPath: "http://thinkantidote.com/admin/reels/index.php?",
			videoId: id
		}
	});
	$("#fancybox_trigger").attr('title', credits);
	$("#fancybox_trigger").trigger('click');
}

function formatTitle(credits, currentArray, currentIndex, currentOpts) {
	var creds = credits.split("\n\n");
	var left_credits = creds[0];
	var right_credits = creds[1];
	
	if(left_credits.length){
		left_credits = left_credits.split("\n");	
		var lstr =  '<div id="left_credits">';
		for(var i in left_credits){
			lstr += "<div>" + left_credits[i] + "</div>";
		}
		lstr += "</div>";
	} else {
		var lstr =  '';
	}
	
	if(creds.length == 2){
		right_credits = right_credits.split("\n");
		var rstr =  '<div id="right_credits">';
		for(var j in right_credits){
			rstr += "<div>" + right_credits[j] + "</div>";
		}
		rstr += "</div>";
	} else{
		var rstr =  '';
	}
	
	return lstr + rstr + '<div style="clear: both"></div>';
}

function scrollEdit(){
	$.scrollTo(450, 750);
}

function scrollShoot(){
	$.scrollTo(325, 750);
}
