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" :
			location.href="http://disney.go.com/disneypictures/downloads/index.html";
		break;
		case "synergy_DMR" :
				cto.trackLink("exit_sbd_dmr");
				location.href="http://disney.go.com/disneymovierewards/";
		break;
		case "synergy_airBuddies" :
				cto.trackLink("exit_sbd_synergy_air_buddies");
				location.href="http://disney.go.com/disneyvideos/animatedfilms/airbuddies/";
		break;
		case "synergy_snowBuddies" :
				cto.trackLink("exit_sbd_synergy_snow_buddies");
				location.href="http://disneydvd.disney.go.com/snow-buddies.html";
		break;
		case "synergy_wall-e" :
				cto.trackLink("exit_sbd_synergy_walle");
				location.href="http://disney.go.com/disneypictures/wall-e/";
		break;
		case "synergy_airBud" :
				cto.trackLink("exit_sbd_synergy_air_bud_special_edition");
				location.href="http://disneydvd.disney.go.com/air-bud.html";
		break;
		case "synergy_magicalPlacePassport" :
				cto.trackLink("exit_sbd_magical_places");
				location.href="http://magicalplacespassport.com/#/home/?cmp=dmov_dmr_bac_dmp_spacebuddies";
		break;
		case "synergy_plushOffer" :
				cto.trackLink("exit_sbd_synergy_plush_offer");
				location.href="http://disney.go.com/disneymovierewards/buddies/?cmp=dmov_dmr_bac_SB-OlivGWP_sbsite";
		break;
		case "bdLive" :
				cto.trackLink("exit_sbd_bd_live");
				location.href="http://www.disneybdlivenetwork.com/";
		break;
		case "valentine_Ecard" :
				cto.trackLink("exit_sbd_valentine_ecard");
				GOurl2('http://ad.doubleclick.net/clk;211526160;12590889;f?http://www.americangreetings.com/ecards/display.pd?N=105791&prodnum=3152207');
		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 "petFinder" :
				cto.trackLink("exit_sbd_petfinder");
				GOurl2('http://www.petfinder.com');
		break;
		case "partners" :
				cto.trackLink("exit_sbd_partners");
				window.open('partners.html', '_BLANK','location=0,status=0,scrollbars=0,width=850,height=680');
				//if this page grows tall enough, you'll need 868 width to accomodate scrollbars
		break;
		
		//VIDEOS
		case "moreOptions" :
			window.open('more_options.html', '_BLANK');
		break;
		
		default:
			alert("troubleshooting a failed popup -- case: " + sCase);
		break;
		
		
	}
}