//alert("infoDiv javascript"); var GpartnerID = 1; var GproductID = 1; var GlanguageID = 1; var GformID = 1; function infoDivOpen(partnerID, productID, languageID, formID) { // hide enlargement //divShow(0, 'enlargeDiv'); GpartnerID = partnerID; GproductID = productID; GlanguageID = languageID; GformID = formID; // wat is de scrollpositie? bepaal Y coordinaat = scrollpositie+100 var ScrollTop = document.body.scrollTop; if (ScrollTop == 0) { if (window.pageYOffset) { ScrollTop = window.pageYOffset; } else { ScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0; } } var newTop = ScrollTop + 50; document.getElementById('infoDiv').style.top = newTop + "px"; // wat is de beschikbare breedte? En de breedte van de div? bepaal x coordinaat var docW = pageWidth(); document.getElementById('infoDiv').style.left = (docW-400)/2 + "px"; //alert("sesam open u!"); infoDivShow(1); // doe de rest strUrl = "http://www.topbloemen.nl/webshop/infoDiv.php?p=" + partnerID + "&pid=" + productID + "&l=" + languageID; //alert(strUrl); infoDivPost(strUrl, ""); showDeliverydate(partnerID, languageID, formID) } function infoDivClose() { //alert("sesam sluit u!"); infoDivShow(0); document.getElementById("postalcode").value = ""; } function infoDivShow(valueOn) { if (valueOn == 1) { strDisplay = ""; } else { strDisplay = "none"; } if (document.all && document.getElementById) { // IE5 browser // show layer document.getElementById( 'infoDiv' ).style.display = strDisplay; } else if (!document.all && document.getElementById) { // netscape 6 browser // show layer document.getElementById( 'infoDiv' ).style.display = strDisplay; } else if (document.all) { // this is the way old msie versions work // show layer document.all[ 'infoDiv' ].style.display = strDisplay; } else if (document.layers) { // this is the way nn4 works // show layer document.layers[ 'infoDiv' ].display = strDisplay; } } function infoDivPost(url, parameters) { http_requestI = false; if (window.XMLHttpRequest) { // Mozilla, Safari,... http_requestI = new XMLHttpRequest(); if (http_requestI.overrideMimeType) { // set type accordingly to anticipated content type //http_requestI.overrideMimeType('text/xml'); http_requestI.overrideMimeType('text/html'); } } else if (window.ActiveXObject) { // IE try { http_requestI = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_requestI = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!http_requestI) { alert('Cannot create XMLHTTP instance'); return false; } http_requestI.onreadystatechange = infoDivFill; http_requestI.open('POST', url, true); http_requestI.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http_requestI.setRequestHeader("Content-length", parameters.length); http_requestI.setRequestHeader("Connection", "close"); http_requestI.send(parameters); } function infoDivFill() { //alert(http_requestI.responseText); if (http_requestI.readyState == 4) { if (http_requestI.status == 200) { //alert(http_requestI.responseText); result = http_requestI.responseText; //display the result into the correct div document.getElementById("infoDivContents").innerHTML = result; //verberg eerste bezorgdatum deliveryDivShow(0); if (GpartnerID>0) { if (GformID==1 || GformID==2 || GformID==6) { divShow(1, 'dateLink'); divShow(0, 'datePostcode'); divShow(0, 'dateShow'); } else { divShow(0, 'dateLink'); divShow(0, 'datePostcode'); divShow(1, 'dateShow'); } } } else { alert('There was a problem with the request.'); } } } function deliveryDivShow(valueOn) { divShow(1, 'datePostcode'); //divShow(1, 'dateShow'); } function stripSpace() { strPostcode = document.getElementById("postalcode").value; document.getElementById("postalcode").value = strPostcode.replace(" ","\n"); } function showDeliverydate(partnerID, languageID, formID) { divShow(0, 'dateShow'); if (document.getElementById("postalcode")) { strPostcode = document.getElementById("postalcode").value; strCijfers = strPostcode.substring(0,4); if(strCijfers.length == 4 && Number(strCijfers)!="NaN") { divShow(1, 'dateShow'); } } else { strCijfers = 0; } getFirstDate(strCijfers, partnerID, languageID, formID); } function getFirstDate(postcodeCijfers, partnerID, languageID, formID) { http_requestM = false; url = 'http://www.topbloemen.nl/webshop/getFirstDate.php?f=' + formID + '&l=' + languageID + '&p=' + partnerID + '&pc=' + postcodeCijfers; //alert(url); parameters = ''; if (window.XMLHttpRequest) { // Mozilla, Safari,... http_requestM = new XMLHttpRequest(); if (http_requestM.overrideMimeType) { // set type accordingly to anticipated content type http_requestM.overrideMimeType('text/html'); } } else if (window.ActiveXObject) { // IE try { http_requestM = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { http_requestM = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!http_requestM) { alert('Cannot create XMLHTTP instance'); return false; } http_requestM.onreadystatechange = dateContents; http_requestM.open('POST', url, true); http_requestM.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); http_requestM.setRequestHeader("Content-length", parameters.length); http_requestM.setRequestHeader("Connection", "close"); http_requestM.send(parameters); } function dateContents() { //alert(http_requestM.responseText); if (http_requestM.readyState == 4) { if (http_requestM.status == 200) { result = http_requestM.responseText; //alert(result) // fill div document.getElementById("firstDelivery").innerHTML = result; } else { alert('There was a problem with the request.'); } } } function divShow(valueOn, divName) { //alert(divName + " - " + valueOn); if (valueOn == 1) { strDisplay = ""; } else { strDisplay = "none"; } if (document.all && document.getElementById) { // IE5 browser // show layer document.getElementById( divName ).style.display = strDisplay; } else if (!document.all && document.getElementById) { // netscape 6 browser // show layer document.getElementById( divName ).style.display = strDisplay; } else if (document.all) { // this is the way old msie versions work // show layer document.all[ divName ].style.display = strDisplay; } else if (document.layers) { // this is the way nn4 works // show layer document.layers[ divName ].display = strDisplay; } } // sluit info popover meteen divShow(0, 'dateLink'); divShow(0, 'datePostcode'); divShow(0, 'dateShow'); infoDivClose(); showDeliverydate(0, 0, 0); function pageWidth() { return window.innerWidth != null? window.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body != null ? document.body.clientWidth : null; }