function toggleDivDisplay(divId) {
	if (document.getElementById(divId).style.display == "none")
		document.getElementById(divId).style.display = "block";
	else
		document.getElementById(divId).style.display = "none";
}

function showDiv(divId) {
	document.getElementById(divId).style.display = "block";
}

function hideDiv(divId) {
	document.getElementById(divId).style.display = "none";
}

var popupWindow = false; 
function openPopup(url,w,h) {
	x = screen.width/2-w/2;
	y = screen.height/2-h/2;
	if (popupWindow) popupWindow.close();
    popupWindow=window.open(url,'ny','toolbar=no,copyhistory=no,location=no,' + 'directories=no,status=no,menubar=no,scrollbars=no,' +'resizable=no,width=' + w + ',height=' + h + ',top=' + y +',left=' + x);
}

function openPopupPay(url,w,h) {
	x = screen.width/2-w/2;
	y = screen.height/2-h/2;
	if (popupWindow) popupWindow.close();
    popupWindow=window.open(url,'ny','toolbar=no,copyhistory=no,location=yes,' + 'directories=no,status=yes,menubar=no,scrollbars=yes,' +'resizable=no,width=' + w + ',height=' + h + ',top=' + y +',left=' + x);
}

function getXMLHTTP() {
    var http_request = false;

    if  (window.XMLHttpRequest) { // Mozilla, Safari, IE7.0+  ...
        http_request = new XMLHttpRequest();
    }
    else if (window.ActiveXObject)  { // IE 6.0-
        try {
            http_request = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                alert("Microsoft.XMLHTTP")
                http_request = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e) {
            }
        }
    }
    return http_request;
}

function search_address(searchValue)
{
	http_request = getXMLHTTP();
	var searchString = searchValue;

	// Kontrollerer XML paa klienten
	if (!http_request){
	alert(NoXMLHTTP);
	return false;
	}
	
	var strURL = "/includes/modules/check_streetname_ajax.asp?search_string=" + searchString + "&noCache=" + Math.random(); + "";
	http_request.onreadystatechange = function() 
	{
		if (http_request.readyState == 4) 
		{
			if (http_request.status == 200) 
			{
				document.getElementById("search_address_result").innerHTML = http_request.responseText;
			}
			else
			{
				alert(http_request.responseText)
			}
		}
	}
	http_request.open('GET', strURL, true);
	http_request.send(null)
}
