
var StoreId='1cca6b86-8ac5-4460-8965-39824f323c58';var UrlTracker='http://tracker.beezup.com/Tracker/';var DaysLastCookie=365;var ValidPayement=null;var Landing=null;var OrderBT=new classOrder();var B="BeezUP";var L=B+"Landing"+StoreId;var O=B+"Order"+StoreId;var IsProcess=false;StartBT();function StartBT(){if(isDefined(window.processLanding)){if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);processLanding();},false);}else if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);processLanding();}});if(document.documentElement.doScroll&&window==window.top)(function(){if(IsProcess)return;try{document.documentElement.doScroll("left");}catch(error){setTimeout(arguments.callee,0);return;}
processLanding();})();}
if(document.attachEvent){window.attachEvent("onload",function(){window.detachEvent("onload",arguments.callee);processLanding();});}
else{window.addEventListener("load",function(e){window.removeEventListener("load",arguments.callee,false);processLanding();},false);}}}
function processLanding(){if(IsProcess===false){IsProcess=true;Landing=getLanding(readCookie(L));var BPCID=gup("BPCID");var BPPID=gup("BPPID");if(!isNullOrEmpty(BPCID)){if(Landing==null){saveLanding(BPCID,BPPID,newVisitorId());}
else if(Landing.BPCID!=BPCID||Landing.BPPID!=BPPID){saveLanding(BPCID,BPPID,Landing.VisitorId);}}
BPCID=null;BPPID=null;}}
function classLanding(BPCID,BPPID,Url,VisitorId){this.Url=Url;this.BPCID=BPCID;this.BPPID=BPPID;this.VisitorId=VisitorId;}
function classOrder(JsId,VisitorId,OrderMerchantId,TotalCost,ListProductId,ListProductQuantity,ListProductUnitPrice,ListProductMargin){this.JsId=JsId;this.VisitorId=VisitorId;this.OrderMerchantId=OrderMerchantId;this.TotalCost=TotalCost;this.ListProductId=ListProductId;this.ListProductQuantity=ListProductQuantity;this.ListProductUnitPrice=ListProductUnitPrice;this.ListProductMargin=ListProductMargin;this.SKU=ListProductMargin;}
function getLanding(value){if(isDefined(value)){var values=value.split("&");return new classLanding(values[0].split("=")[1],values[1].split("=")[1],values[2].split("=")[1],values[3].split("=")[1]);}else{return null};}
function saveLanding(BPCID,BPPID,VisitorId){var body="BPCID="+BPCID+"&BPPID="+BPPID+"&Url="+getUrl()+"&VisitorId="+VisitorId;callTracker("Land",body);saveLandingInCookie(body);Landing=getLanding(body);body=null;return;}
function createOrderBody(order){if(Landing==null){Landing=getLanding(readCookie(L));}
var visitorId=Landing==null?newVisitorId():Landing.VisitorId;var body="JsId="+newJsId()+"&VisitorId="+visitorId;if(!isNullOrEmpty(order.OrderMerchantId)){body+="&OrderMerchantId="+order.OrderMerchantId;}
if(!isNullOrEmpty(order.TotalCost)){body+="&TotalCost="+order.TotalCost;}
if(!isNullOrEmpty(order.ListProductId)){body+="&ListProductId="+order.ListProductId;}
if(!isNullOrEmpty(order.ListProductQuantity)){body+="&ListProductQuantity="+order.ListProductQuantity;}
if(!isNullOrEmpty(order.ListProductUnitPrice)){body+="&ListProductUnitPrice="+order.ListProductUnitPrice;}
if(!isNullOrEmpty(order.ListProductMargin)){body+="&ListProductMargin="+order.ListProductMargin;}
if(!isNullOrEmpty(order.SKU)){body+="&SKU="+order.SKU;}
if(Landing==null){body+="&Url="+getUrl();}
visitorId=null;return body;}
function getOrder(body){if(isDefined(body)){var values=body.split("&");return new classOrder(values[0].split("=")[1],values[1].split("=")[1],values.length>2?values[2].split("=")[1]:"",values.length>3?values[3].split("=")[1]:"",values.length>4?values[4].split("=")[1]:"",values.length>5?values[5].split("=")[1]:"",values.length>6?values[6].split("=")[1]:"",values.length>7?values[7].split("=")[1]:"");}else{return null};}
function saveOrder(order){OrderBT=order;if(document.attachEvent){window.attachEvent("onload",processSaveOrder);}
else{window.addEventListener("load",function(e){processSaveOrder();},false);}}
function processSaveOrder(){var orderC=getOrder(readCookie(O));var body=createOrderBody(OrderBT);if(orderC!=null){deleteCookie(O);if(OrderBT.OrderMerchantId===orderC.OrderMerchantId){body="JsId="+orderC.JsId+"&VisitorId="+orderC.VisitorId;}
else{saveOrderInCookie(body);}}else{saveOrderInCookie(body)};callTracker("SaveOrder","ValidPayement="+ValidPayement+"&"+body);body=null;orderC=null;OrderBT=null;return;}
function callTracker(method,body){return callWS(UrlTracker+method,"StoreId="+StoreId+"&"+body);}
function callWS(url,body){var img=new Image(1,1);img.id=url;img.alt=" ";img.onload=function(img){if(isDefined(img)&&isDefined(img.target)){img.target.style.display="none";}else if(isDefined(this.style)){this.style.display="none";}return;};img.src=url+"?"+body;document.getElementsByTagName("body")[0].appendChild(img);return;}
function saveValueInCookie(name,value){var date=new Date();date.setTime(date.getTime()+DaysLastCookie*86400000);writeCookie(name,value,date);return;}
function saveLandingInCookie(body){saveValueInCookie(L,body);return;}
function saveOrderInCookie(body){saveValueInCookie(O,body);return;}
function gup(name){name=name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");var regexS="[\\?&|&amp;]"+name+"=([^&#]*)";var regex=new RegExp(regexS);var results=regex.exec(window.location.href);return results==null?"":results[1];}
function getUrl(){return escape(window.location.href);}
function isDefined(value){return typeof(value)!=='undefined'&&value!=null;}
function isNullOrEmpty(value){return typeof(value)=='undefined'||value==null||value=="";}
function newId(seed){return Math.round(Math.random()*seed)+"_"+Math.round(new Date().getTime()/1000);}
function newJsId(){return newId(9874625413);}
function newVisitorId(){return newId(2147483647);}
function writeCookie(name,value,expires){document.cookie=name+"="+escape(value)+(expires==null?"":";expires="+expires.toGMTString())+";path=/";return;}
function deleteCookie(name){document.cookie=name+'=;expires=Thu, 01 Jan 1970;';return;}
function extractCookieValue(offset){var end=document.cookie.indexOf(";",offset);return unescape(document.cookie.substring(offset,end==-1?document.cookie.length:end));}
function readCookie(name){var arg=name+"=";var alen=arg.length;var clen=document.cookie.length;var i=0;while(i<clen){var j=i+alen;if(document.cookie.substring(i,j)==arg){return extractCookieValue(j);}
i=document.cookie.indexOf(" ",i)+1;if(i==0)break;}
return null;}