function cookieShow(cookieName) {
var d = document;
var userID = "";
var indexNameBegin;
var indexNameEnd;
var cookieValueStartIndex = -1;
var SSOcookieValueStartIndex = -1;
var cookieLength = 0;
var random_number = Math.floor(Math.random() * 99999999);
var WEBSITE_TGAM = "http://www.theglobeandmail.com";
var host = "(none)";
var imgUrl = (host.indexOf("secure.")!=-1) ? "https://secure.theglobeandmail.com" : "http://images.theglobeandmail.com";
var tlh = "(none)";
var finance = (tlh.indexOf("globeinvestor.c")!=-1 || tlh.indexOf("investdb.")!=-1 || tlh.indexOf("globefund.c")!=-1 || tlh.indexOf("globefunddb.")!=-1 || tlh.indexOf("portfoliodb")!=-1) ? true : false;
// var finance = (tlh.indexOf("staging.globeinvestor")!=-1 || tlh.indexOf("globefundstage")!=-1 || tlh.indexOf("pennys1")!=-1) ? true : false;
////////////////////////////////////////////////////////
//
// Get the user_URL which was passed along in the
// URL query string
//
var queryString = window.location.search;
var forwarded_URL = "";
if (queryString.length > 1) {
queryString = queryString.substring(1, queryString.length);
} else { queryString = null; }
queryKeyVals = new Array();
if(queryString) {
for(var i=0; i < queryString.split("&").length; i++) {
queryKeyVals[i] = queryString.split("&")[i];
}
for(var j=0; j < queryKeyVals.length; j++) {
var Key = queryKeyVals[j].split("=")[0];
var Value = queryKeyVals[j].split("=")[1];
if(Key == "user_URL") {
var loginPageIndex = -1;
var logoutPageIndex = -1;
var otherHosts = -1;
loginPageIndex = Value.indexOf("loginRegistrationPage");
logoutPageIndex = Value.indexOf("logoutPage");
otherHosts = Value.indexOf("newcars.globemegawheels.com");
var maxLoginPageIndex =
Value.indexOf("services/site/concurrentLogin");
if(loginPageIndex == -1 && logoutPageIndex == -1
&& otherHosts == -1 && maxLoginPageIndex == -1 ) {
forwarded_URL = Value;
}
}
}
}
//
// End of getting user_URL
//
////////////////////////////////////////////////////////
if (d.cookie) {
cookieLength = d.cookie.length;
cookieValueStartIndex = d.cookie.indexOf(cookieName + "=");
SSOcookieValueStartIndex = d.cookie.indexOf("SSO_COOKIE");
if ( (cookieValueStartIndex != -1) && (SSOcookieValueStartIndex != -1)) {
indexNameBegin = d.cookie.indexOf(cookieName) + cookieName.length + 1;
nameAll = d.cookie.substr(indexNameBegin);
indexNameEnd = nameAll.search(";");
if (indexNameEnd != -1) {
userID = nameAll.substring(0, indexNameEnd);
} else {
userID = nameAll;
}
newUserID = userID.replace(/\+/g, " ");
// LOGGED IN
d.write('Welcome: ');
d.write(unescape(newUserID));
// d.write(' - denotes Subscription | ');
if(finance){ d.write(' | '); }
else { d.write(' - denotes Subscription | '); }
d.write(' Member Centre | Logout');
if(!finance){ d.write(' | Help'); }
} else {
// NOT logged in
// d.write(' denotes Subscription | ');
if(finance){ d.write(' '); }
else { d.write(' denotes Subscription | '); }
d.write('Login | ');
d.write('Free Registration');
if(!finance){ d.write(' | Help'); }
}
} else {
// NOT logged in
// d.write(' denotes Subscription | ');
if(finance){ d.write(' '); }
else { d.write(' denotes Subscription | '); }
d.write('Login | ');
d.write('Free Registration');
if(!finance){ d.write('| Help'); }
}
}