﻿var joinNowURL = "http://{}/sports/JoinNow.aspx";
var liveChatURL = "http://{}/LiveChatRoom.aspx";

function OpenChatWindow() {
    var wHandle = window.open(GetLiveChatURL(), "LiveChat", "scrollbars=no,resizable=no,width=490,height=403");
    if (wHandle) {
        wHandle.focus();
    }
}

function GetHostURL() {
    var URL = window.location.host;
    var parts = URL.split(".");
    if (parts.length > 2) {
        parts[0] = "www";
        return parts.join(".");
    }
    return window.location.href;
}

function GetJoinNowURL() {
    return joinNowURL.replace("{}", GetHostURL());
}

function GetLiveChatURL() {
    return liveChatURL.replace("{}", GetHostURL());
}

function AutoResizeWindow() {
   var width = 1050;
   var height = 700;

   if (document.all) {
       if (document.body.clientWidth < width || document.body.clientHeight < height) {            
           window.resizeTo(width, height);
       }
   }
   else {
       if (window.innerWidth < width || window.innerHeight < height) {            
           window.resizeTo(width, height);
       }
   }
}
