function xmlhttpobject(){ var xmlHttp; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest (); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject ("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp=new ActiveXObject ("Microsoft.XMLHTTP"); } catch (e) { alert ("Your browser does not support AJAX!"); return false; } } } return xmlHttp; } function checklength( textstring ) { if(document.getElementById('sentiment_'+textstring).value.length > 25) { document.getElementById('sentiment_'+textstring).value = document.getElementById('sentiment_'+textstring).value.substring(0,25); } } function vieworder(base_url) { var order_number = document.getElementById("order_number").value; var newurl = base_url + '/admin/orders/view/' + order_number; document.top.location = newurl; } function getTemplateBox() { var content_type_id = document.getElementById('template').value; } function addToBasket(id, action, categoryId, reserve){ var amount = document.getElementById('amount_'+id).value; var img = document.getElementById('img_'+id); var action_basket = document.getElementById('action_basket_'+id); var action_basket_icon = document.getElementById('action_basket_icon_' + id); var xmlHttp = xmlhttpobject(); if(xmlHttp == false){ return false; } if((reserve == "yes" && amount > 1) || reserve != "yes"){ xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4 && xmlHttp.responseText == 'SUCCESS'){ img.src = "/images/1.gif"; action_basket_icon.src = '/images/removecart.gif'; action_basket.onclick = function() { confirmRemoveFromCart(id); } } else if(xmlHttp.readyState == 4 && xmlHttp.responseText == 'FAILED_DIVERSEN') { alert("Er is onvoldoende voorraad. Dit artikel kunt u momenteel niet bestellen."); } else if(xmlHttp.readyState == 4 && xmlHttp.responseText != 'FAILED_DIVERSEN' && xmlHttp.responseText != 'SUCCES') { if(confirm('Er is onvoldoende voorraad. De huidige voorraad is: '+ xmlHttp.responseText +'. Wilt u alsnog alternatieven zien?')) { window.top.location='http://www.animalgreetings.nl/franchise/products/alternative/' + id + '/' + amount; } } } var url = "http://www.animalgreetings.nl/cart/addToCart.php?id="+ id +"&amount=" + amount + "&reserved=" + reserve; xmlHttp.open ("GET", url , true); xmlHttp.send (null); } else{ alert('Minimale afname is 1!'); } } function removeFromCart(id) { var xmlHttp; var img = document.getElementById('img_'+id); try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest (); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject ("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp=new ActiveXObject ("Microsoft.XMLHTTP"); } catch (e) { alert ("Your browser does not support AJAX!"); return false; } } } xmlHttp.onreadystatechange=function() { if (xmlHttp.readyState == 4){ alert('het product is verwijderd uit uw winkelwagen'); // img.src = "/images/empty.gif"; document.location.reload(); //window.top.location='http://www.animalgreetings.nl/franchise/cart/'; } } var url = "http://www.animalgreetings.nl/cart/removeFromCart.php?id="+ id ; xmlHttp.open ("GET", url , true); xmlHttp.send (null); } function updateCart(id) { var amount = document.getElementById('amount_'+id).value; var xmlHttp; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest (); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject ("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp=new ActiveXObject ("Microsoft.XMLHTTP"); } catch (e) { alert ("Your browser does not support AJAX!"); return false; } } } xmlHttp.onreadystatechange=function() { if (xmlHttp.readyState == 4){ alert('het productaantal is bijgewerkt'); window.top.location='http://www.animalgreetings.nl/franchise/cart/'; } } var url = "http://www.animalgreetings.nl/cart/updateCart.php?id="+ id +"&amount=" + amount ; xmlHttp.open ("GET", url , true); xmlHttp.send (null); } function getdiscount() { var customer_id = document.getElementById('customer_id').value; var total_price = parseFloat(document.getElementById('total_original').value); var xmlHttp; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest (); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject ("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp=new ActiveXObject ("Microsoft.XMLHTTP"); } catch (e) { alert ("Your browser does not support AJAX!"); return false; } } } xmlHttp.onreadystatechange=function() { if (xmlHttp.readyState == 4){ document.getElementById('discount').innerHTML = xmlHttp.responseText + "%"; var total_price_finish = Math.round((total_price - ((total_price / 100 ) * xmlHttp.responseText))*100)/100; document.getElementById('total').value = total_price_finish.toFixed(2); document.getElementById('totalhid').value = total_price_finish.toFixed(2); document.getElementById('total_tax').value = (Math.round((total_price_finish + ((total_price_finish / 100 ) * 19))*100)/100).toFixed(2); document.getElementById('total_tax_hid').value = (Math.round((total_price_finish + ((total_price_finish / 100 ) * 19))*100)/100).toFixed(2); } } var url = "http://www.animalgreetings.nl/cart/getDiscount.php?customer_id="+ customer_id ; xmlHttp.open ("GET", url , true); xmlHttp.send (null); } function calculate(id) { var price = document.getElementById('price_'+id+'').value; var delivered = document.getElementById('deli_'+id+'').value; var rest = document.getElementById('rest_'+id+'').value; var sold = delivered - rest; var newprice = price.replace(",", "."); var calc = (sold * newprice) ; var calc = calc.toFixed(2); var valu = (sold * newprice); var valu = valu.toFixed(2); document.getElementById('sold_'+id+'').innerHTML = sold; document.getElementById('val_'+id+'').innerHTML = '€' + valu.replace('.', ','); document.getElementById('val_form_'+id+'').value = valu; document.getElementById('calc_form_'+id+'').value = calc; document.getElementById('calc_'+id+'').innerHTML = '€' + calc.replace('.', ','); } function calculate_total( discount ) { var discount = 0; var sub_total = 0; var sale_value = 0; for(i=0; i 0) { sub_total = sub_total + parseFloat(document.newOrder.elements[i].value); } } } for(i=0; i 0) { sale_value = sale_value + parseFloat(document.newOrder.elements[i].value); } } } var sale_value = sale_value.toFixed(2); document.getElementById('sale_value').innerHTML = sale_value.replace('.', ','); var sub_total = sub_total.toFixed(2); document.getElementById('sub_total_form').value = sub_total; document.getElementById('sub_total').innerHTML = sub_total.replace('.', ','); if(discount > 0 ) { var total = sub_total - ((sub_total / 100) * discount); var total = total.toFixed(2); document.getElementById('total_form').value = total; document.getElementById('total').innerHTML = total.replace('.', ','); } else { document.getElementById('total_form').value = sub_total; document.getElementById('total').innerHTML = sub_total.replace('.', ','); } } function showTooltip(contentid, posX, posY) { document.getElementById(contentid).style.left = posX+'px'; document.getElementById(contentid).style.top = posY+'px'; document.getElementById(contentid).style.display = 'block'; } function toggleVisibility( contentid ) { if(document.getElementById(contentid).style.display == 'block') { document.getElementById(contentid).style.display = 'none'; } else { document.getElementById(contentid).style.display = 'block'; } } function searchCust ( base_url, uid ) { var xmlHttp; var lijst = document.getElementById('lijst'); var get = document.getElementById('customer_name').value; var URL = base_url + "/lib/findCust.php?name=" + get +"&uid="+ uid; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest (); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject ("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp=new ActiveXObject ("Microsoft.XMLHTTP"); } catch (e) { alert ("Your browser does not support AJAX!"); return false; } } } xmlHttp.onreadystatechange=function () { if (xmlHttp.readyState == 4 && xmlHttp.responseText.length > 5) { lijst.display = ''; lijst.innerHTML = xmlHttp.responseText; } } if (get.length > 0) { xmlHttp.open ("GET", URL , true); xmlHttp.send (null); lijst.style.visibility = 'visible'; } else { lijst.style.visibility = 'hidden'; lijst.innerHTML = ''; } } function setPickup(base_url, newvalue) { var xmlHttp; var pickup = document.getElementById('pickup'); var URL = base_url + "/lib/toggle_shipping.php?mode=" + newvalue; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest (); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject ("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp=new ActiveXObject ("Microsoft.XMLHTTP"); } catch (e) { alert ("Your browser does not support AJAX!"); return false; } } } xmlHttp.onreadystatechange=function () { if (xmlHttp.readyState == 4 && xmlHttp.responseText.length > 5) { window.location.reload(); } } xmlHttp.open ("GET", URL , true); xmlHttp.send (null); } function updateStatus(base_url, order, status ) { var xmlHttp; var URL = base_url + "/lib/update_status.php?order=" + order + "&status=" + status; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest (); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject ("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp=new ActiveXObject ("Microsoft.XMLHTTP"); } catch (e) { alert ("Your browser does not support AJAX!"); return false; } } } xmlHttp.onreadystatechange=function () { if (xmlHttp.readyState == 4 && xmlHttp.responseText == "UPDATED") { } } xmlHttp.open ("GET", URL , true); xmlHttp.send (null); } function enableField( fieldid ) { return document.getElementById(fieldid).disabled = false; } function addAppointment(date, time) { var box = document.getElementById(date +'-'+time); box.style.display = 'block'; } function changeStatus(product_code, base_url ) { var xmlHttp; var URL = base_url + "/lib/change_status.php?product_code=" + product_code ; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest (); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject ("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp=new ActiveXObject ("Microsoft.XMLHTTP"); } catch (e) { alert ("Your browser does not support AJAX!"); return false; } } } xmlHttp.onreadystatechange=function () { if (xmlHttp.readyState == 4) { document.getElementById('img_'+product_code).src = base_url +'/images/'+ xmlHttp.responseText + '.gif'; } } xmlHttp.open ("GET", URL , true); xmlHttp.send (null); } function confirmRemoveFromCart(id) { if(confirm('Wilt u dit product uit uw winkelwagen verwijderen?')) { var xmlHttp; var img = document.getElementById('img_'+id); var action_basket = document.getElementById('action_basket_' + id ); var action_basket_icon = document.getElementById('action_basket_icon_' + id); try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest (); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject ("Msxml2.XMLHTTP"); } catch (e) { try { xmlHttp=new ActiveXObject ("Microsoft.XMLHTTP"); } catch (e) { alert ("Your browser does not support AJAX!"); return false; } } } xmlHttp.onreadystatechange=function() { if (xmlHttp.readyState == 4){ alert('het product is verwijderd uit uw winkelwagen'); img.src = "/images/empty.gif"; action_basket_icon.src = '/images/winkelwagen.gif'; action_basket.onclick = function() { addToBasket(id); } } } var url = "http://www.animalgreetings.nl/cart/removeFromCart.php?id="+ id ; xmlHttp.open ("GET", url , true); xmlHttp.send (null); } else { return false; } } function delete_file(type, file_name) { if(confirm('Wilt u dit bestand echt verwijderen?')) { var xmlHttp= xmlhttpobject(); if(xmlHttp == false){ return false; } xmlHttp.onreadystatechange=function() { if (xmlHttp.readyState == 4){ alert('het bestand is verwijderd'); document.location = 'http://www.animalgreetings.nl/admin/upload'; } } var url = "http://www.animalgreetings.nl/lib/removeFile.php?type="+ type +"&file_name="+ file_name ; xmlHttp.open ("POST", url , true); xmlHttp.send (null); } else { return false; } } function buildCal(m, y, cM, cH, cDW, cD, brdr){ var mn=['Januari','Februari','Maart','April','Mei','Juni','Juli','Augustus','September','Oktober','November','December']; var dim=[31,0,31,30,31,30,31,31,30,31,30,31]; var oD = new Date(y, m-1, 1); //DD replaced line to fix date bug when current day is 31st oD.od=oD.getDay()+1; //DD replaced line to fix date bug when current day is 31st var todaydate=new Date() //DD added var scanfortoday=(y==todaydate.getFullYear() && m==todaydate.getMonth()+1)? todaydate.getDate() : 0 //DD added dim[1]=(((oD.getFullYear()%100!=0)&&(oD.getFullYear()%4==0))||(oD.getFullYear()%400==0))?29:28; var t='
'; t+=''; for(s=0;s<7;s++)t+=''; t+=''; for(i=1;i<=42;i++){ var x=((i-oD.od>=0)&&(i-oD.od' //DD added t+=''; if(((i)%7==0)&&(i<36))t+=''; } return t+='
'+mn[m-1]+' - '+y+'
'+"SMTWTFS".substr(s,1)+'
'+x+'
'; } function verify_order() { var xmlHttp= xmlhttpobject(); if(xmlHttp == false){ return false; } xmlHttp.onreadystatechange=function() { if (xmlHttp.readyState == 4 && xmlHttp.responseText == 'FULL_BASKET'){ return confirm('Er bevinden zich nog producten in uw winkelwagen\nWeet u zeker dat u deze site wilt verlaten?'); } else { return true; } } var url = "http://www.animalgreetings.nl/lib/checkBasket.php"; xmlHttp.open ("POST", url , true); xmlHttp.send (null); } function save_comment(text) { var xmlHttp= xmlhttpobject(); if(xmlHttp == false){ return false; } xmlHttp.onreadystatechange=function() { if (xmlHttp.readyState == 4){ return true; } } var url = "http://www.animalgreetings.nl/lib/saveComment.php?comment=" + text; xmlHttp.open ("POST", url , true); xmlHttp.send (null); } function changeStatusCategory(product_code, base_url ) { var xmlHttp= xmlhttpobject(); var URL = base_url + "/lib/change_status_category.php?groep=" + product_code ; if(xmlHttp == false){ return false; } xmlHttp.onreadystatechange=function () { if (xmlHttp.readyState == 4) { document.getElementById('img_'+product_code).src = base_url +'/images/'+ xmlHttp.responseText + '.gif'; } } xmlHttp.open ("GET", URL , true); xmlHttp.send (null); } function toggleVis(contentId,base_url,productId){ var content = document.getElementById(contentId); if(content.style.display == 'block'){ content.style.display = 'none'; } else{ content.style.display = 'block'; findproduct(base_url, contentId,productId); } } function findproduct(base_url,target,productId){ var xmlHttp= xmlhttpobject(); var tar = document.getElementById(target); var URL = base_url + "/lib/findproduct.php?product="+productId; if(xmlHttp == false){ return false; } xmlHttp.onreadystatechange=function (){ if (xmlHttp.readyState == 4 && xmlHttp.responseText.length > 5){ tar.innerHTML = xmlHttp.responseText; } } xmlHttp.open ("GET", URL , true); xmlHttp.send (null); } function readNewsletter(base_url, newsitem, readId,userId){ var URL = base_url + "/lib/readNewsletter.php?newsId="+readId+"&userId="+userId; var xmlHttp = xmlhttpobject(); if(xmlHttp == false){ return false; } if(newsitem.style.fontWeight == '900'){ xmlHttp.open ("GET", URL , true); xmlHttp.send (null); newsitem.style.fontWeight = 'normal'; } return false; } function seenReminder(base_url, itemx, reminderId,userId){ var item = document.getElementById(itemx); var URL = base_url + "/lib/seereminder.php?reminderId="+reminderId+"&userId="+userId; var xmlHttp = xmlhttpobject(); if(xmlHttp == false){ return false; } xmlHttp.open ("GET", URL , true); xmlHttp.send (null); item.src = '/img/icon_yes.png'; return false; } function reserveToOrder( orderId,link,verbose){ if(verbose != 'false'){ var statusField = document.getElementById('order_status_'+orderId); } var URL = base_url + "/lib/reserveToOrder.php?orderId="+orderId; var xmlHttp = xmlhttpobject(); if(xmlHttp == false){ return false; } if(verbose != 'false'){ xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4){ statusField.innerHTML = xmlHttp.responseText; link.style.display = "none"; } } } else{ xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4){ link.style.display = "none"; window.location.reload(); } } } xmlHttp.open ("GET", URL , true); xmlHttp.send (null); return false; } function sendReminder(franchiseId, orderId){ var defaultmsg = "Uw bestelling komt over x dagen binnen"; var xmlHttp = xmlhttpobject(); var msg = prompt("Uw bericht:",defaultmsg); if(msg != null && msg != "" && msg != defaultmsg){ xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4){ alert(xmlHttp.responseText); return true; } } var URL = base_url + "/lib/sendreminder.php?franchiseId="+franchiseId+"&orderId="+orderId + "&message=" + msg; if(xmlHttp == false){ return false; } xmlHttp.open ("GET", URL , true); xmlHttp.send (null); } return false; }