function initSelectBox()
{
	el = document.getElementById("themas");
        if (el == null) return;
	id = el.options[0].value;
	ajaxFunction(id);
}

function getThemePages(owner)
{
	var data_array = owner.split("\n");
	var output = document.getElementById("theme_pages");
	var optionValues = "";
	var new_option = null;
	output.length = null;

	
	if (owner == "pagina_1.html,OSB")
	{
		var default_option = document.createElement('option');
		default_option.value = "";
		default_option.text = "- Selecteer -";
		output.options[output.options.length] = default_option;  // Fix to make it work in firefox
		//output.add(default_option, 0);
	}
	else
	{
		var default_option = document.createElement('option');
		default_option.value = "";
		default_option.text = "- Selecteer -";
		output.options[output.options.length] = default_option; // Fix to make it work in firefox
		//output.add(default_option, 0);
		

		for (var i = 1; i < data_array.length - 1; i++)
		{
			var new_option = document.createElement('option');
			optionValues = data_array[i].split(",");
			new_option.value = optionValues[0];
			new_option.text = optionValues[1];
			output.options[output.options.length] = new_option; // Fix to make it work in firefox
//			output.add(new_option, i);
		}
	}
}


function ajaxFunction(id)
{ 

var xmlHttp;
  try
    {       xmlHttp=new XMLHttpRequest();    }
  catch (e)
    {     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;        }      }    }
    xmlHttp.onreadystatechange=function()
      {
      if(xmlHttp.readyState==4)
        {
			// Hier de actie die aangeroepen moet worden
			getThemePages(xmlHttp.responseText);
        }
      }
	//alert("Scripts/portal_select.asp?rndm="+ Math.random() +"&id_site="+id,true);
    xmlHttp.open("GET","Scripts/portal_select.asp?rndm="+ Math.random() +"&id_site="+id,true);
    xmlHttp.send(null);  
}


function homeRedirect()
{  
  AjaxRequest.get(
  {
    'url':"Scripts/homeredirect.asp"
    ,'onSuccess':function(req)
    { 
	if (req.responseText.indexOf("redirect")>=0) window.location = "ledenportal.html";
    }
    ,'onError':function(req){ alert("error"); }
  }
  );
}


function jumpToPage()
{
	el = document.getElementById("theme_pages");	

	if (el != null)
	{
		nr = el.selectedIndex;
		url = el.options[nr].value;
		window.location=url;
	}
}

function doSearch()
{
  var el = document.getElementById("SEARCHTXT");
  if (el!=null) if (el.value != null) if (el.value != "") {
      to(137,"SEARCH="+el.value);
  }
}
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;
  };
}