var FlashVars = new Object();
FlashVars.General = new Object();
FlashVars.Broadband = new Object();
FlashVars.DialUp = new Object();

//The following var is used in:
// - FlashVars.General.fullScreenURL
// - FlashVars.General.inFrameURL
// - FlashVars.General.dialUpURL
var fullAbsPageURL = "http://music.aol.com/franchise/chevy.adp";
//Following var [FlashVars.General.swfAssetsURL] is the Media Assets Management URL.
//Its declaration was moved UP here for scope purposes.
FlashVars.General.swfAssetsURL = "http://cdn.channel.aol.com/mus_top11components_3/";
FlashVars.General.showDate = showDate;
FlashVars.General.startVideo = 11;
FlashVars.General.splashURL = fullAbsPageURL;
FlashVars.General.videoVoteText = "Vote The Worst Video";
FlashVars.General.eventURL = "http://pdl.stream.aol.com/aol/us/aolmusic/top11/daily/"+showDate+"/";

//Some of the follwing vars are using the FlashVars.General.swfAssetsURL absolute URL...
//...to point to the Media Assets Management URL.
FlashVars.General.archiveBannerURL = FlashVars.General.swfAssetsURL + "chevy_archive_banner_v6.swf";
//FlashVars.General.advertURL = FlashVars.General.swfAssetsURL + "coke_header_v4.swf"; //NOT USED - change this file out to replace header

FlashVars.General.adURLchevy = "http://cdn.channel.aol.com/mus_top11components_3/top11_skin_track1x1.jpg";
FlashVars.General.adURLpop = "http://cdn.channel.aol.com/mus_top11components_3/top11_skin_track1x1.jpg";
FlashVars.General.adURLtrippy = "http://cdn.channel.aol.com/mus_top11components_3/top11_skin_track1x1.jpg";


//AIM TRACKING TAGS
FlashVars.General.adURLaimImpress = "http://pr.atwola.com/promoimp/100005695xx1076129238/aol";

//not used
FlashVars.General.adURLaimClick = "";


//bds asset tracking
FlashVars.General.videoTrackingURL="http://pdl.stream.aol.com/heartbeat.jpg";

FlashVars.General.videoVoteIntroURL = FlashVars.General.eventURL + showDate +"_poll_video_intro_dl.swf";
FlashVars.General.videoVoteImageURL = "http://cdn.channel.aol.com/mus_top11components_3/poll_bumper_v8.swf";
FlashVars.General.pollgraphicURL = pollgraphic;
FlashVars.General.videoVoteSwfURL = FlashVars.General.eventURL + showDate +"_poll_video"; //_01_dl.swf

FlashVars.General.themeName = defaultSkin;
FlashVars.General.top100URL = FlashVars.General.swfAssetsURL + "top100.xml";

FlashVars.General.trackingAccount = "aolmus";
FlashVars.General.trackingAccountLinkEvents = "aolmus";

FlashVars.General.documentLocation = window.document.location;
FlashVars.General.fullScreenURL = fullAbsPageURL + ".adp";
FlashVars.General.inFrameURL = fullAbsPageURL + ".adp";
FlashVars.General.dialUpURL = fullAbsPageURL + ".adp";

FlashVars.General.lightningcastURL = "http://web.lightningcast.com/servlets/getPlaylist?dcprefix=tw&";//"http://qaweb2.lightningcast.com";
FlashVars.General.lightningcastEnabled = true;
FlashVars.General.adCurtainEnabled = true;
FlashVars.General.adCurtainCollapsedEnabled = true;
FlashVars.General.loopPlaylist = false;
FlashVars.General.introOnLoop = true;

//LC Settings
FlashVars.General.speed = 2000;
FlashVars.General.surfacePoint = "us.aol.music";
FlashVars.General.franchise = "MUSIC: Sessions@AOL";
FlashVars.General.resp = "aolxml";
FlashVars.General.playListGroup = "chevybackstagepass_flash";


//bandwidth sniffing settings
FlashVars.General.bandwidthHigh = "2000"; 
FlashVars.General.bandwidthNarrow = "100"; 


FlashVars.General.detectDialUp = false; // Enables or Disables the sniffing of dial-up
FlashVars.General.omnitureTracking = false; // Enables or Disables Omniture tracking


FlashVars.General.interstitialURL = "http://pdl.stream.aol.com/aol/us/aolmusic/top11/daily/"+FlashVars.General.showDate+"/";
FlashVars.General.introURL = "http://pdl.stream.aol.com/aol/us/aolmusic/top11/daily/"+FlashVars.General.showDate+"/";
FlashVars.General.introText = "Welcome to Chevy Backstage Pass";
FlashVars.General.outroText = "Check Out the Show Next Week";

//Following var [FlashVars.General.cssURL] is the ART assets top11 root folder path...
//...used for the app skins.
FlashVars.General.cssURL = "http://cdn.channel.aol.com/music_chevyskins_2/";
FlashVars.General.cssIdentifier = "folder";

FlashVars.General.fullScreenConfigURL = FlashVars.General.swfAssetsURL + "config_fullscreen_prod_curtain_z16.xml";
FlashVars.General.inFrameConfigURL = FlashVars.General.swfAssetsURL + "config_inframe_prod_chevy_v13.xml";
FlashVars.General.dialUpConfigURL = FlashVars.General.swfAssetsURL + "config_inframe_dialup_curtain_z16.xml";

//FlashVars.General.messagesURL = FlashVars.General.swfAssetsURL + "messageboard.xml";
FlashVars.General.messagesURL = "http://music.aol.com/musictop11/show.xml?id="+showDate+"&request=boards"
FlashVars.General.archive_themeColor ="0xF49124";
FlashVars.General.archive_isPromo = "true";
FlashVars.General.archive_promoFile = "http://cdn.channel.aol.com/ch_musicarchive/promo_v3.swf";
FlashVars.General.archive_introPhoto = "http://cdn.channel.aol.com/flash_art/jessica_simpson_75_0405_music.jpg";
FlashVars.General.archive_introButtonLabels = "Jessica Simpson,Eminem,Backstreet Boys,Coldplay";
FlashVars.General.archive_introArtistIDs = "162028,347307,199819,435023";
FlashVars.General.archive_drawerDefaultText = "Rollover the options above for more information";
FlashVars.General.archive_bottomLinksText = "Check out these similar artists in the AOL Music Archive:";
FlashVars.General.services_host = "http://xml.channel.aol.com";
FlashVars.General.services_port = "";
FlashVars.General.services_file = "mediaarchive/mediaarchive.adp";
FlashVars.General.browser_client = window.navigator.vendor;

FlashVars.Broadband.playlistURL = "http://spinner.aol.com/musictop11/show.xml?id="+showDate
FlashVars.Broadband.altplaylistURL  =  FlashVars.General.swfAssetsURL + "top11show_"+showDate+".xml";
FlashVars.Broadband.tomatoAssetURL = "asset_backstage_bumper_v1.swf";
FlashVars.Broadband.bumperAssetURL = "asset_backstage_bumper_v1.swf";
FlashVars.Broadband.interstitialAssetURL = breakout_broadband;
FlashVars.Broadband.introAssetURL = "backstage_intro_bump_v1.swf";
FlashVars.Broadband.creditScreenURL = creditscreen_broadband;

FlashVars.DialUp.playlistURL = "http://spinner.aol.com/musictop11/show.xml?id="+showDate+"&request=narrowband"
//FlashVars.DialUp.playlistURL = FlashVars.General.swfAssetsURL + "top11show_dialup_"+showDate+".xml";
FlashVars.DialUp.altplaylistURL  =  FlashVars.General.swfAssetsURL + "top11show_dialup.xml";
FlashVars.DialUp.tomatoAssetURL = "asset_tomato_dialup.swf";
FlashVars.DialUp.bumperAssetURL = "asset_bumper_dialup.swf";
FlashVars.DialUp.interstitialAssetURL = breakout_dialup;
FlashVars.DialUp.introAssetURL = "asset_intro_bumper_dialup.swf";
FlashVars.DialUp.preloadGameURL = "comp_dialupgame.swf";
FlashVars.DialUp.creditScreenURL = creditscreen_dialup;





//---------------------------------------------------------------------------------
//---------------------------------------------------------------------------------
function parseQuery(q_str){
  	 	var pairHalves;
  	 	var queryVars = {};
   		var N_V_pairs = q_str.split("&");
   		var l = N_V_pairs.length;
   		for(i=0; i<l; i++){
       		pairHalves = N_V_pairs[i].split("=");
       		queryVars[pairHalves[0]] = pairHalves[1];
   		}
   		return queryVars;
}

function addConditional(strVar, queryVars){
	var strValue = "";
	if(!queryVars[strVar]){
		strValue = "&"+strVar+"="+escape(FlashVars.General[strVar]);
	}
	return strValue;
}
function deepLinkStatus(strVar, queryVars){
	var strValue = "";
	if(!queryVars[strVar]){
		strValue = "&isDeepLink=false";
	} else {
		strValue = "&isDeepLink=true";
	}
	return strValue;
}

function buildQuery(){
	var strQuery = "";
	var queryVars = "";
	strQuery = new String(parent.window.location.search);
	strQuery = strQuery.substr(1);
	queryVars = parseQuery (strQuery);
	strQuery += "&fullScreenURL="+escape(FlashVars.General.fullScreenURL);
	strQuery += "&inFrameURL="+escape(FlashVars.General.inFrameURL);
	strQuery += "&dialUpURL="+escape(FlashVars.General.dialUpURL);
	strQuery += "&documentLocation="+escape(FlashVars.General.documentLocation);
	strQuery += "&trackingAccount="+FlashVars.General.trackingAccount;
	strQuery += "&trackingAccountLinkEvents="+FlashVars.General.trackingAccountLinkEvents;
	strQuery += "&cssURL="+escape(FlashVars.General.cssURL);
	strQuery += "&skinGraphicURL="+escape(FlashVars.General.skinGraphicURL);
	strQuery += "&swfAssetsURL="+escape(FlashVars.General.swfAssetsURL);
	strQuery += "&archive_themeColor="+escape(FlashVars.General.archive_themeColor);
	strQuery += "&archive_isPromo="+escape(FlashVars.General.archive_isPromo);
	strQuery += "&archive_promoFile="+escape(FlashVars.General.archive_promoFile);
	strQuery += "&archive_introPhoto="+escape(FlashVars.General.archive_introPhoto);
	strQuery += "&archive_introButtonLabels="+escape(FlashVars.General.archive_introButtonLabels);
	strQuery += "&archive_introArtistIDs="+escape(FlashVars.General.archive_introArtistIDs);
	strQuery += "&archive_drawerDefaultText="+escape(FlashVars.General.archive_drawerDefaultText);
	strQuery += "&services_host="+escape(FlashVars.General.services_host);
	strQuery += "&services_port="+escape(FlashVars.General.services_port);
	strQuery += "&services_file="+escape(FlashVars.General.services_file);
	strQuery += "&browser_client="+escape(FlashVars.General.browser_client);
	strQuery += "&archive_bottomLinksText="+escape(FlashVars.General.archive_bottomLinksText );
	strQuery += "&splashURL="+escape(FlashVars.General.splashURL);
	strQuery += "&lightningcastURL="+escape(FlashVars.General.lightningcastURL);
	strQuery += "&lightningcastEnabled="+escape(FlashVars.General.lightningcastEnabled);
	strQuery += "&adCurtainEnabled="+escape(FlashVars.General.adCurtainEnabled);
	strQuery += "&adCurtainCollapsedEnabled="+escape(FlashVars.General.adCurtainCollapsedEnabled);
	strQuery += "&adURLchevy="+escape(FlashVars.General.adURLchevy);
	strQuery += "&adURLpop="+escape(FlashVars.General.adURLpop);	
	strQuery += "&adURLtrippy="+escape(FlashVars.General.adURLtrippy);
	strQuery += "&adURLaimImpress="+escape(FlashVars.General.adURLaimImpress);
	strQuery += "&adURLaimClick="+escape(FlashVars.General.adURLaimClick);
	strQuery += "&videoTrackingURL="+escape(FlashVars.General.videoTrackingURL);
	strQuery += "&speed="+escape(FlashVars.General.speed);
	strQuery += "&surfacePoint="+escape(FlashVars.General.surfacePoint);
	strQuery += "&franchise="+escape(FlashVars.General.franchise);
	strQuery += "&resp="+escape(FlashVars.General.resp);
	strQuery += "&playListGroup="+escape(FlashVars.General.playListGroup);
	strQuery += "&bandwidthHigh="+escape(FlashVars.General.bandwidthHigh);
	strQuery += "&bandwidthNarrow="+escape(FlashVars.General.bandwidthNarrow);
	strQuery += "&defaultConnectionSpeed="+escape(FlashVars.General.defaultConnectionSpeed);
	strQuery += "&detectDialUp="+escape(FlashVars.General.detectDialUp);
	strQuery += "&omnitureTracking="+escape(FlashVars.General.omnitureTracking);

	if (!boolSplash){
		strQuery += deepLinkStatus("startVideo", queryVars);
		strQuery += addConditional("startVideo", queryVars);
		strQuery += "&showDate="+escape(showDate);
		strQuery += "&advertURL="+escape(FlashVars.General.advertURL);
		strQuery += "&archiveBannerURL="+escape(FlashVars.General.archiveBannerURL);
		strQuery += "&messagesURL="+escape(FlashVars.General.messagesURL);
		strQuery += "&strTomatoURL="+escape(tomatoVoteURL);
		strQuery += "&videoVoteText="+escape(FlashVars.General.videoVoteText);
		strQuery += "&eventURL="+escape(FlashVars.General.eventURL);
		strQuery += "&eventParam="+escape(FlashVars.General.eventParam);
		strQuery += "&lightningcastURL="+escape(FlashVars.General.lightningcastURL);
		strQuery += "&interstitialURL="+escape(FlashVars.General.interstitialURL);
		strQuery += "&introURL="+escape(FlashVars.General.introURL);
		strQuery += "&introText="+escape(FlashVars.General.introText);
		strQuery += "&outroText="+escape(FlashVars.General.outroText);
		strQuery += "&cssIdentifier="+escape(FlashVars.General.cssIdentifier);
		strQuery += "&loopPlaylist="+escape(FlashVars.General.loopPlaylist);
		strQuery += "&introOnLoop="+escape(FlashVars.General.introOnLoop);
		if(boolDialup){
			strQuery += "&configURL="+escape(FlashVars.General.dialUpConfigURL);
			strQuery += "&themeName=default_dialup";
			strQuery += "&screenVersion=inframe";
			strQuery += "&connectionType=dialup";
			strQuery += "&playlistURL="+escape(FlashVars.DialUp.playlistURL);
			strQuery += "&tomatoAssetURL="+escape(FlashVars.DialUp.tomatoAssetURL);
			strQuery += "&bumperAssetURL="+escape(FlashVars.DialUp.bumperAssetURL);
			strQuery += "&interstitialAssetURL="+escape(FlashVars.DialUp.interstitialAssetURL);
			strQuery += "&introAssetURL="+escape(FlashVars.DialUp.introAssetURL);
			strQuery += "&preloadGameURL="+escape(FlashVars.DialUp.preloadGameURL); 
			strQuery += "&creditScreenURL="+escape(FlashVars.DialUp.creditScreenURL);
			strQuery += "&altplaylistURL="+escape(FlashVars.DialUp.altplaylistURL);
		} else {
			if (boolInframe){
				strQuery += "&screenVersion=inframe";
				strQuery += "&configURL="+escape(FlashVars.General.inFrameConfigURL);
			} else {
				strQuery += "&screenVersion=fullscreen";
				strQuery += "&configURL="+escape(FlashVars.General.fullScreenConfigURL);
			}
			strQuery += addConditional("themeName", queryVars);
			strQuery += "&connectionType=broadband";
			strQuery += "&playlistURL="+escape(FlashVars.Broadband.playlistURL);
			strQuery += "&tomatoAssetURL="+escape(FlashVars.Broadband.tomatoAssetURL);
			strQuery += "&bumperAssetURL="+escape(FlashVars.Broadband.bumperAssetURL);
			strQuery += "&interstitialAssetURL="+escape(FlashVars.Broadband.interstitialAssetURL);
			strQuery += "&introAssetURL="+escape(FlashVars.Broadband.introAssetURL);
			strQuery += "&videoVoteIntroURL="+escape(FlashVars.General.videoVoteIntroURL);
			strQuery += "&videoVoteImageURL="+escape(FlashVars.General.videoVoteImageURL);
			strQuery += "&pollgraphicURL="+escape(FlashVars.General.pollgraphicURL);
			strQuery += "&videoVoteSwfURL="+escape(FlashVars.General.videoVoteSwfURL);
			strQuery += "&videoVoteURL="+escape(videoVoteURL);
			strQuery += "&top100URL="+escape(FlashVars.General.top100URL);
			strQuery += "&creditScreenURL="+escape(FlashVars.Broadband.creditScreenURL);
			strQuery += "&altplaylistURL="+escape(FlashVars.Broadband.altplaylistURL);
			
		}
	} else {
		strQuery += "&splashHostSwfURL="+escape(splashHostSwfURL);
		strQuery += "&splashHostText="+escape(splashHostText);
	}
	return strQuery;
}
function renderFlash(strVars){
	var numFheight;
	var numFwidth;
	var strID = "browser";
	var strSwf = FlashVars.General.swfAssetsURL + "comp_browser_chevy_v2.swf";
	if (boolSplash){
		numFwidth = 756;
		numFheight = 370;
		strID = "splash";
		strSwf = FlashVars.General.swfAssetsURL + "comp_splash-1.0.swf";
	} else if (boolFullscreen){
		numFwidth = 924;
		numFheight = 730;
	} else {
		numFwidth = 756;
		if (boolDialup){
			numFheight = 629;
		} else {
			numFheight = 590;
		}
	}
	document.write('<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="'+numFwidth+'" height="'+numFheight+'" id="'+strID+'" align="rigth">');
	document.write('<param name="allowScriptAccess" value="always" />');
	document.write('<param name="movie" value="'+strSwf+'" />');
	document.write('<param name="FlashVars" value="'+strVars+'"/>');
	document.write('<param name="quality" value="best" />');
	document.write('<param name="bgcolor" value="#ffffff" />');
	document.write('<param name="scale" value="noscale" />');
	document.write('<param name="salign" value = "tl" />');
	document.write('<param name="menu" value = "false" />');
	document.write('<embed src="'+strSwf+'" swLiveConnect="true" FlashVars="'+strVars+'"  menu="false" scale="noscale" salign="tl"  quality="best" bgcolor="#ffffff" width="'+numFwidth+'" height="'+numFheight+'" name="browser" align="middle" allowScriptAccess="always" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}

renderFlash(buildQuery());
