function initializeLogin () { window.top.location = 'http://www.youniversitytv.com/games_content/login.php?return=' + escape(window.top.location); return false; } /** * ifnav * Description: Allows a dynamic base URL (including the protocol and host name) to be passed in as the variable "goto" either using this.href or a by a string literal, forcing the http protocol (for now). * Parameter: (string) protocol: future use. One of "http" or "https". Causes the final goto URL to be forced to either http or https. */ function ifnav(goto, protocol) { parseUri.options.strictMode = true; var host = parseUri(goto).host; //canonicalize youniversitytv.com to www.youniversitytv.com. This makes sure that this function will take https://youniversitytv.com/anything and output http://www.youniversitytv.com/anything if(host == "youniversitytv.com") { host = "www.youniversitytv.com"; } var defaultBaseUrl = "http://www.youniversitytv.com"; var defaultBaseHost = parseUri(defaultBaseUrl).host; //if goto doesn't contain a host or contains the default host if (host == "" || host == undefined || host.indexOf(defaultBaseHost) != -1) { if (host == "" || host == undefined) { //type cast base as a string var base = document.getElementsByTagName('base')[0].href + ""; if (base.length > 0) { //remove any trailing slash from base if (base.lastIndexOf("/") == base.length-1) { base = base.substring(0,base.length-1); } } else { base = defaultBaseUrl; } //concat the base URL with the path (goto) if (goto.indexOf("/") != 0) { //if there is no path separater at the start of goto goto = base + "/" + goto; } else { goto = base + goto; } } //force the protocol on the final url var re = new RegExp("^https:", "g"); goto = goto.replace(re, "http:"); } window.top.location = goto; return false; } // parseUri 1.2.2 // (c) Steven Levithan // MIT License function parseUri (str) { var o = parseUri.options, m = o.parser[o.strictMode ? "strict" : "loose"].exec(str), uri = {}, i = 14; while (i--) uri[o.key[i]] = m[i] || ""; uri[o.q.name] = {}; uri[o.key[12]].replace(o.q.parser, function ($0, $1, $2) { if ($1) uri[o.q.name][$1] = $2; }); return uri; }; parseUri.options = { strictMode: false, key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"], q: { name: "queryKey", parser: /(?:^|&)([^&=]*)=?([^&]*)/g }, parser: { strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/ } };