/* You may give each page an identifying name, server, and channel on
the next lines. */
s.server=""
s.pageType=""
/*s.prop4=""
/*s.prop5=""
/* E-commerce Variables */
s.campaign=""
s.state=""
s.zip=""
s.events=""
s.products=""
s.purchaseID=""
s.eVar2=""
s.eVar3=""
s.eVar4=""
s.eVar5=""

/***************************************************************/
/*Classification Cookie Code
 *
 * Summary: A persistent cookie contains two pieces of
 *    information: the timestamp of the last page view,
 *    and the classification of the visitor. The classification
 *    is used if the timestamp is less than 30 minutes old,
 *    which means the visitor is still in the same "visit".
 */
 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 (name) 
   {
   var arg = name + "=";
   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 SetCookie (name, value) 
   {
   var argv = SetCookie.arguments;
   var argc = SetCookie.arguments.length;
   var expires = (argc > 2) ? argv[2] : null;
   var path = (argc > 3) ? argv[3] : null;
   var domain = (argc > 4) ? argv[4] : null;
   var secure = (argc > 5) ? argv[5] : false;
   document.cookie = name + "=" + escape (value) +
        ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
        ((path == null) ? "" : ("; path=" + path)) +
        ((domain == null) ? "" : ("; domain=" + domain)) +
        ((secure == true) ? "; secure" : "");
   }


var cookie_name = "time_of_last_page";
var cookie_val = GetCookie( cookie_name );
var classification = "First-Time Visitor";
// if the visitor has been to the site before
if( cookie_val ){
    var i = cookie_val.indexOf('|');

    // parse the timestamp from the cookie
    var timestamp = cookie_val.substring( 0, i );

    // parse the classification from the cookie
    classification = cookie_val.substring( i+1 );

    var d = new Date;

     // diff is milliseconds since last page view
    var diff = d.getTime() - parseInt(cookie_val);

    // diff is now minutes since last page view
    diff = diff / ( 1000*60 );
	
    // if more than 30 minutes have passed since the last pageview
    if( diff > 30 ){
        // set classification based on the time lapse
        if( diff > 60*24*30 )
            classification = "More than 30 days";

        if( diff <= 60*24*30 && diff >= 60*24*7 )
            classification = "More than 7 days";

        if( diff < 60*24*7 && diff >= 60*24*2 )
            classification = "Less than 7 days";

        if( diff < 60*24*1 )
            classification = "Less than 1 day";
    }
}

// set a persistent cookie with the timestamp
var t = new Date;
var e = new Date;

e.setTime( e.getTime()+1000*60*60*24*365*3 ); // expire in 3 years

SetCookie( cookie_name, t.getTime()+"|"+classification, e );

// if the cookie is not written, the classification is unknown
if( !GetCookie(cookie_name) ) {
    classification = "unknown - cookies not supported";
}

// put the classification into prop1
s.prop3 = classification;
/*End Classification Code*/
/******************************************************/

/***************************************************************/
/*Set Login Event
 * Summary: Set the event variable if the referrer page is the login.jsp
 *	page.  Event1 will be used on the omniture site, to depict
 *	the login action.
 */
 var myReferrer;
 var num;
 myReferrer= document.referrer;
 num = myReferrer.indexOf("login.jsp");
 if(num > 0) {
 	/*Log in event*/
 	s.events="event1";
 	s.eVar2=classification;
 }
/*End login Event*/
/***************************************************************/