function goHome() {
	if (window.opener && !window.opener.closed) {
		window.opener.location.href = sHomeURL;
		self.close();
	} else {
		var home = window.open(sHomeURL);
		home.focus();	
	}
}

function showWallpaper(sURL) {
	var iWidth = 800;
	var iHeight = 500;
	var sProps = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=1,left=" + Math.round((screen.width - iWidth) / 2) + ",top=" + Math.round((screen.height - iHeight) / 2) + ",width=" + iWidth + ",height=" + iHeight;
	var wallpaper = window.open(sURL,"wallpaper", sProps);
	wallpaper.focus();		
}

function openCC(sURL) {
	var iWidth = 960;
	var iHeight = 652;
	var sProps = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,left=" + Math.round((screen.width - iWidth) / 2) + ",top=" + Math.round((screen.height - iHeight) / 2) + ",width=" + iWidth + ",height=" + iHeight;
	var PVA = window.open(sURL,"PVA", sProps);
	PVA.focus();
}

function openWindow(sURL, iWidth, iHeight) {
	openWindowMain(sURL, iWidth, iHeight, false);
}

function openWindowScrollable(sURL, iWidth, iHeight) {
	openWindowMain(sURL, iWidth, iHeight, true);
}

function openWindowMain(sURL, iWidth, iHeight, isScrollable) {
	var scrollbars = (isScrollable ? "1" : "0");
	var sProps = "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=" + scrollbars + ",resizable=0,left=" + Math.round((screen.width - iWidth) / 2) + ",top=" + Math.round((screen.height - iHeight) / 2) + ",width=" + iWidth + ",height=" + iHeight;
	var miscWin = window.open(sURL, "miscWin", sProps);
	miscWin.focus();
}
function openOffer(sURL) {
    var sProps = "toolbar=1,location=1,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,left=0,top=0,width=" + screen.width + ",height=" + screen.height;
    var miscWin = window.open(sURL, "miscWin", sProps);
    miscWin.focus();
}
function openNewWindow(sURL, windowName) {

	//scrollbars=1,resizable=1,locationbar=1,menubar=1,personalbar=1
	var sProps = "toolbar=1,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,left=0,top=0";
	var miscWin = window.open(sURL, windowName, sProps);
	//alert("OPEN NEW WINDOW: ", miscWin, sURL);
	miscWin.focus();
}
function setStartpage(elmThis) {
    if (document.getElementById) {
        var sUrl = elmThis.value;
        if (sUrl != "") {
            var elem = document.getElementById("selectedCountry");
            if (elem) {
                elem.value = sUrl;
            }
            document.forms[0].submit();
        }
    }
}
function getQueryString() {
    return window.location.search.substring(1);
}

function getQueryVariable(qv) {
    var pairs = getQueryString().split("&");
    for (i = 0; i < pairs.length; i++) {
        var pair = pairs[i].split("=");
        if (pair[0] == qv) {
            return pair[1];
        }
    }
    return '';
}

