var dest = 0;
function AjaxFunction(cat_id, dest)
{
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 i=dest;
		for (i=dest;i<=21;i++)
		{
			document.getElementById("destination_slot_"+i).innerHTML="";
		}
		document.getElementById("destination_slot_"+dest).innerHTML=httpxml.responseText;

		document.getElementById("destination_slot_"+Number(dest+1)).innerHTML='<br/><input id="getQuoteBtn" type="submit" value="Get a quote for this trip" style="width: 150px;" />';

      }
    }
	dest++;

	if (dest>20){

	     alert("You have reached the maximum number of flights for this journey planner, please ensure this last location that you have selected is your final or home flight.");

	} else {

		var url="output_include.php";
		url=url+"?cat_id="+cat_id;
		url=url+"&sid="+Math.random();
		url=url+"&dest="+dest;
		httpxml.onreadystatechange=stateck;
		httpxml.open("GET",url,true);
		httpxml.send(null);

		changeDIVheight("wrapper", dest);

	}
  }