

function regError(msg)
{
  alert(msg);
}

function sendError(diagnostics, query_string)
{
  var oRPC = new jsRPC('request_err2.cfm?diagnostics=' + escape(diagnostics) + '&qs=' + escape(query_string));
  oRPC.execute();
}



  	  function loadPage(page) {
        var oRPC = new jsRPC();
        if (page.indexOf('?') != -1)
          oRPC.href = '/' + page + '&html_load=1';
        else
          oRPC.href = '/' + page + '/?html_load=1';
        oRPC.execute();    
  	  }
      
      function onHTMLLoader_load(href)
      {

      }
      
function clearRequestAppointment()
{
    var form = document.forms['appointment-request-form'];
    form.elements.step.value = '1';
    form.reset();
    document.getElementById('appointment-request-1').style.display = 'block';
    document.getElementById('appointment-request-2').style.display = 'none';
}

function hideRequestAppointment()
{
        var div = document.getElementById('appointment-request-div');
        div.style.display = 'none';    
        clearRequestAppointment();    
}

function showRequestAppointment()
{
        clearRequestAppointment();
        var div = document.getElementById('appointment-request-div');
        var form = document.forms['appointment-request-form'];
        form.reset();
        
        div.style.top = (getScrollY() + (getWinHeight() / 2) - 150) + 'px';
        div.style.display = 'block';
        
        form.elements.name.focus();
}

function handleAppointmentRequestSubmit(form)
{
  var step = form.elements.step.value;
  
  if (step == '1')
  {
    if (form.elements.name.value == '')
    {
      alert('Your name is required.');
      form.elements.name.focus();
      return false;
    }

    if (form.elements.phone.value == '')
    {
      alert('Your phone is required.');
      form.elements.phone.focus();
      return false;
    }
    
    form.elements.step.value = '2';
    document.getElementById('appointment-request-1').style.display = 'none';
    document.getElementById('appointment-request-2').style.display = 'block';
    return;
  }
}

    function getWinHeight() 
    {
      if (window.innerHeight) return window.innerHeight - 18;
    	else if (document.documentElement && document.documentElement.clientHeight) 
    		return document.documentElement.clientHeight;
    	else if (document.body && document.body.clientHeight) 
    		return document.body.clientHeight;
      return 0;
    }
    
    function getScrollY()
    {
      if (typeof window.pageYOffset == "number") return window.pageYOffset;
      else if (document.documentElement && document.documentElement.scrollTop)
    		return document.documentElement.scrollTop;
    	else if (document.body && document.body.scrollTop) 
    		return document.body.scrollTop; 
    	else if (window.scrollY) return window.scrollY;
      return 0;
    }