/*
################################################################
#Page: player.js
#Purpose: 
#Description: 
#Caveats: 
#Dependancies:
#Create Date: 23rd March 2007
#History:
#Author: Paul Hesketh
#params:
################################################################
*/
var isInternetExplorer = navigator.appName.indexOf("Microsoft") != -1;
function fnWritePlayer() {
	var flashVars = 'sDebug=false'+'&sPlayNextTrack=true'+'&sSession='+sSession+'&sXmlConfig='+sitePath+'player/config_strictly.xml';
	if (!useRedirect) {
  		if(hasRightVersion) {
   	 		var oeTags = '<OBJECT CLASSID="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'
    		+ 'WIDTH="335" HEIGHT="169"'
    		+ 'CODEBASE="'+$http+'download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab" name="main" id="main">'
    		+ '<PARAM NAME="MOVIE" VALUE="'+sitePath+'player/edmain.swf">'
   	 		+ '<PARAM NAME="PLAY" VALUE="true">'
   	 		+ '<PARAM NAME="QUALITY" VALUE="high">'
			+ '<param name="salign" value="lt" />'
			+ '<param name="scale" value="noscale" />'
			+ '<param name="wmode" value="transparent">'
			+ '<param name="allowScriptAccess" value="sameDomain" />'
			+ '<param name="FlashVars" value="'+flashVars+ '" />'
    		+ '<EMBED SRC="'+sitePath+'player/edmain.swf"'
			+ 'id = "embedMain"'
			+ 'name="embedMain"'
			+ 'scale="noscale"'
			+ 'salign="lt"'
			+ 'width="335"'
			+ 'height="169"'
			+ 'wmode="transparent"'
    		+ 'PLAY="true"'
    		+ 'LOOP="false"'
			+ 'allowScriptAccess="sameDomain"'
    		+ 'QUALITY="high"'
			+ 'flashvars="'+flashVars+'"'
    		+ 'TYPE="application/x-shockwave-flash"'
    		+ 'PLUGINSPAGE="'+$http+'www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">'
    		+ '<\/EMBED>'
    		+ '<\/OBJECT>';
  		} else {
			var oeTags = '<a href="http://www.macromedia.com/go/getflashplayer" target="_blank"><img src="'+sitePath+'images/no-flash-image-player.gif" alt="Please install flash" border="0" /></a>';
		}
		document.getElementById("playerCont").innerHTML = oeTags;
		//document.write(oeTags);
	}
}

function addTrackQS(qs){
	if(document.main.addTrackQS){
		document.main.addTrackQS(qs);
	}else{
		//we will use the embed instead;
		if(document.getElementById('embedMain')){
			document.getElementById('embedMain').addTrackQS(qs);
		}else{
			
		}
	}
}

function addXML(xml){
	if(document.main.addXML){
		document.main.addXML(xml);
	}else{
		//we will use the embed instead;
		if(document.getElementById('embedMain')){
			document.getElementById('embedMain').addXML(xml);
		}else{
			
		}
	}
}

// Handle all the FSCommand messages in a Flash movie.
function main_DoFSCommand(command, args) {
	var mainObj = isInternetExplorer ? document.all.main : document.main;
	if ((command == "buyAction") || (command == "FSCommand:buyAction")){
		vars = args.split(",");
		sPrice = vars[2].replace("}]","");
		fnUpdateCart(sPrice);
	}
	if ((command == "removeAction") || (command == "FSCommand:removeAction")){
		//code here
	}
	if ((command == "addAction") || (command == "FSCommand:addAction")){
		//code here
	}
	if ((command == "infoAction") || (command == "FSCommand:infoAction")){
		//code here
	}
}
	// Hook for Internet Explorer.
if (navigator.appName && navigator.appName.indexOf("Microsoft") != -1 && navigator.userAgent.indexOf("Windows") != -1 && navigator.userAgent.indexOf("Windows 3.1") == -1) {
	document.write('<script language=\"VBScript\"\>\n');
	document.write('On Error Resume Next\n');
	document.write('Sub main_FSCommand(ByVal command, ByVal args)\n');
	document.write('Call main_DoFSCommand(command, args)\n');
	document.write('End Sub\n');
	document.write('</script\>\n');
}
	