/*
 * @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 rviGetItems(b,c){var a=rviReadCookie("rvi_n"+b);if(a!=null&&a!=""){$j("#rvi_cnt_items").hide();var d="/app/site/hosting/scriptlet.nl?script=customscript_rvi_getitems&deploy=customdeploy_rvi_getitems&items="+a+"&sitenumber="+b+"&callback=?";$j.ajax({url:d,type:"GET",dataType:"jsonp",success:function(e){if(e.Errors.length>0){$j.each(e.Errors,function(f,g){rviErrorManager("Show Items",g.code,g.details)})}else{$j.each(e.Results,function(f,g){$j("#rvi_cnt_items").html(unescape(g.html))});intCntItems=e.Items.length;$j.each(e.Items,function(f,g){$j.ajax({url:unescape(g.url),type:"GET",dataType:"html",success:function(k){var i=k;strStart="<!--BEGIN_GPR_SALESPRICE";strEnd="END_GPR_SALESPRICE-->";intI=i.indexOf(strStart);intF=i.indexOf(strEnd);var j="&nbsp;";if(intI!=-1&&intF!=-1){intI+=strStart.length;j=i.substring(intI,intF)}$j("#rvi_price_"+g.internalid).html(unescape(j));strStart="<!--BEGIN_GPR_STKMESSAGE";strEnd="END_GPR_STKMESSAGE-->";intI=i.indexOf(strStart);intF=i.indexOf(strEnd);var h="&nbsp;";if(intI!=-1&&intF!=-1){intI+=strStart.length;h=i.substring(intI,intF)}$j("#rvi_stkmessage_"+g.internalid).html(unescape(h))},complete:function(h,i){intCntItems--;if(intCntItems<=0){$j("#rvi_cnt_items").fadeIn(1000)}},error:function(h,j,i){rviErrorManager("Get Item Info",j,i)}})})}},error:function(e,g,f){wlpErrorManager("Show Items",g,f)}})}}function rviSaveItemCookie(f,b){var d="";var e="";var c=false;if(f!=""){var e=rviReadCookie("rvi_n"+b);if(e==null){d=f}else{items=e.split(",");for(var a=0;a<items.length;a++){if(f==items[a]){c=true;break}}if(!c){d=f+","+e}else{d=e}}rviCreateCookie("rvi_n"+b,d,10)}}function rviCreateCookie(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 rviReadCookie(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 rviEraseCookie(a){rviCreateCookie(a,"",10)}function rviErrorManager(b,c,a){$j("#rvi_cnt_msgerror").append("<li>Recently Viewed Items Error, "+b+", code: "+unescape(c)+", details: "+unescape(a)+"</li>")};