var lastPopUpWindow = null;
function getDownload (sCase){
	try {
		lastPopUpWindow.close ();
	} catch(e) {
	}
	switch (sCase){
		//DOWNLOADS section
		case "wallpaper" : //wallpaperID number, width
			var id = getDownload.arguments [1];
			var width = getDownload.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('wallpaper.html?id=' +id + '&width=' + width +"&height=" + height,'_BLANK');	
		break;
		case "poster" :
			lastPopUpWindow = launchPopUpWindow ('download.html?theFile=assets/downloads/poster/bb_poster.zip', 'poster', 300, 300);
		break;
		case "icon" :  //iconID
			var id = getDownload.arguments[1];
			var theURL = 'buddyicons.html?id=' +id;
			lastPopUpWindow = launchPopUpWindow (theURL, 'icons', 380, 520);	
		break;
		default:
			alert("failed to download: " + sCase);
		break;
	}
}


function launch (sCase){
	try {
		lastPopUpWindow.close ();
	} catch(e) {
	}
	switch (sCase){
		case "moreOptions" :
			window.open('http://www.apple.com/trailers/summit/thebrothersbloom/','_BLANK');	
		break;
		case "meetTheBrothers" :
			window.open('http://www.brothersbloom.com/meetthebrothers/','_BLANK');	
		break;
		default:
			alert("failed to launch: " + sCase);
		break;
	}
}
