/*
	simplecart.js version 2.00.02 2011-03-09
	javascript client-side functions for SimpleCart PHP system
	copyright © 2007-2011 WebAware Pty Ltd
*/
var SimpleCart={init:function(){var c=/\bcart_items\b/,b=document.getElementsByTagName("table"),a=b.length;while(--a>=0){if(c.test(b[a].className)){this.cartSetActions(b[a])}}},cartSetActions:function(g){var e,m,l,h,a,c,k=g.getElementsByTagName("form"),f=/^cartForm_\d+$/,d=k.length,b;while(--d>=0){c=k[d];a=c.attributes.id.value;if(f.test(a)){m=c.parentNode.parentNode;l=m.getElementsByTagName("td");b=l.length;while(--b>=0){h=l[b];if(h.className=="cartUpdateLinks"){e=document.createElement("a");e.appendChild(document.createTextNode("update"));e.href="#";e.title="Update quantity of this item in cart";e.setAttribute("data-formID",a);e.onclick=function(){var j=this.getAttribute("data-formID"),i=document.getElementById(j);if(i){i.submit()}return false};h.appendChild(e);break}}}}},clearCart:function(){return confirm("Clear shopping cart of all items - are you sure?")},onSubmitPayPal:function(a){var c=this.validatePayPal(),b=document.getElementById("waiting");if(c.length>0){alert(c);return false}if(b){b.style.visibility="visible"}return true},validatePayPal:function(a){return""},ajaxRequest:function(params){var xhr,i,delim,config={callbackError:false,callbackSuccess:false,data:"",method:"POST",responseFormat:"XML",url:document.location.href},parseJSON=function(data){if(typeof JSON!="undefined"){return JSON.parse(data)}else{if(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(data.replace(/"(?:\\.|[^"\\])*"/g,""))){throw new SyntaxError("JSON.parse")}else{return eval("("+data+")")}}};if(typeof params=="object"){for(i in params){config[i]=params[i]}if(typeof params.data=="object"){config.data=delim="";for(i in params.data){config.data+=delim+encodeURIComponent(i)+"="+encodeURIComponent(params.data[i]);delim="&"}}}if(typeof XMLHttpRequest!="undefined"){xhr=new XMLHttpRequest()}else{try{xhr=new ActiveXObject("Msxml2.XMLHTTP")}catch(e){try{xhr=new ActiveXObject("Microsoft.XMLHTTP")}catch(e){xhr=false}}}if(xhr){xhr.onreadystatechange=function(){if(xhr.readyState==4){if(xhr.status==200){try{if(config.callbackSuccess){var response;switch(config.responseFormat){case"XML":response=xhr.responseXML;break;case"JSON":response=parseJSON(xhr.responseText);break;default:response=xhr.responseText;break}config.callbackSuccess("success",response,xhr)}}catch(e){if(config.callbackError){config.callbackError("error","AJAX request incomplete:\n"+e.toString(),xhr)}}}else{if(config.callbackError){config.callbackError("error","AJAX request failed: "+xhr.status,xhr)}}}};if(config.method=="POST"){xhr.open("POST",config.url,true);xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded");xhr.send(config.data)}else{xhr.open("GET",config.url+"?"+config.data,true);xhr.send(null)}return true}return false},hookReady:function(a){if(window.addEventListener){window.addEventListener("DOMContentLoaded",a,false)}else{if(window.attachEvent){window.attachEvent("onload",a)}}},hookEvent:function(a,b,c){if(a.addEventListener){a.addEventListener(b,c,false)}else{if(a.attachEvent){a.attachEvent("on"+b,function(){c.call(a,window.event)})}}}};SimpleCart.hookReady(function(){SimpleCart.init()});
