/**********************************************************
	VARS
**********************************************************/


/**********************************************************
	INIT FUNCTION
**********************************************************/
$(function(){
	// fix the PNGs to work in IE
	// $(document).pngFix();
	
	/* main flash content */
	var flashvars = {
	  embed:"true"
	};
	var params = {
	  menu: "false",
	  bgcolor: "#000000",
	  scale: "noscale",
	  quality: "high",
	  wmode: "transparent",
	  allowscriptaccess: "always",
	  allowfullscreen: "true"
	};
	var attributes = {
	  id: "flashcontent",
	  name: "flashcontent"
	};	
	swfobject.embedSWF('swf/main.swf', 'flashcontent', '100%', '100%', '9.0.45.0', 
		'swfobject/expressinstall.swf', flashvars, params, attributes);
	
	
	/* viddler episode1 */
	var flashvars = {
/*    autoplay: "t",
    useJavaScript:"t"  */
	};
	var params = {
/*    menu: "false",
    bgcolor: "#000000",
    scale: "noscale",
    quality: "high",
    wmode: "transparent",
    allowscriptaccess: "always",
    allowfullscreen: "true"    */
	};
	var attributes = {
	  id: "episode1video",
	  name: "episode1video"
	};
	swfobject.embedSWF('http://vimeo.com/moogaloop.swf?clip_id=12933489', 'episode1video', '610', '372', '8', 
		'swfobject/expressinstall.swf', flashvars, params, attributes);
	
	/* viddler episode2 */
	var flashvars = {
/*    autoplay: "t",
    useJavaScript:"t"
*/	};
	var params = {
/*    menu: "false",
    bgcolor: "#000000",
    scale: "noscale",
    quality: "high",
    wmode: "transparent",
    allowscriptaccess: "always",
    allowfullscreen: "true"                                          */
	};
	var attributes = {
	  id: "episode2video",
	  name: "episode2video"
	};
	swfobject.embedSWF('http://vimeo.com/moogaloop.swf?clip_id=12934203', 'episode2video', '610', '372', '8', 
		'swfobject/expressinstall.swf', flashvars, params, attributes);
	
	/* viddler episode3 */
	var flashvars = {
/*    autoplay: "t",
    useJavaScript:"t"
*/	};
	var params = {
/*    menu: "false",
    bgcolor: "#000000",
    scale: "noscale",
    quality: "high",
    wmode: "transparent",
    allowscriptaccess: "always",
    allowfullscreen: "true"  */
	};
	var attributes = {
	  id: "episode3video",
	  name: "episode3video"
	};
	swfobject.embedSWF('http://vimeo.com/moogaloop.swf?clip_id=12934153', 'episode3video', '610', '372', '8', 
		'swfobject/expressinstall.swf', flashvars, params, attributes);
	
	/* viddler episode4 */
	var flashvars = {
/*    autoplay: "t",
    useJavaScript:"t"
*/	};
	var params = {
/*    menu: "false",
    bgcolor: "#000000",
    scale: "noscale",
    quality: "high",
    wmode: "transparent",
    allowscriptaccess: "always",
    allowfullscreen: "true"   */
	};
	var attributes = {
	  id: "episode4video",
	  name: "episode4video"
	};
	swfobject.embedSWF('http://vimeo.com/moogaloop.swf?clip_id=12934109', 'episode4video', '610', '372', '8', 
		'swfobject/expressinstall.swf', flashvars, params, attributes);
	
	/* viddler episodeAll */
	var flashvars = {
/*    autoplay: "t",
    useJavaScript:"t"*/
	};
	var params = {
/*    menu: "false",
    bgcolor: "#000000",
    scale: "noscale",
    quality: "high",
    wmode: "transparent",
    allowscriptaccess: "always",
    allowfullscreen: "true"  */
	};
	var attributes = {
	  id: "episodeAllvideo",
	  name: "episodeAllvideo"
	};
	swfobject.embedSWF('http://vimeo.com/moogaloop.swf?clip_id=12982581', 'episodeAllvideo', '610', '372', '8', 
		'swfobject/expressinstall.swf', flashvars, params, attributes);
	
});

/*
function LightboxDelegate
@Action: dynamically launch a LightBox (ThickBox) url and hide the background flash content
@Params: 
	url - href to launch, can be an inline div
	caption - what is this link
*/
function LightboxDelegate(url,caption)
{
	// alert(url);
	$('#thickboxlink').attr({ 
		href: url,
		title: caption,
		alt: caption
	});
	$('#thickboxlink').click();
}

/*
function SocialDelegate
@Action: dynamically create and launch the ShareThis module from Flash
@Params: none
*/
function SocialDelegate()
{
	
	// create social button the use jQuery to click it
	var object = SHARETHIS.addEntry({
	title:'Share with Friends',
	summary: 'Sharing is good for the soul.'},
	{button:false});
	var element = document.getElementById("share");
	object.attachButton(element);
	$('#share > a').click();
}

var playStarted = function()
{
	// alert("playStarted");	
}

var playEnded = function()
{
	// alert("playEnded");	
	tb_remove();
}