function class_change(psDivID, psOldClassName, psNewClassName)
{
	document.getElementById(psDivID).onMouseOver = document.getElementById(psDivID).className = psNewClassName;
	document.getElementById(psDivID).onMouseOut = document.getElementById(psDivID).className = psOldClassName;
}

function strrev(psString)
{
	var inp = psString;
	var outp = '';
	
	for (i = 0; i <= inp.length; i++)
	{
		outp = inp.charAt (i) + outp;
	}
	
	return outp;
}

function entsub()
{
	if (window.event && window.event.keyCode == 13)
	{
		//document.zoeken.method = 'get';
		//document.zoeken.action = 'search.php?i_search=' + escape(document.form1.i_search.value);
		if (document.getElementById('zoekformulier'))
		{
			document.getElementById('zoekformulier').submit();
		}
		return false;
	}
	else
	{
		return true;
	}
}

function trim(str)
{
	while(''+str.charAt(0)==' ')
	str=str.substring(1,str.length);
	while(''+str.charAt(str.length-1)==' ')
	str=str.substring(0,str.length-1);
	return str;
}

function sort_dropdown_by_key(id)
{
	var obj = document.getElementById(id);
	var values = new Array();
	
	for(var i = 0; i < obj.options.length; i++)
	{
		values.push(obj.options[i].text + "--xx--" + obj.options[i].value);
	}
	values = values.sort();

	for(var i = 0; i < values.length; i++)
	{
		valueArray = values[i].split('--xx--');
		obj.options[i].text = valueArray[0];
		obj.options[i].value = valueArray[1];
	}
}

function insertValueQuery(psVeldnaam) {
    var myQuery = document.form1.i_search;
	eval("var myListBox = document.form1." + psVeldnaam + ";")
    
    if(myListBox.options.length > 0) {
        sql_box_locked = true;
        var chaineAj = "";
        var NbSelect = 0;
        for(var i=0; i<myListBox.options.length; i++) {
            if (myListBox.options[i].selected){
                NbSelect++;
                if (NbSelect > 1)
                    chaineAj += " ";
				for (ii = 0; ii < document.form1.enofniet.length; ii++)
				{
					if (document.form1.enofniet[ii].checked)
					{
						break;
					}
				}
                chaineAj += document.form1.enofniet[ii].value + '"' + myListBox.options[i].value + '" ';
            }
        }

        //IE support
        if (document.selection) {
            myQuery.focus();
            sel = document.selection.createRange();
            sel.text = chaineAj;
            //document.form1.insert.focus();
        }
        //MOZILLA/NETSCAPE support
        else if (document.form1.i_search.selectionStart || document.form1.i_search.selectionStart == "0") {
            var startPos = document.form1.i_search.selectionStart;
            var endPos = document.form1.i_search.selectionEnd;
            var chaineSql = document.form1.i_search.value;

            myQuery.value = chaineSql.substring(0, startPos) + chaineAj + chaineSql.substring(endPos, chaineSql.length);
        } else {
            myQuery.value += chaineAj;
        }
        sql_box_locked = false;
    }
}
function select_deselect(poForm, pbValue, psName)
{
	var aElements = poForm.elements[psName];
	for (var i = 0; i < aElements.length; i++)
	{
		aElements[i].checked = pbValue;
	}
	if (i == 0)
	{
		aElements.checked = pbValue;
	}
}

function improved_prompt(psURL, psQuestion, psOptions)
{
	if (window.showModalDialog) // If it cannot make a modalDialog
	{
		return window.showModalDialog(psURL, psQuestion, psOptions);
	}
	else // It can't make a modalDialog
	{
		return prompt(psQuestion);
	}
}

if (top.location != self.location)
{
	top.location = self.location;
}
