// HOME PAGE FLASH
function embedHPFlash2007(baseURL,ddURL,scid,hcid,hpLink)
{
	// 
    document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="778" height="700" id="Shell" align="middle">\n');
    document.write('<param name="movie" value="'+baseURL+'/hp/flash/midShell.swf" />\n');
    document.write('<param name="quality" value="high" />\n');
    document.write('<param name="scale" value="noscale" />\n');
    document.write('<param name="salign" value="lt" />\n');
    document.write('<param name="allowScriptAccess" VALUE="always" />\n');
	document.write('<PARAM NAME="menu" VALUE="false"/>\n');	
    document.write('<param name="wmode" value="transparent" />\n');
    document.write('<param name="bgcolor" value="#666666" />\n');
    document.write('<param name="FlashVars" VALUE="spagename=Sirius/XML/StagePromoXML&sc=Collection&scid='+scid+'&hpagename=Sirius/XML/HomePageXML2007&hc=HomePage&hcid='+hcid+'&tpagename=Sirius/XML/TickerXML2007&tc=Collection&tcid='+hcid+'&htmlVer='+hpLink+'" />\n');
    document.write('<embed src="'+baseURL+'/hp/flash/midShell.swf" quality="high"  FlashVars="spagename=Sirius/XML/StagePromoXML&sc=Collection&scid='+scid+'&hpagename=Sirius/XML/HomePageXML2007&hc=HomePage&hcid='+hcid+'&tpagename=Sirius/XML/TickerXML2007&tc=Collection&tcid='+hcid+'&htmlVer='+hpLink+'" bgcolor="#666666" WIDTH="100%" HEIGHT="700" TYPE="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"  scale="noscale" salign="lt" width="778" height="700" name="Shell" align="middle" allowScriptAccess="always" menu="false" wmode="transparent" type="application/x-shockwave-flash"></embed>\n');
		document.write('</object>\n');
}

/*
function embedNav2007(baseURL,ddURL,subtype,frompage,requestType)
{
	//alert("ddURL::"+ddURL);
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="778" height="145" id="subNav" align="middle">\n');
	document.write('<param name="allowScriptAccess" value="always" />\n');
	document.write('<PARAM NAME="menu" VALUE="false"/>\n');	
	document.write('<param name="movie" value="'+ddURL+'/c/flash/TopNav.swf" />\n');
	document.write('<param name="quality" value="high" />\n');
	document.write('<param name="wmode" value="transparent" />\n');
	document.write('<param name="flashVars" value="domain='+baseURL+'&subtype='+subtype+'&npagename=Sirius/XML/NavigationXML&nc=Foo&ncid=1234&nfromPage='+frompage+'&requestType='+requestType+'" />\n');
	document.write('<embed src="'+ddURL+'/c/flash/TopNav.swf" quality="high" menu="false" width="778" height="145" name="nav" allowScriptAccess="always" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="domain='+baseURL+'&subtype='+subtype+'&npagename=Sirius/XML/NavigationXML&nc=Foo&ncid=1234&nfromPage='+frompage+'&requestType='+requestType+'" />\n');
    document.write('</object>\n');
}
*/

function embedNav2007(baseURL,ddURL,subtype,frompage,requestType)
{
	//alert("ddURL::"+ddURL);
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="'+requestType+'://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="778" height="145" id="subNav" align="middle">\n');
	document.write('<param name="allowScriptAccess" value="always" />\n');
	document.write('<PARAM NAME="menu" VALUE="false"/>\n');
	document.write('<param name="movie" value="'+ddURL+'/c/flash/TopNav.swf" />\n');
	document.write('<param name="quality" value="high" />\n');
	document.write('<param name="wmode" value="transparent" />\n');
	document.write('<param name="flashVars" value="domain='+baseURL+'&subtype='+subtype+'&npagename=Sirius/XML/NavigationXML&nc=Foo&ncid=1234&nfromPage='+frompage+'&requestType='+requestType+'" />\n');
	document.write('<embed src="'+ddURL+'/c/flash/TopNav.swf" quality="high" menu="false" width="778" height="145" name="nav" allowScriptAccess="always" wmode="transparent" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" flashvars="domain='+baseURL+'&subtype='+subtype+'&npagename=Sirius/XML/NavigationXML&nc=Foo&ncid=1234&nfromPage='+frompage+'&requestType='+requestType+'" />\n');
    document.write('</object>\n');
}


function embedFlash(width,height,allowScriptAccess,movie,bgcolor,flashvars)
{
	document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="'+width+'" HEIGHT="'+height+'">\n');
	document.write('<param name="allowScriptAccess" value="'+allowScriptAccess+'" />\n');
	document.write('<param name="movie" value="'+movie+'" />\n');
	document.write('<param name="quality" value="high" />\n');
	document.write('<param name="bgcolor" value="'+bgcolor+'" />\n');
	document.write('<PARAM NAME="menu" VALUE="false"/>\n');	
	document.write('<PARAM NAME="FlashVars" VALUE="'+flashvars+'"/>\n');	
	document.write('<embed src="'+movie+'" quality="high" bgcolor="'+bgcolor+'" width="'+width+'" height="'+height+'" align="middle" allowScriptAccess="'+allowScriptAccess+'" menu="false" FlashVars="'+flashvars+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"/>\n');
    document.write('</object>\n');
}	

function embedFlashTransparent(width,height,allowScriptAccess,movie,bgcolor,flashvars)
{
	document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="'+width+'" HEIGHT="'+height+'">\n');
	document.write('<param name="allowScriptAccess" value="'+allowScriptAccess+'" />\n');
	document.write('<param name="movie" value="'+movie+'" />\n');
	document.write('<param name="quality" value="high" />\n');
	document.write('<param name="bgcolor" value="'+bgcolor+'" />\n');
	document.write('<param name="wmode" value="transparent" />\n');
	document.write('<PARAM NAME="menu" VALUE="false"/>\n');	
	document.write('<PARAM NAME="FlashVars" VALUE="'+flashvars+'"/>\n');	
	document.write('<embed src="'+movie+'" quality="high" bgcolor="'+bgcolor+'" width="'+width+'" height="'+height+'" align="middle" allowScriptAccess="'+allowScriptAccess+'" menu="false" FlashVars="'+flashvars+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"/>\n');
	document.write('</object>\n');
}	

function embedPollFlash(width,height,allowScriptAccess,movie,bgcolor,baseurl,pollid)
{
	var flashvars = 'requestXMLURL='+escape(baseurl+'/servlet/ContentServer?pagename=Sirius/XML/PollRequestXML&c=Poll&cid='+pollid);
	flashvars += 	'&resultsXMLURL='+escape(baseurl+'/servlet/ContentServer?pagename=Sirius/XML/PollResultsXML&c=Poll&cid='+pollid);
	flashvars += 	'&responseURL='+escape(baseurl+'/servlet/SiriusPoll?action=submitvote');
	flashvars = 	flashvars.replace(/\//g,"%2F");

	document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="'+width+'" HEIGHT="'+height+'">\n');
	document.write('<param name="allowScriptAccess" value="'+allowScriptAccess+'" />\n');
	document.write('<param name="movie" value="'+movie+'" />\n');
	document.write('<param name="quality" value="high" />\n');
	document.write('<param name="bgcolor" value="'+bgcolor+'" />\n');
	document.write('<PARAM NAME="menu" VALUE="false"/>\n');	
	document.write('<PARAM NAME="FlashVars" VALUE="'+flashvars+'"/>\n');	
	document.write('<embed src="'+movie+'" quality="high" bgcolor="'+bgcolor+'" width="'+width+'" height="'+height+'" align="middle" allowScriptAccess="'+allowScriptAccess+'" menu="false" FlashVars="'+flashvars+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"/>\n');
    document.write('</object>\n');
}	

function embedAVPlayerFlash(width,height,allowScriptAccess,movie,bgcolor,baseurl,assetid)
{
	var flashvars = 'requestXMLURL='+escape(baseurl+'/servlet/ContentServer?pagename=Sirius/XML/FlexibleMediaPlayerXML&c=HOBAsset&cid='+assetid);
	flashvars = 	flashvars.replace(/\//g,"%2F");

	document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="'+width+'" HEIGHT="'+height+'">\n');
	document.write('<param name="allowScriptAccess" value="'+allowScriptAccess+'" />\n');
	document.write('<param name="movie" value="'+movie+'" />\n');
	document.write('<param name="quality" value="high" />\n');
	document.write('<param name="bgcolor" value="'+bgcolor+'" />\n');
	document.write('<PARAM NAME="menu" VALUE="false"/>\n');
	document.write('<PARAM NAME="FlashVars" VALUE="'+flashvars+'"/>\n');
	document.write('<embed src="'+movie+'" quality="high" bgcolor="'+bgcolor+'" width="'+width+'" height="'+height+'" align="middle" allowScriptAccess="'+allowScriptAccess+'" menu="false" FlashVars="'+flashvars+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"/>\n');
    document.write('</object>\n');
}

// HP TEST FLASH
function embedHPTestFlash(baseURL,ddURL,scid,hcid,hpLink)
{
    document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="778" height="837" id="Shell" align="middle">\n');
    document.write('<param name="movie" value="'+ddURL+'/hptest/flash/Shell.swf" />\n');
    document.write('<param name="quality" value="high" />\n');
    document.write('<param name="scale" value="noscale" />\n');
    document.write('<param name="salign" value="lt" />\n');
    document.write('<param name="allowScriptAccess" VALUE="always" />\n');
    document.write('<param name="wmode" value="window" />\n');
    document.write('<param name="bgcolor" value="#666666" />\n');
    document.write('<param name="FlashVars" VALUE="shimLoc=/c/flash/shim.swf&shimServer='+baseURL+'&stageLoc='+ddURL+'/c/flash/stage.swf&npagename=Sirius/XML/NavigationXML&nc=Foo&ncid=1234&spagename=Sirius/XML/StagePromoXML&sc=Collection&scid='+scid+'&hpagename=Sirius/XML/HPTestXML2006&hc=HomePage&hcid='+hcid+'&tpagename=Sirius/XML/TickerXML&tc=Collection&tcid='+hcid+'&htmlVer='+hpLink+'" />\n');
    document.write('<embed src="'+ddURL+'/hptest/flash/Shell.swf" quality="high" menu="false" FlashVars="shimLoc=/c/flash/shim.swf&shimServer='+baseURL+'&navLoc=TopNav.swf&stageLoc='+ddURL+'/c/flash/stage.swf&npagename=Sirius/XML/NavigationXML&nc=Foo&ncid=1234&spagename=Sirius/XML/StagePromoXML&sc=Collection&scid='+scid+'&hpagename=Sirius/XML/HPTestXML2006&hc=HomePage&hcid='+hcid+'&tpagename=Sirius/XML/TickerXML&tc=Collection&tcid='+hcid+'&htmlVer='+hpLink+'" bgcolor="#666666" WIDTH="100%" HEIGHT="837" TYPE="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"  scale="noscale" salign="lt" width="778" height="837" name="Shell" align="middle" allowScriptAccess="always" wmode="window" type="application/x-shockwave-flash"></embed>\n');
    document.write('</object>\n');
}

function embedInlinePlayer(playertype,srcmp3,htmltext,htmlcolor,htmlovercolor,playedcolor,durationcolor)
{
	var width=80;
	var movie = "/flash/common/inlineplayer/inlinePlayer"+playertype.toUpperCase()+".swf";

	//setting the default color values
	if(htmlcolor == undefined || htmlcolor == "")
	{
		htmlcolor = "0097df";		
	}
	if(htmlovercolor == undefined || htmlovercolor == "")
	{
		htmlovercolor = "000000";		
	}
	if(playedcolor == undefined || playedcolor == "")
	{
		playedcolor = "626262";		
	}
	if(durationcolor == undefined || durationcolor == "")
	{
		durationcolor = "0097df";		
	}

	playertype = playertype.toUpperCase();
	if(playertype == 'S')
	{
		width=92;		
	}
	if(playertype == 'M')
	{
		width=315;
	}
	if(playertype == 'L')
	{
		width=400;
	}

	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,79,0" width="'+width+'" height="25">\n');
	document.write('<param name="allowScriptAccess" value="always" />\n');
	document.write('<param name="movie" value="'+movie+'" />\n');
	document.write('<param name="wmode" value="transparent" />\n');
	document.write('<param name="quality" value="high" />\n');
	document.write('<PARAM NAME="menu" VALUE="false"/>\n');
	document.write('<PARAM NAME="FlashVars" VALUE="HTMLText='+encodeURIComponent(htmltext)+'&srcMP3=http://'+document.domain+srcmp3+'&playedColor=0x'+playedcolor+'&durationColor=0x'+durationcolor+'&HTMLColor=0x'+htmlcolor+'&HTMLOverColor=0x'+htmlovercolor+'"/>\n');
	document.write('<embed src="'+movie+'" wmode="transparent" quality="high" width="'+width+'" height="25" align="middle" allowScriptAccess="always" menu="false" FlashVars="HTMLText='+encodeURIComponent(htmltext)+'&srcMP3=http://'+document.domain+srcmp3+'&playedColor=0x'+playedcolor+'&durationColor=0x'+durationcolor+'&HTMLColor=0x'+htmlcolor+'&HTMLOverColor=0x'+htmlovercolor+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"/>\n');
    document.write('</object>\n');
}
//This script doesnt have any fucntional use. But please don't remove this, as it is getting called in the midShell
// and will throw a javascript exception if removed. This needs to cleaned up later on, once the reference from homepage
//flash has been removed.
function ckPoll(what)
{
 	//alert(what);
 	//javascript:homePageSurvey();
}

function includeVideoPlayerScripts()
{
    document.write(unescape('%3Clink rel="stylesheet" href="/styles/vp.css" type="text/css" media="screen"%3E%3C/link%3E'));
    document.write(unescape('%3Cscript src="/scripts/swfobject.js" language="javascript"%3E%3C/script%3E'));
    document.write(unescape('%3Cscript src="/tvad/js/AC_OETags.js" type="text/javascript" language="JavaScript"%3E%3C/script%3E'));
}

function includeCSS(p_file) 
{
    var v_css  = document.createElement('link');
    v_css.rel = 'stylesheet'
    v_css.type = 'text/css';
    v_css.href = p_file;
    document.getElementsByTagName('head')[0].appendChild(v_css);
}

function includeJS(url)
{
   var e = document.createElement("script");
   e.src = url;
   e.type="text/javascript";
   document.getElementsByTagName("head")[0].appendChild(e);   
}

function includeVideoPlayerCSS(){
    includeCSS('/styles/vp.css');
    includeJS('/scripts/swfobject.js');
    includeJS('/tvad/js/AC_OETags.js');
}

function embedInlineVideoPlayer(desc,mediaSourceUrl,playerDiv)
{
    // Major version of Flash required                  
    var requiredMajorVersion = 8;
    // Minor version of Flash required
    var requiredMinorVersion = 0;
    // Minor version of Flash required
    var requiredRevision = 0;

    if(FlashInstalled()) {
	var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

        // Check to see if the version meets the requirements for playback
        if (hasReqestedVersion) {
            var so = new SWFObject("/flash/common/videoplayer/svp.swf", "vp_player", "320", "285", "8", "#FFFFFF");
            so.addVariable("svpDesc",desc);
            so.addVariable("flvURL",mediaSourceUrl);
            so.addVariable("swfPath",'/flash/common/videoplayer/');
            so.write(playerDiv);
        } else {
                document.getElementById(playerDiv).innerHTML = '<div class=vp_container><div class=vp_container_text><span style="color:red">Flash 8</span> or above is required to watch this video content.<br><br><a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&promoid=BUIGA" target="_blank"><img align=center src="/wo/i/videoplayer/get_adobe_flash_player.gif"></a></div></div>';
        }
    } else {
		document.getElementById(playerDiv).innerHTML = '<div class=vp_container><div class=vp_container_text><span style="color:red">Flash 8</span> or above is required to watch this video content.<br><br><a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash&promoid=BUIGA" target="_blank"><img align=center src="/wo/i/videoplayer/get_adobe_flash_player.gif"></a></div></div>';
    }
    
    return false;
}
