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 = 680;
	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) {
    var sProps = "toolbar=1,location=0,directories=0,status=0,menubar=1,scrollbars=1,resizable=1,left=0,top=0";
    openNewWindow(sURL, windowName, sProps);
}
function openNewWindow(sURL, windowName, sProps) {
    var miscWin = window.open(sURL, windowName, sProps);
    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 '';
}


function thisMovie(movieName) {
    if (navigator.appName.indexOf("Microsoft") != -1) {
        return window[movieName];
    }
    else {
        return document[movieName];
    }
}

$(window).resize(function () {
    sidebarWidth();
});

var chatWidth = 312;

function sidebarWidth() {

    if ($('#sidebar').css('display') == 'block')
    {
        var flashsize = this.window.innerWidth - chatWidth;
        $('#content').css('width', flashsize);
        console.log(flashsize);
       
    }
}

function openSidebar() {
    $('#sidebar').css('display', 'block');
    sidebarWidth();
    thisMovie("content").openSidebar("true");
    
}
function closeSidebar() {
    var chatWidth = 312;

    
    $('#sidebar').css('display', 'none')
    $('#content').css('width', '100%');

    //thisMovie("content").closeSidebar("true");
    thisMovie("content").hideChat("true");
} 
