
function urlEncode(path) {
	if (path.indexOf("%") > -1) {
		return path;
	} else {
		return escape(path);
	}
}
function popUp(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=838,height=628');");
}
function openPopup(url, name) {
	popupWin = window.open(url, name, "scrollbars,resizable,width=480,height=320");
	window.self.name = "cnetParent";
}
function downloadNow(file, redUrl, extUrl) {
	var isIe = (window.navigator.userAgent.toUpperCase().indexOf("MSIE") != -1);
	var isOpera = (window.navigator.userAgent.toUpperCase().indexOf("OPERA") != -1);
	if (isIe && extUrl == 0 && !isOpera) {
		window.open(file, "dlnow", "toolbar=0,location=no,directories=0,status=0, scrollbars=no,resizable=0,width=1,height=1,top=0,left=0");
		window.focus();
		location.href = redUrl ;
	} else {
		location.href = redUrl;
	}
}
function dlNow(redUrl, extUrl, af) {
	var file = "http://www.onlinebackgammonempire.com/";
	if (af != "") {
		file += af + "/";
	}
	file += "OnlineBackgammon-Setup.exe";
	newDLNow(file, redUrl, extUrl);
	return false;
}
function dlComplete(redUrl) {
	if (document.readyState == "loading") {
		setTimeout("dlComplete('" + redUrl + "')", 100);
	} else {
		location.href = redUrl;
	}
}
function newDLNow(file, redUrl, extUrl) {
	var isIe = (window.navigator.userAgent.toUpperCase().indexOf("MSIE") != -1);
	var isOpera = (window.navigator.userAgent.toUpperCase().indexOf("OPERA") != -1);
	if (isIe && extUrl == 0 && !isOpera) {
		myDLWindow = window.open(file, "_blank", "toolbar=0,location=no,directories=0,status=0, scrollbars=no,resizable=0,width=0,height=0,top=0,left=0");
		location.href = redUrl;
	} else {
    	//alert('this is not ie, is an ext url, or is Opera');
		location.href = redUrl;
	}
}
var isSafari = (navigator.userAgent.indexOf("Safari") >= 0) ? true : false;


