jQuery.fn.imageZoom=function(b){var a=jQuery.extend({speed:200,dontFadeIn:1,hideClicked:1,imageMargin:30,className:"jquery-image-zoom",loading:"Loading..."},b);a.doubleSpeed=a.speed/4;return this.click(function(h){var d=jQuery(h.target),b=d.is("a")?d:d.parents("a");b=b&&b.is("a")&&typeof b.attr("href")!="undefined"&&b.attr("href").search(/(.*)\.(jpg|jpeg|gif|png|bmp|tif|tiff)$/gi)!=-1?b:false;var c=b&&b.find("img").length?b.find("img"):false;if(b){b.oldText=b.text();b.setLoadingImg=function(){if(c)c.css({opacity:"0.5"});else b.text(a.loading)};b.setNotLoadingImg=function(){if(c)c.css({opacity:"1"});else b.text(b.oldText)};var e=b.attr("href");if(jQuery("div."+a.className+' img[src="'+e+'"]').length)return false;var g=function(){b.setNotLoadingImg();var i=c?c:b,o=c?a.hideClicked:0,n=i.offset(),j={width:i.outerWidth(),height:i.outerHeight(),left:n.left,top:n.top},f=jQuery('<div><img src="'+e+'" alt="" /></div>').css("position","absolute").appendTo(document.body),d={width:f.outerWidth(),height:f.outerHeight()},g={width:jQuery(window).width(),height:jQuery(window).height()};if(d.width>g.width-a.imageMargin*2){var m=g.width-a.imageMargin*2;d.height=m/d.width*d.height;d.width=m}if(d.height>g.height-a.imageMargin*2){var l=g.height-a.imageMargin*2;d.width=l/d.height*d.width;d.height=l}d.left=(g.width-d.width)/2+jQuery(window).scrollLeft();d.top=(g.height-d.height)/2+jQuery(window).scrollTop();var h=jQuery('<a href="#">Close</a>').appendTo(f).hide();o&&b.css("visibility","hidden");f.addClass(a.className).css(j).animate(d,a.speed,function(){h.fadeIn(a.doubleSpeed)});var k=function(){h.fadeOut(a.doubleSpeed,function(){f.animate(j,a.speed,function(){b.css("visibility","visible");f.remove()})});return false};f.click(k);h.click(k)},f=new Image;f.src=e;if(f.complete)g();else{b.setLoadingImg();f.onload=g}return false}})};String.prototype.format=function(){var a=/\{\d+\}/g,b=arguments;return this.replace(a,function(a){return b[a.match(/\d+/)]})};String.prototype.ToElement=function(){return document.getElementById(this)};String.prototype.Trim=function(){return this.replace(/^[ \t]+|[ \t]+$/mg,"")};String.prototype.toBool=function(a){switch(this.toLowerCase()){case"true":case"yes":case"1":return true;case"false":case"no":case"0":case null:return false;default:return a!=undefined?a:false}};String.prototype.IsNumber=function(){return/^ *([0-9]+) *$/.test(this)};Array.prototype.indexOf=function(b){for(var a=0;a<this.length;a++)if(this[a]==b)return a;return-1};Array.prototype.isHas=function(a){return this.indexOf(a)>=0};var MPage=function(){};MPage.Util={FixAjaxPostBackData:function(a){try{for(d in a){a=a[d];break}if(typeof a==="string")if(a.indexOf("[")==0)return eval(a);else if(a.indexOf("{")==0)return(eval("["+a+"]"))[0];return a}catch(b){return null}}};MPage.ajax={onError:function(a,b){if(b=="abort")return;else if(b=="timeout")alert("Timeout! Please try again...");else if(a.status==500&&a.statusText=="Internal Server Error")try{var c=(eval("["+a.responseText+"]"))[0].Message;switch(c){case"999-888-888":alert("User has no permission or not logged in!");break;case"777-666-555":alert("Your browser session has ended. Close browser and login again.");break;default:alert("Error 000-432-484! \n\n"+TOOLS.String.HtmlEncode(c))}}catch(e){alert("Error 000-543-511!\n\n"+a.responseText)}else if(a.status==401&&a.statusText=="Unauthorized")alert("You are not logged in!");else if(a.status==503&&a.statusText=="Service Unavailable")alert("Service Unavailable (probably stoped for upgrade).\nPlease try again later.");else alert("Error 000-101-200 !!!\n\nCode: {0}\n{1}\n\n{2}".format(a.status,a.statusText,a.responseText))}};$(function(){$(document.body).imageZoom({dontFadeIn:0,loading:"..."})})
