
//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 (namefield) {
     var arg = namefield + "=";
     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 (namefield, 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 = namefield + "=" + escape (value) +
          ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
          ((path == null) ? "" : ("; path=" + path)) +
          ((domain == null) ? "" : ("; domain=" + domain)) +
          ((secure == true) ? "; secure" : "");
}
function DeleteCookie (namefield) {
     var exp = new Date();
     exp.setTime (exp.getTime() - 1);
     var cval = GetCookie (namefield);
     document.cookie = namefield + "=" + cval + "; expires=" + exp.toGMTString();
}

//Date Functions//////////////////////////////////////////////////////
function makeArray() {
     len = makeArray.arguments.length;
     for (var i = 1; i < len; i++){this[i] = makeArray.arguments[i]};
return;
}
var months = new makeArray('','JAN','FEB','MAR','APR','MAY','JUN','JUL','AUG','SEP','OCT','NOV','DEC');
     var today = new Date();
     var thisMonth = today.getMonth() + 1; var thisMon = months[thisMonth];
     var thisDay = today.getDate(); var thisHour = today.getHours();

function lastModifiedDate(docMod){
	var resdate = new Date(docMod)
	var lmonth = months[resdate.getMonth() + 1];
	var fyear = resdate.getYear();
	var docModText = lmonth + ' ' + fyear;
return (docModText);
}
function fixDate(date){
     var base = new Date(0);
     var skew = base.getTime();
     if (skew > 0)
          date.setTime(date.getTime() - skew);
}
function compareDates(updatedDate,lastSeenDate){
	var udd = new Date(updatedDate)
	var lsd = new Date(lastSeenDate)
	var revised = false;

	if (lsd.getTime() < udd.getTime()){
		revised = true;
	}
	var ExpireDate= new Date();
		fixDate(ExpireDate);
		ExpireDate.setTime(ExpireDate.getTime() + 365 * 24 * 60 * 60 * 1000);
		SetCookie('Revised',revised,ExpireDate);
return(revised);
}
//UpdateDate//////////////////////////////////////////////////////
var updatedDate =  new Date('Sept 30, 1999 12:00:00');
	fixDate(updatedDate)

//Image Functions/////////////////////////////////////////////////
if (document.images) {
     image1on = new Image(125,35);
     image1on.src = "setson.gif";
     image2on = new Image(125,35);
     image2on.src = "funon.gif";
     image3on = new Image(125,35);
     image3on.src = "agenton.gif";
     image4on = new Image(125,35);
     image4on.src = "linkson.gif";
     image5on = new Image(125,35);
     image5on.src = "talkon.gif";
     image6on = new Image(125,35);
     image6on.src = "helpon.gif";

     image7on = new Image(125,30);
     image7on.src = "emailon.jpg";

     image1off = new Image(125,35);
     image1off.src = "setsoff.jpg";
     image2off = new Image(125,35);
     image2off.src = "funoff.jpg";
     image3off = new Image(125,35);
     image3off.src = "agentoff.jpg";
     image4off = new Image(125,35);
     image4off.src = "linksoff.jpg";
     image5off = new Image(125,35);
     image5off.src = "talkoff.jpg";
     image6off = new Image(125,35);
     image6off.src = "helpoff.jpg";

     image7off = new Image(125,30);
     image7off.src = "emailoff.jpg";

     aringon  = new Image(100,32);	aringon.src  = "aringon.jpg";
     aringoff = new Image(100,32);	aringoff.src = "aringoff.jpg";
}

function changeImages() {
     if (document.images){
          for (var i=0; i<changeImages.arguments.length; i+=2){
               document[changeImages.arguments[i]].src = eval(changeImages.arguments[i+1] + '.src');
          }
     }
}

//Misc Functions//////////////////////////////////////////////////////
function openJukeBox(){
     jukeBox = window.open ('jbox.htm','jukeBox','toolbar=no,menubar=no,location=no,directories=no,status=yes,scrollbars=no,resizeable=no,copyhistory=no,width=375,height=100');
return;
}
function meetOtto(){
     OttoWindow= window.open('genie1.htm','OttoWindow','toolbar=no,menubar=no,location=no,directories=no,status=no,scrollbars=no,resizeable=yes,copyhistory=no,width=500,height=200');
return;
}
function openWWWBoard(){
     WWWBoardWindow= window.open('http:\/\/wwww.reigningpages.com\/forums\/cursors','WWWBoardWindow');
return;
}
function noThirdVoice(){
     //setTimeout('document.location.href = "index2.htm"',8500);
}

function changePage(PageName){
     parent.MainFrame.document.location.href = PageName + '.htm';
     parent.MenuFrame.document.location.href = PageName + 'm.htm';
return;
}

var pageTop = '<HTML><BODY BGCOLOR="#FAF0E6" TEXT="#008080" LINK="#20B2AA" ALINK="#D8BFD8" VLINK="#984868">';
var pageBottom = '<\/BODY><\/HTML>';


//User Functions//////////////////////////////////////////////////////
function makeGreeting(thisHour){
     var greeting ='';
     if ((thisHour >= 4) && (thisHour < 6))greeting = 'You\'re up early';
     if ((thisHour >= 6) && (thisHour < 12))greeting = 'Good Morning';
     if ((thisHour >= 12) && (thisHour < 17))greeting = 'Good Afternoon';
     if ((thisHour >= 17) && (thisHour < 22))greeting = 'Good Evening';
     if ((thisHour >= 22) || (thisHour < 3))greeting = 'You\'re up late';
     if ((thisHour >= 3) && (thisHour < 4))greeting = 'You\'re up very late';
return greeting;
}

function clearCookies(){
     DeleteCookie('VisitorName');
     DeleteCookie('VisitCount');
     DeleteCookie('LastVisitDate');
     DeleteCookie('LastSeenDate');
     DeleteCookie('Revised');
//document.location.href = 'main.htm';
	changePage('main')
	parent.UpdateSiteTracker();
	parent.UpdateAgentTracker();
return;
}
function setUserInfo(NewVisitorName,VisitDate,updateDate,ExpireDate){
     var VisitCount= 0;
     SetCookie('VisitorName', NewVisitorName, ExpireDate);
     SetCookie('VisitCount', VisitCount, ExpireDate);
     SetCookie('LastVisitDate', VisitDate, ExpireDate);
     SetCookie('LastSeenDate', updateDate, ExpireDate);
     document.location.href = 'main.htm';
	parent.UpdateSiteTracker();
//parent.DeleteCookie('AgentEnabled');
	parent.UpdateAgentTracker();
return;
}

function UpdateSiteTracker(){
     parent.SiteFrame.document.location.href =  'site0.htm';
return;
}
function UpdateAgentTracker(){
     parent.AgentFrame.document.location.href =  'agent0.htm';
return;
}

function EnableAgent(){
     if (GetCookie('AgentEnabled')){
          if (confirm('Click OK to reset the Agent to NOT start each time you visit.')){
               parent.DeleteCookie('AgentEnabled');
          }
          else {return;}
     }
     else{
          var ExpireDate= new Date();
               fixDate(ExpireDate);
               ExpireDate.setTime(ExpireDate.getTime() + 365 * 24 * 60 * 60 * 1000);
          SetCookie('AgentEnabled','true',ExpireDate);
     }
     UpdateAgentTracker();
}
    
