$.tabs=function(a,e){var c="on";var d="#"+a;var b=(typeof e=="number")?e-1:0;$(d+">div:lt("+b+")").add(d+">div:gt("+b+")").hide();$(d+">ul>li:nth-child("+b+")").addClass(c);$(d+">ul>li>a").click(function(){if(!$(this.parentNode).is("."+c)){var f=/([_\-\w]+$)/i;var g=$("#"+f.exec(this.href)[1]);if(g.size()>0){$(d+">div:visible").hide();g.show();$(d+">ul>li").removeClass(c);$(this.parentNode).addClass(c)}else{alert("There is no such container.")}}return false})};/*
 * jQuery Plugin FlyDOM v3.0
 *
 * Create DOM elements on the fly and automatically append or prepend them to another DOM object.
 * There are also template functions (tplAppend and tplPrepend) that can take a simple HTML structure
 * and apply a JSON object to it to make creating layouts MUCH easier.
 *
 * This plugin was inspired by "Oslow" [http://mg.to/2006/02/27/easy-dom-creation-for-jquery-and-prototype#comment-176],
 * and since I could not get his code to work, I decided I write my own plugin. My hope is that this
 * version will be easier to understand and maintain with future versions of jQuery.
 *
 * Copyright (c) 2007 Ken Stanley [dohpaz at gmail dot com]
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * @version     $Id: jquery.flydom-3.1.0.js 9 2007-09-12 22:20:23Z dohpaz $
 *
 * @author      Ken Stanley [dohpaz at gmail dot com]
 * @copyright   (C) 2007. All rights reserved.
 *
 * @license     http://www.opensource.org/licenses/mit-license.php
 * @license     http://www.opensource.org/licenses/gpl-license.php
 *
 * @package     jQuery Plugins
 * @subpackage  FlyDOM
 *
 * @todo        Cache basic elements that are created, and if an already existing basic element is
 *              asked to be created an additional time, use a copy of the cached element to build from.
 */
jQuery.fn.createAppend=function(e,c,f){if(c==undefined&&e.constructor==Array){for(var d=0;d<e.length;d+=3){jQuery(this).createAppend(e[d],e[d+1]||{},e[d+2]||[])}return this}var a=this[0];if(jQuery.browser.msie&&e=="input"&&c.type){var e=document.createElement("<"+e+' type="'+c.type+'" />')}else{var e=document.createElement(e)}if(a.nodeName.toLowerCase()=="table"&&e.nodeName.toLowerCase()=="tr"){if(a&&a.getElementsByTagName("tbody")[0]){var b=a.getElementsByTagName("tbody")[0]}else{var b=a.appendChild(document.createElement("tbody"))}var e=b.appendChild(e)}else{var e=a.appendChild(e)}e=__FlyDOM_parseAttrs(e,c);if(typeof f=="object"&&f!=null){for(var d=0;d<f.length;d=d+3){jQuery(e).createAppend(f[d],f[d+1]||{},f[d+2]||[])}}else{if(f!=null){e=__FlyDOM_setText(e,f)}}return jQuery(e)};jQuery.fn.createPrepend=function(c,a,d){if(a==undefined&&c.constructor==Array){for(var b=0;b<c.length;b+=3){jQuery(this).createPrepend(c[b],c[b+1]||{},c[b+2]||[])}return this}var c=document.createElement(c);if(this[0].hasChildNodes()==false){var c=this[0].appendChild(c)}c=__FlyDOM_parseAttrs(c,a);if(typeof d=="object"&&d!=null){for(var b=0;b<d.length;b=b+3){jQuery(c).createAppend(d[b],d[b+1]||{},d[b+2]||[])}}else{if(d!=null){c=__FlyDOM_setText(c,d)}}if(this[0].hasChildNodes()==true){var c=this[0].insertBefore(c,this[0].firstChild)}return jQuery(c)};jQuery.fn.tplAppend=function(e,b){if(e.constructor!=Array){e=[e]}if(e.length==0){return false}for(var d=0;d<e.length;d++){var c=b.apply(e[d]);for(var a=0;a<c.length;a=a+3){jQuery(this).createAppend(c[a],c[a+1],c[a+2])}}return this};jQuery.fn.tplPrepend=function(g,d){var b=this[0];if(g.constructor!=Array){g=[g]}if(g.length==0){return false}var h=document.createElement("div");for(var f=0;f<g.length;f++){var e=d.apply(g[f]);for(var c=0;c<e.length;c=c+3){jQuery(h).createAppend(e[c],e[c+1],e[c+2])}}for(f=h.childNodes.length-1;f>=0;f--){if(jQuery.browser.msie&&b.nodeName.toLowerCase()=="table"&&h.childNodes[f].nodeName.toLowerCase()=="tr"){if(b.getElementsByTagName("tbody")[0]){var a=b.getElementsByTagName("tbody")[0];a.insertBefore(h.childNodes[f],a.firstChild)}else{var a=b.insertBefore(document.createElement("tbody"),b.firstChild);a.appendChild(a.appendChild(h.childNodes[f]))}}else{b.insertBefore(h.childNodes[f],b.firstChild)}}return this};String.prototype.toCamelCase=function(){var a=this;var b={"class":"className",colspan:"colSpan",rowspan:"rowSpan","for":"htmlFor",httpequiv:"httpEquiv",alink:"aLink",vlink:"vLink",bgcolor:"bgColor",acceptcharset:"acceptCharset",selectedindex:"selectedIndex",tabindex:"tabIndex",selected:"defaultSelected",checked:"defaultChecked",value:"defaultValue",accesskey:"accessKey",noshade:"noShade",datetime:"dateTime",usemap:"useMap",lowsrc:"lowSrc",longdesc:"longDesc",ismap:"isMap",codebase:"codeBase",codetype:"codeType",valuetype:"valueType",nohref:"noHref",thead:"tHead",tfoot:"tFoot",cellpadding:"cellPadding",cellspacing:"cellSpacing",charoff:"chOff",valign:"vAlign",frameborder:"frameBorder",marginheight:"marginHeight",marginwidth:"marginWidth",noresize:"noResize"};if(b[a]!=""&&typeof b[a]!="undefined"){return b[a]}if(a.indexOf("-")>0){var c=a.split("-");a=c[0];for(i=1;i<c.length;i++){a+=c[i].substr(0,1).toUpperCase()+c[i].substr(1).toLowerCase()}}return a};String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")};__FlyDOM_parseAttrs=function(element,attrs){for(attr in attrs){var attrName=attr;var attrValue=attrs[attr];switch(attrName){case"style":if(typeof attrValue=="string"){var params=attrValue.split(";");for(var i=0;i<params.length;i++){if(params[i].trim()!=""){var styleName=params[i].split(":")[0].trim();var styleValue=params[i].split(":")[1].trim();styleName=styleName.toCamelCase();if(styleName!=""){element.style[styleName]=styleValue}}}}else{if(typeof attrValue=="object"){for(styleName in attrValue){var styleNameCamel=styleName.toCamelCase();if(styleName.trim()!=""){element.style[styleNameCamel]=attrValue[styleName]}}}}break;default:if(attrName.substr(0,2)=="on"){var event=attrName.substr(2);attrValue=(typeof attrValue!="function")?eval("f = function() { "+attrValue+"}"):attrValue;jQuery(element).bind(event,attrValue)}else{element[attrName.toCamelCase()]=attrValue}}}return element};__FlyDOM_setText=function(a,c){var b=/(<\S[^><]*>)|(&.+;)/g;if(c.match(b)!=null&&a.tagName.toUpperCase()!="TEXTAREA"){a.innerHTML=c}else{var d=document.createTextNode(c);a.appendChild(d)}return a};(function(c){var b=c.browser.msie&&parseInt(c.browser.version)==6&&typeof window.XMLHttpRequest!="object",d=null,a=[];c.modal=function(f,e){return c.modal.impl.init(f,e)};c.modal.close=function(){c.modal.impl.close()};c.fn.modal=function(e){return c.modal.impl.init(this,e)};c.modal.defaults={opacity:50,overlayId:"simplemodal-overlay",overlayCss:{},containerId:"simplemodal-container",containerCss:{},dataCss:{},zIndex:1003,close:true,closeHTML:'<a class="modalCloseImg" title="Close"></a>',closeClass:"simplemodal-close",position:null,persist:false,onOpen:null,onShow:null,onClose:null};c.modal.impl={opts:null,dialog:{},init:function(f,e){if(this.dialog.data){return false}d=c.browser.msie&&!c.boxModel;this.opts=c.extend({},c.modal.defaults,e);this.zIndex=this.opts.zIndex;this.occb=false;if(typeof f=="object"){f=f instanceof jQuery?f:c(f);if(f.parent().parent().size()>0){this.dialog.parentNode=f.parent();if(!this.opts.persist){this.dialog.orig=f.clone(true)}}}else{if(typeof f=="string"||typeof f=="number"){f=c("<div/>").html(f)}else{alert("SimpleModal Error: Unsupported data type: "+typeof f);return false}}this.dialog.data=f.addClass("simplemodal-data").css(this.opts.dataCss);f=null;this.create();this.open();if(c.isFunction(this.opts.onShow)){this.opts.onShow.apply(this,[this.dialog])}return this},create:function(){a=this.getDimensions();if(b){this.dialog.iframe=c('<iframe src="javascript:false;"/>').css(c.extend(this.opts.iframeCss,{display:"none",opacity:0,position:"fixed",height:a[0],width:a[1],zIndex:this.opts.zIndex,top:0,left:0})).appendTo("body")}this.dialog.overlay=c("<div/>").attr("id",this.opts.overlayId).addClass("simplemodal-overlay").css(c.extend(this.opts.overlayCss,{display:"none",opacity:this.opts.opacity/100,height:a[0],width:a[1],position:"fixed",left:0,top:0,zIndex:this.opts.zIndex+1})).appendTo("body");this.dialog.container=c("<div/>").attr("id",this.opts.containerId).addClass("simplemodal-container").css(c.extend(this.opts.containerCss,{display:"none",position:"fixed",zIndex:this.opts.zIndex+2})).append(this.opts.close?c(this.opts.closeHTML).addClass(this.opts.closeClass):"").appendTo("body");this.setPosition();if(b||d){this.fixIE()}this.dialog.container.append(this.dialog.data.hide())},bindEvents:function(){var e=this;c("."+this.opts.closeClass).bind("click.simplemodal",function(f){f.preventDefault();e.close()});c(window).bind("resize.simplemodal",function(){a=e.getDimensions();e.setPosition();if(b||d){e.fixIE()}else{e.dialog.iframe&&e.dialog.iframe.css({height:a[0],width:a[1]});e.dialog.overlay.css({height:a[0],width:a[1]})}})},unbindEvents:function(){c("."+this.opts.closeClass).unbind("click.simplemodal");c(window).unbind("resize.simplemodal")},fixIE:function(){var e=this.opts.position;c.each([this.dialog.iframe||null,this.dialog.overlay,this.dialog.container],function(q,j){if(j){var o="document.body.clientHeight",t="document.body.clientWidth",v="document.body.scrollHeight",r="document.body.scrollLeft",m="document.body.scrollTop",h="document.body.scrollWidth",g="document.documentElement.clientHeight",p="document.documentElement.clientWidth",n="document.documentElement.scrollLeft",w="document.documentElement.scrollTop",x=j[0].style;x.position="absolute";if(q<2){x.removeExpression("height");x.removeExpression("width");x.setExpression("height",""+v+" > "+o+" ? "+v+" : "+o+' + "px"');x.setExpression("width",""+h+" > "+t+" ? "+h+" : "+t+' + "px"')}else{var l,f;if(e&&e.constructor==Array){var u=e[0]?typeof e[0]=="number"?e[0].toString():e[0].replace(/px/,""):j.css("top").replace(/px/,"");l=u.indexOf("%")==-1?u+" + (t = "+w+" ? "+w+" : "+m+') + "px"':parseInt(u.replace(/%/,""))+" * (("+g+" || "+o+") / 100) + (t = "+w+" ? "+w+" : "+m+') + "px"';if(e[1]){var k=typeof e[1]=="number"?e[1].toString():e[1].replace(/px/,"");f=k.indexOf("%")==-1?k+" + (t = "+n+" ? "+n+" : "+r+') + "px"':parseInt(k.replace(/%/,""))+" * (("+p+" || "+t+") / 100) + (t = "+n+" ? "+n+" : "+r+') + "px"'}}else{l="("+g+" || "+o+") / 2 - (this.offsetHeight / 2) + (t = "+w+" ? "+w+" : "+m+') + "px"';f="("+p+" || "+t+") / 2 - (this.offsetWidth / 2) + (t = "+n+" ? "+n+" : "+r+') + "px"'}x.removeExpression("top");x.removeExpression("left");x.setExpression("top",l);x.setExpression("left",f)}}})},getDimensions:function(){var f=c(window);var e=c.browser.opera&&c.browser.version>"9.5"&&c.fn.jquery<="1.2.6"?document.documentElement.clientHeight:f.height();return[e,f.width()]},setPosition:function(){var h,g,f=(a[0]/2)-((this.dialog.container.height()||this.dialog.data.height())/2),e=(a[1]/2)-((this.dialog.container.width()||this.dialog.data.width())/2);if(this.opts.position&&this.opts.position.constructor==Array){h=this.opts.position[0]||f;g=this.opts.position[1]||e}else{h=f;g=e}this.dialog.container.css({left:g,top:h})},open:function(){this.dialog.iframe&&this.dialog.iframe.show();if(c.isFunction(this.opts.onOpen)){this.opts.onOpen.apply(this,[this.dialog])}else{this.dialog.overlay.show();this.dialog.container.show();this.dialog.data.show()}this.bindEvents()},close:function(){if(!this.dialog.data){return false}if(c.isFunction(this.opts.onClose)&&!this.occb){this.occb=true;this.opts.onClose.apply(this,[this.dialog])}else{if(this.dialog.parentNode){if(this.opts.persist){this.dialog.data.hide().appendTo(this.dialog.parentNode)}else{this.dialog.data.remove();this.dialog.orig.appendTo(this.dialog.parentNode)}}else{this.dialog.data.remove()}this.dialog.container.remove();this.dialog.overlay.remove();this.dialog.iframe&&this.dialog.iframe.remove();this.dialog={}}this.unbindEvents()}}})(jQuery);/*
 * jQuery.create() - jQuery plugin to create HTML elements
 * 
 * jQuery.create() - it's a featured plugin for jQuery JavaScript Library.
 * You can create any types of HTML elements, set attributes and context or HTML using jQuery.create().
 * See below the HTML example declaration.
 * 
 * I think it make easy and fast your programming in JavaScript.
 * 
 * Here is an example HTML using jquery and jquery.create() plug-in
 * 
 * HTML example declaration.
 * <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 *     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 * <html xmlns="http://www.w3.org/1999/xhtml">
 * <head>
 *     <title>Untitled Page</title>
 *     <script type="text/javascript"
 *         src="../App_Scripts/jQuery/jQuery-1.2.3.js"></script>
 *     <!-- Utils.js - contain jQuery.create - plug-in -->
 *     <script type="text/javascript"
 *         src="../App_Scripts/Utils/Utils.js"></script>
 *     <script type="text/javascript">
 *     $(document).ready(function() {
 *         // Create new element typeof DIV
 *         var o = $.create('div',
 *                         {'id':'wrapper-header',
 *                          'class':'header'}, ['Hello world!!!']);
 *                   
 *         // Append object o
 *         $('#wrapper').append($(o));
 *     });
 *     </script>
 * </head>
 * <body>
 * 
 *     <div id="wrapper"></div>
 * 
 * </body>
 * </html>
 * 
 * 
 * 
 * NOTE: this jquery plug-in is obtained from 
 * http://blogs.microsoft.co.il/blogs/basil/archive/2008/08/21/jquery-create-jquery-plug-in-to-create-elements.aspx
 */
jQuery.create=function(){if(arguments.length==0){return[]}var c=arguments[0]||{},e=null,f=null;var g=null;if(c==null){c=""}if(c.constructor==String){if(arguments.length>1){var b=arguments[1];if(b.constructor==String){e=document.createTextNode(c);f=[];f.push(e);g=jQuery.create.apply(null,Array.prototype.slice.call(arguments,1));f=f.concat(g);return f}else{e=document.createElement(c);var b=arguments[1];for(var a in b){jQuery(e).attr(a,b[a])}var d=arguments[2];d=jQuery.create.apply(null,d);jQuery(e).append(d);if(arguments.length>3){g=jQuery.create.apply(null,Array.prototype.slice.call(arguments,3));return[e].concat(g)}return e}}else{return document.createTextNode(c)}}else{f=[];f.push(c);g=jQuery.create.apply(null,(Array.prototype.slice.call(arguments,1)));f=f.concat(g);return f}};/*
 * iso8601.js
 * pebblebox web
 * 
 * The following two functions convert ISO8601 format string from and to 
 * javscript Date object.  These two functions are implemented by 
 * Paul Sowden 
 * http://delete.me.uk/2005/03/iso8601.html
 * 
 */
Date.prototype.setISO8601=function(b){var c="([0-9]{4})(-([0-9]{2})(-([0-9]{2})(T([0-9]{2}):([0-9]{2})(:([0-9]{2})(.([0-9]+))?)?(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?";var f=b.match(new RegExp(c));var e=0;var a=new Date(f[1],0,1);if(f[3]){a.setMonth(f[3]-1)}if(f[5]){a.setDate(f[5])}if(f[7]){a.setHours(f[7])}if(f[8]){a.setMinutes(f[8])}if(f[10]){a.setSeconds(f[10])}if(f[12]){a.setMilliseconds(Number("0."+f[12])*1000)}if(f[14]){e=(Number(f[16])*60)+Number(f[17]);e*=((f[15]=="-")?1:-1)}e-=a.getTimezoneOffset();time=(Number(a)+(e*60*1000));this.setTime(Number(time))};Date.prototype.toISO8601String=function(e,h){if(!e){var e=6}if(!h){var h="Z";var a=this}else{var g=h.match(/([-+])([0-9]{2}):([0-9]{2})/);var c=(Number(g[2])*60)+Number(g[3]);c*=((g[1]=="-")?-1:1);var a=new Date(Number(Number(this)+(c*60000)))}var i=function(d){return((d<10)?"0":"")+d};var f="";f+=a.getUTCFullYear();if(e>1){f+="-"+i(a.getUTCMonth()+1)}if(e>2){f+="-"+i(a.getUTCDate())}if(e>3){f+="T"+i(a.getUTCHours())+":"+i(a.getUTCMinutes())}if(e>5){var b=Number(a.getUTCSeconds()+"."+((a.getUTCMilliseconds()<100)?"0":"")+i(a.getUTCMilliseconds()));f+=":"+i(b)}else{if(e>4){f+=":"+i(a.getUTCSeconds())}}if(e>3){f+=h}return f};/*
File: Math.uuid.js
Version: 1.3
Change History:
  v1.0 - first release
  v1.1 - less code and 2x performance boost (by minimizing calls to Math.random())
  v1.2 - Add support for generating non-standard uuids of arbitrary length
  v1.3 - Fixed IE7 bug (can't use []'s to access string chars.  Thanks, Brian R.)
  v1.4 - Changed method to be "Math.uuid". Added support for radix argument.  Use module pattern for better encapsulation.

Latest version:   http://www.broofa.com/Tools/Math.uuid.js
Information:      http://www.broofa.com/blog/?p=151
Contact:          robert@broofa.com
----
Copyright (c) 2008, Robert Kieffer
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

    * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
    * Neither the name of Robert Kieffer nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
Math.uuid=(function(){var a="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");return function(b,f){var h=a,e=[],d=Math.random;f=f||h.length;if(b){for(var c=0;c<b;c++){e[c]=h[0|d()*f]}}else{var g;e[8]=e[13]=e[18]=e[23]="-";e[14]="4";for(var c=0;c<36;c++){if(!e[c]){g=0|d()*16;e[c]=h[(c==19)?(g&3)|8:g&15]}}}return e.join("")}})();var randomUUID=Math.uuid;/*
 * SimpleModal 1.2.2 - jQuery Plugin
 * http://www.ericmmartin.com/projects/simplemodal/
 * Copyright (c) 2008 Eric Martin
 * Dual licensed under the MIT and GPL licenses
 * Revision: $Id: jquery.simplemodal.js 181 2008-12-16 16:51:44Z emartin24 $
 */
(function(c){var b=c.browser.msie&&parseInt(c.browser.version)==6&&!window.XMLHttpRequest,d=c.browser.msie&&!c.boxModel,a=[];c.modal=function(f,e){return c.modal.impl.init(f,e)};c.modal.close=function(){c.modal.impl.close()};c.fn.modal=function(e){return c.modal.impl.init(this,e)};c.modal.defaults={opacity:50,overlayId:"simplemodal-overlay",overlayCss:{},containerId:"simplemodal-container",containerCss:{},dataCss:{},zIndex:1000,close:true,closeHTML:'<a class="modalCloseImg" title="Close"></a>',closeClass:"simplemodal-close",position:null,persist:false,onOpen:null,onShow:null,onClose:null};c.modal.impl={opts:null,dialog:{},init:function(f,e){if(this.dialog.data){return false}this.opts=c.extend({},c.modal.defaults,e);this.zIndex=this.opts.zIndex;this.occb=false;if(typeof f=="object"){f=f instanceof jQuery?f:c(f);if(f.parent().parent().size()>0){this.dialog.parentNode=f.parent();if(!this.opts.persist){this.dialog.orig=f.clone(true)}}}else{if(typeof f=="string"||typeof f=="number"){f=c("<div/>").html(f)}else{alert("SimpleModal Error: Unsupported data type: "+typeof f);return false}}this.dialog.data=f.addClass("simplemodal-data").css(this.opts.dataCss);f=null;this.create();this.open();if(c.isFunction(this.opts.onShow)){this.opts.onShow.apply(this,[this.dialog])}return this},create:function(){a=this.getDimensions();if(b){this.dialog.iframe=c('<iframe src="javascript:false;"/>').css(c.extend(this.opts.iframeCss,{display:"none",opacity:0,position:"fixed",height:a[0],width:a[1],zIndex:this.opts.zIndex,top:0,left:0})).appendTo("body")}this.dialog.overlay=c("<div/>").attr("id",this.opts.overlayId).addClass("simplemodal-overlay").css(c.extend(this.opts.overlayCss,{display:"none",opacity:this.opts.opacity/100,height:a[0],width:a[1],position:"fixed",left:0,top:0,zIndex:this.opts.zIndex+1})).appendTo("body");this.dialog.container=c("<div/>").attr("id",this.opts.containerId).addClass("simplemodal-container").css(c.extend(this.opts.containerCss,{display:"none",position:"fixed",zIndex:this.opts.zIndex+2})).append(this.opts.close?c(this.opts.closeHTML).addClass(this.opts.closeClass):"").appendTo("body");this.setPosition();if(b||d){this.fixIE()}this.dialog.container.append(this.dialog.data.hide())},bindEvents:function(){var e=this;c("."+this.opts.closeClass).bind("click.simplemodal",function(f){f.preventDefault();e.close()});c(window).bind("resize.simplemodal",function(){a=e.getDimensions();e.setPosition();if(b||d){e.fixIE()}else{e.dialog.iframe&&e.dialog.iframe.css({height:a[0],width:a[1]});e.dialog.overlay.css({height:a[0],width:a[1]})}})},unbindEvents:function(){c("."+this.opts.closeClass).unbind("click.simplemodal");c(window).unbind("resize.simplemodal")},fixIE:function(){var e=this.opts.position;c.each([this.dialog.iframe||null,this.dialog.overlay,this.dialog.container],function(q,j){if(j){var o="document.body.clientHeight",t="document.body.clientWidth",v="document.body.scrollHeight",r="document.body.scrollLeft",m="document.body.scrollTop",h="document.body.scrollWidth",g="document.documentElement.clientHeight",p="document.documentElement.clientWidth",n="document.documentElement.scrollLeft",w="document.documentElement.scrollTop",x=j[0].style;x.position="absolute";if(q<2){x.removeExpression("height");x.removeExpression("width");x.setExpression("height",""+v+" > "+o+" ? "+v+" : "+o+' + "px"');x.setExpression("width",""+h+" > "+t+" ? "+h+" : "+t+' + "px"')}else{var l,f;if(e&&e.constructor==Array){if(e[0]){var u=typeof e[0]=="number"?e[0].toString():e[0].replace(/px/,"");l=u.indexOf("%")==-1?u+" + (t = "+w+" ? "+w+" : "+m+') + "px"':parseInt(u.replace(/%/,""))+" * (("+g+" || "+o+") / 100) + (t = "+w+" ? "+w+" : "+m+') + "px"'}if(e[1]){var k=typeof e[1]=="number"?e[1].toString():e[1].replace(/px/,"");f=k.indexOf("%")==-1?k+" + (t = "+n+" ? "+n+" : "+r+') + "px"':parseInt(k.replace(/%/,""))+" * (("+p+" || "+t+") / 100) + (t = "+n+" ? "+n+" : "+r+') + "px"'}}else{l="("+g+" || "+o+") / 2 - (this.offsetHeight / 2) + (t = "+w+" ? "+w+" : "+m+') + "px"';f="("+p+" || "+t+") / 2 - (this.offsetWidth / 2) + (t = "+n+" ? "+n+" : "+r+') + "px"'}x.removeExpression("top");x.removeExpression("left");x.setExpression("top",l);x.setExpression("left",f)}}})},getDimensions:function(){var f=c(window);var e=c.browser.opera&&c.browser.version>"9.5"&&c.fn.jquery<="1.2.6"?document.documentElement.clientHeight:f.height();return[e,f.width()]},setPosition:function(){var h,g,f=(a[0]/2)-((this.dialog.container.height()||this.dialog.data.height())/2),e=(a[1]/2)-((this.dialog.container.width()||this.dialog.data.width())/2);if(this.opts.position&&this.opts.position.constructor==Array){h=this.opts.position[0]||f;g=this.opts.position[1]||e}else{h=f;g=e}this.dialog.container.css({left:g,top:h})},open:function(){this.dialog.iframe&&this.dialog.iframe.show();if(c.isFunction(this.opts.onOpen)){this.opts.onOpen.apply(this,[this.dialog])}else{this.dialog.overlay.show();this.dialog.container.show();this.dialog.data.show()}this.bindEvents()},close:function(){if(!this.dialog.data){return false}if(c.isFunction(this.opts.onClose)&&!this.occb){this.occb=true;this.opts.onClose.apply(this,[this.dialog])}else{if(this.dialog.parentNode){if(this.opts.persist){this.dialog.data.hide().appendTo(this.dialog.parentNode)}else{this.dialog.data.remove();this.dialog.orig.appendTo(this.dialog.parentNode)}}else{this.dialog.data.remove()}this.dialog.container.remove();this.dialog.overlay.remove();this.dialog.iframe&&this.dialog.iframe.remove();this.dialog={}}this.unbindEvents()}}})(jQuery);(function(c){var b=c.browser.msie&&parseInt(c.browser.version)==6&&typeof window.XMLHttpRequest!="object",d=null,a=[];c.modal=function(f,e){return c.modal.impl.init(f,e)};c.modal.close=function(){c.modal.impl.close()};c.fn.modal=function(e){return c.modal.impl.init(this,e)};c.modal.defaults={opacity:40,overlayId:"simplemodal-overlay",overlayCss:{},containerId:"simplemodal-container",containerCss:{},dataCss:{},zIndex:1003,close:true,closeHTML:'<a class="modalCloseImg" title="Close"></a>',closeClass:"simplemodal-close",position:null,persist:false,onOpen:null,onShow:null,onClose:null};c.modal.impl={opts:null,dialog:{},init:function(f,e){if(this.dialog.data){return false}d=c.browser.msie&&!c.boxModel;this.opts=c.extend({},c.modal.defaults,e);this.zIndex=this.opts.zIndex;this.occb=false;if(typeof f=="object"){f=f instanceof jQuery?f:c(f);if(f.parent().parent().size()>0){this.dialog.parentNode=f.parent();if(!this.opts.persist){this.dialog.orig=f.clone(true)}}}else{if(typeof f=="string"||typeof f=="number"){f=c("<div/>").html(f)}else{alert("SimpleModal Error: Unsupported data type: "+typeof f);return false}}this.dialog.data=f.addClass("simplemodal-data").css(this.opts.dataCss);f=null;this.create();this.open();if(c.isFunction(this.opts.onShow)){this.opts.onShow.apply(this,[this.dialog])}return this},create:function(){a=this.getDimensions();if(b){this.dialog.iframe=c('<iframe src="javascript:false;"/>').css(c.extend(this.opts.iframeCss,{display:"none",opacity:0,position:"fixed",height:a[0],width:a[1],zIndex:this.opts.zIndex,top:0,left:0})).appendTo("body")}this.dialog.overlay=c("<div/>").attr("id",this.opts.overlayId).addClass("simplemodal-overlay").css(c.extend(this.opts.overlayCss,{display:"none",opacity:this.opts.opacity/100,height:a[0],width:a[1],position:"fixed",left:0,top:0,zIndex:this.opts.zIndex+1})).appendTo("body");this.dialog.container=c("<div/>").attr("id",this.opts.containerId).addClass("simplemodal-container").css(c.extend(this.opts.containerCss,{display:"none",position:"fixed",zIndex:this.opts.zIndex+2})).append(this.opts.close?c(this.opts.closeHTML).addClass(this.opts.closeClass):"").appendTo("body");this.setPosition();if(b||d){this.fixIE()}this.dialog.container.append(this.dialog.data.hide())},bindEvents:function(){var e=this;c("."+this.opts.closeClass).bind("click.simplemodal",function(f){f.preventDefault();e.close()});c(window).bind("resize.simplemodal",function(){a=e.getDimensions();e.setPosition();if(b||d){e.fixIE()}else{e.dialog.iframe&&e.dialog.iframe.css({height:a[0],width:a[1]});e.dialog.overlay.css({height:a[0],width:a[1]})}})},unbindEvents:function(){c("."+this.opts.closeClass).unbind("click.simplemodal");c(window).unbind("resize.simplemodal")},fixIE:function(){var e=this.opts.position;c.each([this.dialog.iframe||null,this.dialog.overlay,this.dialog.container],function(q,j){if(j){var o="document.body.clientHeight",t="document.body.clientWidth",v="document.body.scrollHeight",r="document.body.scrollLeft",m="document.body.scrollTop",h="document.body.scrollWidth",g="document.documentElement.clientHeight",p="document.documentElement.clientWidth",n="document.documentElement.scrollLeft",w="document.documentElement.scrollTop",x=j[0].style;x.position="absolute";if(q<2){x.removeExpression("height");x.removeExpression("width");x.setExpression("height",""+v+" > "+o+" ? "+v+" : "+o+' + "px"');x.setExpression("width",""+h+" > "+t+" ? "+h+" : "+t+' + "px"')}else{var l,f;if(e&&e.constructor==Array){var u=e[0]?typeof e[0]=="number"?e[0].toString():e[0].replace(/px/,""):j.css("top").replace(/px/,"");l=u.indexOf("%")==-1?u+" + (t = "+w+" ? "+w+" : "+m+') + "px"':parseInt(u.replace(/%/,""))+" * (("+g+" || "+o+") / 100) + (t = "+w+" ? "+w+" : "+m+') + "px"';if(e[1]){var k=typeof e[1]=="number"?e[1].toString():e[1].replace(/px/,"");f=k.indexOf("%")==-1?k+" + (t = "+n+" ? "+n+" : "+r+') + "px"':parseInt(k.replace(/%/,""))+" * (("+p+" || "+t+") / 100) + (t = "+n+" ? "+n+" : "+r+') + "px"'}}else{l="("+g+" || "+o+") / 2 - (this.offsetHeight / 2) + (t = "+w+" ? "+w+" : "+m+') + "px"';f="("+p+" || "+t+") / 2 - (this.offsetWidth / 2) + (t = "+n+" ? "+n+" : "+r+') + "px"'}x.removeExpression("top");x.removeExpression("left");x.setExpression("top",l);x.setExpression("left",f)}}})},getDimensions:function(){var f=c(window);var e=c.browser.opera&&c.browser.version>"9.5"&&c.fn.jquery<="1.2.6"?document.documentElement.clientHeight:f.height();return[e,f.width()]},setPosition:function(){var h,g,f=(a[0]/2)-((this.dialog.container.height()||this.dialog.data.height())/2),e=(a[1]/2)-((this.dialog.container.width()||this.dialog.data.width())/2);if(this.opts.position&&this.opts.position.constructor==Array){h=this.opts.position[0]||f;g=this.opts.position[1]||e}else{h=f;g=e}this.dialog.container.css({left:g,top:h})},open:function(){this.dialog.iframe&&this.dialog.iframe.show();if(c.isFunction(this.opts.onOpen)){this.opts.onOpen.apply(this,[this.dialog])}else{this.dialog.overlay.show();this.dialog.container.show();this.dialog.data.show()}this.bindEvents()},close:function(){if(!this.dialog.data){return false}if(c.isFunction(this.opts.onClose)&&!this.occb){this.occb=true;this.opts.onClose.apply(this,[this.dialog])}else{if(this.dialog.parentNode){if(this.opts.persist){this.dialog.data.hide().appendTo(this.dialog.parentNode)}else{this.dialog.data.remove();this.dialog.orig.appendTo(this.dialog.parentNode)}}else{this.dialog.data.remove()}this.dialog.container.remove();this.dialog.overlay.remove();this.dialog.iframe&&this.dialog.iframe.remove();this.dialog={}}this.unbindEvents()}}})(jQuery);