function element(ID)
{
	if (document.getElementById)
		return document.getElementById(ID);
	else
		return document.all[ID];
}

function StartVideo(sUrl)
{
	var el2 = element("videobg");
	if (el2)
	{
		el2.style.display="block";
	}
	el2 = element("videobg2");
	if (el2)
	{
		el2.style.display="block";
	}
	el2 = element("videooverlay");
	if (el2)
	{
		el2.style.display="block";
	}

	var w = 800;
	var h = 450;

	var movie="/jwflvplayer312.swf?file=/video/" + sUrl + "&autostart=true&enablejs=true&volume=100";
	
	var el = element("flv");
	if (el)
	{
		var mh = h + 22; // extra height for UI of jw flvplayer
		//mh = h + 25; // extra height for UI of moxiecode player
		el.style.width = w + "px";
		el.style.height = mh + "px";
		WriteFlash("flv",movie,"flvplayer",w,mh);
	}
}

function StartVideoDonate(sUrl)
{
	var el2 = element("videobg");
	if (el2)
	{
		el2.style.display="block";
	}
	el2 = element("videobgdonate");
	if (el2)
	{
		el2.style.display="block";
	}
	el2 = element("videooverlay");
	if (el2)
	{
		el2.style.display="block";
	}

	var w = 640;
	var h = 360;

	var movie="/jwflvplayer312.swf?file=/video/" + sUrl + "&autostart=true&enablejs=true&volume=100&image=/images/dieuwertje.jpg";
	
	var el = element("donate-flv");
	if (el)
	{
		var mh = h + 22; // extra height for UI of jw flvplayer
		//mh = h + 25; // extra height for UI of moxiecode player
		el.style.width = w + "px";
		el.style.height = mh + "px";
		WriteFlash("donate-flv",movie,"flvplayer",w,mh);
	}
}

function StopVideoDonate()
{
	var el = element("donate-flv");
	if (el)
	{
		el.style.width = "1px";
		el.style.height = "1px";
		el.innerHTML = '';
	}
}


function StopVideo()
{
	var el = element("flv");
	if (el)
	{
		el.style.width = "1px";
		el.style.height = "1px";
		el.innerHTML = '';
	}
}

function HideVideo()
{
    var donate = element('donate-flv');
    
    if(donate != undefined && donate.style.width == '1px') {
	var el = element("flv");
	if (el)
	{
		el.style.width = "1px";
		el.style.height = "1px";
		el.innerHTML = '';
	}
	el = element("videobg");
	if (el)
	{
		el.style.display="none";
	}
	el = element("videobg2");
	if (el)
	{
		el.style.display="none";
	}
	el2 = element("videooverlay");
	if (el2)
	{
		el2.style.display="none";
	}
    }
}

var oldimgsrc = null;
function hl(obj, img)
{
	oldimgsrc = obj.src;
	obj.src = img;
}


function unhighlight(obj)
{
	obj.src = oldimgsrc;
	//obj.src = 'images/nixel.gif';
}

// callbacks for JW Player 3
function getUpdate(typ, pr1, pr2, pid)
{
	if (typ == "time") return; // pr1=seconds playing
	if (typ == "load") return; // pr1=percentage loaded
	//if (typ == "volume") return; // pr1=new volume
	//if (typ == "size") return; // volumr1=width,pr2=heighte

	// typ == "state": pr1=0 paused pr1=1 buffering pr1=2 playing pr1=3 complete
	var el = document.getElementById("dbg");
	if (el)
		el.innerHTML += "getupdate " + typ + "," + pr1 + "," + pr2 + "," + pid + "<br>";
	if (typ=="state" && pr1=="3") setTimeout('HideVideo()',100);
}


function WriteFlash(flashdiv,movie,sFlash,w,h)
{
	var fl = element(flashdiv);
	if (fl)
	{
		fl.innerHTML = '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="' + w + '" height="' + h + '" id="' + sFlash + '" align="left"> <param name="movie" value="' + movie + '"> <param name="allowScriptAccess" value="sameDomain"> <param name="play" value="true"> <param name="quality" value="autohigh"> <param name="bgcolor" value="#203193"> <param name="menu" value="false"> <embed src="' + movie + '" play="true" quality="autohigh" bgcolor="#203193" menu="false" width="' + w + '" height="' + h + '" name="' + sFlash + '" align="left" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></embed></object>';
	}
}



