function agencyInventory_callback(r){if(r.agencyInventory.length>0){var k=r.agencyInventory,t=k.length;if(typeof listing_per_page=="undefined")listing_per_page=3;var n;switch(zeeID){case "48":n="active_images/aberdeen";break;case "6":n="active_images/dickinson";break;case "36":n="active_images/duluth";break;case "63":n="active_images/lexington";break;case "68":n="active_images/toledo";break;case "1":n="active_images";break;default:n="active_images"}jQuery.fn.pagination=function(d,a){a=jQuery.extend({items_per_page:3,
num_display_entries:5,current_page:0,num_edge_entries:0,link_to:"#",prev_text:"Prev",next_text:"Next",ellipse_text:"...",prev_show_always:true,next_show_always:true,callback:function(){return false}},a||{});return this.each(function(){function s(){var b=Math.ceil(a.num_display_entries/2),e=g(),l=e-a.num_display_entries;l=c>b?Math.max(Math.min(c-b,l),0):0;b=c>b?Math.min(c+b,e):Math.min(a.num_display_entries,e);return[l,b]}function j(){h.empty();var b=s(),e=g(),l=function(i){return function(o){return q(i,
o)}},p=function(i,o){i=i<0?0:i<e?i:e-1;o=jQuery.extend({text:i+1,classes:""},o||{});i=i==c?jQuery("<span style='display:block;float:left;padding:0.3em 0.5em;margin-right:5px;margin-bottom:5px;background:#7d7d64;color:#fff;border:solid 1px #333;'>"+o.text+"</span>"):jQuery("<a>"+o.text+"</a>").css({display:"block","float":"left",padding:"0.3em 0.5em","margin-right":"5px","margin-bottom":"5px","text-decoration":"none",border:"solid 1px #333",color:"#333"}).hover(function(){jQuery(this).css("color",
"#087700")},function(){jQuery(this).css("color","#333")}).bind("click",l(i)).attr("href",a.link_to.replace(/__id__/,i));o.classes&&i.css({color:"#cdcebd","border-color":"#cdcebd",background:"#fff"});h.append(i)};if(a.prev_text&&(c>0||a.prev_show_always))p(c-1,{text:a.prev_text,classes:"prev"});if(b[0]>0&&a.num_edge_entries>0){for(var m=Math.min(a.num_edge_entries,b[0]),f=0;f<m;f++)p(f);a.num_edge_entries<b[0]&&a.ellipse_text&&jQuery("<span style='display:block;float:left;padding:0.3em 0.5em;margin-right:5px;margin-bottom:5px;'>"+
a.ellipse_text+"</span>").appendTo(h)}for(m=b[0];m<b[1];m++)p(m);if(b[1]<e&&a.num_edge_entries>0){e-a.num_edge_entries>b[1]&&a.ellipse_text&&jQuery("<span style='display:block;float:left;padding:0.3em 0.5em;margin-right:5px;margin-bottom:5px;'>"+a.ellipse_text+"</span>").appendTo(h);for(b=Math.max(e-a.num_edge_entries,b[1]);b<e;b++)p(b)}if(a.next_text&&(c<e-1||a.next_show_always))p(c+1,{text:a.next_text,classes:"next"})}function q(b,e){c=b;j();b=a.callback(b,h);if(!b)if(e.stopPropagation)e.stopPropagation();
else e.cancelBubble=true;return b}var c=a.current_page;d=!d||d<0?1:d;a.items_per_page=!a.items_per_page||a.items_per_page<0?1:a.items_per_page;var h=jQuery(this),g=function(){return Math.ceil(d/a.items_per_page)};this.selectPage=function(b){q(b)};this.prevPage=function(){if(c>0){q(c-1);return true}else return false};this.nextPage=function(){if(c<g()-1){q(c+1);return true}else return false};j();a.callback(c,this)})};r=jQuery("<span></span>").css("float","right").html('<a href="http://www.homeshq.com/?zeeID='+
zeeID+'" title="homesHQ.com"><img src="http://widgets.fccinteractive.com/homeshq/images/homesHQBrand.png" style="border:none;" alt="homesHQ.com" /></a>');var v=jQuery("<span></span>").css({"font-family":"Arial, Helvetica, sans-serif","font-size":"80%"}).attr("id","inventoryPagination");jQuery("#brand").css({clear:"both",display:"block"}).append(v).append(r);var u=1,w=function(d,a){a=jQuery("<div></div>");var s=Math.min((d+1)*listing_per_page,t);for(d=d*listing_per_page;d<s;d++){var j=k[d].list_number,
q=k[d].list_price,c=k[d].address,h=k[d].city,g=k[d].state,b=k[d].total_bedrooms,e=k[d].total_bathrooms,l=k[d].total_sqft,p=k[d].remark1,m=k[d].agency_name,f="";if(c!=="")f=c;if(h!=="")f+=f!==""?", "+h:h;if(g!=="")f+=f!==""?", "+g:g;g=j.substring(0,4);c=jQuery("<div></div>").css({display:"block",margin:"0 auto",padding:"4px",border:"#fff 2px solid","border-bottom":"#cccccc 2px dotted","font-size":"small",cursor:"pointer"}).attr({id:"listing"+u,href:"http://www.homeshq.com/search/?page=detail&list_number="+
j+"&zeeID="+zeeID}).hover(function(){jQuery(this).css({"background-color":"#fffae7",border:"#087700 2px solid"});jQuery(this).prev().css("border","#ffffff 2px solid")},function(){jQuery(this).css({"background-color":"#ffffff",border:"#ffffff 2px solid","border-bottom":"#cccccc 2px dotted"});jQuery(this).prev().css("border-bottom","#cccccc 2px dotted")}).click(function(){window.open(jQuery(this).attr("href"),"new_window")});h=jQuery("<div></div>");var i=jQuery("<span></span>").css("width","325px").html('<a href="http://www.homeshq.com/search/?page=detail&list_number='+
j+"&zeeID="+zeeID+'" title="'+f+'" style="color:#087700;font-weight:bold;text-decoration:none;">'+f+"</a>");jQuery(h).append(i);jQuery(c).append(h);jQuery(c).append('<p style="clear:both;"></p>');h=jQuery("<div></div>").css({"float":"left",width:"auto","font-size":"x-small","font-weight":"bold","padding-right":"1em",color:"#087700"});f=jQuery("<a></a>").attr({href:"http://www.homeshq.com/search/?page=detail&list_number="+j+"&zeeID="+zeeID,title:f}).html('<img src="http://www.homeshq.com/'+n+"/thumbnails/"+
g+"/"+j+'_1.jpg" style="border:none;" alt="'+f+'" />');jQuery(h).append(f);f=jQuery("<div></div>");g="";if(b!=="")g+=b+" Bed";if(e!==""){e.replace(/\.00/,"");g+=g!==""?" "+e+" Bath":e+" Bath"}if(l!==""){l.replace(/\.00/,"");g+=g!=""?" "+l+" sqft":l+" sqft"}g!==""?jQuery(f).html(g+"<br />Listing: "+j):jQuery(f).html("Listing: "+j);jQuery(h).append(f);jQuery(c).append(h);j=jQuery("<span></span>").css({"font-size":"x-large","font-weight":"bold"}).text(q);m=jQuery("<div></div>").css({display:"block",
"font-size":"xx-small",color:"#595653"}).html('<span style="font-weight:bold">Courtesy of:</span> '+m);jQuery(c).append(j);jQuery(c).append(p);jQuery(c).append(m);jQuery(c).append('<p style="clear:both;"></p>');u++;jQuery(a).append(c)}jQuery("#agencyHQInventory_widget").css({clear:"both","font-family":"Arial,Helvetica,sans-serif"}).html(a);return false};jQuery(document).ready(function(){jQuery("#inventoryPagination").pagination(t,{callback:w,items_per_page:listing_per_page})})}};

