var currencySymbol="&pound;";function writeCartTable(b){html="";html+='<div id="backLink"><a href="#" onclick="history.back();return false;">Back</a></div>';if(b.length){html+='<form id="cartForm" style="margin:0px;border:0px;" name="cartForm" target="_blank" action="https://www.paypal.com/cgi-bin/webscr" method="post">';html+='<table id="cartTable" cellpadding="0" cellspacing="0">';html+="<tr>";html+="<th>Photo</th>";html+="<th>Caption</th>";html+="<th>Option</th>";html+="<th>Price</th>";html+="<th>Quantity</th>";html+="<th>Total price</th>";html+='<td><input type="Button" value="Clear cart" class="button" onmouseover="this.className=\'buttonHi\';" onmouseout="this.className=\'button\';" onclick="if(confirm(\'Clear items?\')){deleteCookie(\'JOHNCAVE\'); window.location.reload(false);}"></td>';html+="</tr>";for(var a=0;a<b.length;a++){id=b[a].id;ref=b[a].ref;option=b[a].option;price=b[a].price;name=b[a].name;if(option.length==0){option="&nbsp;"}if(name.length==0){name="&nbsp;"}if(thumbnails[id]){src=thumbnails[id].src}else{src=""}html+=writeCartTableRow(b,src,a,id,ref,name,option,price,b[a].quantity)}html+="<tr>";html+="<td>&nbsp;</td>";html+="<td>&nbsp;</td>";html+="<td>&nbsp;</td>";html+="<td>&nbsp;</td>";html+="<td>Total</td>";html+='<td id="orderTotal">'+currencySymbol+orderTotal()+"</td>";html+='<input type="hidden" name="business" value="john.cave@westhavenww.co.uk">';html+='<input type="hidden" name="currency_code" value="GBP">';html+='<input type="hidden" name="cmd" value="_cart">';html+='<input type="hidden" name="upload" value="1">';html+='<td><input type="Submit" value="Place order" id="payPalAddButton" class="button" onmouseover="this.className=\'buttonHi\';" onmouseout="this.className=\'button\';"></td>';html+="</tr>";html+='<input type="hidden" name="site" value="JOHNCAVE">';html+="</table>";html+="</form>"}else{html+='<p id="cartEmpty">Cart empty</p>'}$("#cartDiv").html(html)}function writeCartTableRow(h,a,j,i,c,b,f,g,d){var e=j+1;id=i;photo_ref=c+" - "+b;html="";html+='<input type="hidden" name="item_number_'+e+'" value="'+photo_ref+'">';html+='<input type="hidden" name="item_name_'+e+'" value="'+f+'">';html+='<input type="hidden" name="quantity_'+e+'" value="'+d+'">';html+='<input type="hidden" name="item_ref_'+e+'" value="'+photo_ref+'">';html+='<input type="hidden" name="item_title_'+e+'" value="'+b+'">';html+='<input type="hidden" name="item_description_'+e+'" value="'+f+'">';html+='<input type="hidden" name="item_price_'+e+'" value="'+g+'">';html+='<input type="hidden" name="id_'+e+'" value="'+i+'">';html+='<input type="hidden" name="amount_'+e+'" value="'+g+'">';html+="<tr>";html+='<td class="image"><img src="'+a+'"></td>';html+="<td>"+b+"</td>";html+="<td>"+f+"</td>";html+="<td>"+currencySymbol+g+"</td>";html+='<td><input type="Text" size="5" class="cartInputField" value="'+d+"\" onkeyup=\"quantityOnKeyUp(arrayOfItems, this.value, 'cartForm', "+e+", "+id+');"></td>';html+='<td id="totalPrice_'+e+'">'+currencySymbol+totalPrice(g,d)+"</td>";html+='<td id="remove_'+e+'"><input type="Button" value="Remove" class="button" onmouseover="this.className=\'buttonHi\';" onmouseout="this.className=\'button\';" onclick="confirmRemove(\'Remove item?\',\'JOHNCAVE\', '+j+');"></td>';html+="</tr>";return html}function quantityOnKeyUp(g,d,b,c,a){if(isInteger(d)&&isPositive(d)){updateQuantity("JOHNCAVE",a,g[parseInt(c)-1].option,d);document.forms[b]["quantity_"+c].value=d;document.forms[b]["quantity_"+c].value=d;setHTML("totalPrice_"+c,currencySymbol+totalPrice(document.forms[b]["amount_"+c].value,d));setHTML("orderTotal",currencySymbol+orderTotal())}if(d==0){try{clearTimeout(removeAlert)}catch(f){}removeAlert=setTimeout("confirmRemove('Remove item?','JOHNCAVE', "+(c-1)+")",3000)}else{try{clearTimeout(removeAlert)}catch(f){}}};