document.write('<p id="members">');
   
/********** MI: /registration/production/cookies.comp **********/

// GENERIC COOKIE FUNCTIONS
function getCookieVal(offset) {
 var endstr=document.cookie.indexOf(";",offset);
 if (endstr==-1) endstr=document.cookie.length;
 return unescape(document.cookie.substring(offset,endstr));
}
function GetCookie(cname) {
 var arg=cname+"="; var alen=arg.length;
 var clen=document.cookie.length; var i=0;
 while (i<clen) {
		var j=i+alen;
		if (document.cookie.substring(i,j)==arg) return getCookieVal (j); i=document.cookie.indexOf("",i)+ 1;
		if (i==0) break;
 } return null;
}
function SaveCookie(cname,cvalue,cdays,cpath) {
		ex = new Date; ex.setTime(ex.getTime() + (cdays*86400000));
		if (cpath == null) { cpath = "/" } else { cpath = "; path=" + cpath }
		sitedom=location.hostname.replace(/www\./,"");
		document.cookie=cname + '=' + cvalue + '; expires=' + ex.toGMTString() + cpath + "; domain="+sitedom;
}

//SHOW HIDE CSS
var insitecookie=document.cookie.match('sacbee_user_auth');
var icname = GetCookie(insitecookie);
if (icname && icname.indexOf('.threshold') == -1) { 
	document.write("<style>#nonmember{display:none;}</style>");
 } else {
	document.write("<style>#member{display:none;}</style>");
 }

/********** MI: /registration/production/registration_links.comp **********/
var rurl_qs = '';
var loc = ''+document.location;

if (loc.match('/reg-bin/') ) {
 rurl_qs = ";goto=/";
} 
else { 
 rurl_qs = ";goto="+loc 
}

var insitecookie=document.cookie.match('sacbee_user_auth');

if (GetCookie(insitecookie)) {              
 var name = (GetCookie(insitecookie).replace(/\|.*/,""));
 name = name.replace(/\.threshold/ig,'Guest');
} 
else {
 name = 'Guest'
}

document.write('<span id="nonmember"><a style="font-weight: bold;" href="http://www.sacbee.com/static/insite/slogin.html?' + rurl_qs + '">Sign In</a> | <a href="http://www.sacbee.com/reg-bin/int.cgi?mode=register">Register Now</a> | <a href="http://www.sacbee.com/pressclub">PressClub</a> <a href="http://www.sacbee.com/help/" id="sitehelp">Site Help</a></span>');

document.write('<span id="member"><a style="font-weight: bold;" href="http://www.sacbee.com/reg-bin/tint.cgi?mode=edit">My Account</a> | <a href="http://www.sacbee.com/reg-bin/tint.cgi?mode=logout">Sign Out</a> | <a href="http://www.sacbee.com/pressclub">PressClub</a> <a href="http://www.sacbee.com/help/" id="sitehelp">Site Help</a></span></p><span style="clear:both;"></span>');

