
/* ----- mci_validate.js ----- */
// Validation for MCI chat form
//
// The integer in document.forms[1] may need to be adjusted if there are other forms on the page

    
      window.onunload = closedBusWin;

      var businessHourWindow = null;

      function isIE()
      {
        return (navigator.userAgent.toLowerCase().indexOf('msie') != -1);
      }

      function isSafari()
      {
        return (navigator.userAgent.toLowerCase().indexOf("safari") != -1);
      }

      function isNetscape()
      {
        return (navigator.userAgent.toLowerCase().indexOf("netscape") != -1);
      }

      window.onload = init;
      
      function init()
      {
        if (isNetscape())
        {
          document.chat_init.action = "jar:http://webcenter.mci.com/TAW/light/chat/secure.jar!/light/chat/chat_page.jsp";
        }
      }
      
      function ShowCompanyHoursPopup()
      {
        businessHourWindow = window.open("https://webcenter.mci.com/webcenter/AdministrationManager/company_hours_popup.jsp?companyId=60492&languageId=1&time=" + (new Date()).getTime(), null, "width=180,height=218,menubar=no");
      }

      function closedBusWin()
      {
        if (businessHourWindow != null && !businessHourWindow.closed)
        {
          businessHourWindow.close();
        }
      }


      function validate()
      {

        if (document.chat_init.firstName.value.match(/^$|^\s+$/) || document.chat_init.firstName.value == "" )
        {
          alert("The field 'First Name' is required.");
          document.getElementById("firstName").focus();
          return false;
        }

        if (document.chat_init.lastName.value.match(/^$|^\s+$/) || document.chat_init.lastName.value == "")
        {
          alert("The field 'Last Name' is required.");
          document.getElementById("lastName").focus();
          return false;
        }

        if (document.chat_init.company.value.match(/^$|^\s+$/) || document.chat_init.company.value == "")
        {
          alert("The field 'Company' is required.");
          document.getElementById("company").focus();
          return false;
        }
        
        if (document.chat_init.email.value.match(/^$|^\s+$/) || document.chat_init.email.value == "")
        {
          alert("The field 'Email' is required.");
          document.getElementById("email").focus();
          return false;
        }
        //document.chat_init.elements['isIE'].value = isIE();
        document.chat_init.submit();
        }

