function CVacancySearch(DisplayType, Url, Container, BaseUrl)
{
  this.DisplayType = DisplayType;
  this.Url        = Url;
  this.Container  = Container;
  this.BaseUrl    = BaseUrl;
  this.Branche    = "";
  this.Function   = "";
  this.Region     = "";
  this.Search     = "";
  this.Offset     = 0;
    
  if (window.XMLHttpRequest)  {
    this.CallBackObj = new XMLHttpRequest();
    this.bReady = true;
  } else {
    if (window.ActiveXObject) {
      try {
        this.CallBackObj = new ActiveXObject("Msxml2.XMLHTTP");
        this.bReady = true;
      }
      catch (e) {
        try {
          this.CallBackObj = new ActiveXObject("Microsoft.XMLHTTP");
          this.bReady = true;
        }
        catch (e) {
          return;
        }
      }
    }
  }
}

CVacancySearch.prototype.GetCallBack = function()
{      
  document.getElementById(this.Container).innerHTML = "<img src=\""+ this.BaseUrl +"pics/loader.gif\" alt=\"loading...\">";
      
  if(getCookie("Branche") != 0) { this.Branche  = getCookie("Branche"); }
  if(getCookie("Function") != 0) { this.Function = getCookie("Function"); }
  if(getCookie("Region") != 0) { this.Region   = getCookie("Region"); }
  if(getCookie("Search") != 0) { this.Search   = getCookie("Search"); }
  if(getCookie("Offset") != 0) { this.Offset   = getCookie("Offset"); }
  
  this.bReady = false;
                     
  var UrlSuffix = "displaytype="+ this.DisplayType +"&branche=" + this.Branche + "&function=" + this.Function + "&region=" + this.Region + "&search=" + this.Search + "&offset="+ this.Offset;  
  var _this = this; // set the var so we can scope the callback
  
  this.CallBackObj.open('POST', this.Url, true);
  this.CallBackObj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  this.CallBackObj.setRequestHeader("Content-length", UrlSuffix.length);
  this.CallBackObj.setRequestHeader("Connection", "close");
                                                     
  this.CallBackObj.onreadystatechange = function() {_this.Display()};
  
  this.CallBackObj.send(UrlSuffix);
}

CVacancySearch.prototype.Display = function()
{              
  if (this.CallBackObj.readyState != 4 || this.CallBackObj.status != 200) {
    return;
  }  
     
  var Text = this.CallBackObj.responseText; 
  document.getElementById(this.Container).innerHTML = Text;  
  initOverLabels();   
}  
    
CVacancySearch.prototype.SetBranche = function(Branche, Description) {
  this.Branche = Branche;
  setCookie("Branche", this.Branche, getExpDate(0, 1, 0)); 
  setCookie("BrancheDescription", Description, getExpDate(0, 1, 0));
  document.getElementById('menu_branche').innerHTML = '<strong>categorie: </strong>'+ this.TruncString(Description, 19);
  this.GetCallBack();
  return false;  
} 

CVacancySearch.prototype.SetFunction = function(Function, Description) {
  this.Function = Function;
  setCookie("Function", this.Function, getExpDate(0, 1, 0));
  setCookie("FunctionDescription", Description, getExpDate(0, 1, 0));
  document.getElementById('menu_function').innerHTML = '<strong>functie: </strong>'+ this.TruncString(Description, 22);
  this.GetCallBack();
  return false;  
} 

CVacancySearch.prototype.SetRegion = function(Region, Description) {
  this.Region = Region;
  setCookie("Region", this.Region, getExpDate(0, 1, 0)); 
  setCookie("RegionDescription", Description, getExpDate(0, 1, 0)); 
  document.getElementById('menu_region').innerHTML = '<strong>regio: </strong>'+ this.TruncString(Description, 22); 
  this.GetCallBack();
  return false;
} 

CVacancySearch.prototype.SetSearch = function(SearchId) {
  this.Search = document.getElementById(SearchId).value;
  setCookie("Search", this.Search, getExpDate(0, 1, 0));  
  return false;
}

CVacancySearch.prototype.SetOffset = function(Offset) {
  this.Offset = Offset;
  setCookie("Offset", this.Offset, getExpDate(0, 1, 0));  
  this.GetCallBack();
  return false;
}

CVacancySearch.prototype.LoadValues = function() {
  if(getCookie("BrancheDescription") != 0) { 
    document.getElementById('menu_branche').innerHTML = '<strong>categorie: </strong>'+ this.TruncString(getCookie("BrancheDescription"), 19);
  }
  
  if(getCookie("FunctionDescription") != 0) {
    document.getElementById('menu_function').innerHTML = '<strong>functie: </strong>'+ this.TruncString(getCookie("FunctionDescription"), 22);
  }
  
  if(getCookie("RegionDescription") != 0) {
    document.getElementById('menu_region').innerHTML = '<strong>regio: </strong>'+ this.TruncString(getCookie("RegionDescription"), 22); 
  }
  
  if(getCookie("Search") != 0) {
    document.getElementById("id_e-").value = getCookie("Search");
  }
}

CVacancySearch.prototype.TruncString = function(Input, MaxLength) {
  if(Input.length > MaxLength) {
    return Input.substring(0, (MaxLength -3)) + "...";
  }
  
  return Input;
} 
  
  

  


