var xmlObj; function loadXMLDoc(u, id) { // branch for native XMLHttpRequest object if (window.XMLHttpRequest) { xmlObj = new XMLHttpRequest(); xmlObj.onreadystatechange = function(){processReqChange(id)}; xmlObj.open("GET", u, true); xmlObj.send(null); // branch for IE/Windows ActiveX version } else if (window.ActiveXObject) { xmlObj = new ActiveXObject("Microsoft.XMLHTTP"); if (xmlObj) { xmlObj.onreadystatechange = function(){processReqChange(id)}; xmlObj.open("GET", u, true); xmlObj.send(); } } } function processReqChange(id) { if (xmlObj.readyState == 4) { //State : Loaded if (xmlObj.status == 200) { //Status : OK response = xmlObj.responseText; if (response.indexOf('script:') == 0){ var scr = response.replace('script:', ''); if (scr.length > 0){ eval(scr); } } else { document.getElementById(id).innerHTML = xmlObj.responseText; } } else { alert('There was a problem retrieving the XML data:\n' + xmlObj.statusText); } } else { document.getElementById(id).innerHTML = 'Loading...'; } } function loadHTML(u, o){ u = u + '&ts='+ Number(new Date()); if (xmlObj) { if(xmlObj.readyState != 4){ setTimeout('loadHTML(\''+u+'\', \''+o+'\')', 100); } else { loadXMLDoc(u, o); } } else { loadXMLDoc(u, o); } } function doLogin(id){ usr = document.getElementById("username"); pwd = document.getElementById("password"); if (usr.value.length == 0){ alert("U moet een gebruikersnaam invullen."); usr.focus(); return false; } if (pwd.value.length == 0){ alert("U moet een wachtwoord invullen."); pwd.focus(); return false; } loadXMLDoc("/login.asp?action=login&id="+ id +"&username="+ usr.value +"&password="+ pwd.value +"&u="+ escape(document.location), "Object"+ id); return false; } function product(id, type){ document.location = 'default.asp?id=15&product='+id+'&type='+type; } function goPage(id){ document.location = 'default.asp?id='+id; } function download(id){ document.location='/download.asp?id='+id; } function openImage(id){ var leftPos = (screen.availWidth-100) / 2; var topPos = (screen.availHeight-100) / 2; window.open('/image-preview.asp?id='+id,'', 'scrollbars=no,resizable=yes,status=no,toolbar=no,width=100,height=100,top=' + topPos + ',left=' + leftPos); } function toggleCart(d){ document.getElementById('cart').style.display = d; } function goCart(){ document.location = '/cart.asp?u='+escape(document.location); } function addToCart(pid){ var aantal = document.getElementById('aantal').value document.location = '/cart.asp?action=add&pid='+pid+'&aantal='+aantal+'&u='+escape(document.location); } function emptyCart(){ if (confirm('Weet u zeker dat u uw winkelwagen wilt legen?')) { document.location = '/cart.asp?action=empty&u='+escape(document.location); } } function login(){ document.location = '/account.asp?action=login'; } function removeFromCart(pid){ if (confirm('Weet u zeker dat u dit artikel uit de winkelwagen wilt verwijderen?')){ window.location = 'cart.asp?action=remove&pid='+pid+'&u='+escape(document.getElementById('u').value); } } function changeNumber(c, id, pid){ min = 1; var aantal = document.getElementById(id); if (isNaN(parseFloat(aantal.value))) { alert('Aantal moet een numerieke waarde zijn.'); } else { newValue = parseFloat(aantal.value) + c; if (newValue < min) { if (confirm('Weet u zeker dat u dit artikel uit de winkelwagen wilt verwijderen?')){ window.location = 'cart.asp?action=remove&pid='+pid+'&u='+escape(document.getElementById('u').value); } else { aantal.value = min; modified = true; } } else if (newValue > 0) { aantal.value = newValue; modified = true; } } } function changeNumberV(o, v, min, max){ var aantal = document.getElementById(o); if (aantal) { if (isNaN(parseFloat(aantal.value))) { alert('Dit is geen numerieke waarde.'); } else { newValue = aantal.value.replace(",", ".") newValue = parseFloat(newValue) + v; if (newValue < min) { aantal.value = min; } else if (newValue > max) { aantal.value = max; } else { aantal.value = newValue.toString().replace(".", ","); } } } } function numbersonly(myfield, e, dec){ var key; var keychar; if (window.event) key = window.event.keyCode; else if (e) key = e.which; else return true; keychar = String.fromCharCode(key); // control keys if ((key==null) || (key==0) || (key==8) || (key==9) || (key==13) || (key==27) ) return true; // numbers else if ((("0123456789-").indexOf(keychar) > -1)) return true; // decimal point jump else if (dec && (keychar == ".")) { myfield.form.elements[dec].focus(); return false; } else return false; } function recalcCart(){ document.cart.order.value = 'false'; document.cart.submit(); } function orderCart(){ if (modified) { document.cart.order.value = 'true'; document.cart.submit(); } else { document.location = 'order.asp'; } } function showImage(img){ var leftPos = (screen.availWidth-100) / 2; var topPos = (screen.availHeight-100) / 2; window.open('/image-preview.asp?img='+escape(img),'', 'scrollbars=no,resizable=yes,status=no,toolbar=no,width=100,height=100,top=' + topPos + ',left=' + leftPos); } function forgotPassword(){ var leftPos = (screen.availWidth-400) / 2; var topPos = (screen.availHeight-400) / 2; window.open('/password.asp','', 'scrollbars=no,resizable=yes,status=no,toolbar=no,width=400,height=400,top=' + topPos + ',left=' + leftPos); } function orderBy(o, nr, dir){ myForm = document.getElementById(o); myForm.order.value = nr; myForm.direction.value = dir; myForm.submit(); } function addMarker(point, html, iconImg, id, tip) { var icon = new GIcon(); icon.image = "/lib/images/"+ iconImg; icon.shadow = "/lib/images/marker-shadow.png"; icon.iconSize = new GSize(36,18); icon.shadowSize = new GSize(36,18); icon.iconAnchor = new GPoint(26,18); icon.infoWindowAnchor = new GPoint(26,9); eval("bounds"+ id +".extend(point)"); var marker = new GMarker(point, icon); GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); /* marker.openExtInfoWindow( map, "custom_info_window_red", html, {beakOffset: 3} ); */ var tooltip = new Tooltip(marker, tip, 4); marker.tooltip = tooltip; var map = eval("map"+ id); map.addOverlay(tooltip); GEvent.addListener(marker,'mouseover',function(){ this.tooltip.show(); }); GEvent.addListener(marker,'mouseout',function(){ this.tooltip.hide(); }); return marker; } var currentMenu; function toggleMenu(o){ var lvl = parseInt(o.className.replace("lvl", "")); if (lvl == 0){ if ((currentMenu) && (currentMenu.id != o.id)) { var el = currentMenu.getElementsByTagName("DIV"); for (var i = 0; i < el.length; i++) { if (el[i].className.indexOf("lvl") >= 0) { el[i].style.display = "none"; } } } currentMenu = o; } lvl = lvl + 1; var el = o.getElementsByTagName("DIV"); for (var i = 0; i < el.length; i++) { if ((el[i].style.display == "none") && (el[i].className == "lvl"+ lvl)) { el[i].style.display = ""; } } } function initMenu(){ if (document.getElementById("menu")) { var el = document.getElementById("menu").getElementsByTagName("DIV"); for (var i = 0; i < el.length; i++) { if ((el[i].style.display == "") && (el[i].className == "lvl0")) { currentMenu = el[i]; break; } } } } function toggleInputHelp(o, e){ if (e == "focus") { o.className = ""; if (o.value == o.title){ o.value = ""; } } if (e == "blur") { if (o.value == ""){ o.value = o.title; o.className = "empty"; } } } function checkCalculator(){ var koopsom = document.getElementById("koopsom"); var hypotheeksom = document.getElementById("hypotheeksom"); var k = isNaN(parseFloat(koopsom.value)); var h = isNaN(parseFloat(hypotheeksom.value)); if ((k) && (h)) { if (isNaN(parseFloat(koopsom.value))) { alert("U dient de koopsom van uw woning in te voeren."); koopsom.focus(); return false; } if (isNaN(parseFloat(hypotheeksom.value))) { alert("U dient de hypotheeksom in te voeren."); hypotheeksom.focus(); return false; } } } function logout(){ if (confirm("Weet u zeker dat u wilt stoppen?")){ document.location = "logout.asp"; } }