/* * SimpleModal 1.3.3 - jQuery Plugin * http://www.ericmmartin.com/projects/simplemodal/ * Copyright (c) 2009 Eric Martin (http://twitter.com/EricMMartin) * Dual licensed under the MIT and GPL licenses * Revision: $Id: jquery.simplemodal.js 228 2009-10-30 13:34:27Z emartin24 $ */ (function(b){var i=b.browser.msie&&parseInt(b.browser.version)==6&&typeof window.XMLHttpRequest!="object",j=null,d=[];b.modal=function(a,c){return b.modal.impl.init(a,c)};b.modal.close=function(){b.modal.impl.close()};b.fn.modal=function(a){return b.modal.impl.init(this,a)};b.modal.defaults={appendTo:"body",focus:true,opacity:50,overlayId:"simplemodal-overlay",overlayCss:{},containerId:"simplemodal-container",containerCss:{},dataId:"simplemodal-data",dataCss:{},minHeight:200,minWidth:300,maxHeight:null, maxWidth:null,autoResize:false,autoPosition:true,zIndex:1E3,close:true,closeHTML:'',closeClass:"simplemodal-close",escClose:true,overlayClose:false,position:null,persist:false,onOpen:null,onShow:null,onClose:null};b.modal.impl={o:null,d:{},init:function(a,c){if(this.d.data)return false;j=b.browser.msie&&!b.boxModel;this.o=b.extend({},b.modal.defaults,c);this.zIndex=this.o.zIndex;this.occb=false;if(typeof a=="object"){a=a instanceof jQuery?a:b(a);if(a.parent().parent().size()> 0){this.d.parentNode=a.parent();if(!this.o.persist)this.d.orig=a.clone(true)}}else if(typeof a=="string"||typeof a=="number")a=b("
").html(a);else{alert("SimpleModal Error: Unsupported data type: "+typeof a);return this}this.create(a);this.open();b.isFunction(this.o.onShow)&&this.o.onShow.apply(this,[this.d]);return this},create:function(a){d=this.getDimensions();if(i)this.d.iframe=b('').css(b.extend(this.o.iframeCss,{display:"none",opacity:0,position:"fixed", height:d[0],width:d[1],zIndex:this.o.zIndex,top:0,left:0})).appendTo(this.o.appendTo);this.d.overlay=b("").attr("id",this.o.overlayId).addClass("simplemodal-overlay").css(b.extend(this.o.overlayCss,{display:"none",opacity:this.o.opacity/100,height:d[0],width:d[1],position:"fixed",left:0,top:0,zIndex:this.o.zIndex+1})).appendTo(this.o.appendTo);this.d.container=b("").attr("id",this.o.containerId).addClass("simplemodal-container").css(b.extend(this.o.containerCss,{display:"none", position:"fixed",zIndex:this.o.zIndex+2})).append(this.o.close&&this.o.closeHTML?b(this.o.closeHTML).addClass(this.o.closeClass):"").appendTo(this.o.appendTo);this.d.wrap=b("").attr("tabIndex",-1).addClass("simplemodal-wrap").css({height:"100%",outline:0,width:"100%"}).appendTo(this.d.container);this.d.data=a.attr("id",a.attr("id")||this.o.dataId).addClass("simplemodal-data").css(b.extend(this.o.dataCss,{display:"none"})).appendTo("body");this.setContainerDimensions();this.d.data.appendTo(this.d.wrap); if(i||j)this.fixIE()},bindEvents:function(){var a=this;b("."+a.o.closeClass).bind("click.simplemodal",function(c){c.preventDefault();a.close()});a.o.close&&a.o.overlayClose&&a.d.overlay.bind("click.simplemodal",function(c){c.preventDefault();a.close()});b(document).bind("keydown.simplemodal",function(c){if(a.o.focus&&c.keyCode==9)a.watchTab(c);else if(a.o.close&&a.o.escClose&&c.keyCode==27){c.preventDefault();a.close()}});b(window).bind("resize.simplemodal",function(){d=a.getDimensions();a.setContainerDimensions(true); if(i||j)a.fixIE();else{a.d.iframe&&a.d.iframe.css({height:d[0],width:d[1]});a.d.overlay.css({height:d[0],width:d[1]})}})},unbindEvents:function(){b("."+this.o.closeClass).unbind("click.simplemodal");b(document).unbind("keydown.simplemodal");b(window).unbind("resize.simplemodal");this.d.overlay.unbind("click.simplemodal")},fixIE:function(){var a=this.o.position;b.each([this.d.iframe||null,this.d.overlay,this.d.container],function(c,h){if(h){var e=h[0].style;e.position="absolute";if(c<2){e.removeExpression("height"); e.removeExpression("width");e.setExpression("height",'document.body.scrollHeight > document.body.clientHeight ? document.body.scrollHeight : document.body.clientHeight + "px"');e.setExpression("width",'document.body.scrollWidth > document.body.clientWidth ? document.body.scrollWidth : document.body.clientWidth + "px"')}else{var f,g;if(a&&a.constructor==Array){f=a[0]?typeof a[0]=="number"?a[0].toString():a[0].replace(/px/,""):h.css("top").replace(/px/,"");f=f.indexOf("%")==-1?f+' + (t = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"': parseInt(f.replace(/%/,""))+' * ((document.documentElement.clientHeight || document.body.clientHeight) / 100) + (t = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"';if(a[1]){g=typeof a[1]=="number"?a[1].toString():a[1].replace(/px/,"");g=g.indexOf("%")==-1?g+' + (t = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft) + "px"':parseInt(g.replace(/%/,""))+' * ((document.documentElement.clientWidth || document.body.clientWidth) / 100) + (t = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft) + "px"'}}else{f= '(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (t = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"';g='(document.documentElement.clientWidth || document.body.clientWidth) / 2 - (this.offsetWidth / 2) + (t = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft) + "px"'}e.removeExpression("top");e.removeExpression("left");e.setExpression("top", f);e.setExpression("left",g)}}})},focus:function(a){a=b(":input:enabled:visible:"+(a||"first"),this.d.wrap);a.length>0?a.focus():this.d.wrap.focus()},getDimensions:function(){var a=b(window);return[b.browser.opera&&b.browser.version>"9.5"&&b.fn.jquery<="1.2.6"?document.documentElement.clientHeight:b.browser.opera&&b.browser.version<"9.5"&&b.fn.jquery>"1.2.6"?window.innerHeight:a.height(),a.width()]},getVal:function(a){return a=="auto"?0:a.indexOf("%")>0?a:parseInt(a.replace(/px/,""))},setContainerDimensions:function(a){if(!a|| a&&this.o.autoResize){a=this.getVal(this.d.container.css("height"));var c=this.getVal(this.d.container.css("width")),h=this.d.data.outerHeight(true),e=this.d.data.outerWidth(true),f=this.o.maxHeight&&this.o.maxHeight