﻿function cartMiniViewInstance()
{this.callBack=null;}
var __cartMiniView=new cartMiniViewInstance();function cartMiniViewClear()
{var ctrlView=document.getElementById("ctrlcartmini");while(ctrlView.firstChild)
ctrlView.removeChild(ctrlView.firstChild);}
function cartMiniViewDrawBody()
{var table=document.createElement("table");table.className="ctrlcartmini";var tBody=document.createElement("tbody");{var tr=document.createElement("tr");var td=document.createElement("td");td.className="header";td.colSpan=2;td.style.height="10px";td.appendChild(document.createTextNode("Your shopping cart"));tr.appendChild(td);tBody.appendChild(tr);}
{var tr=document.createElement("tr");var td=document.createElement("td");td.colSpan=2;td.style.height="10px";{var span=document.createElement("span");span.className="msclabel";span.appendChild(document.createTextNode("Number of products: "));td.appendChild(span);}
{var span=document.createElement("span");span.className="msctext";span.appendChild(document.createTextNode(__cartMiniInfo.productCount));td.appendChild(span);}
tr.appendChild(td);tBody.appendChild(tr);}
{var tr=document.createElement("tr");{var td=document.createElement("td");td.style.height="10px";var span=document.createElement("span");span.className="msclabel";span.appendChild(document.createTextNode("Total"));td.appendChild(span);tr.appendChild(td);}
{var td=document.createElement("td");td.style.height="10px";var span=document.createElement("span");span.className="mscclublabel";span.appendChild(document.createTextNode("Club Total"));td.appendChild(span);tr.appendChild(td);}
tBody.appendChild(tr);}
if(parseFloat(__cartMiniInfo.Discount)==0 && parseFloat(__cartMiniInfo.BundleDiscount) == 0)
{var tr=document.createElement("tr");{var td=document.createElement("td");td.style.height="10px";var span=document.createElement("span");span.className="msctext";span.appendChild(document.createTextNode("$"+__cartMiniInfo.price));td.appendChild(span);tr.appendChild(td);}
{var td=document.createElement("td");td.style.height="10px";var span=document.createElement("span");span.className="mscclublabel";span.appendChild(document.createTextNode("$"+__cartMiniInfo.priceClub));td.appendChild(span);tr.appendChild(td);}
tBody.appendChild(tr);}
else
{var tr=document.createElement("tr");{var td=document.createElement("td");td.style.height="10px";var span=document.createElement("del");span.className="msctext";span.appendChild(document.createTextNode("$"+__cartMiniInfo.price));td.appendChild(span);tr.appendChild(td);}
{var td=document.createElement("td");td.style.height="10px";var span=document.createElement("del");span.className="mscclublabel";span.appendChild(document.createTextNode("$"+__cartMiniInfo.priceClub));td.appendChild(span);tr.appendChild(td);}
tBody.appendChild(tr);tr=document.createElement("tr");{var td=document.createElement("td");td.style.height="10px";var span=document.createElement("span");span.className="msctext";var discountPrice=parseFloat(__cartMiniInfo.price)-parseFloat(__cartMiniInfo.Discount)-parseFloat(__cartMiniInfo.BundleDiscount);discountPrice=Math.round(discountPrice*100)/100;discountPrice=discountPrice.toFixed(2);span.appendChild(document.createTextNode("$"+discountPrice.toString()));td.appendChild(span);tr.appendChild(td);}
{var td=document.createElement("td");td.style.height="10px";var span=document.createElement("span");span.className="mscclublabel";var discountPrice=parseFloat(__cartMiniInfo.priceClub)-parseFloat(__cartMiniInfo.DiscountMember)-parseFloat(__cartMiniInfo.BundleDiscountMember);discountPrice=Math.round(discountPrice*100)/100;discountPrice=discountPrice.toFixed(2);span.appendChild(document.createTextNode("$"+discountPrice.toString()));td.appendChild(span);tr.appendChild(td);}
tBody.appendChild(tr);}
{var tr=document.createElement("tr");var td=document.createElement("td");td.colSpan=2;td.style.height="10px";var a=document.createElement("a");a.href="/Cart.aspx";var img=new Image();img.src="/images/checkout.gif";img.border=0;a.appendChild(img);td.appendChild(a);tr.appendChild(td);tBody.appendChild(tr);}
{var tr=document.createElement("tr");var td=document.createElement("td");td.colSpan=2;td.style.height="10px";var a=document.createElement("a");a.href="javascript:cartMiniListViewVisibilityToggle()";a.id="ctrlcartminishowhidelink";a.appendChild(document.createTextNode((cartMiniListViewVisible()==true)?"Hide contents":"Show contents"));td.appendChild(a);tr.appendChild(td);tBody.appendChild(tr);}
{var tr=document.createElement("tr");var td=document.createElement("td");td.colSpan=2;td.style.height="4px";td.style.backgroundColor="#ffffff";tr.appendChild(td);tBody.appendChild(tr);}
cartMiniViewClear();var ctrlView=document.getElementById("ctrlcartmini");table.appendChild(tBody);ctrlView.appendChild(table);}
function cartMiniViewDrawLoading()
{var center=document.createElement("center");var table=document.createElement("table");var tBody=document.createElement("tbody");table.width="100%";table.cellPadding=0;table.cellSpacing=0;var tr=document.createElement("tr");var td=document.createElement("td");td.className="loading";td.style.width="100%";td.style.height="200px";td.style.textAlign="center";td.style.verticalAlign="middle";var img=new Image();img.src="/images/loading-cart.gif";td.appendChild(img);tr.appendChild(td);tBody.appendChild(tr);table.appendChild(tBody);center.appendChild(table);cartMiniViewClear();var ctrlView=document.getElementById("ctrlcartmini");ctrlView.appendChild(center);}
function cartMiniViewInit(callerContext)
{cartMiniViewDrawBody();if(cartMiniListViewVisible()==true)
cartMiniListViewLoad();}
function cartMiniViewCreate()
{__cartMiniView.callBack=cartMiniViewInit;cartMiniViewLoad();}
function cartMiniViewLoad()
{cartMiniViewDrawLoading();cartMiniInfoGet(__cartMiniView);}
function cartMiniViewProductAdd(catalogId)
{cartMiniViewDrawLoading();cartMiniInfoProductAdd(catalogId,__cartMiniView);}
function cartMiniViewProductRemove(catalogId)
{cartMiniViewDrawLoading();cartMiniInfoProductRemove(catalogId,__cartMiniView);}
