﻿

//minimale zoeklengte
var xmlhttp = new XMLHttpRequest();
var IE = ( navigator.appVersion.indexOf("MSIE") != -1 );
var DateField = "DateField";

function ajax() 
{ 
  try 
    { 
    // Firefox, Opera 8.0+, Safari 
    xmlhttp=new XMLHttpRequest(); 
    } 
  catch (e) 
    { 
    // Internet Explorer 
    try 
      { 
      xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
      } 
    catch (e) 
      { 
      try 
        { 
        xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
        } 
      catch (e) 
        { 
        alert("Your browser does not support AJAX!"); 
        return false; 
        } 
      } 
    }  
}

function trySearch(val, option)
{    
      
     
      document.getElementById("TrainingName").value = option;
      
      ajax(); 
     
      search(val);
}

function search(q)
{
    xmlhttp.open("GET", "default.aspx?module=433&pagetype=ajax&tr_id=" + q, true);  
    xmlhttp.onreadystatechange = function() {   
    if(xmlhttp.readyState == 4)  
        processResult();
    };
    xmlhttp.send('');
}

function processResult()
{
    //alert(xmlhttp.responseText);
    document.getElementById(DateField).innerHTML = xmlhttp.responseText;    
}

