var mouseX, mouseY;

function str_replace(replaceWhat, replaceWith, string)
{
	var cur = string;
	if ( string.replace(replaceWhat, replaceWith) != cur )
	{
		string = string.replace(replaceWhat, replaceWith);
		while ( string != cur )
		{
			cur = string;
			string = string.replace(replaceWhat, replaceWith);
		}
	}
	
	return string;
}

function $(id)
{
	return document.getElementById(id);
}

function checkUncheck(cbName)
{
	var cb = $(cbName);
	cb.checked = cb.checked == true ? false : true;
}

function AJAXRequest(url, postdata, functiononcompletion)
{
    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("Uw browser moet geupdate worden om gebruik te maken van deze website.");
                document.location = 'http://www.getfirefox.com';
            }
        }
    }

    xmlHttp.onreadystatechange = function()
    {
        if ( xmlHttp.readyState == 4 )
        {
            functiononcompletion(xmlHttp.responseText);
        }
    }
    
    xmlHttp.open("POST", url, true);
	xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xmlHttp.send(postdata);
}

function slideout()
{
	if ( $('findSizeHeight').style.height != '199px' )
	{
		var height = $('findSizeHeight').style.height.substr(0, $('findSizeHeight').style.height.length -2);
		$('findSizeHeight').style.height = (parseInt(height) + 2) + 'px';
		$('findSizeHeight').style.backgroundPosition = '0px '+(parseInt(height) - 1)+'px';
		setTimeout("slideout()", 1);
	}
}

function slidein()
{
	if ( $('findSizeHeight').style.height != '5px' )
	{
		var height = $('findSizeHeight').style.height.substr(0, $('findSizeHeight').style.height.length -2);
		$('findSizeHeight').style.height = (parseInt(height) - 2) + 'px';
		$('findSizeHeight').style.backgroundPosition = '0px '+(parseInt(height) + 1)+'px';
		setTimeout("slidein()", 1);
	}
}

function slideSearchbar()
{
	if ( $('findSizeHeight').style.height == '5px' )
		setTimeout("slideout()", 1);
	else if ( $('findSizeHeight').style.height == '199px' )
		setTimeout("slidein()", 1);
	else
	{
		$('findSizeHeight').style.height = '5px';
		slideSearchbar();
	}
}
