function loadVideo( filename, w, h, autos )
{
	var name = "videoPlayer";
	var container = document.getElementById( name );
	
	var width = (!w ? 464 : w);
	var height = (!h ? 372 : h);
	var autostart= (autos == null ? false : autos);
	
	container.innerHTML = "<a href=\"/media-videos/" + filename + ".wmv\"><img height=\""+height+"\" width=\""+width+"\" src=\"/media-videos/" + filename + "_noplayer.jpg\" alt=\"Click here to download video\" border=\"none\" /></a>";

	var s1 = new WMPObject("/media-videos/" + filename + ".wmv", "single", width, height);
	s1.addParam("SendPlayStateChangeEvents", "true");
	
	//if( !showControls )
	//	s1.addParam("showControls", "false");
	
	s1.addParam("WindowlessVideo", "True");
	s1.addParam("playCount", "10000");
	s1.write(name);
	
	/*
	var s2 = new SWFObject("/media-videos/WFLVidPlayer.swf", "single", "" + width, "" + height, "9");
	s2.addParam("allowfullscreen", "true");
	s2.addParam("wmode", "opaque");
	s2.addParam("play", "true");
	s2.write(name);
	*/
	
	    //video 3
    var s2 = new SWFObject("/media-videos/flvplayer.swf","single", width, ( height - 1 ),"7");
	s2.addParam("allowfullscreen","true");
	s2.addVariable("file", filename + ".flv");
	s2.addVariable("image","/media-videos/" + filename + ".jpg");
	s2.addVariable("width",width);
	s2.addVariable("height", height);
	s2.addParam("wmode", "opaque");
	s2.addVariable("autostart", autostart);	    
	s2.write(name);
}

function updateRatingOptions()
{
//	document.getElementById( "rating_count" ).style.display="none";
//	document.getElementById( "lblRatingSignIn" ).style.display ="";
}

function resetRatingOptions()
{
//	document.getElementById( "rating_count" ).style.display="";
//	document.getElementById( "lblRatingSignIn" ).style.display ="none";    		
}

function updateStarList(index)
{
	for (var i = 1; i <= 5; i++)
	{
		document.getElementById( "star" + i ).className = ( i <= index ? "rating-star-on" : "rating-star-off" );
		document.getElementById( "star" + i ).style.cursor = "pointer";
	}
}

function resetStarList()
{
	for( var i = 1; i <= 5; i++ )
	{
		document.getElementById( "star" + i ).className = ( i <= rating ? "rating-star-on" : "rating-star-off" );
	}
}

function submitRating( index )
{	
	$.get("/videos/" + videoID+"/rate_video", { rating: index } );
	
	rating = index;
	document.getElementById( "rating_count" ).innerHTML = "Thank you for your rating";
}