// The website owner asserts copyright on this program and all of its components

var error_count=0;

function goto(url)
{window.location = url;
};

function fback()
{alert("You have an old version of this page. Please click REFRESH/RELOAD");
 record("Old version of pace - fback() called");
};

function oldfback()
{var rating = document.feedback.rating.value;
 var SubmitIt = true;
  if  (rating == 0)
      {alert('Please select a rating');
	   SubmitIt = false;
	  };
	  
  if  ((rating < 3) && (document.feedback.comments.value.length < 10))
      {alert('Please provide some reasonable feedback explaining your low score')
       SubmitIt = false;
	  };
	  
 if   (document.feedback.MagicNumber.value != "1998")	  
      {alert("You entered the wrong number. Please try again");
	     SubmitIt = false;
	    };
	  
 if (SubmitIt == true) document.feedback.submit();
};

function MoneyFormat(amount)
{
   var val = parseFloat(amount);
   if   (isNaN(val))
        { return "0.00"; };

   if   (val <= 0)
        { return "0.00"; }
   else { val = Math.round(val*100)/100; };

   val = (val == Math.floor(val)) ? val + '.00' : ((val*10 == Math.floor(val*10)) ? val + '0' : val);
   return val;
};

function GetCookie(name)
{  var allcookies = unescape(document.cookie);
   var pos = allcookies.indexOf(name+"=", start);
   if (pos != -1)
      {var start = pos + name.length + 1
       var end   = allcookies.indexOf(";", start)
       if (end == -1) end = allcookies.length;
       return unescape(allcookies.substring(start, end))
      }
   else return "";
};


function debug(msg)
{
 if (GetCookie('DEBUG')=="ON")
    {
     alert(msg)
    };
};

function coachad()
{
// document.writeln("<p><B>Fed up?</B><br>");
// document.writeln("<a href='http://www.uklifecoaching.org?ref=LFBtopad' target='_blank'>Professional Life Coaching</a> can give you<br>");
// document.writeln("the boost that will turn your life around.<br>");
// document.writeln("Be the Best you can Be - talk to you <a href='http://www.uklifecoaching.org?ref=LFBtopad2' target='_blank'>Life Coach</a> today.</p>");
};


function record(info)
{
 if (document.URL.search(/file/i) != 0)
   {
    var LogVersion = '1';
    var CID;
    if   (GetCookie('CDROOT') !='')
         {CID ='CDROM'}
    else {CID ='ONLIN'};

    var BID        = GetCookie('BID');
    if (BID == '')
       {
        var now = new Date();
        BID = Date.parse(now.toUTCString())/1000;
        document.cookie = "BID=" + BID + '; expires=Tue, 31-Dec-2012 00:00:00 GMT';
        BID = GetCookie('BID');
       };

    var undefined;
    var NQ         = document.URL.split('?'); if (NQ[1] == undefined) NQ[1]='';
    var pagename   = NQ[0].split(/\\|\//);
        pagename   = pagename[pagename.length-1];

    if ((info != '') && (info != undefined)) pagename = pagename + '+' + info;
    if (NQ[1] !='') pagename = pagename + '?' + NQ[1];
    pagename = escape(pagename);

    if (pagename.length > 255)
       { pagename = pagename.slice(0,254)
       };

	 NQ 	    = document.referrer.split('?');
    var  temp1      = NQ[0].split('/');
         myreferrer = temp1[temp1.length-1];
    var  refdomain  = temp1[2]; if (refdomain == undefined) refdomain = '';

    if (refdomain != '' && refdomain != document.domain) myreferrer = document.referrer;
    if (myreferrer.length > 255)
       { myreferrer = myreferrer.slice(0,254)
       };

    var x = new Image();
    var logstring = 'http://www.letsfixbritain.com/cgi-bin/log.pl?' +
                     LogVersion        + '^'
                      + pagename       + '^'
                      + BID            + '^'
                      + CID            + '^'
                      + escape(myreferrer);
    x.src = logstring;
  };
};
