<!--

/*----------------------------------------------------------------------------*/

  var timerID = null;
  var timerRunning = false;

  function stopclock () {
   if (timerRunning)
     clearTimeout(timerID);
     timerRunning = false;
  }

  function showtime() {
    var now = new Date();
    var hours = now.getHours();
    var minutes = now.getMinutes();
    var seconds = now.getSeconds();
    var timeValue = "" + ((hours >12) ? hours -12 :hours)
    if (timeValue == "0") timeValue = 12;
    timeValue += ((minutes < 10) ? ":0" : ":") + minutes
    timeValue += ((seconds < 10) ? ":0" : ":") + seconds
    timeValue += (hours >= 12) ? " P.M." : " A.M."
    document.clock.face.value = timeValue;
    timerID = setTimeout("showtime()",1000);
    timerRunning = true;
  }

  function startclock() {
    stopclock();
    showtime();
  }

/*----------------------------------------------------------------------------*/


  function confirmDialogMessage(n_id) {
    var dell = confirm("Do you really want to remove this user? \nIf yes press OK, otherwise Cancel...");

    if (dell) { 
      document.location.href = "index.php?mp=5&del=1&user_id="+n_id;
    } 
    else { 
      document.location.reload();
    }
  }

/*----------------------------------------------------------------------------*/


  function confirmChangingStatus(n_id) {
    var dell = confirm("Do you really want to change status of this order? \nIf yes, press OK, otherwise Cancel...");

    if (dell) { 
      document.location.href = "index.php?mp=7&done=1&rid="+n_id; 
    } 
    else { 
      document.location.reload();
    }
  }


/*----------------------------------------------------------------------------*/


  function confirmDeleteCompleted(n_id) {
    var dell = confirm("Do you really want to remove this order? \nIf yes, press OK, otherwise Cancel...");

    if (dell) { 
      document.location.href = "index.php?mp=9&del=1&rid="+n_id; 
    } 
    else { 
      document.location.reload();
    }
  }

/*----------------------------------------------------------------------------*/


  function confirmDeleteClosed(n_id) {
    var dell = confirm("Do you really want to remove this service? \nIf yes, press OK, otherwise Cancel...");

    if (dell) { 
      document.location.href = "index.php?mp=15&del=1&rid="+n_id; 
    } 
    else { 
      document.location.reload();
    }
  }


/*----------------------------------------------------------------------------*/


  function confirmDeleteWinterizationAlerts(n_id) {
    var dell = confirm("Do you really want to remove this order? \nIf yes, press OK, otherwise Cancel...");

    if (dell) { 
      document.location.href = "index.php?mp=13&del=1&rid="+n_id; 
    } 
    else { 
      document.location.reload();
    }
  }

/*----------------------------------------------------------------------------*/


  function confirmCloseRecurring(n_id) {
    var dell = confirm("Do you really want to stop this recurring order? \nIf yes, press OK, otherwise Cancel...");

    if (dell) { 
      document.location.href = "index.php?mp=39&close=1&rid="+n_id; 
    } 
    else { 
      document.location.reload();
    }
  }

/*----------------------------------------------------------------------------*/


  function confirmCloseRecurringByAdmin(n_id) {
    var dell = confirm("Do you really want to stop this recurring order? \nIf yes, press OK, otherwise Cancel...");

    if (dell) { 
      document.location.href = "index.php?mp=11&close=1&rid="+n_id; 
    } 
    else { 
      document.location.reload();
    }
  }

/*----------------------------------------------------------------------------*/


  function confirmOpenRecurring(n_id) {
    var dell = confirm("Do you really want to re-open this recurring order? \nIf yes press OK, otherwise Cancel...");

    if (dell) { 
      document.location.href = "index.php?mp=43&open=1&rid="+n_id; 
    } 
    else { 
      document.location.reload();
    }
  }

/*----------------------------------------------------------------------------*/


  function confirmOpenRecurringByAdmin(n_id) {
    var dell = confirm("Do you really want to re-open this recurring order? \nIf yes, press OK, otherwise Cancel...");

    if (dell) { 
      document.location.href = "index.php?mp=15&open=1&rid="+n_id; 
    } 
    else { 
      document.location.reload();
    }
  }

/*----------------------------------------------------------------------------*/


  function confirmDoneRecurring(n_id) {
    var dell = confirm("Did you really complete this recurring order? \nIf yes, press OK, otherwise Cancel...");

    if (dell) { 
      document.location.href = "index.php?mp=11&done=1&rid="+n_id; 
    } 
    else { 
      document.location.reload();
    }
  }

/*----------------------------------------------------------------------------*/


  function confirmRemoveDirection(n_id) {
    var dell = confirm("Do you really want to remove this direction? \nIf yes press OK, otherwise Cancel...");

    if (dell) { 
      document.location.href = "index.php?mp=25&del=1&dirid="+n_id; 
    } 
    else { 
      document.location.reload();
    }
  }

/*----------------------------------------------------------------------------*/


  function confirmApproveBid(n_id) {
    var dell = confirm("Do you want to approve the bid(s)? \nIf yes, click OK, otherwise Cancel...");

    if (dell) { 
      document.location.href = "index.php?mp=51&bidapp=1&rid="+n_id; 
    } 
    else { 
      document.location.reload();
    }
  }

/*----------------------------------------------------------------------------*/


  function confirmApproveBidAdmin(n_id, r_id) {
    var dell = confirm("Did you complete this job? \nIf yes, click OK, otherwise Cancel...");

    if (dell) { 
      document.location.href = "index.php?mp=12&bidapp=1&qid="+n_id+"&rid="+r_id; 
    } 
    else { 
      document.location.reload();
    }
  }

/*----------------------------------------------------------------------------*/


  function realDigits(klavisas) {

    var key_code;
    key_code = klavisas.keyCode;

    if ((key_code >= 48 && key_code <= 57) || (key_code == 46)) 
      return true;
    else
      return false;
  }

/*----------------------------------------------------------------------------*/


  function onlyInteger(klavisas) {

    var key_code;
    key_code = klavisas.keyCode;

    if (key_code >= 48 && key_code <= 57) 
      return true;
    else
      return false;
  }

/*----------------------------------------------------------------------------*/


  function formatCurrency(elementToParse) {

    var numType = "integer";
    var tempnum = elementToParse.value;

    for (i = 0; i < tempnum.length; i++) {

      if (tempnum.charAt(i) == ".") {
        numType = "real";
        break;
      }
    }

    if (numType == "integer") {
      elementToParse.value = tempnum + ".00";
    }

    else {

      if (tempnum.charAt(tempnum.length - 2) == ".") {
        elementToParse.value = tempnum + "0";
      }
      else {
        tempnum = Math.round(tempnum * 100) / 100;
        elementToParse.value = tempnum;
      }
    }

  }

/*----------------------------------------------------------------------------*/


function checkRequestFormFields() {
  missinginfo = "";
  if (document.request.fcompany.value == "") {
    missinginfo += "\n     -  Company Name";
  }
  if (document.request.fname.value == "") {
    missinginfo += "\n     -  First Name";
  }
  if (document.request.fsurname.value == "") {
    missinginfo += "\n     -  Last Name";
  }
  if (document.request.fphone.value == "") {
    missinginfo += "\n     -  Phone Number";
  }
  if (document.request.fcase_nr.value == "") {
    missinginfo += "\n     -  Case Number";
  }
  if (document.request.fstreet.value == "") {
    missinginfo += "\n     -  Street";
  }
  if (document.request.fcity.value == "") {
    missinginfo += "\n     -  City";
  }
  if (document.request.fstate.value == "") {
    missinginfo += "\n     -  State";
  }
  if ((document.request.fzip.value == "") || (document.request.fzip.value.length < 5)) {
    missinginfo += "\n     -  ZIP Code";
  }

/*
  if ((!document.request.job1.checked) && (!document.request.job2.checked) && (!document.request.job3.checked) && (!document.request.job4.checked) && (!document.request.job5.checked) && (!document.request.job6.checked) && (!document.request.job7.checked) && (!document.request.job8.checked) && (!document.request.job9.checked) && (!document.request.job10.checked)) {
    missinginfo += "\n     -  No Service selected";
  }
*/

  if (document.request.fdate_begin.value == "") {
    missinginfo += "\n     -  Date to begin";
  }
  if (document.request.fdate_end.value == "") {
    missinginfo += "\n     -  Due date";
  }
  if ((!document.request.foccupancy[0].checked) && (!document.request.foccupancy[1].checked) && (!document.request.foccupancy[2].checked)) {
    missinginfo += "\n     -  No Occupancy status selected";
  }

/*
  if ((!document.request.flegal[0].checked) && (!document.request.flegal[1].checked) && (!document.request.flegal[2].checked)) {
    missinginfo += "\n     -  No Legal status selected";
  }
*/

  if (missinginfo != "") {
    missinginfo ="_____________________________\n" + "You failed to correctly fill new\n request form:\n" +
missinginfo + "\n_____________________________" + "\nPlease correct and submit again!";
  alert(missinginfo);
  return false;
  }
  else return true;
}

/*----------------------------------------------------------------------------*/


function checkDirectionFormFields() {
  missinginfo = "";
  if (document.request.fcity.value == "") {
    missinginfo += "\n     -  City";
  }
  if ((document.request.fzip.value == "") || (document.request.fzip.value.length < 5)) {
    missinginfo += "\n     -  ZIP Code";
  }
  if (document.request.fdirection.options[0].selected == true) {
    missinginfo += "\n     -  Direction";
  }

  if (missinginfo != "") {
    missinginfo ="_____________________________\n" + "You failed to correctly fill new\n direction's data:\n" +
missinginfo + "\n_____________________________" + "\nPlease correct and submit again!";
  alert(missinginfo);
  return false;
  }
  else return true;
}

/*----------------------------------------------------------------------------*/

//-->
