ScrollSpeed = 200;
ScrollChars = 1;
// set up a handler for any javascript boo-boos
// activate by use of statement :
//                                window.onerror=errorhandler;
//
function errorhandler(msg,url,ln){
  alert("Javascript error: "+msg+"\nAt Line: "+ln+"\nIn File: "+url);
  return true;
}

function GetCookie() {
  var visit="Today";
  if(document.cookie){
    var cookiedata=unescape(document.cookie);
    var userdata = cookiedata.split( "=" );
    if (userdata[0]=="cookiedata"){
      var data = userdata[1].split( "," );
      visit=data[1];
    }
  }
  return visit;
}

function SetCookie() {
// to keep a track of last visit
  var expiry = new Date();
  var timm   = expiry.getTime();
  var visit  = "STAR BLUES," + timm.toGMTString();
  expiry.setTime( timm + (7*24*60*60*1000) );
  document.cookie="cookiedata="+escape(visit);
  document.cookie.expires=expiry.toGMTString();
}

function ScrollMarquee() {
// to scroll a line of text in an input box
  window.setTimeout('ScrollMarquee()', ScrollSpeed);
  var msg = document.InputForm.field_value.value;
  document.InputForm.field_value.value = msg.substring(ScrollChars) + msg.substring(0, ScrollChars);
}

function alertmessage(msg){
// displays the windows ALERT DIALOG
  alert(msg);
}

function scrolltext(seed,msg){
// formats msg into a string padded with some spaces at the left
  var out = " ";
  var LIM = 127;
  var c   = 1;

        if (seed > LIM) {
		        out=msg;
        }
        else if (seed <= LIM && seed > 0) {
                for (c=0 ; c < seed ; c++) {
                        out+=" ";
                }
                out+=msg;
        }
        else if (seed <= 0) {
                if (-seed < msg.length) {
                        out+=msg.substring(-seed,msg.length);
                }
                else {
                        out=" ";
                }
        }
		return out;
}

function scrollmessage(seed,msg){
// function is called at regular intervals (LIM) to
// format the message and show it on the status line
  var LIM=100;
  var out=" ";
  var cmd=" ";
  var tto=" ";
  out=scrolltext(seed,msg);
  seed--;
  if (-seed == msg.length) seed=127;
  window.status=out;
  cmd="scrollmessage(" + seed.toString() + ",\"" + msg + "\")";
  timerTwo=window.setTimeout(cmd,LIM);
}

function scroller(msg){
// initiator of the scrollmessage function
// called once on the HTML page onLoad event
// Do Not use scrollmessage function on the HTML page
  var seed=127;
  scrollmessage(seed,msg);
}

// function to verify input was specified
// shows an alert if empty data found
function noEntry() {
var ss="***";
var mt=document.InputForm.field_value.value;
if ((mt.length<1)||(mt.indexOf(ss)!=-1)){
alertmessage("Please enter a value here");
document.InputForm.field_value.focus();
return false;
}
else { return true; }
}

// function to verify input was specified
// clears field if empty data found
function ClearEntry() {
var ss="***";
var mt=document.InputForm.field_value.value;
if ((mt.length<1)||(mt.indexOf(ss)!=-1)){
document.InputForm.field_value.value="";
}
return true;
}

