var lastPopUpWindow = null;
function pop (sCase)
{

	var extLink;
	
	// close the last pop-up.
	try {
		lastPopUpWindow.close ();
	} catch(e) {
	}
	switch (sCase){
		//GALLERY section
		case "galleryDownload" :
			var id = pop.arguments [1];
			window.open('galleryDownload.html?id=' +id,'_BLANK');
			break;		
		//DOWNLOADS section
		case "wallpaperDownload" :
		case "wallpaper" : 
			var id = pop.arguments [1];
			var width = pop.arguments [2];
			var height=0;
			switch (width){
				case '800' : height=600; break;
				case '1024' : height=768; break;
				case '1280' : height=1024; break;
				case '1600' : height=1200; break;
				case '1920' : height=1200; break;
				default : width=1024; height=768; break;
			}
			window.open('wallpaperDownload.html?id=' +id + '&width=' + width +"&height=" + height,'_BLANK');	
		break;
		case "poster" :
			window.open('download.html?theFile=assets/downloads/poster/ml_poster.zip','_BLANK');
			return false;
		break;
		case "buddyicons":
		case "icons" :  //iconID
			//var iconURL = 'buddyicons.html?id='+pop.arguments [1];
			var iconURL = 'buddyicons.html';
			window.open(iconURL, '_BLANK');
			return false;
		break;
		case "ultimatewallpaper" :
			window.open('http://disney.go.com/disneypictures/downloads/index.html', '_BLANK');
		break;
		case "synergy_DMR" :
				cto.trackLink("exit_sbd_dmr");
				window.open('http://disney.go.com/disneymovierewards/', '_SELF');
		break;
		case "synergy_airBuddies" :
				cto.trackLink("exit_sbd_synergy_air_buddies");
				alert('trackLink("exit_sbd_synergy_air_buddies")');
				window.open('http://disney.go.com/disneyvideos/animatedfilms/airbuddies/', '_SELF');
		break;
		case "synergy_snowBuddies" :
				cto.trackLink("exit_sbd_synergy_snow_buddies");
				window.open('http://adisney.go.com/disneyvideos/liveaction/snowbuddies/', '_SELF');
		break;
		case "synergy_wall-e" :
				cto.trackLink("exit_sbd_synergy_walle");
				window.open('http://disney.go.com/disneypictures/wall-e/', '_SELF');
		break;
		case "synergy_magicalPlacePassport" :
				cto.trackLink("exit_sbd_magical_places");
				window.open('http://magicalplacespassport.com/#/home/?cmp=dmov_dmr_bac_dmp_spacebuddies', '_SELF');
		break;
		case "buyDVD" :
				cto.trackLink("exit_sbd_order_dvd");
				window.open('http://transfer.go.com/cgi/transfer.dll?name=23303&SOURCE=23303&srvc=store&goto=http://disneyshopping.go.com/disney/store/DSIProductDisplay?catalogId=10002&storeId=10051&productId=1238791&langId=-1&categoryId=13694&CMP=OTL-TWDC_BVHE&att=BVHE', '_SELF');
		break;
		case "buyBluRay" :
				cto.trackLink("exit_sbd_order_bluray");
				window.open('http://transfer.go.com/cgi/transfer.dll?name=23303&SOURCE=23303&srvc=store&goto=http://disneyshopping.go.com/disney/store/DSIProductDisplay?catalogId=10002&storeId=10051&productId=1238773&langId=-1&categoryId=13694&CMP=OTL-TWDC_BVHE&att=BVHE', '_SELF');
		break;
		case "itunes" :
				
				window.open('http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewMovie?id=298442728&s=143460', '_BLANK');
		break;

		
		//VIDEOS
		case "moreOptions" :
			window.open('more_options.html', '_BLANK');
		break;
		
		default:
			alert("troubleshooting a failed popup -- case: " + sCase);
		break;
		
		
	}
}