<!--

// set up our SWFObject ready to be pushed into the div
clipSo = new SWFObject("/flash/flvPlayer.swf","player","853","580","8");
//clipSo.addParam("wmode","transparent");
clipSo.addVariable("quality","high");

function setDefaultClip(){
	// getQueryParamValue is defined in swfObject
	clipOnTheUrl = document.getElementById("startVid").innerHTML;
                clipOnTheUrl = clipOnTheUrl.trim();
	if(clipOnTheUrl != "") {
		pushClip(clipOnTheUrl);
	} else {
		pushClip(0);
	}
}

String.prototype.trim = function() {
	return this.replace(/^\s+|\s+$/g,"");
}

function pushClip(clip) {

	var subtitles = getCookie('subtitles');
	var volume = getCookie('volume');

	if(subtitles == null || subtitles == "") {
		subtitles = 1;
	}
	
	if(volume == null || volume == "") {
		volume = 100;
	}

	// set the specific parameter for the selected clip and push to the div
	clipSo.addVariable("c",clip);
	clipSo.addVariable("s",subtitles);
	clipSo.addVariable("v",volume);
	clipSo.write("movie");

}

function updateLink(val) {
	document.getElementById("permaLink").innerHTML = val;
	document.getElementById("permaLink").href = val;
}

function updateSub(val) {
	subtitles = val;
	setCookie('subtitles',subtitles);
}

function updateVol(val) {
	volume = val;
	setCookie('volume',volume);
}

function setCookie(c_name,value) {
	var exdate = new Date();
	exdate.setDate(exdate.getDate() + 365);
	document.cookie = c_name + "=" + escape(value) 
			  + ";expires=" + exdate.toGMTString();
}

function getCookie(c_name)
{
	if (document.cookie.length>0) {
		c_start = document.cookie.indexOf(c_name + "=");
		if (c_start!=-1) { 
			c_start = c_start + c_name.length + 1;
			c_end = document.cookie.indexOf(";",c_start);
			if (c_end == -1) c_end = document.cookie.length;
			return unescape( document.cookie.substring(c_start,c_end) );
		} 
	}
	return "";
}

document.onload = setDefaultClip();

-->
