// some variables to save
var currentPosition;
var currentVolume;
var currentItem;

// these functions are caught by the JavascriptView object of the player.
function getUpdate(typ,pr1,pr2,pid) {
	if(typ == "time") { currentPosition = pr1; }
	else if(typ == "volume") { currentVolume = pr1; }
	else if(typ == "item") { currentItem = pr1; setTimeout("getItemData(currentItem)",100); }
};

// These functions are caught by the feeder object of the player.
function getItemData(idx) {
	var obj = thisMovie("fplayer").itemData(idx);
	$("#featured-video-title").html(obj["title"]);
};

// This is a javascript handler for the player and is always needed.
function thisMovie(movieName) {
    if(navigator.appName.indexOf("Microsoft") != -1) {
		return window[movieName];
	} else {
		return document[movieName];
	}
};

function createFeaturedVideoPlayer(h,w,target) {
	var so = new SWFObject("/swf/mediaplayer.swf","fplayer",w,h,"8","#333333");
	so.addParam("allowfullscreen","true");
	so.addVariable("file","/videos/rss_featured.xml");
	so.addVariable("config","/config/videoplayer_config.xml");
	so.addVariable("width",w);
	so.addVariable("height",h);
	so.addVariable("overstretch","true");
	so.addVariable("fullscreen","true");
	so.addVariable("shuffle","true");
	so.addVariable("enablejs","true");
    so.write(target);
};

function createFeaturedContentRotator(h,w,target) {
	var so = new SWFObject("/swf/imagerotator.swf","rotator",w,h,"7", "#000000");
	so.addVariable("file","/features/rss_featured.xml");
	so.addVariable("config","/config/featuredrotator_home.xml");
    so.addVariable("width",w);
    so.addVariable("height",h);
	so.addVariable("overstretch","true");
	so.addVariable("linkfromdisplay","true");
	so.addVariable("linktarget","_self");
	so.addVariable("repeat","true");
	so.addVariable("shuffle","false");
	so.addVariable("rotatetime","10");
    so.write(target);
};