
var whichVersion = navigator.appVersion;
var platform = "";
var netscapev = "";
var i = 1;

if (whichVersion.substring(0,3) == "2.0") 
{
	netscapev="2"
}
else 
	if (whichVersion.substring(0,3) == "3.0") 
	{
        netscapev="3"
	}
	else 
	{
        netscapev="1"
	}

while (i < whichVersion.length) 
{
   if (whichVersion.substring(i,i+1) == "(") 
   {
      if (whichVersion.substring(i+1,i+4) == "Mac") {
         platform="Mac";
      }
      else if (whichVersion.substring(i+1,i+6) == "Win16") {
         platform="Win";
      }
      else if (whichVersion.substring(i+1,i+6) == "Win95") {
         platform="Win95";
      }
      else if (whichVersion.substring(i+1,i+6) == "WinNT") {
         platform="WinNT";
      }
      else {
         platform = "UNIX";
      }
      break;
   }
   i = i + 1;
}


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" : "");
}

function setLastHereOnCookie (value) 
{
    var rightNow = new Date()
    var expdate = new Date()
    expdate.setTime (expdate.getTime() + 180*(24 * 60 * 60 * 1000)) // dead in 6 months
	valor=""+rightNow.getMonth()+rightNow.getTime();
		
	if (value == null)
	    //SetCookie ("lastHereOn", rightNow.getTime(), expdate, "/")//original
		SetCookie ("cookie_id_", valor, expdate, "/")
	//else
	//	SetCookie ("cookie_id_", value, expdate, "/")//original
}

var lastVisit = GetCookie("cookie_id_")

if (lastVisit == null) 
{
        //htm += "No record of you visiting in the last 2 months."
		//alert("No hay registros de visita");
		setLastHereOnCookie();
}
/*else 
{
		//alert("te registre el dia"+ String(lastVisit));		
        // mac getTime() but workaround, when they fix it this will be wrong...be vigilant
		//alert("Te encontre");
        if (platform == "Mac") {
        	lastVisit = lastVisit - (24 * 60 * 60 * 1000) // getTime() one day off on Mac
        }
        
        lastVisit = 1 * lastVisit  // integerize that stringy cookie
        var lastHereFormatting = new Date(lastVisit);  // Date-i-fy that number
        var intLastVisit = (lastHereFormatting.getYear() * 10000)+(lastHereFormatting.getMonth() * 100) + lastHereFormatting.getDate()
        var lastHereInDateFormat = "" + lastHereFormatting;  // Gotta use substring functions
        var dayOfWeek = lastHereInDateFormat.substring(0,3)
        var dateMonth = lastHereInDateFormat.substring(4,11)
        var timeOfDay = lastHereInDateFormat.substring(11,16)
        var year = lastHereInDateFormat.substring(23,25)
        var noChange=0
}*/
        
//setLastHereOnCookie(lastVisit);  //borrada mientras se reconfigura
