/*
 * @author Gproxy Design Inc.
 * @copyright (c) 2009, Gproxy Design Inc. All rights reserved.
 * @version 2.5
 *
 * Gproxy doesn't allow to copy or change this code without Gproxy authorization. 
 * See http://www.gproxy.com/licenses/license01.pdf for the full license governing this code. 
 */
function wlpAddItemCookie(b,a){var e=wlpReadCookie("itemId");if(e!=null&&e!=""){wlpEraseCookie("itemId");var d="/app/site/hosting/scriptlet.nl?script=customscript_wlp_additem&deploy=customdeploy_wlp_additem&customerid="+escape(b)+"&sitenumber="+a+"&itemid="+e;var c=document.createElement("script");c.setAttribute("type","text/javascript");c.setAttribute("src",d);document.getElementsByTagName("head")[0].appendChild(c)}}function wlpAddItem(b,a,f,c){if(b==""){wlpCreateCookie("itemId",f,10);window.location.href=c}else{var e="/app/site/hosting/scriptlet.nl?script=customscript_wlp_additem&deploy=customdeploy_wlp_additem&customerid="+escape(b)+"&sitenumber="+a+"&itemid="+f;var d=document.createElement("script");d.setAttribute("type","text/javascript");d.setAttribute("src",e);document.getElementsByTagName("head")[0].appendChild(d)}}function wlpRemoveItem(b,a,e){var d="/app/site/hosting/scriptlet.nl?script=customscript_wlp_removeitem&deploy=customdeploy_wlp_removeitem&customerid="+escape(b)+"&sitenumber="+a+"&itemid="+e;var c=document.createElement("script");c.setAttribute("type","text/javascript");c.setAttribute("src",d);document.getElementsByTagName("head")[0].appendChild(c)}function wlpClearItems(b,a){var d="/app/site/hosting/scriptlet.nl?script=customscript_wlp_clearitems&deploy=customdeploy_wlp_clearitems&customerid="+escape(b)+"&sitenumber="+a;var c=document.createElement("script");c.setAttribute("type","text/javascript");c.setAttribute("src",d);document.getElementsByTagName("head")[0].appendChild(c)}function wlpShowItems(c,b,d){var a=0;if(c==""){window.location.href=d}else{$j("#wlp_cnt_loading").show();$j("#wlp_cnt_items").hide();var e="/app/site/hosting/scriptlet.nl?script=customscript_wlp_getitems&deploy=customdeploy_wlp_getitems&customerid="+escape(c)+"&sitenumber="+b+"&callback=?";$j.ajax({url:e,type:"GET",dataType:"jsonp",success:function(f){if(f.Errors.length>0){$j.each(f.Errors,function(g,h){wlpErrorManager("Show Items",h.code,h.details)})}else{$j.each(f.Results,function(g,h){$j("#wlp_cnt_items").html(unescape(h.html))});a=f.Items.length;$j.each(f.Items,function(g,h){$j("#wlp_cnt_loading").show();$j.ajax({url:unescape(h.url),type:"GET",dataType:"html",success:function(q){var l=q;strStart="<!--BEGIN_GPR_SALESPRICE";strEnd="END_GPR_SALESPRICE-->";intI=l.indexOf(strStart);intF=l.indexOf(strEnd);var o="&nbsp;";if(intI!=-1&&intF!=-1){intI+=strStart.length;var o=l.substring(intI,intF)}$j("#price_"+h.internalid).html(unescape(o));strStart="<!--BEGIN_GPR_STKMESSAGE";strEnd="END_GPR_STKMESSAGE-->";intI=l.indexOf(strStart);intF=l.indexOf(strEnd);var m="";if(intI!=-1&&intF!=-1){intI+=strStart.length;var m=l.substring(intI,intF)}$j("#stkmessage_"+h.internalid).html(unescape(m));strStart="<!--BEGIN_GPR_ITEMOPTIONS";strEnd="END_GPR_ITEMOPTIONS-->";intI=l.indexOf(strStart);intF=l.indexOf(strEnd);var k="";if(intI!=-1&&intF!=-1){intI+=strStart.length;var k=l.substring(intI,intF)}strStart="<!--BEGIN_GPR_ADDTOCARTITEMID";strEnd="END_GPR_ADDTOCARTITEMID-->";intI=l.indexOf(strStart);intF=l.indexOf(strEnd);var n="&nbsp;";if(intI!=-1&&intF!=-1){intI+=strStart.length;var n=l.substring(intI,intF)}strStart="<!--BEGIN_GPR_ADDTOCARTQTY";strEnd="END_GPR_ADDTOCARTQTY-->";intI=l.indexOf(strStart);intF=l.indexOf(strEnd);var j="&nbsp;";if(intI!=-1&&intF!=-1){intI+=strStart.length;var j=l.substring(intI,intF)}$j("#form"+h.internalid).html(unescape(k+n+j));strStart="<!--BEGIN_GPR_ADDTOCARTCLICKSCRIPT";strEnd="END_GPR_ADDTOCARTCLICKSCRIPT-->";intI=l.indexOf(strStart);intF=l.indexOf(strEnd);var p="#";if(intI!=-1&&intF!=-1){intI+=strStart.length;var p=l.substring(intI,intF)}$j("#addtocart_img_"+h.internalid).attr("onclick",unescape(p));strStart="<!--BEGIN_GPR_ADDTOCARTSUBMITSCRIPT";strEnd="END_GPR_ADDTOCARTSUBMITSCRIPT-->";intI=l.indexOf(strStart);intF=l.indexOf(strEnd);var i="#";if(intI!=-1&&intF!=-1){intI+=strStart.length;var i=l.substring(intI,intF)}$j("#addtocart_onsubmit_"+h.internalid).html(unescape(i))},complete:function(i,j){$j("#wlp_cnt_loading").hide();a--;if(a<=0){$j("#wlp_cnt_items").fadeIn(1000)}},error:function(i,k,j){wlpErrorManager("Get Item Info",k,j)}})})}},complete:function(f,g){$j("#wlp_cnt_loading").hide()},error:function(f,h,g){wlpErrorManager("Show Items",h,g)}})}}var itemsCart=new Array();function wlpAddToCart(b,f){var d="";var c=false;for(var e=0;e<itemsCart.length;e++){var a=itemsCart[e];var g=document.getElementById(a.id.replace("qty","chk")).checked;if(g){if(a.qty>0){d+=a.id.replace("qty_","")+","+a.qty+";"}else{document.getElementById(a.id).value=1;c=true;break}}}if(c){alert("Invalid number (must be greater than 0).")}else{if(d!=""){d=d.substr(0,d.length-1);document.location="/app/site/backend/additemtocart.nl?c="+b+"&n="+f+"&qtyadd=1&buyid=multi&multi="+d}else{alert("No products selected")}}}function wlpPopItemX_ID(a){for(var b=0;b<itemsCart.length;b++){if(itemsCart[b].id==a){itemsCart.splice(b,1);break}}}function wlpQtyChanged(a){wlpPopItemX_ID(a);var b=document.getElementById(a).value;itemsCart[itemsCart.length]={id:a,qty:b}}function wlpLoadItemsArray(a){itemsArray=a.split(";");for(var b=0;b<itemsArray.length-1;b++){var c=itemsArray[b].split(",")[0];wlpQtyChanged("qty_"+c)}}function wlpRedirectGProxy(){window.open("http://www.gproxy.com")}function wlpCreateCookie(c,d,e){if(e){var b=new Date();b.setTime(b.getTime()+(e*24*60*60*1000));var a="; expires="+b.toGMTString()}else{var a=""}document.cookie=c+"="+escape(d)+a+"; path=/"}function wlpReadCookie(a){if(document.cookie.length>0){c_start=document.cookie.indexOf(a+"=");if(c_start!=-1){c_start=c_start+a.length+1;c_end=document.cookie.indexOf(";",c_start);if(c_end==-1){c_end=document.cookie.length}return unescape(document.cookie.substring(c_start,c_end))}}return null}function wlpEraseCookie(a){wlpCreateCookie(a,"",10)}function wlpAddEvent(d,c,b,a){if(d.addEventListener){d.addEventListener(c,b,a);return true}else{if(d.attachEvent){return(d.attachEvent("on"+c,b))}else{return false}}}function wlpErrorManager(b,c,a){$j("#wlp_cnt_msgerror").append("<li>Wish List Error, "+b+", code: "+unescape(c)+", details: "+unescape(a)+"</li>")};