function checkDeepLink() {
	var queryVars = {};
	var queryPairs = window.location.search.substring(1).split("&");
	for (var i = 0; i < queryPairs.length; ++i) {
		var pos = queryPairs[i].indexOf("=");
		if (pos > 0) {
			var key = queryPairs[i].substring(0, pos);
			if (key == "page" || key == "mixID" || key == "skin") {
				var value = queryPairs[i].substring(pos + 1);
				queryVars[key] = value;
			}
		}
	}
	var urlHash = window.location.hash.substring(1);
	if (urlHash.length > 0) {
		queryVars["page"] = urlHash;
	}
	if (parseInt(queryVars["mixID"]) > 0) {
		queryVars["page"] = "vote";
	}
	if (queryVars["page"] && queryVars["page"].length > 0) {
		writeFlash(queryVars);
	}else{
		writeFlash();
	}
}
function getInnerCode(id) {
	var element = document.getElementById(id);
	return escape(element.innerHTML.toString());
}
function popupWindow(href, page, width, height) {
	setTimeout("popupWindow2('" + href + "','" + page + "'," + width + "," + height + ")", 1);
}
function popupWindow2(href, page, width, height) {
	var winName = (page.length > 0) ? page : "_blank";
	var leftVal = (screen.width - width) >> 1;
	var topVal = (screen.height - height) >> 2;
	var options = "channelmode=no,directories=no,height=" + height + ",innerHeight=" + height + ",innerWidth="
	            + width + ",left=" + leftVal + ",location=no,menuBar=no,resizable=no,scrollbars=auto,status=no,toolbar=no,top="
	            + topVal + ",width=" + width;
	var win = window.open(href, winName, options);
	if (win) {
		win.focus();
	}
}
function resizeFlashContent() {
	var BASE_WIDTH = 1024;
	var BASE_HEIGHT = 546;
	var innerWidth = BASE_WIDTH;
	var innerHeight = BASE_HEIGHT;
	if (typeof(window.innerHeight) == "number") {
		innerWidth = window.innerWidth;
		innerHeight = window.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) {
		innerWidth = document.documentElement.clientWidth;
		innerHeight = document.documentElement.clientHeight;
	} else if (document.body && document.body.clientHeight) {
		innerWidth = document.body.clientWidth;
		innerHeight = document.body.clientHeight;
	}
	var flashContent = document.getElementById("flashContent");
	if (flashContent) {
		if (innerWidth < BASE_WIDTH) {
			flashContent.style.width = BASE_WIDTH + "px";
		} else {
			flashContent.style.width = "100%";
		}
		if (innerHeight < BASE_HEIGHT) {
			flashContent.style.height = BASE_HEIGHT + "px";
		} else {
			flashContent.style.height = "100%";
		}
		if (innerWidth < BASE_WIDTH || innerHeight < BASE_HEIGHT) {
			document.body.style.overflow = "scroll";
		} else {
			document.body.style.overflow = "hidden";
		}
	}
}
function writeFlash(vars, skipDetect) {
	document.body.style.height = "100%";
	var flashIndex = new SWFObject("index.swf", "flashIndex", "100%", "100%", "8", "#000000");
	//flashIndex.useExpressInstall("expressinstall.swf");
	flashIndex.addParam("allowScriptAccess", "always");
	flashIndex.addParam("loop", "false");
	flashIndex.addParam("menu", "false");
	flashIndex.addParam("scale", "noscale");
	for (var key in vars) {
		flashIndex.addVariable(key, escape(vars[key]));
	}
	flashIndex.skipDetect = skipDetect;
	if (flashIndex.write("flashContent")) {
		resizeFlashContent();
	} else if (!skipDetect
	           && confirm("You do not appear to have a recent version of the Flash Player.\n\nDo you want to continue?")) {
		flashIndex.skipDetect = true;
		flashIndex.write("flashContent");
	}
}
