
    if (document.location.hostname == 'www.motocode.com') {

    pathArray = window.location.pathname.split( '/' );

    path = '/rinkrunner/' + pathArray[2] + '/';

    } else {

    path = '/';

    }

  function ConfirmDelete(url){

    if(confirm('Are you sure you want to permanently delete this item?')) {

    document.location.href = url;

    }

  }

  function ConfirmCancel(url){

    if(confirm('Are you sure you want to cancel this support ticket?')) {

    document.location.href = url;

    }

  }

  function filter(type,field) {

  var date = new Date();

  date.setTime(date.getTime()+(31536000000));

  tempFilterId = field.options[field.selectedIndex].value;

  filterId = tempFilterId.split(',');

    if (type == 'league') {

    document.cookie = 'f_lea_id='+filterId[0]+'; expires='+date.toGMTString()+'; path='+path;
    document.cookie = 'f_sea_id='+filterId[1]+'; expires='+date.toGMTString()+'; path='+path;
    document.cookie = 'f_dis_id=; path='+path;
    document.cookie = 'f_tea_id=; path='+path;

    }

    if (type == 'season') {

    document.cookie = 'f_sea_id='+filterId[0]+'; expires='+date.toGMTString()+'; path='+path;
    document.cookie = 'f_dis_id=; path='+path;
    document.cookie = 'f_tea_id=; path='+path;

    }

    if (type == 'division') {

    document.cookie = 'f_dis_id='+filterId[0]+'; expires='+date.toGMTString()+'; path='+path;
    document.cookie = 'f_tea_id=; path='+path;

    }

    if (type == 'team') {

    document.cookie = 'f_tea_id='+filterId[0]+'; expires='+date.toGMTString()+'; path='+path;

    }

    if (type == 'facility') {

    document.cookie = 'f_fac_id='+filterId[0]+'; expires='+date.toGMTString()+'; path='+path;

    }

  document.location.href = document.location.href;

  }


  function setInfoBoxCookie(color,message,index) {

  document.cookie = 'infoBoxColor='+color+'; path='+path;
  document.cookie = 'infoBoxMessage='+message+'; path='+path;
  document.cookie = 'infoBoxIndex='+index+'; path='+path;

  }


  function eraseInfoBoxCookie() {

  document.cookie = 'infoBoxColor=; path='+path;
  document.cookie = 'infoBoxMessage=; path='+path;
  document.cookie = 'infoBoxIndex=; path='+path;

  }


  function hideInfoBox() {

  document.getElementById('infoBox').innerHTML='';

  }


  function showInfoBox(color,message,index) {

  message.replace("'", "\'");



  document.getElementById('infoBox' + index).innerHTML='<table border=\'0\' width=\'690\' cellpadding=\'0\' cellspacing=\'0\'><tr><td><img src=\'img_uni_mai_inf_' + color + '_top_bg.gif\' width=\'690\' height=\'10\'></td></tr><tr><td background=\'img_uni_mai_inf_' + color + '_mid_bg.gif\'><table border=\'0\' width=\'100%\' cellspacing=\'0\' cellpadding=\'0\' class=\'bt\'><tr><td width=\'25\' align=\'right\'><img src=\'img_uni_mai_inf_' + color + '_icon.gif\' width=\'16\' height=\'16\'></td><td width=\'5\'><img src=\'img_uni_mis_spacer.gif\' width=\'5\' height=\'16\'></td><td width=\'660\'>' + message + '</td></tr></table></td></tr><tr><td><img src=\'img_uni_mai_inf_' + color + '_bot_bg.gif\' width=\'690\' height=\'10\'></td></tr><tr><td><img src=\'img_uni_mis_spacer.gif\' width=\'690\' height=\'10\'></td></tr></table>';

  eraseInfoBoxCookie();

  }


  function populateSeasonsEdi(url) {

  document.location.href = url + '&lea_id=' + document.adm_edi_division.lea_id.options[document.adm_edi_division.lea_id.selectedIndex].value;

  }

  function tabOver (tabFrom,tabTo) {

    if (tabFrom.value.length > 1) {

    tabTo.focus();

    }

  }

  function tabBack (tabFrom,tabTo) {

    if (tabFrom.value == '') {

      if (event.keyCode == 8) {

      tabTo.value = tabTo.value.substring(-1);

      tabTo.focus();

      tabTo.value = tabTo.value;

      }

    }

  }

  function setDateBoxLength (yearBox,monthBox,dateBox) {

  var year = yearBox.options[yearBox.selectedIndex].value

  var month = monthBox.options[monthBox.selectedIndex].value

  var d = new Date(year,month,0);

  var daysInMonth = d.getDate();

  dateBox.options.length=28;

    if (daysInMonth>28) for (i=29;i<=daysInMonth;i++) {

    dateBox.options.length++;

    dateBox.options[dateBox.options.length-1] = new Option(i,i);

    }

  }

  function setFilterCookies (leaId,seaId,redirect) {

  var date = new Date();

  date.setTime(date.getTime()+(31536000000));

  document.cookie = 'f_lea_id='+leaId+'; expires='+date.toGMTString()+'; path='+path;

  document.cookie = 'f_sea_id='+seaId+'; expires='+date.toGMTString()+'; path='+path;

  document.cookie = 'c_sendback=; path='+path;

  document.location.href = redirect;

  }

  function readCookie (cookieName) {

  var cookiesString; 

  cookiesArray = document.cookie.split('\; ');

    for ( var i in cookiesArray ) {

    cookieArray = cookiesArray[i].split('=');

      if (cookieArray[0] == cookieName) {

      return cookieArray[1];

      }

    }

  return false;

  }

  function setHistoryCookie (newHistoryItem) {

  var date = new Date();

  date.setTime(date.getTime()+(3600000));

  var historySentBackwards = readCookie('historySentBackwards');

    if (historySentBackwards == 1) { // If you've been sent backwards, reset the cookie and break.

    document.cookie = 'historySentBackwards=0; expires='+date.toGMTString()+'; path='+path;

    return true;

    }

  var currentHistoryItems = readCookie('historyItems');

  var currentHistoryLength = readCookie('historyLength');

    if (!currentHistoryLength) { // If no history cookie set, set it and break.

    var newHistoryLength = 1;

    var newHistoryItems = newHistoryItem;

    document.cookie = 'historyLength=' + newHistoryLength + '; expires='+date.toGMTString()+'; path='+path;

    document.cookie = 'historyItems=' + newHistoryItems + '; expires='+date.toGMTString()+'; path='+path;

    return true;

    }

  var currentHistoryItemsArray = currentHistoryItems.split(',');

    if (currentHistoryItemsArray[currentHistoryLength * 1 - 1] == newHistoryItem) { // If most recent history item is the same as the new one, break.

    return false;

    }

    if (currentHistoryLength > 0 && currentHistoryLength < 10) {

    var newHistoryLength = currentHistoryLength * 1 + 1;

    var newHistoryItems = currentHistoryItems + ',' + newHistoryItem;

    document.cookie = 'historyLength=' + newHistoryLength + '; expires='+date.toGMTString()+'; path='+path;

    document.cookie = 'historyItems=' + newHistoryItems + '; expires='+date.toGMTString()+'; path='+path;

    return true;

    }

    if (currentHistoryLength >= 10) {

    var newHistoryLength = 10;

    var newHistoryItems;

      for (i=1; i<=9; i++) {

      newHistoryItems += currentHistoryItemsArray[i] + ',';

      }

    newHistoryItems += newHistoryItem;

    document.cookie = 'historyLength=' + newHistoryLength + '; expires='+date.toGMTString()+'; path='+path;

    document.cookie = 'historyItems=' + newHistoryItems + '; expires='+date.toGMTString()+'; path='+path;

    }

  }

  function eraseHistoryCookies () {

  document.cookie = 'historyLength=; path='+path;
  document.cookie = 'historyItems=; path='+path;

  }

  function goBackInHistory () {

  var currentHistoryLength;

  var currentHistoryItems;

  var newHistoryItems = '';

  var newHistoryItemsArray;

  var date = new Date();

  date.setTime(date.getTime()+(3600000));

  currentHistoryItems = readCookie('historyItems');

  currentHistoryLength = readCookie('historyLength');

  var currentHistoryItemsArray = currentHistoryItems.split(',');

  var newHistoryLength = currentHistoryLength * 1 - 1;

    for ( j=0; j<newHistoryLength; j++ ) {

      if ( j != newHistoryLength * 1 - 1 ) {

      newHistoryItems += currentHistoryItemsArray[j] + ',';

      } else {

      newHistoryItems += currentHistoryItemsArray[j];

      }

    }

  document.cookie = 'historyLength=' + newHistoryLength + '; expires='+date.toGMTString()+'; path='+path;

  document.cookie = 'historyItems=' + newHistoryItems + '; expires='+date.toGMTString()+'; path='+path;

  document.cookie = 'historySentBackwards=1; expires='+date.toGMTString()+'; path='+path;

  var goBackToHref = currentHistoryItemsArray[currentHistoryLength * 1 - 2];

  goBackToHref = goBackToHref.replace('##','=');

  document.location.href = goBackToHref;

  }

  function setAddPlayerCookie (addPlayerReferrer) {

  var date = new Date();

  date.setTime(date.getTime()+(31536000000));

  addPlayerReferrer = addPlayerReferrer.replace('=','##');

  document.cookie = 'addPlayerReferrer='+addPlayerReferrer+'; expires='+date.toGMTString()+'; path='+path;

  }

  function viewAddPlayerCookie () {

  var xaddPlayerReferrer = readCookie('addPlayerReferrer');

  xaddPlayerReferrer = xaddPlayerReferrer.replace('##','=');

  document.cookie = 'addPlayerReferrer=; path='+path;

  document.location.href = xaddPlayerReferrer;

  }

  function setDropBoxByValue (dropBox,value) {

    for (i=0; i<dropBox.options.length; i++) {

      if (dropBox.options[i].value == value) {

      dropBox.selectedIndex = i;

      }

    }

  }

  function setDropBoxByName (dropBox,name) {

    for (i=0; i<dropBox.options.length; i++) {

      if (dropBox.options[i].text == name) {

      dropBox.selectedIndex = i;

      }

    }

  }

  function trimWhiteSpace (stringName) {
    
  return stringName.replace(/^\s*|\s*$/g,'');

  }

