

<!-- 
var thresholdA=10;
var thresholdB=100000;
var daystokeep=365;
var incval=1;
var sitedom="reviewjournal.com";
var insitecookie="reviewjournal_user_auth";
var insiteURL="http://insite.reviewjournal.com"
var loginpage=insiteURL+"/register-bin/interface.pl.cgi?mode=register&goto=";
var thresholdB_page=insiteURL+"/register-bin/trusted_interface.pl.cgi?mode=edit&version=upgrade";
var thresholdB_segment="full_user";
var insite_secure_file=insiteURL+"/secure/log.gif?pg=";

// 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="reviewjournal.com";
	document.cookie=cname + '=' + cvalue + '; expires=' + ex.toGMTString() + cpath + "; domain="+sitedom;
}

//Threshold management
//Back off threshold for Drudge and Yahoo links
var myurl= new String(document.location);
if (myurl.match("drudge") ) { incval = -10 }
if (myurl.match("yahoo")  ) { incval = -10 }
if (myurl.match("google")  ) { incval = -10 }
if (myurl.match("erj.reviewjournal.com")  ) { incval = -10 }

//Incrementer
if (GetCookie('pagecount')) {
	pp=eval(GetCookie('pagecount')) + incval;
	SaveCookie('pagecount',pp,daystokeep,'/') ;
} else {
	pp=incval;
	SaveCookie('pagecount',incval,daystokeep,'/') ;
}

// let reviewjournal's newsroom through no matter what
// the ip address has to be set outside of this .js file because ssi is not applied to .js
//var ip = '<!--#echo var="REMOTE_ADDR"-->';
if ( ip.substr(0,7) != '172.16.') {
    //Act on threshold
    if ( (!GetCookie(insitecookie)) && (pp>thresholdA) && (!navigator.userAgent.match("WebTV")) ){
        SaveCookie('rurl',document.location,.01,'/') ;
        location=loginpage+"?"+escape(document.location);
    } else { 
        // You ARE logged in and....

       //This short routine daily ensures user has all their custom cookies
        if (!GetCookie('seentoday')) { 
           document.write("<img width=1 height=1 border=0 ");
           document.write("src='"+insite_secure_file+escape(document.location)+"'>");
           SaveCookie('seentoday',1,.9,'/')
        }
        //Second Threshold for those logged in
        var segments = GetCookie('segments'); 
        if ( (pp>thresholdB) && !segments.match(thresholdB_segment) && (!navigator.userAgent.match("WebTV")) ) {
            SaveCookie('rurl',document.location,.01,'/') ;
            location=thresholdB_page+"&"+escape(document.location);
        }
    }
}


//This portion allows sites to build navigation for both logged-in and no logged-in users
//Simply put your elements into DIV tags with the classnames "member" or "nonmember"


 // Member links: sets styles to "hide" links based on membership status
 if (GetCookie(insitecookie)) {
    document.write('<style type="text/css">#nonmember{display:none;}</style>');
 } else {
   document.write('<style type="text/css">#member{display:none;}</style>');
 }


