  function setText(a, b)
  {
  
	var selObj = document.getElementById('empcan');
	var formObj = document.getElementById('form11');
	var advObj = document.getElementById('advsearch');
    x = document.getElementById(a);
    if (x){
      var strr = b.options[b.selectedIndex].innerHTML;
      x.innerHTML = strr.substring(0,22);      
    }  
  }
  
   function setText1(a, b)
  {
  
	var selObj = document.getElementById('empcan');
	var formObj = document.getElementById('form11');
	var advObj = document.getElementById('advsearch');
	
	//alert(selObj.options[selObj.selectedIndex].text)
	if(selObj.options[selObj.selectedIndex].text=='For a Job')
			{
			
			formObj.action='search.php';
			advObj.href='searchjobs.php'
			var x1=document.getElementById("location11");
			x1.disabled=false;
			
			var x2=document.getElementById("sector1");
			x2.disabled=true;
			
			}
			
	if(selObj.options[selObj.selectedIndex].text=='For a Candidate')
			{
			formObj.action='searchresults.php';
			advObj.href='searchcandidates.php'
			var x1=document.getElementById("location11");
			x1.disabled=true;
			
			var x2=document.getElementById("sector1");
			x2.disabled=false;
			
			}
    x = document.getElementById(a);
    if (x)
      x.innerHTML = b.options[b.selectedIndex].innerHTML;
  }
  
  
 // AJAX CODE  
 
  
  var holidayId_s=0;
  var confirmed_s=0;
  var interested_s=0;
  var pageno_s=0;
  var registrantId_s=0;
/*  function setText(a, b)
  {
    x = document.getElementById(a);
    if (x){
      //x.innerHTML = b.options[b.selectedIndex].innerHTML;
      var strr = b.options[b.selectedIndex].innerHTML;
      x.innerHTML = strr.substring(0,22);
    }  
    // IF Pager value is changed then resubmit the form
    if (a=="records_per_page_search")
      document.search_form.submit();
  }
*/

  function setRegistrants(holidayId, confirmed, interested, pageno)
  {
      var url="http://www.vidalocatravel.co.uk/templates/default/display-registrants.inc.php";
      
      holidayId_s=holidayId;
      confirmed_s=confirmed;
      interested_s=interested;
      pageno_s=pageno;
      registrantId_s=0;

      xmlhttpPost(url, holidayId, confirmed, interested, pageno, registrantId_s);
  }
  function setHolidays(regID, confirmed, interested, pageno)
  {
      var url="http://www.vidalocatravel.co.uk/templates/default/display-holidays.inc.php";
      holidayId_s=0;
      holidayId=0;
      confirmed_s=confirmed;
      interested_s=interested;
      pageno_s=pageno;
      registrantId_s = regID;

      xmlhttpPost(url, holidayId, confirmed, interested, pageno, regID);
  }


  function xmlhttpPost(strURL, holidayId, confirmed, interested, pageno,registrantID) {
      
      var xmlHttpReq = false;
      var self = this;
      // Mozilla/Safari
      if (window.XMLHttpRequest) {
          self.xmlHttpReq = new XMLHttpRequest();
      }
      // IE
      else if (window.ActiveXObject) {
          self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
      }
      self.xmlHttpReq.open('POST', strURL, true);
      self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
      self.xmlHttpReq.onreadystatechange = function() {
          if (self.xmlHttpReq.readyState == 4) {
              updatepage(self.xmlHttpReq.responseText);
          }
      }
      self.xmlHttpReq.send(getquerystring(holidayId, confirmed, interested, pageno, registrantID));
  }
  
  function getquerystring(holidayId, confirmed, interested, pageno,registrantID) {
  
      //var form = document.forms['search_form'];
      //var word = form.sub_directories_search.value;
      qstr = 'holidayId=' + escape(holidayId);  // NOTE: no '?' before querystring
      qstr += '&confirmed=' + escape(confirmed);  // NOTE: no '?' before querystring
      qstr += '&interested=' + escape(interested);  // NOTE: no '?' before querystring
      qstr += '&page_number=' + escape(pageno);  // NOTE: no '?' before querystring
      qstr += '&registrantID=' + escape(registrantID);  // NOTE: no '?' before querystring
      return qstr;
  }
  
  function updatepage(str){
      
    //if populating registrants
    if(registrantId_s==0){ 
       if(confirmed_s=="1")
          document.getElementById("confirmed_travellers").innerHTML = str;
       if (interested_s=="1")  
          document.getElementById("interested_travellers").innerHTML = str;
    }
    
    //if populating holidays
    if(holidayId_s==0){
       if(confirmed_s=="1")
          document.getElementById("confirmed_holidays").innerHTML = str;
       if (interested_s=="1")  
          document.getElementById("interested_holidays").innerHTML = str;
    }    
  }

  // AJAX Code
