/*function loadFLV(f,a,i,h,w,li) {
	vi = (typeof i == "undefined") ? 0:i
	l = (typeof a == "undefined") ? "false":a;
	var F = {movie:"/flash/flvplayer/flvplayer.swf",width:w,height:h,majorversion:"7",build:"0",bgcolor:"#FFFFFF",id:"ftmovie",allowfullscreen:"true",
	            flashvars:"overstretch=false&showfsbutton=true&width=" + w + "&height=" + h +"&id=" + vi + "&file=" + f + "&image=" + li + "&enablejs=true&showdigits=false&autostart=" + l};
	UFO.create(	F, "flashbanner");
}*/

var player;
var videoid;
function loadFLV(f,a,i,h,w,li,sc,id,v) {
	vi = (typeof i == "undefined") ? 0:i;
	l = (typeof a == "undefined") ? "false":a;
	c = (typeof sc == "undefined") ? "bottom" : sc;
	id = (typeof id == "undefined") ? "flashbanner" : id;
	volume = (typeof v == "undefined") ? "100" : v;
	
	if(f.indexOf(";") > 0) {
		var files = f.split(";");
		var ran = Math.floor(files.length  * Math.random());
		var f = files[ran];
		if(li.indexOf(";") > 0) {
			var images = li.split(";");
			if(images.length == files.length)
				var li = images[ran];
		}
	}
	
	var F = {movie:"/res/flash/flvplayer.swf",width:w,height:h,majorversion:"7",build:"0",bgcolor:"#FFFFFF",id:"ftmovie",allowfullscreen:'true',wmode:'transparent',
	            flashvars:"overstretch=false&showfsbutton=true&width=" + w + "&height=" + h +"&id=" + vi + "&file=" + f + "&image=" + li + "&enablejs=true&showdigits=true&type=http&repeat=list&abouttext=About+AusGamers&aboutlink=/about/" + "&controlbar=" + c + "&autostart=" + l + "&volume=" + volume};

	UFO.create(	F, id)
}

function playerReady(obj) {
	player = $('ftmovie');
	$('ftmovie').addModelListener('STATE', 'stateMonitor');
};


function stateMonitor(obj)
{
	if(obj.newstate == 'BUFFERING')
	{
		new Ajax("/videos/sc.php", {postBody: 'state=start&id='+videoid}).request();
	}
	else if (obj.newstate == 'COMPLETED')
	{
		new Ajax("/videos/sc.php", {postBody: 'state=complete&id='+videoid}).request();
	}
};