function pop(sID) {
	
	var trackID = "";
	var theURL = "";
	switch (sID) {
		case "icons":
			trackID = "section_downloads_icons"
			theURL = cid + "/icons.html";
			popUpAndTrack(trackID,theURL,380,450);
		break;
		case "avatars":
			trackID = "section_downloads_avatars";
			theURL = cid + "/avatars.html";
			popUpAndTrack(trackID,theURL,380,450);
		break;
		case "wallpaper":
			var id = pop.arguments [1]
			var width = pop.arguments [2];
			var height = 0;
			switch (width) {
				case 1600:
					height=1200;
				break;
				case 1280:
					height=1024;
				break;
				case 1024:
					height=768;
				break
				case 800:
				default:
					width=800;
					height=600;
				break
			}
			var margin = 14;
			var newWidth = Number(width) + (margin * 2) < screen.width ? Number(width) + (margin * 2) : screen.width;
			var newHeight = height + 164 < screen.height ? height + 164 : screen.height;
			theURL = cid + '/wallpaper.html?id=' +id + '&width=' + width +"&height=" + height;
			trackID = "section_downloads_wallpaper_" + id + "_" + width + "x" + height;
			popUpAndTrack(trackID, theURL, newWidth, newHeight);
		break;
	}
}

function simpleTrack (sID) {
	cto.initFlashPV();
	cto.pageName=sID;
	cto.siteSection=ctoMap + sID;	
	cto.trackFlashPV();
}

function popUpAndTrack (sID, sURL, nWidth, nHeight, sType) {
	setTimeout("openWindow('" + sURL + "','" + nWidth + "','" + nHeight + "','" + sType + "')", 1000);
	simpleTrack(sID);
}

function openWindow(sUrl, nWidth, nHeight, sType){
	// and the opening of the link
	if(sType == "self"){
		document.location = sUrl;
	}else{
		window.open(sUrl,"project_window",'scrollbars=1,resizable=1,width=' + nWidth + ',height=' + nHeight + '');
	}
}

function mailtoAndTrack (sID, sBody, sSubject) {
	// and the opening of the mail window
	document.location = "mailto:?body=" + sBody + "&subject=" + sSubject;
	simpleTrack(sID);
}
