

var slideTimer;$(document).ready(function(){$(".dk-cart-nav-button").livequery("click",getCartItems);$("#dkp-shopping-cart-list").click(function(){$("#showCartList").toggle()});$("#dkp-recent-view-list").click(function(){getRecentViewItems()});getCartItems();$("#hid_loaded").val(1)});function getCartItems(){var a=Math.floor(Math.random()*10000);var b="hiii"+a;url=(this.href)?this.href:"/shopping/cart/?viewrefrence="+b+"&view=lightbox";arg="";$.ajax({url:url,type:"GET",data:arg,beforeSend:function(){$("#showCartList").html('<b><img src="/images/animation/loading.gif" /></b>')},success:function(c){$("#showCartList").html(c);return false}});return false}function getRecentViewItems(){url=(this.href)?this.href:"/design/recentView";arg="";$.ajax({url:url,type:"GET",data:arg,beforeSend:function(){$("#showRecentView1").html('<b><img src="/images/animation/loading.gif" /></b>')},success:function(a){$("#showRecentView1").html(a);$("#showRecentView1").toggle();return false}});return false}function getCartCountItems(){var a=Math.floor(Math.random()*10000);var b="hellooo"+a;url=(this.href)?this.href:"/shopping/totalitems/?var="+b;arg="";$.ajax({url:url,type:"GET",data:arg,success:function(c){$("#footerShowTotalItems").html(c);if(parseInt(c)!=0){$("#dkp-cart-image").attr("src","/images/cart-items.gif")}else{$("#dkp-cart-image").attr("src","/images/cart.gif");$("#shoppingdiv").css("display","none")}$("#headerShowTotalItems").html(c)}})}function showList(a){a=(a)?a:400;$("#showCartList").slideDown(a);if(a>500){slideTimer=setTimeout("hideList()",6000)}return false}function hideList(){$("#showCartList").css("display","none")}function hideViewList(){$("#showRecentView1").css("display","none")}function delItemInSlider(a){if(confirm("Are you sure you want to delete\n this Item from the Cart?")){$.ajax({url:"/shopping/cart/removeItem/"+a,type:"GET",success:function(c){$("#dkp-cart-item-slider-"+a).remove();var b=getCartItems();getCartCountItems();if(($("#billingUrl").val())&&($("#billingUrl").val()=="/shopping/cart/billing-shipping/")){location.reload()}}})}return false};

var imgCache="";function cart(c,b){var a=$("#pidfield").val();arg="designId="+c;url="/shopping/cart/addItem/"+c;$.ajax({url:url,type:"GET",data:arg,beforeSend:function(){$("#dkp-"+b+"-to-cart-img-btn-"+c).parent().attr("onclick","");imgCache=$("#dkp-"+b+"-to-cart-img-btn-"+c).attr("src");$("#dkp-"+b+"-to-cart-img-btn-"+c).attr({src:"/images/animation/loading.gif"})},success:function(e){if(e=="success"){if(b=="buy"){if($("#pidfield").val()!=""){window.location.href="/shopping/cart/?pid="+a}else{window.location.href="/shopping/cart"}return true}$("#dkp-"+b+"-to-cart-img-btn-"+c).parent().attr("onclick","cart("+c+", '"+b+"');return false;");$("#dkp-"+b+"-to-cart-img-btn-"+c).attr({src:imgCache});var d=getCartItems();getCartCountItems();showList(3000);return true}else{return false}}})}function subdomain_cart(c,b){var a=$("#pidfield").val();arg="designId="+c;url="/shopping/cart/addItem/"+c;$.ajax({url:url,type:"GET",data:arg,beforeSend:function(){$("#dkp-"+b+"-to-cart-img-btn-"+c).parent().attr("onclick","");imgCache=$("#dkp-"+b+"-to-cart-img-btn-"+c).attr("src");$("#dkp-"+b+"-to-cart-img-btn-"+c).attr({src:"/images/animation/loading.gif"})},success:function(d){if(d=="success"){if(b=="buy"){if($("#pidfield").val()!=""){window.location.href="/shopping/cart/?pid="+a}else{window.location.href="/shopping/cart"}return true}if(b=="add"){$("#bg-image-container"+c).show();$("#bg-image-container"+c).fadeOut(8500)}getCartCountItems();return true}else{return false}}})};

(function(a){a.extend(a.fn,{livequery:function(f,e,d){var c=this,g;if(a.isFunction(f)){d=e,e=f,f=undefined}a.each(a.livequery.queries,function(h,j){if(c.selector==j.selector&&c.context==j.context&&f==j.type&&(!e||e.$lqguid==j.fn.$lqguid)&&(!d||d.$lqguid==j.fn2.$lqguid)){return(g=j)&&false}});g=g||new a.livequery(this.selector,this.context,f,e,d);g.stopped=false;a.livequery.run(g.id);return this},expire:function(f,e,d){var c=this;if(a.isFunction(f)){d=e,e=f,f=undefined}a.each(a.livequery.queries,function(g,h){if(c.selector==h.selector&&c.context==h.context&&(!f||f==h.type)&&(!e||e.$lqguid==h.fn.$lqguid)&&(!d||d.$lqguid==h.fn2.$lqguid)&&!this.stopped){a.livequery.stop(h.id)}});return this}});a.livequery=function(c,e,g,f,d){this.selector=c;this.context=e||document;this.type=g;this.fn=f;this.fn2=d;this.elements=[];this.stopped=false;this.id=a.livequery.queries.push(this)-1;f.$lqguid=f.$lqguid||a.livequery.guid++;if(d){d.$lqguid=d.$lqguid||a.livequery.guid++}return this};a.livequery.prototype={stop:function(){var c=this;if(this.type){this.elements.unbind(this.type,this.fn)}else{if(this.fn2){this.elements.each(function(d,e){c.fn2.apply(e)})}}this.elements=[];this.stopped=true},run:function(){if(this.stopped){return}var e=this;var f=this.elements,d=a(this.selector,this.context),c=d.not(f);this.elements=d;if(this.type){c.bind(this.type,this.fn);if(f.length>0){a.each(f,function(g,h){if(a.inArray(h,d)<0){a.event.remove(h,e.type,e.fn)}})}}else{c.each(function(){e.fn.apply(this)});if(this.fn2&&f.length>0){a.each(f,function(g,h){if(a.inArray(h,d)<0){e.fn2.apply(h)}})}}}};a.extend(a.livequery,{guid:0,queries:[],queue:[],running:false,timeout:null,checkQueue:function(){if(a.livequery.running&&a.livequery.queue.length){var c=a.livequery.queue.length;while(c--){a.livequery.queries[a.livequery.queue.shift()].run()}}},pause:function(){a.livequery.running=false},play:function(){a.livequery.running=true;a.livequery.run()},registerPlugin:function(){a.each(arguments,function(d,e){if(!a.fn[e]){return}var c=a.fn[e];a.fn[e]=function(){var f=c.apply(this,arguments);a.livequery.run();return f}})},run:function(c){if(c!=undefined){if(a.inArray(c,a.livequery.queue)<0){a.livequery.queue.push(c)}}else{a.each(a.livequery.queries,function(d){if(a.inArray(d,a.livequery.queue)<0){a.livequery.queue.push(d)}})}if(a.livequery.timeout){clearTimeout(a.livequery.timeout)}a.livequery.timeout=setTimeout(a.livequery.checkQueue,20)},stop:function(c){if(c!=undefined){a.livequery.queries[c].stop()}else{a.each(a.livequery.queries,function(d){a.livequery.queries[d].stop()})}}});a.livequery.registerPlugin("append","prepend","after","before","wrap","attr","removeAttr","addClass","removeClass","toggleClass","empty","remove");a(function(){a.livequery.play()});var b=a.prototype.init;a.prototype.init=function(d,f){var e=b.apply(this,arguments);if(d&&d.selector){e.context=d.context,e.selector=d.selector}if(typeof d=="string"){e.context=f||document,e.selector=d}return e};a.prototype.init.prototype=a.prototype})(jQuery);

(function(a){a.prompt=function(p,q){q=a.extend({},a.prompt.defaults,q);a.prompt.currentPrefix=q.prefix;var e=(a.browser.msie&&a.browser.version<7);var g=a(document.body);var c=a(window);var b='<div class="'+q.prefix+'box" id="'+q.prefix+'box">';if(q.useiframe&&((a("object, applet").length>0)||e)){b+='<iframe src="javascript:false;" style="display:block;position:absolute;z-index:-1;" class="'+q.prefix+'fade" id="'+q.prefix+'fade"></iframe>'}else{if(e){a("select").css("visibility","hidden")}b+='<div class="'+q.prefix+'fade" id="'+q.prefix+'fade"></div>'}b+='<div class="'+q.prefix+'" id="'+q.prefix+'"><div class="'+q.prefix+'container"><div class="';b+=q.prefix+'close">X</div><div id="'+q.prefix+'states"></div>';b+="</div></div></div>";var o=a(b).appendTo(g);var l=o.children("#"+q.prefix);var m=o.children("#"+q.prefix+"fade");if(p.constructor==String){p={state0:{html:p,buttons:q.buttons,focus:q.focus,submit:q.submit}}}var n="";a.each(p,function(s,r){r=a.extend({},a.prompt.defaults.state,r);p[s]=r;n+='<div id="'+q.prefix+"_state_"+s+'" class="'+q.prefix+'_state" style="display:none;"><div class="'+q.prefix+'message">'+r.html+'</div><div class="'+q.prefix+'buttons">';a.each(r.buttons,function(u,t){n+='<button name="'+q.prefix+"_"+s+"_button"+u+'" id="'+q.prefix+"_"+s+"_button"+u+'" value="'+t+'">'+u+"</button>"});n+="</div></div>"});l.find("#"+q.prefix+"states").html(n).children("."+q.prefix+"_state:first").css("display","block");l.find("."+q.prefix+"buttons:empty").css("display","none");a.each(p,function(t,s){var r=l.find("#"+q.prefix+"_state_"+t);r.children("."+q.prefix+"buttons").children("button").click(function(){var w=r.children("."+q.prefix+"message");var u=s.buttons[a(this).text()];var x={};a.each(l.find("#"+q.prefix+"states :input").serializeArray(),function(y,z){if(x[z.name]===undefined){x[z.name]=z.value}else{if(typeof x[z.name]==Array){x[z.name].push(z.value)}else{x[z.name]=[x[z.name],z.value]}}});var v=s.submit(u,w,x);if(v===undefined||v){d(true,u,w,x)}});r.find("."+q.prefix+"buttons button:eq("+s.focus+")").addClass(q.prefix+"defaultbutton")});var f=function(){o.css({top:c.scrollTop()})};var j=function(){if(q.persistent){var s=0;o.addClass(q.prefix+"warning");var r=setInterval(function(){o.toggleClass(q.prefix+"warning");if(s++>1){clearInterval(r);o.removeClass(q.prefix+"warning")}},100)}else{d()}};var h=function(u){var t=(window.event)?event.keyCode:u.keyCode;if(t==27){d()}if(t==9){var v=a(":input:enabled:visible",o);var s=!u.shiftKey&&u.target==v[v.length-1];var r=u.shiftKey&&u.target==v[0];if(s||r){setTimeout(function(){if(!v){return}var w=v[r===true?v.length-1:0];if(w){w.focus()}},10);return false}}};var i=function(){o.css({position:(e)?"absolute":"fixed",height:c.height(),width:"100%",top:(e)?c.scrollTop():0,left:0,right:0,bottom:0});m.css({position:"absolute",height:c.height(),width:"100%",top:0,left:0,right:0,bottom:0});l.css({position:"absolute",top:q.top,left:"50%",marginLeft:((l.outerWidth()/2)*-1)})};var k=function(){m.css({zIndex:q.zIndex,display:"none",opacity:q.opacity});l.css({zIndex:q.zIndex+1,display:"none"});o.css({zIndex:q.zIndex})};var d=function(t,s,u,r){l.remove();if(e){g.unbind("scroll",f)}c.unbind("resize",i);m.fadeOut(q.overlayspeed,function(){m.unbind("click",j);m.remove();if(t){q.callback(s,u,r)}o.unbind("keypress",h);o.remove();if(e&&!q.useiframe){a("select").css("visibility","visible")}})};i();k();if(e){c.scroll(f)}m.click(j);c.resize(i);o.bind("keydown keypress",h);l.find("."+q.prefix+"close").click(d);m.fadeIn(q.overlayspeed);l[q.show](q.promptspeed,q.loaded);l.find("#"+q.prefix+"states ."+q.prefix+"_state:first ."+q.prefix+"defaultbutton").focus();if(q.timeout>0){setTimeout(a.prompt.close,q.timeout)}return o};a.prompt.defaults={prefix:"jqi",buttons:{Ok:true},loaded:function(){},submit:function(){return true},callback:function(){},opacity:0.6,zIndex:999,overlayspeed:"slow",promptspeed:"fast",show:"fadeIn",focus:0,useiframe:false,top:"15%",persistent:true,timeout:0,state:{html:"",buttons:{Ok:true},focus:0,submit:function(){return true}}};a.prompt.currentPrefix=a.prompt.defaults.prefix;a.prompt.setDefaults=function(b){a.prompt.defaults=a.extend({},a.prompt.defaults,b)};a.prompt.setStateDefaults=function(b){a.prompt.defaults.state=a.extend({},a.prompt.defaults.state,b)};a.prompt.getStateContent=function(b){return a("#"+a.prompt.currentPrefix+"_state_"+b)};a.prompt.getCurrentState=function(){return a("."+a.prompt.currentPrefix+"_state:visible")};a.prompt.getCurrentStateName=function(){var b=a.prompt.getCurrentState().attr("id");return b.replace(a.prompt.currentPrefix+"_state_","")};a.prompt.goToState=function(b){a("."+a.prompt.currentPrefix+"_state").slideUp("slow");a("#"+a.prompt.currentPrefix+"_state_"+b).slideDown("slow",function(){a(this).find("."+a.prompt.currentPrefix+"defaultbutton").focus()})};a.prompt.nextState=function(){var b=a("."+a.prompt.currentPrefix+"_state:visible").next();a("."+a.prompt.currentPrefix+"_state").slideUp("slow");b.slideDown("slow",function(){b.find("."+a.prompt.currentPrefix+"defaultbutton").focus()})};a.prompt.prevState=function(){var b=a("."+a.prompt.currentPrefix+"_state:visible").prev();a("."+a.prompt.currentPrefix+"_state").slideUp("slow");b.slideDown("slow",function(){b.find("."+a.prompt.currentPrefix+"defaultbutton").focus()})};a.prompt.close=function(){a("#"+a.prompt.currentPrefix+"box").fadeOut("fast",function(){a(this).remove()})}})(jQuery);