//- The Bravo Group www.thebravogroup.net
function overStyle(o) {
/*   o.className="stdColorRoll";*/
   o.style.color="#FF0000";
}

function outStyle(o) {
/*   o.className="stdColor";*/
   o.style.color="#FF0000";
}

function overWhiteBackStyle(o) {
    o.style.color="#FF0000";
}

function outWhiteBackStyle(o) {
    o.style.color="#000066";
}

function outFootStyle(o) {
    o.style.color="#0000ff";
}
function overFootStyle(o) {
    o.style.color="#ff0000";
}

function overRefSched(o) {
    o.className="refSchedRoll";
}

function outRefSched(o) {
    o.className="refSched";
}

function overStyleSide(o) {
    o.className="stdMenuBoxRoll";
}

function outStyleSide(o) {
    o.className="stdMenuBox";
}
function overStyleSide1(o) {
    o.className="stdMenuBoxRoll1";
}

function outStyleSide1(o) {
    o.className="stdMenuBox1";
}

function overSubStyleSide(o) {
    o.className="stdSubMenuBoxRoll";
}

function outSubStyleSide(o) {
    o.className="stdSubMenuBox";
}
function mainMenu_onmouseover(o) {
    o.style.color="999900";
    o.style.background="F5F5F5";
    
}
function mainMenu_onmouseout(o) {
    o.style.background="F5F5F5";
    o.style.color="336699";
}

//==============================================================================
function isWhitespace (s) {
//==============================================================================
    var whitespace = " \t\n\r";
    var i;
    
    if (isEmpty(s)) {
        return true;
    } 
    
    for (i = 0; i < s.length; i++) {
        var c = s.charAt(i);
        if (whitespace.indexOf(c) != -1) {
            return true;
        }
    }
    
    return false;
    
}

//==============================================================================
function MM_jumpMenu(targ,selObj,restore){ //v3.0
//==============================================================================
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
// -->


//==============================================================================
function isEmpty(s) {
//==============================================================================
        return ((s == null) || (s.length == 0))
}

//==============================================================================
function isValidEmail(s) {
//==============================================================================
    var at="@";
    var dot=".";
    var atPos, dotPos
    
    if (isEmpty(s)) {
        return false;
    } 
    
    atPos = s.indexOf(at);
    dotPos = s.lastIndexOf(dot);

    if (atPos > 0 && dotPos > atPos + 1 && dotPos < s.length -1) {    
        return true;
    } else {
        return false;
    }
}

//==============================================================================
function ValidateForm(eform)
//==============================================================================
{
   var eMsg, msgNum, header;

   switch (eform.name) {
    case "frmRegister": {

      var al= new Array(0,1);
      msgNum=0;
      eMsg="";
      header = "BravoBuys.com\nQuick Register Form\n\nYou have received the following errors.\nPlease correct and try again.\n\n";

      if ("" == eform.email.value) {
        eMsg += ++msgNum + ") Must enter a value for Email.\n\n";
      } else if (!isValidEmail(eform.email.value)) {
        eMsg += ++msgNum + ") Invalid email address. Please re-enter.\n\n";
      }

      if ("" == eform.firstName.value) {
        eMsg += ++msgNum + ") Must enter a value for First Name.\n\n";
      }

      if ("" == eform.lastName.value) {
        eMsg += ++msgNum + ") Must enter a value for Last Name.\n\n";
      }

      if (eMsg != "") {
        window.alert(header + eMsg);
        return false;
      }
      
      break;
    }
    case "frmLongRegister": {

      var al= new Array(0,1);
      msgNum=0;
      eMsg="";
      header = "BravoBuys.com\nLong Registration Form\n\nYou have received the following errors.\nPlease correct and try again.\n\n";

      if ("" == eform.email.value) {
        eMsg += ++msgNum + ") Must enter a value for Email.\n\n";
      } else if (!isValidEmail(eform.email.value)) {
        eMsg += ++msgNum + ") Invalid email address. Please re-enter.\n\n";
      }

      if ("" == eform.firstName.value) {
        eMsg += ++msgNum + ") Must enter a value for First Name.\n\n";
      }

      if ("" == eform.lastName.value) {
        eMsg += ++msgNum + ") Must enter a value for Last Name.\n\n";
      }

      if ("" == eform.password.value) {
        eMsg += ++msgNum + ") Must enter a value for Password.\n\n";
      } else if (eform.shadowPassword.value != eform.password.value) {
        eMsg += ++msgNum + ") Password and password confirmation do not match. Please re-enter.\n\n";
      } else if (isWhitespace(eform.password.value)) {
        eMsg += ++msgNum + ") Password contains some empty spaces. Please remove all blank spaces.\n\n";
      } else if (eform.password.value.length < 4 || eform.password.value.length > 8 ) {
        eMsg += ++msgNum + ") Password must be between 4 and 8 characters long.\n\n";
      }

      if (eMsg != "") {
        window.alert(header + eMsg);
        return false;
      }
      
      break;
    }
    case "frmLogin": {

      var al= new Array(0,1);
      msgNum=0;
      eMsg="";
      header = "BravoBuys.com\nLogin Form\n\nYou have received the following errors.\nPlease correct and try again.\n\n";

      if ("" == eform.email.value) {
        eMsg += ++msgNum + ") Must enter a value for Email.\n\n";
      } 

      if ("" == eform.password.value) {
           eMsg += ++msgNum + ") Must enter a value for Password.\n\n";
      }

      if (eMsg != "") {
        window.alert(header + eMsg);
        return false;
      }
      
      break;
    }
    case "frmSendPwd": {

      var al= new Array(0,1);
      msgNum=0;
      eMsg="";
      header = "BravoBuys.com\nLogin Form\n\nYou have received the following errors.\nPlease correct and try again.\n\n";

      if ("" == eform.email.value) {
        eMsg += ++msgNum + ") Must enter a value for Email.\n\n";
      } 

      if (eMsg != "") {
        window.alert(header + eMsg);
        return false;
      }
      
      break;
    }

    case "frmEmail": {
      msgNum=0;
      eMsg="";

      if ("" == eform.email_address.value) {
        eMsg += ++msgNum + ") Must enter a value for email address.\n\n";
      }

      if (eMsg != "") {
        window.alert(eMsg);
        return false;
      }
      
      break;
    
    }

    default : {
      break;
    }
  }
}
function setSelect(o,v) {

    var l=o.length;

    for (var i=0;i<l;i++) {
        if (o.options[i].value == v) {
            o.options[i].selected=true;
        } else {
            o.options[i].selected=false;
        }
    }
}

function ccCopy_onclick(box)
{  
    var f,s,c,sv,cv;

    f=document.frmCCAdd;
    s=f.ccState;
    c=f.ccCountry;
    sv=f.ptnState.value;
    cv=f.ptnCountry.value;

    if (box.checked){
        f.ccName.value = f.ptnName.value;
        f.ccAddress.value = f.ptnAddress.value;
        f.ccCity.value = f.ptnCity.value;
        f.ccZip.value = f.ptnZip.value;

        setSelect(s,sv);
        setSelect(c,cv);
    } else {
        f.ccName.value = "";
        f.ccAddress.value = "";
        f.ccCity.value = "";
        f.ccZip.value = "";

        setSelect(s,"");
        setSelect(c,"US");
    }
}
function isCreditCard(st) {
    if (st.length > 19)
        return false
        sum = 0; mul = 1; l = st.length
        for (x = 0; x < l; x++) {
            digit = st.substring(l-x-1,l-x)
            tproduct = parseInt(digit ,10)*mul
            if (tproduct >= 10) 
                sum += (tproduct % 10) + 1
            else 
                sum += tproduct
            if (mul == 1) 
                mul++
            else 
                mul--
        }
        if ((sum % 10) == 0) 
            return true
        else 
            return false
}
function HelpWindow(f)
{
helpwindow=window.open(f,'helpwindow','scrollbars,location=no,height=325,width=375');helpwindow.focus();
}

function valTextSize(eform,size)
{

     var valtext, emsg;
     
     valtext = eform.value;
     
     if (valtext.length > size) {
       emsg="The text you have entered exceeds\nthe maximum amount of text allowed\nfor this field.\n";
       window.alert(emsg);
     
       eform.value = valtext.substring(0,size);
       eform.focus();
     }
     return;
}
function reset_onclick(eform)
{
    var msg;
    
    msg = "Log value = |" + document.frmCCAdd.log.value + "|\n";
    msg += "Log Default value = |" + document.frmCCAdd.log.defaultValue + "|\n";
    window.alert("Reset is taking place. "+ eform.name);
    window.alert(msg);
}

function resetForm() {
//      document.frmCCAdd.log.value = document.frmCCAdd.h_log.value;
//      document.frmCCAdd.code.value = document.frmCCAdd.h_code.value;
//      document.frmCCAdd.code2.value = document.frmCCAdd.h_code.value;
      document.frmCCAdd.email.value = document.frmCCAdd.h_email.value;
      document.frmCCAdd.ccName.value = document.frmCCAdd.h_ccName.value;
      document.frmCCAdd.ccAddress.value = document.frmCCAdd.h_ccAddress.value;
      document.frmCCAdd.ccCity.value = document.frmCCAdd.h_ccCity.value;
      document.frmCCAdd.ccZip.value = document.frmCCAdd.h_ccZip.value;
      document.frmCCAdd.ccNumber.value = document.frmCCAdd.h_ccNumber.value;
      document.frmCCAdd.ccCCV.value = document.frmCCAdd.h_ccCCV.value;

      setSelect(document.frmCCAdd.ccState,document.frmCCAdd.h_ccState.value);
      setSelect(document.frmCCAdd.ccCountry,document.frmCCAdd.h_ccCountry.value);
      setSelect(document.frmCCAdd.expMonth,document.frmCCAdd.h_ccExpMonth.value);
      setSelect(document.frmCCAdd.expYear,document.frmCCAdd.h_ccExpYear.value);

}
function frmCCAdd_onload()
{
//  window.alert("On Load h_ccName = |" + document.frmCCAdd.h_ccName.value + "|");
  if (document.frmCCAdd.h_ccName.value == "" || document.frmCCAdd.h_ccName.value == null) {
//      window.alert("VALUE IS NULL!"); 
      return;
  } else {
//      window.alert("VALUE IS NOT NULL!");
      resetForm();

  }
}
function getArticle(article) {
    o=document.getElementById("articleName");
    o.value=article;
	document.frmGetArticle.submit();
}

function getRefSched(frm) {
    o=document.getElementById("formName");
    o.value=frm;
	document.frmGetRefSched.submit();
}
function gotoRegister() {
    location.replace("http://www.sportspilot.com/Register/RegProgram.asp?asoid=100043&amp;programid=1011&amp;Method=new&amp;sibling");
}
function gotoMain() {
    location.replace("http://www.matrixsportsref.com/index.html");
}
function gotoSubMenu(frm) {
    //location.replace("http://www.matrixsportsref.com/"+frm);
    location.replace(frm);
}
<!-- Original:  Xavier R. (xav@lougaou.com) -->
<!-- Modified:  Benjamin Wright, Editor -->
<!-- Web Site:  http://www.lougaou.com/ -->

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->

<!-- Begin
function clock() {
if (!document.layers && !document.all) return;
var digital = new Date();
var hours = digital.getHours();
var minutes = digital.getMinutes();
var seconds = digital.getSeconds();
var amOrPm = "AM";
if (hours > 11) amOrPm = "PM";
if (hours > 12) hours = hours - 12;
if (hours == 0) hours = 12;
if (minutes <= 9) minutes = "0" + minutes;
if (seconds <= 9) seconds = "0" + seconds;
dispTime = hours + ":" + minutes + ":" + seconds + " " + amOrPm;
if (document.layers) {
document.layers.pendule.document.write(dispTime);
document.layers.pendule.document.close();
}
else
if (document.all)
pendule.innerHTML = dispTime;
setTimeout("clock()", 1000);
}
function setScrollingLabel () {
window.setTimeout('setScrollingLabel()', 200);
/*var msg = document.scrollform.box.value;
document.scrollform.box.value = msg.substring(ScrollChars) + msg.substring(0, ScrollChars);
}
*/
    o=document.getElementById("topScroll");
//    window.alert(o.id);
/*
    if (document.all) {
        lbl=o.innerText;
    } else {
        lbl=o.innerHTML;
    }
*/
    lbl=o.value;
	    
	firstChar=lbl.substr(0,1);
	lbl=lbl.substr(1)+firstChar;

    o.value=lbl;
/*
    if (document.all) {
        o.innerText=lbl;
    } else {
        o.innerHTML=lbl;
    }
*/
    return;
}
function openRefWindow(f)
{
	var base="http://www.matrixsportsref.com/forms.html";
	var target=base + "/" + f
refwindow=window.open(target,'SLSC_Referee','scrollbars,resizable,toolbar,location=no,height=750,width=650');

}
function gotoLinks()
{
	var base="links.html";
	var target=base;
refwindow=window.open(target,"matrix_links",'scrollbars,resizable,toolbar,location=no,height=750,width=750');

}
