function mediaplayerloop(thefilename, thewidth, theheight){
	document.write('<div style="width:'+thewidth+'px;margin:auto;background:#ccc;">');
	document.write('<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" WIDTH="'+thewidth+'" HEIGHT="'+theheight+'" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0">');
	document.write('<PARAM NAME="controller" VALUE="TRUE">');
	document.write('<PARAM NAME="type" VALUE="video/quicktime">');
	document.write('<PARAM NAME="autoplay" VALUE="true">');
	document.write('<PARAM NAME="scale" VALUE="aspect">');
	document.write('<PARAM NAME="BGCOLOR" VALUE="#ffffff">');
	document.write('<PARAM NAME="target" VALUE="myself">');
	document.write('<PARAM NAME="loop" VALUE="true">');
	document.write('<PARAM NAME="src" VALUE="'+thefilename+'">');
	document.write('<PARAM NAME="pluginspage" VALUE="http://www.apple.com/quicktime/download/indext.html">');
	document.write('<EMBED width='+thewidth+' height='+theheight+' CONTROLLER="TRUE" SCALE="aspect" TARGET="myself" SRC="'+thefilename+'" autoplay="true" loop="true" type="video/quicktime" BGCOLOR="#ffffff" BORDER="0" PLUGINSPAGE="http://www.apple.com/quicktime/download/indext.html"></EMBED>');
	document.write('</OBJECT> ');
	document.write('</div> ');
}

function mediaplayer(thefilename, thewidth, theheight){
	document.write('<div style="width:'+thewidth+'px;margin:auto;background:#ccc;">');
	document.write('<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" WIDTH="'+thewidth+'" HEIGHT="'+theheight+'" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0">');
	document.write('<PARAM NAME="controller" VALUE="TRUE">');
	document.write('<PARAM NAME="type" VALUE="video/quicktime">');
	document.write('<PARAM NAME="autoplay" VALUE="true">');
	document.write('<PARAM NAME="scale" VALUE="aspect">');
	document.write('<PARAM NAME="BGCOLOR" VALUE="#ffffff">');
	document.write('<PARAM NAME="target" VALUE="myself">');
	document.write('<PARAM NAME="loop" VALUE="false">');
	document.write('<PARAM NAME="src" VALUE="'+thefilename+'">');
	document.write('<PARAM NAME="pluginspage" VALUE="http://www.apple.com/quicktime/download/indext.html">');
	document.write('<EMBED width='+thewidth+' height='+theheight+' CONTROLLER="TRUE" SCALE="aspect" TARGET="myself" SRC="'+thefilename+'" autoplay="true" loop="false" type="video/quicktime" BGCOLOR="#ffffff" BORDER="0" PLUGINSPAGE="http://www.apple.com/quicktime/download/indext.html"></EMBED>');
	document.write('</OBJECT> ');
	document.write('</div> ');
}

function mediaplayerNoAutoPlay(thefilename, thewidth, theheight){
	document.write('<div style="width:'+thewidth+'px;margin:auto;background:#ccc;">');
	document.write('<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" WIDTH="'+thewidth+'" HEIGHT="'+theheight+'" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0">');
	document.write('<PARAM NAME="controller" VALUE="TRUE">');
	document.write('<PARAM NAME="type" VALUE="video/quicktime">');
	document.write('<PARAM NAME="autoplay" VALUE="false">');
	document.write('<PARAM NAME="scale" VALUE="aspect">');
	document.write('<PARAM NAME="BGCOLOR" VALUE="#ffffff">');
	document.write('<PARAM NAME="target" VALUE="myself">');
	document.write('<PARAM NAME="loop" VALUE="false">');
	document.write('<PARAM NAME="src" VALUE="'+thefilename+'">');
	document.write('<PARAM NAME="pluginspage" VALUE="http://www.apple.com/quicktime/download/indext.html">');
	document.write('<EMBED width='+thewidth+' height='+theheight+' CONTROLLER="TRUE" SCALE="aspect" TARGET="myself" SRC="'+thefilename+'" autoplay="false" loop="false" type="video/quicktime" BGCOLOR="#ffffff" BORDER="0" PLUGINSPAGE="http://www.apple.com/quicktime/download/indext.html"></EMBED>');
	document.write('</OBJECT> ');
	document.write('</div> ');
}

// used within the movies section
function popMovie(filename, lang) {
	popup("view.cfm?movie="+escape(filename)+"&lang="+lang,"",680,500,"");
}

// used within the tutorials section
function popTutorial(filename, lang) {
	popup("tutorialview.cfm?movie="+escape(filename)+"&lang="+lang,"",680,500,"");
}

// used within the movies section
function popCCTerms(lang) {
	popup("ccterms.cfm?lang="+lang,"terms",640,400,"scrollbars=1");
}


//Used to show full screenshots
function popScreenshot(filename,lang) {
	window.open("view_screen.cfm?image="+escape(filename)+"&lang="+lang,"FIFAStreet3","scrollbars=1,resizable=1,status=1,left=0,top=0,width="+screen.width+",height="+screen.height);
}

//Used to show newsletters
function popNewsletter(nllink)
{	
	popup(nllink,"SporeNewsletter",650,505,"resizable=0");
}

// used within the movies section
function popSlideShow(sid) {
	popup("screenshots.cfm?sid="+sid,"",1075,641,"scrollbars=0");
}

// used to pop up the promotional creepy and cute adobe player
function popAdobe() {
	popup(dotdotpath + "adobe/index.cfm","CreepyCute",990,650,"scrollbars=0,resizable=0");
}



// Popup Window (Centred)
function popup(url,winname,w,h,feat) {
	if (!(isNaN(w) || isNaN(h))) {
		var x=parseInt((screen.width-w)/2);
		var y=parseInt((screen.height-h)/2);
		if (x<0)	x=0;
		if (y<0)	y=0;
		
		if (feat!=null && feat!="") {
			feat=","+feat;
		} else {
			feat="";
		}
		feat="left="+x+",top="+y+",width="+w+",height="+h+feat;
	}
	window.open(url,winname,feat);
}

function clearField(Field)
{
	Field.value = "";
}

function showWidget(){
	var divA = document.getElementById("sourceblock");
	var divB = document.getElementById("sourcebtn");
	divA.className="left";
	divB.className="left hide";
}

function hideWidget(){
	var divA = document.getElementById("sourceblock");
	var divB = document.getElementById("sourcebtn");
	divA.className="left hide";
	divB.className="left";
}


function setRatingJQ(assetid, rating)
{
	if(assetid != "" && rating != "")
	{
		document.getElementById('jq_ratingload').style.visibility = 'visible';
		if(rating !=1) { rating = 0; }
		$.post(dotdotpath + "sporepedia/postrating.cfm", {assetid: assetid, rating: rating}, function(data){
		
		var divcontainer = document.getElementById('jq_msgcontain');
		var divcontent = document.getElementById('jq_msgcontent');
		divcontainer.style.display = 'block';
		divcontent.innerHTML = "<strong>" + data + "</strong>";
		document.getElementById('jq_ratingload').style.visibility = 'hidden';
	});
	}
}