document.observe("dom:loaded", function(){
	if(getcookie2('__un') != ''){
		style = "";
		allAnchor = document.getElementById('_membershipWidgetDiv').getElementsByTagName("A");
		if( allAnchor.length > 0 ){
			style = allAnchor[0].style.cssText;
		}
		var myDomain = document.domain.toString();
		if(myDomain.match(/s2\.webstarts\.com/i))
		{
			//easyurl
			subject = window.top.document.location.href;
			match = subject.match(/s2\.webstarts\.com\/([a-zA-Z0-9_-]+)\/.*/i);
			if (match != null) {
				// matched text: match[0]
				// match start: match.index
				// capturing group n: match[n]
				strHTML = '<span>Hello <strong>'+getcookie('__un')+'</strong> - <a style="'+style+'" href="http://'+myDomain+'/'+match[1]+'/Scripts/logout.php">Log Out</a></span>';
			} else {
				// Match attempt failed
				alert("Oops! Regex error occured. Please refresh page and try again.");
			}
		}else{
			strHTML = '<span>Hello <strong>'+getcookie('__un')+'</strong> - <a style="'+style+'" href="/Scripts/logout.php">Log Out</a></span>';
		}
		document.getElementById('_membershipWidgetDiv').innerHTML = strHTML;
	}
});
