// JS Funktionen fuer Frontend
       
        var url = "_inc/ajax_functions.php?action=getprice";
       
        function handleHttpResponsedienstmannschaft() {
        if (http.readyState == 4) {
        document.getElementById("price").innerHTML=http.responseText;
         }
        }
        
        function getprice() {
        var passengersValue = document.getElementById("passengers").value;

        var d1Value = document.getElementById("d1").value;
        var d2Value = document.getElementById("d2").value;
        var directionValue = document.getElementById("directionval").value;

        var myRandom=parseInt(Math.random()*99999999);  // cache buster
        http.open("GET", url + "&a_id= " + escape(passengersValue) + "&d1=" + escape(d1Value) + "&d2=" + escape(d2Value) + "&direction=" + escape(directionValue) + "&rand=" + myRandom, true);
        http.onreadystatechange = handleHttpResponsedienstmannschaft;
        http.send(null);
        }
        
        function loadrecord(record) {
        document.schform.telno.value = record;
        }
        
        function getHTTPObject() {
        var xmlhttp;
        /*@cc_on
         @if (@_jscript_version >= 5)
          try {
              xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
              } catch (e) {
              try {
                  xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
                  } catch (E) {
                  xmlhttp = false;
                  }
              } 
         @else
          xmlhttp = false;
         @end @*/
        if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
         try {
           xmlhttp = new XMLHttpRequest();
           } catch (e) {
           xmlhttp = false;
           }
          }
          return xmlhttp;
        }


var http = getHTTPObject();
        

function getdestinations(cat_id,airport,type,formfield)
{
var httpxml;
try
  {
  // Firefox, Opera 8.0+, Safari
  httpxml=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
		  try
   			 		{
   				 httpxml=new ActiveXObject("Msxml2.XMLHTTP");
    				}
  			catch (e)
    				{
    			try
      		{
      		httpxml=new ActiveXObject("Microsoft.XMLHTTP");
     		 }
    			catch (e)
      		{
      		alert("Your browser does not support AJAX!");
      		return false;
      		}
    		}
  }
function stateck() 
    {
    if(httpxml.readyState==4)
      {

var myarray=eval(httpxml.responseText);
// Before adding new we must remove previously loaded elements
for(j=document.getElementById(formfield).options.length-1;j>=0;j--)
{
document.getElementById(formfield).remove(j);

if (formfield == 'from_airport') {

	document.getElementById('to_destination').remove(j);

	var optn = document.createElement("OPTION");
	optn.text = 'select destination';
	optn.value = '';
	document.getElementById('to_destination').options.add(optn);

	}
}


for (i=0;i<myarray.length;i++)
{
var optn = document.createElement("OPTION");
optn.text = myarray[i];
optn.value = myarray[i+1];
document.getElementById(formfield).options.add(optn);
i++;
} 
      }
    }
	var url="_inc/ajax_fields.php";
url=url+"?l_id="+cat_id; 
url=url+"&airport="+airport;
url=url+"&type="+type;
url=url+"&sid="+Math.random();
httpxml.onreadystatechange=stateck;
httpxml.open("GET",url,true);
httpxml.send(null);
  }



function check() {


  if (document.getElementById('passengers').value == 0) {

  alert("More than 0 passengers required!");

document.getElementById('terms').focus();

return false;

   }


  if (document.getElementById('firstname').value == "") {

  alert("Firstname required!");

document.getElementById('firstname').focus();

return false;

   }


  if (document.getElementById('lastname').value == "") {

  alert("Lastname required!");

document.getElementById('lastname').focus();

return false;

   }


  if (document.getElementById('phone').value == "") {

  alert("Mobile number required!");

document.getElementById('phone').focus();

return false;

   }


  if (document.getElementById('email').value == "") {

  alert("Email adress required!");

document.getElementById('email').focus();

return false;

   }


  if (document.getElementById('terms').checked == false) {

  alert("Terms must be accepted!");

document.getElementById('terms').focus();

return false;

   }


	
   return true;

 }



function checkstep1() {


  if (document.getElementById('start_destination').value < 1) {

  alert("Please choose start destination first!");

document.getElementById('start_destination').focus();

return false;

   }


  if (document.getElementById('to_destination').value < 1) {

  alert("Please choose end destination first!");

document.getElementById('to_destination').focus();

return false;

   }
	
   return true;

 }

//-->

