function keydown(e) {
  if (e==null) return;
  try 
  {
    var keyCode = e.keyCode;
  }
  catch(e) 
  {
    alert(e.message);
  }
  if (keyCode==null) keyCode=e.which;
  if (keyCode==13) {
    try 
    {
	    if (e.cancelBubble!=null) e.cancelBubble=true;
	    if (e.returnValue!=null) e.returnValue=false;
	    if (e.keyCode!=null) e.keyCode=0;
	    if (e.which!=null) e.which=0;
    }
    catch(e)
    {
    }
    doSearch();
    return false;
  };
}


function doSearch()
{
  var el = document.getElementById("searchtxt");

  if (el!=null) if (el.value != null) if (el.value != "") {
      to(52,"SEARCH="+el.value);
  }
}

$(document).ready(function(){
	$("#topmenu").pulldown();
	
	if (typeof(activeOnd) != "undefined")
		setActiveMenuItem(activeOnd);
		
	initContactFormSubject();
});

function setActiveMenuItem(id) 
{
	$("#"+id).addClass("sub_active");
	$("#"+id).parent().parent().parent().children("a").addClass("default_active");
}

function initContactFormSubject(){
	$("#NDRWRP").change(function(){
		var curVal = ""+$(this).val();
		var defVal = 'Contactformulier CAO vragen';
		switch(curVal)
		{
			case 'cao':
				defVal = 'Contactformulier CAO vragen';
			break;
			case 'opleidingen':
				defVal = 'Contactformulier Opleidingsvragen';
			break;
			case 'overig':
				defVal = 'Contactformulier overige vragen';
			break;
		}
		
		$(this).siblings("div").children("input").val(defVal);
	});
}
