Type.registerNamespace("WinDoH.Escher");WinDoH.Escher.View=function(){WinDoH.Escher.View.initializeBase(this);this._msgs={};this._iRows=null;this._iColumns=null;this._sImageSyntax=null;this._sPageChangeJS=null;this._bCaptionDisplayTitle=null;this._bCaptionDisplayInline=null;this._bCaptionDisplayAbove=null;this._bCaptionDisplayPolaroid=null;this._bCaptionTitle=null;this._bCaptionDesc=null;this._nextButton=null;this._prevButton=null;this._imagesPanel=null;this._updateSuccessDelegate=Function.createDelegate(this,this._updateSuccess);this._updateFailDelegate=Function.createDelegate(this,this._updateFail)};WinDoH.Escher.View.prototype={get_ns:function(a){return this.get_id()+"_"+a},get_msgs:function(){return this._msgs},set_msgs:function(a){this._msgs=Sys.Serialization.JavaScriptSerializer.deserialize(a)},get_iRows:function(){return this._iRows},set_iRows:function(a){this._iRows=a},get_iColumns:function(){return this._iColumns},set_iColumns:function(a){this._iColumns=a},get_sImageSyntax:function(){return this._sImageSyntax},set_sImageSyntax:function(a){this._sImageSyntax=a},get_sPageChangeJS:function(){return this._sPageChangeJS},set_sPageChangeJS:function(a){this._sPageChangeJS=a},get_bCaptionDisplayTitle:function(){return this._bCaptionDisplayTitle},set_bCaptionDisplayTitle:function(a){this._bCaptionDisplayTitle=a},get_bCaptionDisplayInline:function(){return this._bCaptionDisplayInline},set_bCaptionDisplayInline:function(a){this._bCaptionDisplayInline=a},get_bCaptionDisplayAbove:function(){return this._bCaptionDisplayAbove},set_bCaptionDisplayAbove:function(a){this._bCaptionDisplayAbove=a},get_bCaptionDisplayPolaroid:function(){return this._bCaptionDisplayPolaroid},set_bCaptionDisplayPolaroid:function(a){this._bCaptionDisplayPolaroid=a},get_bCaptionTitle:function(){return this._bCaptionTitle},set_bCaptionTitle:function(a){this._bCaptionTitle=a},get_bCaptionDesc:function(){return this._bCaptionDesc},set_bCaptionDesc:function(a){this._bCaptionDesc=a},initialize:function(){WinDoH.Escher.View.callBaseMethod(this,"initialize");this._nextButton=$get(this.get_ns("bNext"));this._prevButton=$get(this.get_ns("bPrev"));this._imagesPanel=$get(this.get_ns("pImages"));if(this._nextButton){$addHandlers(this._nextButton,{click:this._onPageChange},this)}if(this._prevButton){$addHandlers(this._prevButton,{click:this._onPageChange},this)}},_onPageChange:function(b,a){b.preventDefault();this._displayWait(true);dnn.xmlhttp.callControlMethod("WinDoH.Escher.View."+this.get_id(),"LoadData",{startIndex:b.target.getAttribute("startIndex"),maxResults:this._iRows*this._iColumns},this._updateSuccessDelegate,this._updateFailDelegate)},getMessage:function(a){return this._msgs[a]},showMessage:function(a){$get(this.get_ns("lblResponse")).innerHTML=a},_createChildControl:function(a,d,c){var b=document.createElement(a);if(d){b.id=this.get_ns(d)}if(c){b.type=c}return b},_createImage:function(c,a,e,d){link=this._createChildControl("a");link.href=a;if(this._bCaptionDisplayTitle){if(e&&d&&this._bCaptionTitle&&this._bCaptionDesc){link.title=e+"&mdash;"+d}else{if(e&&this._bCaptionTitle){link.title=e}else{if(d&&this._bCaptionDesc){link.title=d}}}}var b=null;for(var f=0;f<this.get_sImageSyntax().length;f++){b=this.get_sImageSyntax()[f].split("=");link.setAttribute(b[0],b[1])}img=this._createChildControl("img");img.src=c;img.border=0;if(this._bCaptionDisplayTitle&&this._bCaptionDisplayAbove){aboveImg=this._createChildControl("span");aboveImg.innerHTML=e;link.appendChild(aboveImg)}link.appendChild(img);if(this._bCaptionDisplayTitle&&this._bCaptionDisplayPolaroid){polaroidImg=this._createChildControl("span");polaroidImg.innerHTML=e;link.appendChild(polaroidImg)}return link},_createOverlay:function(b,a){b.preventDefault();tb_show(b.target.parentNode.title,b.target.parentNode.href,b.target.parentNode.rel)},_updateSuccess:function(payload,ctx,req){this._prevButton.setAttribute("startIndex",payload.Start-payload.Size);this._nextButton.setAttribute("startIndex",payload.Start+payload.Size);var totalSum=payload.Start+payload.Size-1;totalSum=(totalSum>payload.Total?payload.Total:totalSum);$get(this.get_ns("lPageInfo")).innerHTML=String.format("Displaying {0}-{1} of {2} items.",payload.Start,totalSum,payload.Total);if(totalSum==payload.Total){$(this._nextButton).hide()}else{$(this._nextButton).show()}if(payload.Start==1){$(this._prevButton).hide()}else{$(this._prevButton).show()}var table=this._createChildControl("table");table.className="escher";var tbody=this._createChildControl("tbody");var row=this._iRows;var col=this._iColumns;var c_row=0;var c_col=0;for(var i=0;i<payload.Rows.length;i++){var c2=c_col%col;if(c2==0&&c_col!=0){c_row++;c_col=0;tbody.appendChild(row_current);row_current=this._createChildControl("tr")}else{if(c_row==0&&c_col==0&&c2==0){row_current=this._createChildControl("tr")}}c_col++;cell_current=this._createChildControl("td");cell_current.appendChild(this._createImage(payload.Rows[i].Thumb,payload.Rows[i].Full,payload.Rows[i].Name,payload.Rows[i].Desc));if(this._bCaptionDisplayInline){txt=this._createChildControl("span");if(payload.Rows[i].Name&&payload.Rows[i].Desc&&this._bCaptionTitle&&this._bCaptionDesc){txt.innerHTML=payload.Rows[i].Name+"&mdash;"+payload.Rows[i].Desc}else{if(payload.Rows[i].Name&&this._bCaptionTitle){txt.innerHTML=payload.Rows[i].Name}else{if(payload.Rows[i].Desc&&this._bCaptionDesc){txt.innerHTML=payload.Rows[i].Desc}}}cell_current.appendChild(txt)}row_current.appendChild(cell_current)}tbody.appendChild(row_current);table.appendChild(tbody);$("#"+this.get_ns("pImages")).empty();$("#"+this.get_ns("pImages")).append(table);if(this.get_sPageChangeJS().length>0){eval(this.get_sPageChangeJS())}this._displayWait(false)},_updateFail:function(c,b,a){this._displayWait(false);alert("error: "+c)},_displayWait:function(a){$get(this.get_ns("imgAjax")).className=(a?"":"ohHidden");ctl=$(this._imagesPanel);if(a){ctl.css("height",ctl.height()).css("width",ctl.width());ctl.fadeOut("slow")}else{$(document).ready(function(){ctl.fadeIn("slow")})}},dispose:function(){if(this._nextButton){$clearHandlers(this._nextButton)}if(this._prevButton){$clearHandlers(this._prevButton)}this._msgs={};this._iRows=null;this._iColumns=null;this._sImageSyntax=null;this._sPageChangeJS=null;this._bCaptionDisplayTitle=null;this._bCaptionDisplayInline=null;this._bCaptionDisplayAbove=null;this._bCaptionDisplayPolaroid=null;this._bCaptionTitle=null;this._bCaptionDesc=null;this._nextButton=null;this._prevButton=null;this._imagesPanel=null;this._updateSuccessDelegate=null;this._updateFailDelegate=null}};WinDoH.Escher.View.registerClass("WinDoH.Escher.View",Sys.Component);