$(document).ready(function(){ // Show Sign In popup on anonymous user hitting link for authenticated users only. var targetPageURL = getUrlVars()["targetURL"]; var register = getUrlVars()["register"]; if (targetPageURL && targetPageURL !=null && register == undefined){ if (typeof tb_show === 'function') { setTimeout(function () { tb_show("", "#TB_inline?height=315&width=470&inlineId=signInFormDiv"); }, 1000); } else { console.log('Can\'t show SignIn popup because "tb_show" is undefined.'); } }else if(targetPageURL && targetPageURL !=null && register != undefined ){ $("#singup-button").trigger('click'); } // From http://stackoverflow.com/questions/979975/how-to-get-the-value-from-the-url-parameter. function getUrlVars() { var vars = {}; var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) { vars[key] = value; }); return vars; } var xmlhttp = new getXMLObject(); var isUserLoggedInC = getCookie("li_c"); var isUserLoggedIn = "false"; getUserLoggedIn(); if(isUserLoggedIn != undefined && isUserLoggedIn != null){ var loc = window.location.href; if((isUserLoggedInC == '1' || isUserLoggedIn == "true")){ if(loc == marketingUrl){ window.location.href= appBaseUrl + "/home.htm"; } //if(loc.indexOf("/about") == -1 && loc.indexOf("/press") == -1) } } function getUserLoggedIn(){ if(xmlhttp) { xmlhttp.open("GET", appBaseUrl + "/checkUserLoggedInStatus.htm" ,true); xmlhttp.onreadystatechange = handleResponse; xmlhttp.setRequestHeader('Content-Type', 'application/json'); xmlhttp.send(null); } } function handleResponse(){ if (xmlhttp.readyState == 4) { if(xmlhttp.status == 200) { isUserLoggedIn = xmlhttp.responseText; } } } if(isUserLoggedInC == "1" || isUserLoggedIn == "true"){ $(".loggedin-menu-holder").show(); $(".header-right-buttons").html(''); }else{ $(".loggedin-menu-holder").html(''); $(".header-right-buttons").show(); } });