function hideUserShell(){
	try {
    	Dwt.setVisibility(document.getElementById("userShell"),false);
    } catch (ex){
      return;
    }
}

function showUserShell(){
    try {
      Dwt.setVisibility(document.getElementById("userShell"),true);
    } catch (ex){
      return;
    }
}

function esiGeneratePageInvalidationUrl(){
     var theUrl = window.location.href;

     var invEsiMarker = "esi=invalidateNow";

     var posInv = theUrl.indexOf(invEsiMarker);
     //add invalidation marker
     if (posInv == -1) {
         var posParam = theUrl.indexOf("?");
         if (posParam == -1) {
            theUrl += "?"+invEsiMarker;
         } else {
            theUrl += "&"+invEsiMarker;
         }
         document.write("Invalidating cache for this page...");
         document.close();
    }
    else {
         document.write("The current URL["+theUrl+"] already contains ["+invEsiMarker+"] when it shouldn't");
         document.close();
    }
   window.location.href = theUrl;
}

function esiForwardToOrginalUrl(){
	var theUrl = window.location.href;

	var invEsiMarker = new String("esi=invalidateNow");
    var posInv = theUrl.indexOf(invEsiMarker);

    //remove invalidation marker
    if (posInv != -1) {
    	document.write(theUrl);
        theUrl = theUrl.replace(/\?esi=invalidateNow/gi,"");
        theUrl = theUrl.replace(/&esi=invalidateNow/gi,"");
        theUrl = theUrl.replace(/esi=invalidateNow/gi,"");
        window.location.href = theUrl;
	}
}

function readCookie(name)
{
	var nameEQ = name + "=";
    var ca = document.cookie.split(';');
    for(var i=0;i < ca.length;i++)
        {
            var c = ca[i];
            while (c.charAt(0)==' ') c = c.substring(1,c.length);
            if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
        }
	//alert('A cookie was not set. '+name+'. Please ensure that your browser accepts cookies.');
	return "Username";
}

