function showTextAd(cookieName) {
var host = location.href;
var imgUrl = (host.indexOf("secure.")!=-1) ? "https://secure.theglobeandmail.com" : "http://images.theglobeandmail.com";
var WEBSITE_TGAM = "http://images.theglobeandmail.com";
var userPromo = "
";
var loggedInText = userPromo;
var loggedOutText = userPromo;
var d = document;
var cookieValueStartIndex = -1;
var SSOcookieValueStartIndex = -1;
var random_number = Math.floor(Math.random() * 99999999);
var WEBSITE_TGAM = "http://images.theglobeandmail.com";
////////////////////////////////////////////////////////
//
// 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;
loginPageIndex = Value.indexOf("loginRegistrationPage");
logoutPageIndex = Value.indexOf("logoutPage");
if(loginPageIndex == -1 && logoutPageIndex == -1) {
forwarded_URL = Value;
}
}
}
}
//
// End of getting user_URL
//
////////////////////////////////////////////////////////
if (d.cookie) {
cookieLength = document.cookie.length;
cookieValueStartIndex = document.cookie.indexOf(cookieName + "=");
SSOcookieValueStartIndex = document.cookie.indexOf("SSO_COOKIE");
if ( (cookieValueStartIndex != -1) && (SSOcookieValueStartIndex != -1)) {
///////////////////////////////////////////////
// Write the Logged In version to the page
//
textLoggedIn = escape(loggedInText);
d.write('' + unescape(textLoggedIn) + '');
// d.write(''+ unescape(textLoggedIn) + '');
// d.write('' + unescape(textLoggedIn) + '');
} else {
///////////////////////////////////////////////
// Write the NOT Logged In version to the page
//
textLoggedOut = escape(loggedOutText);
d.write('' + unescape(textLoggedOut) + '');
// d.write(''+ unescape(textLoggedOut) + '');
// d.write(''+ unescape(textLoggedOut) + '');
}
} else {
///////////////////////////////////////////////
// Write the NOT Logged In version to the page
//
textLoggedOut = escape(loggedOutText);
d.write('' + unescape(textLoggedOut) + '');
// d.write(''+ unescape(textLoggedOut) + '');
// d.write(''+ unescape(textLoggedOut) + '');
}
}