function $(tgtId) { return document.getElementById(tgtId); } function goPage( basePath , page ) { window.location = ""+basePath+""+page+"/"; } function redirectUserSetTimer( strUrl ) { var timer = window.setTimeout("redirectUser('"+ strUrl +"')", 7000); return true; } function redirectUser( strUrl ) { window.location = ""+strUrl+""; return true; } function confirmDeleteAd( name, url ) { var confirmDelete = confirm("Weet u zeker dat u '"+name+"' wilt verwijderen?"); if(confirmDelete == true) { window.location = url; return true; } return false; } function confirmAcceptBid( bidder, price, url ) { var confirmAccept = confirm("Weet u zeker dat u dit product wilt verkopen aan "+bidder+" voor € "+price+" ?"); if(confirmAccept == true) { window.location = url; } return true; } function confirmAcceptInterested( bidder, charity, url ) { var confirmAccept = confirm("Weet u zeker dat u dit product wilt schenken aan "+bidder+" ( "+charity+" ) ?"); if(confirmAccept == true) { window.location = url; } return true; } function confirmDeleteBid( bidder, price, url ) { var confirmAccept = confirm("Weet u zeker dat u "+bidder+"'s bod van € "+price+" wilt verwijderen ?"); if(confirmAccept == true) { window.location = url; } return true; } function toggleAdType( tgtVal ) { var charityWindow = document.getElementById("charityWindow"); var amountWindow = document.getElementById("amountTr"); if(tgtVal == "free") { charityWindow.style.display = "none"; amountWindow.style.display = "none"; //amountWindow.style.visibility = "hidden"; }else { charityWindow.style.display = "block"; amountWindow.style.display = "table-row"; } } function toggleAangeboden( tgt ) { var sellFree = document.getElementById("sellFree"); // If this changes we need to refill the select box so lets clear it removeOptions(sellFree); // If its aangeboden its can be sold if(tgt.value == "aangeboden") { toggleAdType("pay"); var payOpt = document.createElement("option"); payOpt.value = "pay"; payOpt.text = "Te koop"; sellFree.options.add(payOpt); }else { toggleAdType("free"); } // The free option var freeOpt = document.createElement("option"); freeOpt.value = "free"; freeOpt.text = "Gratis"; sellFree.options.add(freeOpt); return true; } function toggleCheckbox(tgtId) { var tgt = $(tgtId); if(tgt.checked == true) { tgt.checked = false; }else { tgt.checked = true; } } function removeOptions( selectEl ) { while(selectEl.length > 0) { selectEl.remove(selectEl.length-1); } return true; } function openPopup( url, width, height ) { window.open(url, 'Popup', 'width='+width+',height='+height+',screenX=' + ((screen.width - width) / 2) + ', screenY=' + ((screen.height - height) / 2) + ',scrollbars=yes,toolbar=no,location=no'); }; function changeCategory( tgt, fw ) { var val = tgt.value; if(val == null) { return false; } var tgtSelect = document.getElementById("subCategory"); if(val != 0) { var req = null; if(window.XMLHttpRequest) { req = new XMLHttpRequest(); }else if (window.ActiveXObject) { req = new ActiveXObject("Microsoft.XMLHTTP"); } req.onreadystatechange = function() { if(req.readyState == 4) { if(req.status == 200) { var jsonResponse = req.responseText; if(jsonResponse.length > 0) { var jsonObj = eval("("+jsonResponse+")"); // Remove all options while(tgtSelect.options.length > 0) { tgtSelect.options[0] = null; } if(fw == "filter") { appendOptionEnd( '0' , 'Alle' ); } for( var i = 0; i < jsonObj.categories.length; i++ ) { appendOptionEnd( jsonObj.categories[i].ID , jsonObj.categories[i].name ); } } } } }; req.open("GET", "/includes/marktplaats_advertisements.php?c="+val, true); req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); req.send(null); }else { // Remove all options while(tgtSelect.options.length > 0) { tgtSelect.options[0] = null; } appendOptionEnd( '0', 'Kies Categorie' ); } } function appendOptionEnd( id , name ) { var elOptNew = document.createElement('option'); elOptNew.text = name; elOptNew.value = id; var elSel = document.getElementById('subCategory'); try { elSel.add(elOptNew, null); // standards compliant; doesn't work in IE } catch(ex) { elSel.add(elOptNew); // IE only } }