/* Copyright(c) 2010 One.Com */
(function(){var X=this,ac,F=X.jQuery,T=X.$,U=X.jQuery=X.$=function(b,a){return new U.fn.init(b,a)},N=/^[^<]*(<(.|\s)+>)[^>]*$|^#([\w-]+)$/,ad=/^.[^:#\[\.,]*$/;U.fn=U.prototype={init:function(e,b){e=e||document;if(e.nodeType){this[0]=e;this.length=1;this.context=e;return this}if(typeof e==="string"){var c=N.exec(e);if(c&&(c[1]||!b)){if(c[1]){e=U.clean([c[1]],b)}else{var a=document.getElementById(c[3]);if(a&&a.id!=c[3]){return U().find(e)}var d=U(a||[]);d.context=document;d.selector=e;return d}}else{return U(b).find(e)}}else{if(U.isFunction(e)){return U(document).ready(e)}}if(e.selector&&e.context){this.selector=e.selector;this.context=e.context}return this.setArray(U.isArray(e)?e:U.makeArray(e))},selector:"",jquery:"1.3.2",size:function(){return this.length},get:function(a){return a===ac?Array.prototype.slice.call(this):this[a]},pushStack:function(c,a,d){var b=U(c);b.prevObject=this;b.context=this.context;if(a==="find"){b.selector=this.selector+(this.selector?" ":"")+d}else{if(a){b.selector=this.selector+"."+a+"("+d+")"}}return b},setArray:function(a){this.length=0;Array.prototype.push.apply(this,a);return this},each:function(a,b){return U.each(this,a,b)},index:function(a){return U.inArray(a&&a.jquery?a[0]:a,this)},attr:function(c,a,b){var d=c;if(typeof c==="string"){if(a===ac){return this[0]&&U[b||"attr"](this[0],c)}else{d={};d[c]=a}}return this.each(function(e){for(c in d){U.attr(b?this.style:this,c,U.prop(this,d[c],b,e,c))}})},css:function(b,a){if((b=="width"||b=="height")&&parseFloat(a)<0){a=ac}return this.attr(b,a,"curCSS")},text:function(a){if(typeof a!=="object"&&a!=null){return this.empty().append((this[0]&&this[0].ownerDocument||document).createTextNode(a))}var b="";U.each(a||this,function(){U.each(this.childNodes,function(){if(this.nodeType!=8){b+=this.nodeType!=1?this.nodeValue:U.fn.text([this])}})});return b},wrapAll:function(b){if(this[0]){var a=U(b,this[0].ownerDocument).clone();if(this[0].parentNode){a.insertBefore(this[0])}a.map(function(){var c=this;while(c.firstChild){c=c.firstChild}return c}).append(this)}return this},wrapInner:function(a){return this.each(function(){U(this).contents().wrapAll(a)})},wrap:function(a){return this.each(function(){U(this).wrapAll(a)})},append:function(){return this.domManip(arguments,true,function(a){if(this.nodeType==1){this.appendChild(a)}})},prepend:function(){return this.domManip(arguments,true,function(a){if(this.nodeType==1){this.insertBefore(a,this.firstChild)}})},before:function(){return this.domManip(arguments,false,function(a){this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,false,function(a){this.parentNode.insertBefore(a,this.nextSibling)})},end:function(){return this.prevObject||U([])},push:[].push,sort:[].sort,splice:[].splice,find:function(b){if(this.length===1){var a=this.pushStack([],"find",b);a.length=0;U.find(b,this[0],a);return a}else{return this.pushStack(U.unique(U.map(this,function(c){return U.find(b,c)})),"find",b)}},clone:function(b){var d=this.map(function(){if(!U.support.noCloneEvent&&!U.isXMLDoc(this)){var f=this.outerHTML;if(!f){var e=this.ownerDocument.createElement("div");e.appendChild(this.cloneNode(true));f=e.innerHTML}return U.clean([f.replace(/ jQuery\d+="(?:\d+|null)"/g,"").replace(/^\s*/,"")])[0]}else{return this.cloneNode(true)}});if(b===true){var a=this.find("*").andSelf(),c=0;d.find("*").andSelf().each(function(){if(this.nodeName!==a[c].nodeName){return}var g=U.data(a[c],"events");for(var e in g){for(var f in g[e]){U.event.add(this,e,g[e][f],g[e][f].data)}}c++})}return d},filter:function(a){return this.pushStack(U.isFunction(a)&&U.grep(this,function(b,c){return a.call(b,c)})||U.multiFilter(a,U.grep(this,function(b){return b.nodeType===1})),"filter",a)},closest:function(c){var a=U.expr.match.POS.test(c)?U(c):null,b=0;return this.map(function(){var d=this;while(d&&d.ownerDocument){if(a?a.index(d)>-1:U(d).is(c)){U.data(d,"closest",b);return d}d=d.parentNode;b++}})},not:function(b){if(typeof b==="string"){if(ad.test(b)){return this.pushStack(U.multiFilter(b,this,true),"not",b)}else{b=U.multiFilter(b,this)}}var a=b.length&&b[b.length-1]!==ac&&!b.nodeType;return this.filter(function(){return a?U.inArray(this,b)<0:this!=b})},add:function(a){return this.pushStack(U.unique(U.merge(this.get(),typeof a==="string"?U(a):U.makeArray(a))))},is:function(a){return !!a&&U.multiFilter(a,this).length>0},hasClass:function(a){return !!a&&this.is("."+a)},val:function(c){if(c===ac){var j=this[0];if(j){if(U.nodeName(j,"option")){return(j.attributes.value||{}).specified?j.value:j.text}if(U.nodeName(j,"select")){var e=j.selectedIndex,b=[],a=j.options,f=j.type=="select-one";if(e<0){return null}for(var h=f?e:0,d=f?e+1:a.length;h<d;h++){var g=a[h];if(g.selected){c=U(g).val();if(f){return c}b.push(c)}}return b}return(j.value||"").replace(/\r/g,"")}return ac}if(typeof c==="number"){c+=""}return this.each(function(){if(this.nodeType!=1){return}if(U.isArray(c)&&/radio|checkbox/.test(this.type)){this.checked=(U.inArray(this.value,c)>=0||U.inArray(this.name,c)>=0)}else{if(U.nodeName(this,"select")){var k=U.makeArray(c);U("option",this).each(function(){this.selected=(U.inArray(this.value,k)>=0||U.inArray(this.text,k)>=0)});if(!k.length){this.selectedIndex=-1}}else{this.value=c}}})},html:function(a){return a===ac?(this[0]?this[0].innerHTML.replace(/ jQuery\d+="(?:\d+|null)"/g,""):null):this.empty().append(a)},replaceWith:function(a){return this.after(a).remove()},eq:function(a){return this.slice(a,+a+1)},slice:function(){return this.pushStack(Array.prototype.slice.apply(this,arguments),"slice",Array.prototype.slice.call(arguments).join(","))},map:function(a){return this.pushStack(U.map(this,function(b,c){return a.call(b,c,b)}))},andSelf:function(){return this.add(this.prevObject)},domManip:function(d,a,b){if(this[0]){var e=(this[0].ownerDocument||this[0]).createDocumentFragment(),h=U.clean(d,(this[0].ownerDocument||this[0]),e),f=e.firstChild;if(f){for(var g=0,j=this.length;g<j;g++){b.call(c(this[g],f),this.length>1||g>0?e.cloneNode(true):e)}}if(h){U.each(h,E)}}return this;function c(l,k){return a&&U.nodeName(l,"table")&&U.nodeName(k,"tr")?(l.getElementsByTagName("tbody")[0]||l.appendChild(l.ownerDocument.createElement("tbody"))):l}}};U.fn.init.prototype=U.fn;function E(b,a){if(a.src){U.ajax({url:a.src,async:false,dataType:"script"})}else{U.globalEval(a.text||a.textContent||a.innerHTML||"")}if(a.parentNode){a.parentNode.removeChild(a)}}function ae(){return +new Date}U.extend=U.fn.extend=function(){var c=arguments[0]||{},e=1,d=arguments.length,h=false,f;if(typeof c==="boolean"){h=c;c=arguments[1]||{};e=2}if(typeof c!=="object"&&!U.isFunction(c)){c={}}if(d==e){c=this;--e}for(;e<d;e++){if((f=arguments[e])!=null){for(var g in f){var b=c[g],a=f[g];if(c===a){continue}if(h&&a&&typeof a==="object"&&!a.nodeType){c[g]=U.extend(h,b||(a.length!=null?[]:{}),a)}else{if(a!==ac){c[g]=a}}}}}return c};var ah=/z-?index|font-?weight|opacity|zoom|line-?height/i,R=document.defaultView||{},L=Object.prototype.toString;U.extend({noConflict:function(a){X.$=T;if(a){X.jQuery=F}return U},isFunction:function(a){return L.call(a)==="[object Function]"},isArray:function(a){return L.call(a)==="[object Array]"},isXMLDoc:function(a){return a.nodeType===9&&a.documentElement.nodeName!=="HTML"||!!a.ownerDocument&&U.isXMLDoc(a.ownerDocument)},globalEval:function(a){if(a&&/\S/.test(a)){var b=document.getElementsByTagName("head")[0]||document.documentElement,c=document.createElement("script");c.type="text/javascript";if(U.support.scriptEval){c.appendChild(document.createTextNode(a))}else{c.text=a}b.insertBefore(c,b.firstChild);b.removeChild(c)}},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()==b.toUpperCase()},each:function(e,a,f){var g,d=0,c=e.length;if(f){if(c===ac){for(g in e){if(a.apply(e[g],f)===false){break}}}else{for(;d<c;){if(a.apply(e[d++],f)===false){break}}}}else{if(c===ac){for(g in e){if(a.call(e[g],g,e[g])===false){break}}}else{for(var b=e[0];d<c&&a.call(b,d,b)!==false;b=e[++d]){}}}return e},prop:function(b,a,c,d,e){if(U.isFunction(a)){a=a.call(b,d)}return typeof a==="number"&&c=="curCSS"&&!ah.test(e)?a+"px":a},className:{add:function(b,a){U.each((a||"").split(/\s+/),function(d,c){if(b.nodeType==1&&!U.className.has(b.className,c)){b.className+=(b.className?" ":"")+c}})},remove:function(b,a){if(b.nodeType==1){b.className=a!==ac?U.grep(b.className.split(/\s+/),function(c){return !U.className.has(a,c)}).join(" "):""}},has:function(a,b){return a&&U.inArray(b,(a.className||a).toString().split(/\s+/))>-1}},swap:function(b,c,a){var e={};for(var d in c){e[d]=b.style[d];b.style[d]=c[d]}a.call(b);for(var d in c){b.style[d]=e[d]}},css:function(e,g,c,h){if(g=="width"||g=="height"){var a,f={position:"absolute",visibility:"hidden",display:"block"},b=g=="width"?["Left","Right"]:["Top","Bottom"];function d(){a=g=="width"?e.offsetWidth:e.offsetHeight;if(h==="border"){return}U.each(b,function(){if(!h){a-=parseFloat(U.curCSS(e,"padding"+this,true))||0}if(h==="margin"){a+=parseFloat(U.curCSS(e,"margin"+this,true))||0}else{a-=parseFloat(U.curCSS(e,"border"+this+"Width",true))||0}})}if(e.offsetWidth!==0){d()}else{U.swap(e,f,d)}return Math.max(0,Math.round(a))}return U.curCSS(e,g,c)},curCSS:function(e,h,g){var b,j=e.style;if(h=="opacity"&&!U.support.opacity){b=U.attr(j,"opacity");return b==""?"1":b}if(h.match(/float/i)){h=H}if(!g&&j&&j[h]){b=j[h]}else{if(R.getComputedStyle){if(h.match(/float/i)){h="float"}h=h.replace(/([A-Z])/g,"-$1").toLowerCase();var a=R.getComputedStyle(e,null);if(a){b=a.getPropertyValue(h)}if(h=="opacity"&&b==""){b="1"}}else{if(e.currentStyle){var d=h.replace(/\-(\w)/g,function(l,k){return k.toUpperCase()});b=e.currentStyle[h]||e.currentStyle[d];if(!/^\d+(px)?$/i.test(b)&&/^\d/.test(b)){var f=j.left,c=e.runtimeStyle.left;e.runtimeStyle.left=e.currentStyle.left;j.left=b||0;b=j.pixelLeft+"px";j.left=f;e.runtimeStyle.left=c}}}}return b},clean:function(g,b,d){b=b||document;if(typeof b.createElement==="undefined"){b=b.ownerDocument||b[0]&&b[0].ownerDocument||document}if(!d&&g.length===1&&typeof g[0]==="string"){var e=/^<(\w+)\s*\/?>$/.exec(g[0]);if(e){return[b.createElement(e[1])]}}var f=[],h=[],a=b.createElement("div");U.each(g,function(m,j){if(typeof j==="number"){j+=""}if(!j){return}if(typeof j==="string"){j=j.replace(/(<(\w+)[^>]*?)\/>/g,function(r,q,t){return t.match(/^(abbr|br|col|img|input|link|meta|param|hr|area|embed)$/i)?r:q+"></"+t+">"});var n=j.replace(/^\s+/,"").substring(0,10).toLowerCase();var l=!n.indexOf("<opt")&&[1,"<select multiple='multiple'>","</select>"]||!n.indexOf("<leg")&&[1,"<fieldset>","</fieldset>"]||n.match(/^<(thead|tbody|tfoot|colg|cap)/)&&[1,"<table>","</table>"]||!n.indexOf("<tr")&&[2,"<table><tbody>","</tbody></table>"]||(!n.indexOf("<td")||!n.indexOf("<th"))&&[3,"<table><tbody><tr>","</tr></tbody></table>"]||!n.indexOf("<col")&&[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"]||!U.support.htmlSerialize&&[1,"div<div>","</div>"]||[0,"",""];a.innerHTML=l[1]+j+l[2];while(l[0]--){a=a.lastChild}if(!U.support.tbody){var k=/<tbody/i.test(j),o=!n.indexOf("<table")&&!k?a.firstChild&&a.firstChild.childNodes:l[1]=="<table>"&&!k?a.childNodes:[];for(var p=o.length-1;p>=0;--p){if(U.nodeName(o[p],"tbody")&&!o[p].childNodes.length){o[p].parentNode.removeChild(o[p])}}}if(!U.support.leadingWhitespace&&/^\s/.test(j)){a.insertBefore(b.createTextNode(j.match(/^\s*/)[0]),a.firstChild)}j=U.makeArray(a.childNodes)}if(j.nodeType){f.push(j)}else{f=U.merge(f,j)}});if(d){for(var c=0;f[c];c++){if(U.nodeName(f[c],"script")&&(!f[c].type||f[c].type.toLowerCase()==="text/javascript")){h.push(f[c].parentNode?f[c].parentNode.removeChild(f[c]):f[c])}else{if(f[c].nodeType===1){f.splice.apply(f,[c+1,0].concat(U.makeArray(f[c].getElementsByTagName("script"))))}d.appendChild(f[c])}}return h}return f},attr:function(c,f,b){if(!c||c.nodeType==3||c.nodeType==8){return ac}var e=!U.isXMLDoc(c),a=b!==ac;f=e&&U.props[f]||f;if(c.tagName){var g=/href|src|style/.test(f);if(f=="selected"&&c.parentNode){c.parentNode.selectedIndex}if(f in c&&e&&!g){if(a){if(f=="type"&&U.nodeName(c,"input")&&c.parentNode){throw"type property can't be changed"}c[f]=b}if(U.nodeName(c,"form")&&c.getAttributeNode(f)){return c.getAttributeNode(f).nodeValue}if(f=="tabIndex"){var d=c.getAttributeNode("tabIndex");return d&&d.specified?d.value:c.nodeName.match(/(button|input|object|select|textarea)/i)?0:c.nodeName.match(/^(a|area)$/i)&&c.href?0:ac}return c[f]}if(!U.support.style&&e&&f=="style"){return U.attr(c.style,"cssText",b)}if(a){c.setAttribute(f,""+b)}var h=!U.support.hrefNormalized&&e&&g?c.getAttribute(f,2):c.getAttribute(f);return h===null?ac:h}if(!U.support.opacity&&f=="opacity"){if(a){c.zoom=1;c.filter=(c.filter||"").replace(/alpha\([^)]*\)/,"")+(parseInt(b)+""=="NaN"?"":"alpha(opacity="+b*100+")")}return c.filter&&c.filter.indexOf("opacity=")>=0?(parseFloat(c.filter.match(/opacity=([^)]*)/)[1])/100)+"":""}f=f.replace(/-([a-z])/ig,function(k,j){return j.toUpperCase()});if(a){c[f]=b}return c[f]},trim:function(a){return(a||"").replace(/^\s+|\s+$/g,"")},makeArray:function(a){var c=[];if(a!=null){var b=a.length;if(b==null||typeof a==="string"||U.isFunction(a)||a.setInterval){c[0]=a}else{while(b){c[--b]=a[b]}}}return c},inArray:function(b,a){for(var d=0,c=a.length;d<c;d++){if(a[d]===b){return d}}return -1},merge:function(b,e){var d=0,c,a=b.length;if(!U.support.getAll){while((c=e[d++])!=null){if(c.nodeType!=8){b[a++]=c}}}else{while((c=e[d++])!=null){b[a++]=c}}return b},unique:function(a){var f=[],g={};try{for(var e=0,d=a.length;e<d;e++){var b=U.data(a[e]);if(!g[b]){g[b]=true;f.push(a[e])}}}catch(c){f=a}return f},grep:function(e,a,f){var d=[];for(var c=0,b=e.length;c<b;c++){if(!f!=!a(e[c],c)){d.push(e[c])}}return d},map:function(f,a){var e=[];for(var d=0,c=f.length;d<c;d++){var b=a(f[d],d);if(b!=null){e[e.length]=b}}return e.concat.apply([],e)}});var P=navigator.userAgent.toLowerCase();U.browser={version:(P.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1],safari:/webkit/.test(P),opera:/opera/.test(P),msie:/msie/.test(P)&&!/opera/.test(P),mozilla:/mozilla/.test(P)&&!/(compatible|webkit)/.test(P)};U.each({parent:function(a){return a.parentNode},parents:function(a){return U.dir(a,"parentNode")},next:function(a){return U.nth(a,2,"nextSibling")},prev:function(a){return U.nth(a,2,"previousSibling")},nextAll:function(a){return U.dir(a,"nextSibling")},prevAll:function(a){return U.dir(a,"previousSibling")},siblings:function(a){return U.sibling(a.parentNode.firstChild,a)},children:function(a){return U.sibling(a.firstChild)},contents:function(a){return U.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:U.makeArray(a.childNodes)}},function(b,a){U.fn[b]=function(d){var c=U.map(this,a);if(d&&typeof d=="string"){c=U.multiFilter(d,c)}return this.pushStack(U.unique(c),b,d)}});U.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(b,a){U.fn[b]=function(h){var e=[],c=U(h);for(var d=0,g=c.length;d<g;d++){var f=(d>0?this.clone(true):this).get();U.fn[a].apply(U(c[d]),f);e=e.concat(f)}return this.pushStack(e,b,h)}});U.each({removeAttr:function(a){U.attr(this,a,"");if(this.nodeType==1){this.removeAttribute(a)}},addClass:function(a){U.className.add(this,a)},removeClass:function(a){U.className.remove(this,a)},toggleClass:function(a,b){if(typeof b!=="boolean"){b=!U.className.has(this,a)}U.className[b?"add":"remove"](this,a)},remove:function(a){if(!a||U.filter(a,[this]).length){U("*",this).add([this]).each(function(){U.event.remove(this);U.removeData(this)});if(this.parentNode){this.parentNode.removeChild(this)}}},empty:function(){U(this).children().remove();while(this.firstChild){this.removeChild(this.firstChild)}}},function(b,a){U.fn[b]=function(){return this.each(a,arguments)}});function Z(b,a){return b[0]&&parseInt(U.curCSS(b[0],a,true),10)||0}var ab="jQuery"+ae(),I=0,S={};U.extend({cache:{},data:function(c,d,b){c=c==X?S:c;var a=c[ab];if(!a){a=c[ab]=++I}if(d&&!U.cache[a]){U.cache[a]={}}if(b!==ac){U.cache[a][d]=b}return d?U.cache[a][d]:a},removeData:function(c,d){c=c==X?S:c;var a=c[ab];if(d){if(U.cache[a]){delete U.cache[a][d];d="";for(d in U.cache[a]){break}if(!d){U.removeData(c)}}}else{try{delete c[ab]}catch(b){if(c.removeAttribute){c.removeAttribute(ab)}}delete U.cache[a]}},queue:function(c,d,a){if(c){d=(d||"fx")+"queue";var b=U.data(c,d);if(!b||U.isArray(a)){b=U.data(c,d,U.makeArray(a))}else{if(a){b.push(a)}}}return b},dequeue:function(a,b){var d=U.queue(a,b),c=d.shift();if(!b||b==="fx"){c=d[0]}if(c!==ac){c.call(a)}}});U.fn.extend({data:function(d,b){var a=d.split(".");a[1]=a[1]?"."+a[1]:"";if(b===ac){var c=this.triggerHandler("getData"+a[1]+"!",[a[0]]);if(c===ac&&this.length){c=U.data(this[0],d)}return c===ac&&a[1]?this.data(a[0]):c}else{return this.trigger("setData"+a[1]+"!",[a[0],b]).each(function(){U.data(this,d,b)})}},removeData:function(a){return this.each(function(){U.removeData(this,a)})},queue:function(b,a){if(typeof b!=="string"){a=b;b="fx"}if(a===ac){return U.queue(this[0],b)}return this.each(function(){var c=U.queue(this,b,a);if(b=="fx"&&c.length==1){c[0].call(this)}})},dequeue:function(a){return this.each(function(){U.dequeue(this,a)})}});(function(){var b=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?/g,h=0,m=Object.prototype.toString;var o=function(t,x,al,ak){al=al||[];x=x||document;if(x.nodeType!==1&&x.nodeType!==9){return[]}if(!t||typeof t!=="string"){return al}var r=[],v,C,z,y,aj,w,u=true;b.lastIndex=0;while((v=b.exec(t))!==null){r.push(v[1]);if(v[2]){w=RegExp.rightContext;break}}if(r.length>1&&g.exec(t)){if(r.length===2&&l.relative[r[0]]){C=k(r[0]+r[1],x)}else{C=l.relative[r[0]]?[x]:o(r.shift(),x);while(r.length){t=r.shift();if(l.relative[t]){t+=r.shift()}C=k(t,C)}}}else{var D=ak?{expr:r.pop(),set:p(ak)}:o.find(r.pop(),r.length===1&&x.parentNode?x.parentNode:x,c(x));C=o.filter(D.expr,D.set);if(r.length>0){z=p(C)}else{u=false}while(r.length){var A=r.pop(),B=A;if(!l.relative[A]){A=""}else{B=r.pop()}if(B==null){B=x}l.relative[A](z,B,c(x))}}if(!z){z=C}if(!z){throw"Syntax error, unrecognized expression: "+(A||t)}if(m.call(z)==="[object Array]"){if(!u){al.push.apply(al,z)}else{if(x.nodeType===1){for(var q=0;z[q]!=null;q++){if(z[q]&&(z[q]===true||z[q].nodeType===1&&j(x,z[q]))){al.push(C[q])}}}else{for(var q=0;z[q]!=null;q++){if(z[q]&&z[q].nodeType===1){al.push(C[q])}}}}}else{p(z,al)}if(w){o(w,x,al,ak);if(n){hasDuplicate=false;al.sort(n);if(hasDuplicate){for(var q=1;q<al.length;q++){if(al[q]===al[q-1]){al.splice(q--,1)}}}}}return al};o.matches=function(r,q){return o(r,null,null,q)};o.find=function(q,y,z){var r,u;if(!q){return[]}for(var v=0,w=l.order.length;v<w;v++){var t=l.order[v],u;if((u=l.match[t].exec(q))){var x=RegExp.leftContext;if(x.substr(x.length-1)!=="\\"){u[1]=(u[1]||"").replace(/\\/g,"");r=l.find[t](u,y,z);if(r!=null){q=q.replace(l.match[t],"");break}}}}if(!r){r=y.getElementsByTagName("*")}return{set:r,expr:q}};o.filter=function(aj,ak,B,v){var w=aj,z=[],q=ak,t,y,r=ak&&ak[0]&&c(ak[0]);while(aj&&ak.length){for(var al in l.filter){if((t=l.match[al].exec(aj))!=null){var x=l.filter[al],A,C;y=false;if(q==z){z=[]}if(l.preFilter[al]){t=l.preFilter[al](t,q,B,z,v,r);if(!t){y=A=true}else{if(t===true){continue}}}if(t){for(var u=0;(C=q[u])!=null;u++){if(C){A=x(C,t,u,q);var D=v^!!A;if(B&&A!=null){if(D){y=true}else{q[u]=false}}else{if(D){z.push(C);y=true}}}}}if(A!==ac){if(!B){q=z}aj=aj.replace(l.match[al],"");if(!y){return[]}break}}}if(aj==w){if(y==null){throw"Syntax error, unrecognized expression: "+aj}else{break}}w=aj}return q};var l=o.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF_-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF_-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF_-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*_-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF_-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(q){return q.getAttribute("href")}},relative:{"+":function(q,y,r){var u=typeof y==="string",z=u&&!/\W/.test(y),t=u&&!z;if(z&&!r){y=y.toUpperCase()}for(var v=0,w=q.length,x;v<w;v++){if((x=q[v])){while((x=x.previousSibling)&&x.nodeType!==1){}q[v]=t||x&&x.nodeName===y?x||false:x===y}}if(t){o.filter(y,q,true)}},">":function(w,t,v){var y=typeof t==="string";if(y&&!/\W/.test(t)){t=v?t:t.toUpperCase();for(var r=0,u=w.length;r<u;r++){var x=w[r];if(x){var q=x.parentNode;w[r]=q.nodeName===t?q:false}}}else{for(var r=0,u=w.length;r<u;r++){var x=w[r];if(x){w[r]=y?x.parentNode:x.parentNode===t}}if(y){o.filter(t,w,true)}}},"":function(q,t,v){var r=h++,u=a;if(!t.match(/\W/)){var w=t=v?t:t.toUpperCase();u=d}u("parentNode",t,r,q,w,v)},"~":function(q,t,v){var r=h++,u=a;if(typeof t==="string"&&!t.match(/\W/)){var w=t=v?t:t.toUpperCase();u=d}u("previousSibling",t,r,q,w,v)}},find:{ID:function(t,r,q){if(typeof r.getElementById!=="undefined"&&!q){var u=r.getElementById(t[1]);return u?[u]:[]}},NAME:function(r,w,v){if(typeof w.getElementsByName!=="undefined"){var t=[],x=w.getElementsByName(r[1]);for(var q=0,u=x.length;q<u;q++){if(x[q].getAttribute("name")===r[1]){t.push(x[q])}}return t.length===0?null:t}},TAG:function(r,q){return q.getElementsByTagName(r[1])}},preFilter:{CLASS:function(q,t,r,u,w,v){q=" "+q[1].replace(/\\/g,"")+" ";if(v){return q}for(var y=0,x;(x=t[y])!=null;y++){if(x){if(w^(x.className&&(" "+x.className+" ").indexOf(q)>=0)){if(!r){u.push(x)}}else{if(r){t[y]=false}}}}return false},ID:function(q){return q[1].replace(/\\/g,"")},TAG:function(r,t){for(var q=0;t[q]===false;q++){}return t[q]&&c(t[q])?r[1]:r[1].toUpperCase()},CHILD:function(r){if(r[1]=="nth"){var q=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(r[2]=="even"&&"2n"||r[2]=="odd"&&"2n+1"||!/\D/.test(r[2])&&"0n+"+r[2]||r[2]);r[2]=(q[1]+(q[2]||1))-0;r[3]=q[3]-0}r[0]=h++;return r},ATTR:function(x,t,r,u,w,v){var q=x[1].replace(/\\/g,"");if(!v&&l.attrMap[q]){x[1]=l.attrMap[q]}if(x[2]==="~="){x[4]=" "+x[4]+" "}return x},PSEUDO:function(w,t,r,u,v){if(w[1]==="not"){if(w[3].match(b).length>1||/^\w/.test(w[3])){w[3]=o(w[3],null,null,t)}else{var q=o.filter(w[3],t,r,true^v);if(!r){u.push.apply(u,q)}return false}}else{if(l.match.POS.test(w[0])||l.match.CHILD.test(w[0])){return true}}return w},POS:function(q){q.unshift(true);return q}},filters:{enabled:function(q){return q.disabled===false&&q.type!=="hidden"},disabled:function(q){return q.disabled===true},checked:function(q){return q.checked===true},selected:function(q){q.parentNode.selectedIndex;return q.selected===true},parent:function(q){return !!q.firstChild},empty:function(q){return !q.firstChild},has:function(q,r,t){return !!o(t[3],q).length},header:function(q){return/h\d/i.test(q.nodeName)},text:function(q){return"text"===q.type},radio:function(q){return"radio"===q.type},checkbox:function(q){return"checkbox"===q.type},file:function(q){return"file"===q.type},password:function(q){return"password"===q.type},submit:function(q){return"submit"===q.type},image:function(q){return"image"===q.type},reset:function(q){return"reset"===q.type},button:function(q){return"button"===q.type||q.nodeName.toUpperCase()==="BUTTON"},input:function(q){return/input|select|textarea|button/i.test(q.nodeName)}},setFilters:{first:function(q,r){return r===0},last:function(r,t,u,q){return t===q.length-1},even:function(q,r){return r%2===0},odd:function(q,r){return r%2===1},lt:function(q,r,t){return r<t[3]-0},gt:function(q,r,t){return r>t[3]-0},nth:function(q,r,t){return t[3]-0==r},eq:function(q,r,t){return t[3]-0==r}},filter:{PSEUDO:function(w,r,q,v){var t=r[1],y=l.filters[t];if(y){return y(w,q,r,v)}else{if(t==="contains"){return(w.textContent||w.innerText||"").indexOf(r[3])>=0}else{if(t==="not"){var x=r[3];for(var q=0,u=x.length;q<u;q++){if(x[q]===w){return false}}return true}}}},CHILD:function(y,v){var r=v[1],x=y;switch(r){case"only":case"first":while(x=x.previousSibling){if(x.nodeType===1){return false}}if(r=="first"){return true}x=y;case"last":while(x=x.nextSibling){if(x.nodeType===1){return false}}return true;case"nth":var w=v[2],z=v[3];if(w==1&&z==0){return true}var t=v[0],A=y.parentNode;if(A&&(A.sizcache!==t||!y.nodeIndex)){var u=0;for(x=A.firstChild;x;x=x.nextSibling){if(x.nodeType===1){x.nodeIndex=++u}}A.sizcache=t}var q=y.nodeIndex-z;if(w==0){return q==0}else{return(q%w==0&&q/w>=0)}}},ID:function(q,r){return q.nodeType===1&&q.getAttribute("id")===r},TAG:function(q,r){return(r==="*"&&q.nodeType===1)||q.nodeName===r},CLASS:function(q,r){return(" "+(q.className||q.getAttribute("class"))+" ").indexOf(r)>-1},ATTR:function(w,q){var r=q[1],u=l.attrHandle[r]?l.attrHandle[r](w):w[r]!=null?w[r]:w.getAttribute(r),v=u+"",x=q[2],t=q[4];return u==null?x==="!=":x==="="?v===t:x==="*="?v.indexOf(t)>=0:x==="~="?(" "+v+" ").indexOf(t)>=0:!t?v&&u!==false:x==="!="?v!=t:x==="^="?v.indexOf(t)===0:x==="$="?v.substr(v.length-t.length)===t:x==="|="?v===t||v.substr(0,t.length+1)===t+"-":false},POS:function(w,t,r,v){var u=t[2],q=l.setFilters[u];if(q){return q(w,r,t,v)}}}};var g=l.match.POS;for(var e in l.match){l.match[e]=RegExp(l.match[e].source+/(?![^\[]*\])(?![^\(]*\))/.source)}var p=function(q,r){q=Array.prototype.slice.call(q);if(r){r.push.apply(r,q);return r}return q};try{Array.prototype.slice.call(document.documentElement.childNodes)}catch(f){p=function(v,q){var t=q||[];if(m.call(v)==="[object Array]"){Array.prototype.push.apply(t,v)}else{if(typeof v.length==="number"){for(var r=0,u=v.length;r<u;r++){t.push(v[r])}}else{for(var r=0;v[r];r++){t.push(v[r])}}}return t}}var n;if(document.documentElement.compareDocumentPosition){n=function(r,t){var q=r.compareDocumentPosition(t)&4?-1:r===t?0:1;if(q===0){hasDuplicate=true}return q}}else{if("sourceIndex" in document.documentElement){n=function(r,t){var q=r.sourceIndex-t.sourceIndex;if(q===0){hasDuplicate=true}return q}}else{if(document.createRange){n=function(q,t){var r=q.ownerDocument.createRange(),u=t.ownerDocument.createRange();r.selectNode(q);r.collapse(true);u.selectNode(t);u.collapse(true);var v=r.compareBoundaryPoints(Range.START_TO_END,u);if(v===0){hasDuplicate=true}return v}}}}(function(){var r=document.createElement("form"),q="script"+(new Date).getTime();r.innerHTML="<input name='"+q+"'/>";var t=document.documentElement;t.insertBefore(r,t.firstChild);if(!!document.getElementById(q)){l.find.ID=function(x,w,v){if(typeof w.getElementById!=="undefined"&&!v){var u=w.getElementById(x[1]);return u?u.id===x[1]||typeof u.getAttributeNode!=="undefined"&&u.getAttributeNode("id").nodeValue===x[1]?[u]:ac:[]}};l.filter.ID=function(v,u){var w=typeof v.getAttributeNode!=="undefined"&&v.getAttributeNode("id");return v.nodeType===1&&w&&w.nodeValue===u}}t.removeChild(r)})();(function(){var q=document.createElement("div");q.appendChild(document.createComment(""));if(q.getElementsByTagName("*").length>0){l.find.TAG=function(u,v){var w=v.getElementsByTagName(u[1]);if(u[1]==="*"){var r=[];for(var t=0;w[t];t++){if(w[t].nodeType===1){r.push(w[t])}}w=r}return w}}q.innerHTML="<a href='#'></a>";if(q.firstChild&&typeof q.firstChild.getAttribute!=="undefined"&&q.firstChild.getAttribute("href")!=="#"){l.attrHandle.href=function(r){return r.getAttribute("href",2)}}})();if(document.querySelectorAll){(function(){var r=o,q=document.createElement("div");q.innerHTML="<p class='TEST'></p>";if(q.querySelectorAll&&q.querySelectorAll(".TEST").length===0){return}o=function(w,x,u,t){x=x||document;if(!t&&x.nodeType===9&&!c(x)){try{return p(x.querySelectorAll(w),u)}catch(v){}}return r(w,x,u,t)};o.find=r.find;o.filter=r.filter;o.selectors=r.selectors;o.matches=r.matches})()}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var q=document.createElement("div");q.innerHTML="<div class='test e'></div><div class='test'></div>";if(q.getElementsByClassName("e").length===0){return}q.lastChild.className="e";if(q.getElementsByClassName("e").length===1){return}l.order.splice(1,0,"CLASS");l.find.CLASS=function(u,t,r){if(typeof t.getElementsByClassName!=="undefined"&&!r){return t.getElementsByClassName(u[1])}}})()}function d(x,r,t,z,q,A){var B=x=="previousSibling"&&!A;for(var v=0,w=z.length;v<w;v++){var y=z[v];if(y){if(B&&y.nodeType===1){y.sizcache=t;y.sizset=v}y=y[x];var u=false;while(y){if(y.sizcache===t){u=z[y.sizset];break}if(y.nodeType===1&&!A){y.sizcache=t;y.sizset=v}if(y.nodeName===r){u=y;break}y=y[x]}z[v]=u}}}function a(x,r,t,z,q,A){var B=x=="previousSibling"&&!A;for(var v=0,w=z.length;v<w;v++){var y=z[v];if(y){if(B&&y.nodeType===1){y.sizcache=t;y.sizset=v}y=y[x];var u=false;while(y){if(y.sizcache===t){u=z[y.sizset];break}if(y.nodeType===1){if(!A){y.sizcache=t;y.sizset=v}if(typeof r!=="string"){if(y===r){u=true;break}}else{if(o.filter(r,[y]).length>0){u=y;break}}}y=y[x]}z[v]=u}}}var j=document.compareDocumentPosition?function(q,r){return q.compareDocumentPosition(r)&16}:function(q,r){return q!==r&&(q.contains?q.contains(r):true)};var c=function(q){return q.nodeType===9&&q.documentElement.nodeName!=="HTML"||!!q.ownerDocument&&c(q.ownerDocument)};var k=function(u,w){var q=[],y="",x,r=w.nodeType?[w]:w;while((x=l.match.PSEUDO.exec(u))){y+=x[0];u=u.replace(l.match.PSEUDO,"")}u=l.relative[u]?u+"*":u;for(var v=0,t=r.length;v<t;v++){o(u,r[v],q)}return o.filter(y,q)};U.find=o;U.filter=o.filter;U.expr=o.selectors;U.expr[":"]=U.expr.filters;o.selectors.filters.hidden=function(q){return q.offsetWidth===0||q.offsetHeight===0};o.selectors.filters.visible=function(q){return q.offsetWidth>0||q.offsetHeight>0};o.selectors.filters.animated=function(q){return U.grep(U.timers,function(r){return q===r.elem}).length};U.multiFilter=function(q,t,r){if(r){q=":not("+q+")"}return o.matches(q,t)};U.dir=function(r,t){var u=[],q=r[t];while(q&&q!=document){if(q.nodeType==1){u.push(q)}q=q[t]}return u};U.nth=function(v,u,r,q){u=u||1;var t=0;for(;v;v=v[r]){if(v.nodeType==1&&++t==u){break}}return v};U.sibling=function(q,r){var t=[];for(;q;q=q.nextSibling){if(q.nodeType==1&&q!=r){t.push(q)}}return t};return;X.Sizzle=o})();U.event={add:function(c,f,d,a){if(c.nodeType==3||c.nodeType==8){return}if(c.setInterval&&c!=X){c=X}if(!d.guid){d.guid=this.guid++}if(a!==ac){var e=d;d=this.proxy(e);d.data=a}var g=U.data(c,"events")||U.data(c,"events",{}),b=U.data(c,"handle")||U.data(c,"handle",function(){return typeof U!=="undefined"&&!U.event.triggered?U.event.handle.apply(arguments.callee.elem,arguments):ac});b.elem=c;U.each(f.split(/\s+/),function(l,k){var j=k.split(".");k=j.shift();d.type=j.slice().sort().join(".");var h=g[k];if(U.event.specialAll[k]){U.event.specialAll[k].setup.call(c,a,j)}if(!h){h=g[k]={};if(!U.event.special[k]||U.event.special[k].setup.call(c,a,j)===false){if(c.addEventListener){c.addEventListener(k,b,false)}else{if(c.attachEvent){c.attachEvent("on"+k,b)}}}}h[d.guid]=d;U.event.global[k]=true});c=null},guid:1,global:{},remove:function(b,e,c){if(b.nodeType==3||b.nodeType==8){return}var f=U.data(b,"events"),g,h;if(f){if(e===ac||(typeof e==="string"&&e.charAt(0)==".")){for(var d in f){this.remove(b,d+(e||""))}}else{if(e.type){c=e.handler;e=e.type}U.each(e.split(/\s+/),function(n,l){var j=l.split(".");l=j.shift();var m=RegExp("(^|\\.)"+j.slice().sort().join(".*\\.")+"(\\.|$)");if(f[l]){if(c){delete f[l][c.guid]}else{for(var k in f[l]){if(m.test(f[l][k].type)){delete f[l][k]}}}if(U.event.specialAll[l]){U.event.specialAll[l].teardown.call(b,j)}for(g in f[l]){break}if(!g){if(!U.event.special[l]||U.event.special[l].teardown.call(b,j)===false){if(b.removeEventListener){b.removeEventListener(l,U.data(b,"handle"),false)}else{if(b.detachEvent){b.detachEvent("on"+l,U.data(b,"handle"))}}}g=null;delete f[l]}}})}for(g in f){break}if(!g){var a=U.data(b,"handle");if(a){a.elem=null}U.removeData(b,"events");U.removeData(b,"handle")}}},trigger:function(d,b,e,h){var f=d.type||d;if(!h){d=typeof d==="object"?d[ab]?d:U.extend(U.Event(f),d):U.Event(f);if(f.indexOf("!")>=0){d.type=f=f.slice(0,-1);d.exclusive=true}if(!e){d.stopPropagation();if(this.global[f]){U.each(U.cache,function(){if(this.events&&this.events[f]){U.event.trigger(d,b,this.handle.elem)}})}}if(!e||e.nodeType==3||e.nodeType==8){return ac}d.result=ac;d.target=e;b=U.makeArray(b);b.unshift(d)}d.currentTarget=e;var c=U.data(e,"handle");if(c){c.apply(e,b)}if((!e[f]||(U.nodeName(e,"a")&&f=="click"))&&e["on"+f]&&e["on"+f].apply(e,b)===false){d.result=false}if(!h&&e[f]&&!d.isDefaultPrevented()&&!(U.nodeName(e,"a")&&f=="click")){this.triggered=true;try{e[f]()}catch(a){}}this.triggered=false;if(!d.isPropagationStopped()){var g=e.parentNode||e.ownerDocument;if(g){U.event.trigger(d,b,g,true)}}},handle:function(b){var c,h;b=arguments[0]=U.event.fix(b||X.event);b.currentTarget=this;var a=b.type.split(".");b.type=a.shift();c=!a.length&&!b.exclusive;var d=RegExp("(^|\\.)"+a.slice().sort().join(".*\\.")+"(\\.|$)");h=(U.data(this,"events")||{})[b.type];for(var f in h){var e=h[f];if(c||d.test(e.type)){b.handler=e;b.data=e.data;var g=e.apply(this,arguments);if(g!==ac){b.result=g;if(g===false){b.preventDefault();b.stopPropagation()}}if(b.isImmediatePropagationStopped()){break}}}},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode metaKey newValue originalTarget pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(c){if(c[ab]){return c}var e=c;c=U.Event(e);for(var d=this.props.length,a;d;){a=this.props[--d];c[a]=e[a]}if(!c.target){c.target=c.srcElement||document}if(c.target.nodeType==3){c.target=c.target.parentNode}if(!c.relatedTarget&&c.fromElement){c.relatedTarget=c.fromElement==c.target?c.toElement:c.fromElement}if(c.pageX==null&&c.clientX!=null){var b=document.documentElement,f=document.body;c.pageX=c.clientX+(b&&b.scrollLeft||f&&f.scrollLeft||0)-(b.clientLeft||0);c.pageY=c.clientY+(b&&b.scrollTop||f&&f.scrollTop||0)-(b.clientTop||0)}if(!c.which&&((c.charCode||c.charCode===0)?c.charCode:c.keyCode)){c.which=c.charCode||c.keyCode}if(!c.metaKey&&c.ctrlKey){c.metaKey=c.ctrlKey}if(!c.which&&c.button){c.which=(c.button&1?1:(c.button&2?3:(c.button&4?2:0)))}return c},proxy:function(a,b){b=b||function(){return a.apply(this,arguments)};b.guid=a.guid=a.guid||b.guid||this.guid++;return b},special:{ready:{setup:Q,teardown:function(){}}},specialAll:{live:{setup:function(b,a){U.event.add(this,a[0],ag)},teardown:function(a){if(a.length){var c=0,b=RegExp("(^|\\.)"+a[0]+"(\\.|$)");U.each((U.data(this,"events").live||{}),function(){if(b.test(this.type)){c++}});if(c<1){U.event.remove(this,a[0],ag)}}}}}};U.Event=function(a){if(!this.preventDefault){return new U.Event(a)}if(a&&a.type){this.originalEvent=a;this.type=a.type}else{this.type=a}this.timeStamp=ae();this[ab]=true};function Y(){return false}function J(){return true}U.Event.prototype={preventDefault:function(){this.isDefaultPrevented=J;var a=this.originalEvent;if(!a){return}if(a.preventDefault){a.preventDefault()}a.returnValue=false},stopPropagation:function(){this.isPropagationStopped=J;var a=this.originalEvent;if(!a){return}if(a.stopPropagation){a.stopPropagation()}a.cancelBubble=true},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=J;this.stopPropagation()},isDefaultPrevented:Y,isPropagationStopped:Y,isImmediatePropagationStopped:Y};var ai=function(b){var c=b.relatedTarget;while(c&&c!=this){try{c=c.parentNode}catch(a){c=this}}if(c!=this){b.type=b.data;U.event.handle.apply(this,arguments)}};U.each({mouseover:"mouseenter",mouseout:"mouseleave"},function(a,b){U.event.special[b]={setup:function(){U.event.add(this,a,ai,b)},teardown:function(){U.event.remove(this,a,ai)}}});U.fn.extend({bind:function(b,a,c){return b=="unload"?this.one(b,a,c):this.each(function(){U.event.add(this,b,c||a,c&&a)})},one:function(b,a,c){var d=U.event.proxy(c||a,function(e){U(this).unbind(e,d);return(c||a).apply(this,arguments)});return this.each(function(){U.event.add(this,b,d,c&&a)})},unbind:function(a,b){return this.each(function(){U.event.remove(this,a,b)})},trigger:function(b,a){return this.each(function(){U.event.trigger(b,a,this)})},triggerHandler:function(c,a){if(this[0]){var b=U.Event(c);b.preventDefault();b.stopPropagation();U.event.trigger(b,a,this[0]);return b.result}},toggle:function(a){var c=arguments,b=1;while(b<c.length){U.event.proxy(a,c[b++])}return this.click(U.event.proxy(a,function(d){this.lastToggle=(this.lastToggle||0)%b;d.preventDefault();return c[this.lastToggle++].apply(this,arguments)||false}))},hover:function(b,a){return this.mouseenter(b).mouseleave(a)},ready:function(a){Q();if(U.isReady){a.call(document,U)}else{U.readyList.push(a)}return this},live:function(a,b){var c=U.event.proxy(b);c.guid+=this.selector+a;U(document).bind(aa(a,this.selector),this.selector,c);return this},die:function(a,b){U(document).unbind(aa(a,this.selector),b?{guid:b.guid+this.selector+a}:null);return this}});function ag(a){var d=RegExp("(^|\\.)"+a.type+"(\\.|$)"),b=true,c=[];U.each(U.data(this,"events").live||[],function(g,f){if(d.test(f.type)){var e=U(a.target).closest(f.data)[0];if(e){c.push({elem:e,fn:f})}}});c.sort(function(e,f){return U.data(e.elem,"closest")-U.data(f.elem,"closest")});U.each(c,function(){if(this.fn.call(this.elem,a,this.fn.data)===false){return(b=false)}});return b}function aa(a,b){return["live",a,b.replace(/\./g,"`").replace(/ /g,"|")].join(".")}U.extend({isReady:false,readyList:[],ready:function(){if(!U.isReady){U.isReady=true;if(U.readyList){U.each(U.readyList,function(){this.call(document,U)});U.readyList=null}U(document).triggerHandler("ready")}}});var G=false;function Q(){if(G){return}G=true;if(document.addEventListener){document.addEventListener("DOMContentLoaded",function(){document.removeEventListener("DOMContentLoaded",arguments.callee,false);U.ready()},false)}else{if(document.attachEvent){document.attachEvent("onreadystatechange",function(){if(document.readyState==="complete"){document.detachEvent("onreadystatechange",arguments.callee);U.ready()}});if(document.documentElement.doScroll&&X==X.top){(function(){if(U.isReady){return}try{document.documentElement.doScroll("left")}catch(a){setTimeout(arguments.callee,0);return}U.ready()})()}}}U.event.add(X,"load",U.ready)}U.each(("blur,focus,load,resize,scroll,unload,click,dblclick,mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave,change,select,submit,keydown,keypress,keyup,error").split(","),function(a,b){U.fn[b]=function(c){return c?this.bind(b,c):this.trigger(b)}});U(X).bind("unload",function(){for(var a in U.cache){if(a!=1&&U.cache[a].handle){U.event.remove(U.cache[a].handle.elem)}}});(function(){U.support={};var f=document.documentElement,e=document.createElement("script"),a=document.createElement("div"),b="script"+(new Date).getTime();a.style.display="none";a.innerHTML='   <link/><table></table><a href="/a" style="color:red;float:left;opacity:.5;">a</a><select><option>text</option></select><object><param/></object>';var d=a.getElementsByTagName("*"),g=a.getElementsByTagName("a")[0];if(!d||!d.length||!g){return}U.support={leadingWhitespace:a.firstChild.nodeType==3,tbody:!a.getElementsByTagName("tbody").length,objectAll:!!a.getElementsByTagName("object")[0].getElementsByTagName("*").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/red/.test(g.getAttribute("style")),hrefNormalized:g.getAttribute("href")==="/a",opacity:g.style.opacity==="0.5",cssFloat:!!g.style.cssFloat,scriptEval:false,noCloneEvent:true,boxModel:null};e.type="text/javascript";try{e.appendChild(document.createTextNode("window."+b+"=1;"))}catch(c){}f.insertBefore(e,f.firstChild);if(X[b]){U.support.scriptEval=true;delete X[b]}f.removeChild(e);if(a.attachEvent&&a.fireEvent){a.attachEvent("onclick",function(){U.support.noCloneEvent=false;a.detachEvent("onclick",arguments.callee)});a.cloneNode(true).fireEvent("onclick")}U(function(){var h=document.createElement("div");h.style.width=h.style.paddingLeft="1px";document.body.appendChild(h);U.boxModel=U.support.boxModel=h.offsetWidth===2;document.body.removeChild(h).style.display="none"})})();var H=U.support.cssFloat?"cssFloat":"styleFloat";U.props={"for":"htmlFor","class":"className","float":H,cssFloat:H,styleFloat:H,readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",tabindex:"tabIndex"};U.fn.extend({_load:U.fn.load,load:function(e,b,a){if(typeof e!=="string"){return this._load(e)}var c=e.indexOf(" ");if(c>=0){var g=e.slice(c,e.length);e=e.slice(0,c)}var d="GET";if(b){if(U.isFunction(b)){a=b;b=null}else{if(typeof b==="object"){b=U.param(b);d="POST"}}}var f=this;U.ajax({url:e,type:d,dataType:"html",data:b,complete:function(j,h){if(h=="success"||h=="notmodified"){f.html(g?U("<div/>").append(j.responseText.replace(/<script(.|\s)*?\/script>/g,"")).find(g):j.responseText)}if(a){f.each(a,[j.responseText,h,j])}}});return this},serialize:function(){return U.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?U.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||/select|textarea/i.test(this.nodeName)||/text|hidden|password|search/i.test(this.type))}).map(function(c,b){var a=U(this).val();return a==null?null:U.isArray(a)?U.map(a,function(d,e){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});U.each("ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","),function(b,a){U.fn[a]=function(c){return this.bind(a,c)}});var O=ae();U.extend({get:function(d,b,a,c){if(U.isFunction(b)){a=b;b=null}return U.ajax({type:"GET",url:d,data:b,success:a,dataType:c})},getScript:function(b,a){return U.get(b,null,a,"script")},getJSON:function(c,b,a){return U.get(c,b,a,"json")},post:function(d,b,a,c){if(U.isFunction(b)){a=b;b={}}return U.ajax({type:"POST",url:d,data:b,success:a,dataType:c})},ajaxSetup:function(a){U.extend(U.ajaxSettings,a)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return X.ActiveXObject?new ActiveXObject("Microsoft.XMLHTTP"):new XMLHttpRequest()},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},ajax:function(l){l=U.extend(true,l,U.extend(true,{},U.ajaxSettings,l));var a,t=/=\?(&|$)/g,f,b,r=l.type.toUpperCase();if(l.data&&l.processData&&typeof l.data!=="string"){l.data=U.param(l.data)}if(l.dataType=="jsonp"){if(r=="GET"){if(!l.url.match(t)){l.url+=(l.url.match(/\?/)?"&":"?")+(l.jsonp||"callback")+"=?"}}else{if(!l.data||!l.data.match(t)){l.data=(l.data?l.data+"&":"")+(l.jsonp||"callback")+"=?"}}l.dataType="json"}if(l.dataType=="json"&&(l.data&&l.data.match(t)||l.url.match(t))){a="jsonp"+O++;if(l.data){l.data=(l.data+"").replace(t,"="+a+"$1")}l.url=l.url.replace(t,"="+a+"$1");l.dataType="script";X[a]=function(w){b=w;p();m();X[a]=ac;try{delete X[a]}catch(v){}if(q){q.removeChild(d)}}}if(l.dataType=="script"&&l.cache==null){l.cache=false}if(l.cache===false&&r=="GET"){var u=ae();var c=l.url.replace(/(\?|&)_=.*?(&|$)/,"$1_="+u+"$2");l.url=c+((c==l.url)?(l.url.match(/\?/)?"&":"?")+"_="+u:"")}if(l.data&&r=="GET"){l.url+=(l.url.match(/\?/)?"&":"?")+l.data;l.data=null}if(l.global&&!U.active++){U.event.trigger("ajaxStart")}var g=/^(\w+:)?\/\/([^\/?#]+)/.exec(l.url);if(l.dataType=="script"&&r=="GET"&&g&&(g[1]&&g[1]!=location.protocol||g[2]!=location.host)){var q=document.getElementsByTagName("head")[0];var d=document.createElement("script");d.src=l.url;if(l.scriptCharset){d.charset=l.scriptCharset}if(!a){var j=false;d.onload=d.onreadystatechange=function(){if(!j&&(!this.readyState||this.readyState=="loaded"||this.readyState=="complete")){j=true;p();m();d.onload=d.onreadystatechange=null;q.removeChild(d)}}}q.appendChild(d);return ac}var n=false;var o=l.xhr();if(l.username){o.open(r,l.url,l.async,l.username,l.password)}else{o.open(r,l.url,l.async)}try{if(l.data){o.setRequestHeader("Content-Type",l.contentType)}if(l.ifModified){o.setRequestHeader("If-Modified-Since",U.lastModified[l.url]||"Thu, 01 Jan 1970 00:00:00 GMT")}o.setRequestHeader("X-Requested-With","XMLHttpRequest");o.setRequestHeader("Accept",l.dataType&&l.accepts[l.dataType]?l.accepts[l.dataType]+", */*":l.accepts._default)}catch(e){}if(l.beforeSend&&l.beforeSend(o,l)===false){if(l.global&&!--U.active){U.event.trigger("ajaxStop")}o.abort();return false}if(l.global){U.event.trigger("ajaxSend",[o,l])}var k=function(x){if(o.readyState==0){if(h){clearInterval(h);h=null;if(l.global&&!--U.active){U.event.trigger("ajaxStop")}}}else{if(!n&&o&&(o.readyState==4||x=="timeout")){n=true;if(h){clearInterval(h);h=null}f=x=="timeout"?"timeout":!U.httpSuccess(o)?"error":l.ifModified&&U.httpNotModified(o,l.url)?"notmodified":"success";if(f=="success"){try{b=U.httpData(o,l.dataType,l)}catch(v){f="parsererror"}}if(f=="success"){var w;try{w=o.getResponseHeader("Last-Modified")}catch(v){}if(l.ifModified&&w){U.lastModified[l.url]=w}if(!a){p()}}else{U.handleError(l,o,f)}m();if(x){o.abort()}if(l.async){o=null}}}};if(l.async){var h=setInterval(k,13);if(l.timeout>0){setTimeout(function(){if(o&&!n){k("timeout")}},l.timeout)}}try{o.send(l.data)}catch(e){U.handleError(l,o,null,e)}if(!l.async){k()}function p(){if(l.success){l.success(b,f)}if(l.global){U.event.trigger("ajaxSuccess",[o,l])}}function m(){if(l.complete){l.complete(o,f)}if(l.global){U.event.trigger("ajaxComplete",[o,l])}if(l.global&&!--U.active){U.event.trigger("ajaxStop")}}return o},handleError:function(c,a,d,b){if(c.error){c.error(a,d,b)}if(c.global){U.event.trigger("ajaxError",[a,c,b])}},active:0,httpSuccess:function(a){try{return !a.status&&location.protocol=="file:"||(a.status>=200&&a.status<300)||a.status==304||a.status==1223}catch(b){}return false},httpNotModified:function(b,d){try{var a=b.getResponseHeader("Last-Modified");return b.status==304||a==U.lastModified[d]}catch(c){}return false},httpData:function(a,c,d){var e=a.getResponseHeader("content-type"),f=c=="xml"||!c&&e&&e.indexOf("xml")>=0,b=f?a.responseXML:a.responseText;if(f&&b.documentElement.tagName=="parsererror"){throw"parsererror"}if(d&&d.dataFilter){b=d.dataFilter(b,c)}if(typeof b==="string"){if(c=="script"){U.globalEval(b)}if(c=="json"){b=X["eval"]("("+b+")")}}return b},param:function(d){var b=[];function a(f,e){b[b.length]=encodeURIComponent(f)+"="+encodeURIComponent(e)}if(U.isArray(d)||d.jquery){U.each(d,function(){a(this.name,this.value)})}else{for(var c in d){if(U.isArray(d[c])){U.each(d[c],function(){a(c,this)})}else{a(c,U.isFunction(d[c])?d[c]():d[c])}}}return b.join("&").replace(/%20/g,"+")}});var W={},V,af=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];function K(b,c){var a={};U.each(af.concat.apply([],af.slice(0,c)),function(){a[this]=b});return a}U.fn.extend({show:function(c,a){if(c){return this.animate(K("show",3),c,a)}else{for(var e=0,g=this.length;e<g;e++){var h=U.data(this[e],"olddisplay");this[e].style.display=h||"";if(U.css(this[e],"display")==="none"){var f=this[e].tagName,b;if(W[f]){b=W[f]}else{var d=U("<"+f+" />").appendTo("body");b=d.css("display");if(b==="none"){b="block"}d.remove();W[f]=b}U.data(this[e],"olddisplay",b)}}for(var e=0,g=this.length;e<g;e++){this[e].style.display=U.data(this[e],"olddisplay")||""}return this}},hide:function(b,a){if(b){return this.animate(K("hide",3),b,a)}else{for(var c=0,d=this.length;c<d;c++){var e=U.data(this[c],"olddisplay");if(!e&&e!=="none"){U.data(this[c],"olddisplay",U.css(this[c],"display"))}}for(var c=0,d=this.length;c<d;c++){this[c].style.display="none"}return this}},_toggle:U.fn.toggle,toggle:function(a,b){var c=typeof a==="boolean";return U.isFunction(a)&&U.isFunction(b)?this._toggle.apply(this,arguments):a==null||c?this.each(function(){var d=c?a:U(this).is(":hidden");U(this)[d?"show":"hide"]()}):this.animate(K("toggle",3),a,b)},fadeTo:function(c,a,b){return this.animate({opacity:a},c,b)},animate:function(a,d,b,c){var e=U.speed(d,b,c);return this[e.queue===false?"each":"queue"](function(){var g=U.extend({},e),j,f=this.nodeType==1&&U(this).is(":hidden"),h=this;for(j in a){if(a[j]=="hide"&&f||a[j]=="show"&&!f){return g.complete.call(this)}if((j=="height"||j=="width")&&this.style){g.display=U.css(this,"display");g.overflow=this.style.overflow}}if(g.overflow!=null){this.style.overflow="hidden"}g.curAnim=U.extend({},a);U.each(a,function(p,l){var m=new U.fx(h,g,p);if(/toggle|show|hide/.test(l)){m[l=="toggle"?f?"show":"hide":l](a)}else{var n=l.toString().match(/^([+-]=)?([\d+-.]+)(.*)$/),k=m.cur(true)||0;if(n){var q=parseFloat(n[2]),o=n[3]||"px";if(o!="px"){h.style[p]=(q||1)+o;k=((q||1)/m.cur(true))*k;h.style[p]=k+o}if(n[1]){q=((n[1]=="-="?-1:1)*q)+k}m.custom(k,q,o)}else{m.custom(k,l,"")}}});return true})},stop:function(b,c){var a=U.timers;if(b){this.queue([])}this.each(function(){for(var d=a.length-1;d>=0;d--){if(a[d].elem==this){if(c){a[d](true)}a.splice(d,1)}}});if(!c){this.dequeue()}return this}});U.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(b,a){U.fn[b]=function(d,c){return this.animate(a,d,c)}});U.extend({speed:function(b,a,c){var d=typeof b==="object"?b:{complete:c||!c&&a||U.isFunction(b)&&b,duration:b,easing:c&&a||a&&!U.isFunction(a)&&a};d.duration=U.fx.off?0:typeof d.duration==="number"?d.duration:U.fx.speeds[d.duration]||U.fx.speeds._default;d.old=d.complete;d.complete=function(){if(d.queue!==false){U(this).dequeue()}if(U.isFunction(d.old)){d.old.call(this)}};return d},easing:{linear:function(b,a,d,c){return d+c*b},swing:function(b,a,d,c){return((-Math.cos(b*Math.PI)/2)+0.5)*c+d}},timers:[],fx:function(b,c,a){this.options=c;this.elem=b;this.prop=a;if(!c.orig){c.orig={}}}});U.fx.prototype={update:function(){if(this.options.step){this.options.step.call(this.elem,this.now,this)}(U.fx.step[this.prop]||U.fx.step._default)(this);if((this.prop=="height"||this.prop=="width")&&this.elem.style){this.elem.style.display="block"}},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null)){return this.elem[this.prop]}var b=parseFloat(U.css(this.elem,this.prop,a));return b&&b>-10000?b:parseFloat(U.curCSS(this.elem,this.prop))||0},custom:function(a,b,c){this.startTime=ae();this.start=a;this.end=b;this.unit=c||this.unit||"px";this.now=this.start;this.pos=this.state=0;var e=this;function d(f){return e.step(f)}d.elem=this.elem;if(d()&&U.timers.push(d)&&!V){V=setInterval(function(){var f=U.timers;for(var g=0;g<f.length;g++){if(!f[g]()){f.splice(g--,1)}}if(!f.length){clearInterval(V);V=ac}},13)}},show:function(){this.options.orig[this.prop]=U.attr(this.elem.style,this.prop);this.options.show=true;this.custom(this.prop=="width"||this.prop=="height"?1:0,this.cur());U(this.elem).show()},hide:function(){this.options.orig[this.prop]=U.attr(this.elem.style,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(c){var d=ae();if(c||d>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;var f=true;for(var e in this.options.curAnim){if(this.options.curAnim[e]!==true){f=false}}if(f){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;this.elem.style.display=this.options.display;if(U.css(this.elem,"display")=="none"){this.elem.style.display="block"}}if(this.options.hide){U(this.elem).hide()}if(this.options.hide||this.options.show){for(var b in this.options.curAnim){U.attr(this.elem.style,b,this.options.orig[b])}}this.options.complete.call(this.elem)}return false}else{var a=d-this.startTime;this.state=a/this.options.duration;this.pos=U.easing[this.options.easing||(U.easing.swing?"swing":"linear")](this.state,a,0,1,this.options.duration);this.now=this.start+((this.end-this.start)*this.pos);this.update()}return true}};U.extend(U.fx,{speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){U.attr(a.elem.style,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null){a.elem.style[a.prop]=a.now+a.unit}else{a.elem[a.prop]=a.now}}}});if(document.documentElement.getBoundingClientRect){U.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return U.offset.bodyOffset(this[0])}var f=this[0].getBoundingClientRect(),c=this[0].ownerDocument,g=c.body,h=c.documentElement,a=h.clientTop||g.clientTop||0,b=h.clientLeft||g.clientLeft||0,d=f.top+(self.pageYOffset||U.boxModel&&h.scrollTop||g.scrollTop)-a,e=f.left+(self.pageXOffset||U.boxModel&&h.scrollLeft||g.scrollLeft)-b;return{top:d,left:e}}}else{U.fn.offset=function(){if(!this[0]){return{top:0,left:0}}if(this[0]===this[0].ownerDocument.body){return U.offset.bodyOffset(this[0])}U.offset.initialized||U.offset.initialize();var f=this[0],j=f.offsetParent,k=f,a=f.ownerDocument,c,h=a.documentElement,e=a.body,d=a.defaultView,l=d.getComputedStyle(f,null),b=f.offsetTop,g=f.offsetLeft;while((f=f.parentNode)&&f!==e&&f!==h){c=d.getComputedStyle(f,null);b-=f.scrollTop,g-=f.scrollLeft;if(f===j){b+=f.offsetTop,g+=f.offsetLeft;if(U.offset.doesNotAddBorder&&!(U.offset.doesAddBorderForTableAndCells&&/^t(able|d|h)$/i.test(f.tagName))){b+=parseInt(c.borderTopWidth,10)||0,g+=parseInt(c.borderLeftWidth,10)||0}k=j,j=f.offsetParent}if(U.offset.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"){b+=parseInt(c.borderTopWidth,10)||0,g+=parseInt(c.borderLeftWidth,10)||0}l=c}if(l.position==="relative"||l.position==="static"){b+=e.offsetTop,g+=e.offsetLeft}if(l.position==="fixed"){b+=Math.max(h.scrollTop,e.scrollTop),g+=Math.max(h.scrollLeft,e.scrollLeft)}return{top:b,left:g}}}U.offset={initialize:function(){if(this.initialized){return}var c=document.body,j=document.createElement("div"),g,h,a,f,b,k,e=c.style.marginTop,d='<div style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;"><div></div></div><table style="position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;" cellpadding="0" cellspacing="0"><tr><td></td></tr></table>';b={position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"};for(k in b){j.style[k]=b[k]}j.innerHTML=d;c.insertBefore(j,c.firstChild);g=j.firstChild,h=g.firstChild,f=g.nextSibling.firstChild.firstChild;this.doesNotAddBorder=(h.offsetTop!==5);this.doesAddBorderForTableAndCells=(f.offsetTop===5);g.style.overflow="hidden",g.style.position="relative";this.subtractsBorderForOverflowNotVisible=(h.offsetTop===-5);c.style.marginTop="1px";this.doesNotIncludeMarginInBodyOffset=(c.offsetTop===0);c.style.marginTop=e;c.removeChild(j);this.initialized=true},bodyOffset:function(c){U.offset.initialized||U.offset.initialize();var a=c.offsetTop,b=c.offsetLeft;if(U.offset.doesNotIncludeMarginInBodyOffset){a+=parseInt(U.curCSS(c,"marginTop",true),10)||0,b+=parseInt(U.curCSS(c,"marginLeft",true),10)||0}return{top:a,left:b}}};U.fn.extend({position:function(){var b=0,c=0,e;if(this[0]){var d=this.offsetParent(),a=this.offset(),f=/^body|html$/i.test(d[0].tagName)?{top:0,left:0}:d.offset();a.top-=Z(this,"marginTop");a.left-=Z(this,"marginLeft");f.top+=Z(d,"borderTopWidth");f.left+=Z(d,"borderLeftWidth");e={top:a.top-f.top,left:a.left-f.left}}return e},offsetParent:function(){var a=this[0].offsetParent||document.body;while(a&&(!/^body|html$/i.test(a.tagName)&&U.css(a,"position")=="static")){a=a.offsetParent}return U(a)}});U.each(["Left","Top"],function(b,c){var a="scroll"+c;U.fn[a]=function(d){if(!this[0]){return null}return d!==ac?this.each(function(){this==X||this==document?X.scrollTo(!b?d:U(X).scrollLeft(),b?d:U(X).scrollTop()):this[a]=d}):this[0]==X||this[0]==document?self[b?"pageYOffset":"pageXOffset"]||U.boxModel&&document.documentElement[a]||document.body[a]:this[0][a]}});U.each(["Height","Width"],function(b,d){var f=b?"Left":"Top",c=b?"Right":"Bottom",e=d.toLowerCase();U.fn["inner"+d]=function(){return this[0]?U.css(this[0],e,false,"padding"):null};U.fn["outer"+d]=function(g){return this[0]?U.css(this[0],e,false,g?"margin":"border"):null};var a=d.toLowerCase();U.fn[a]=function(g){return this[0]==X?document.compatMode=="CSS1Compat"&&document.documentElement["client"+d]||document.body["client"+d]:this[0]==document?Math.max(document.documentElement["client"+d],document.body["scroll"+d],document.documentElement["scroll"+d],document.body["offset"+d],document.documentElement["offset"+d]):g===ac?(this.length?U.css(this[0],a):null):this.css(a,typeof g==="string"?g:g+"px")}})})();var display;function Display(f){f.page=f.page<=0?1:f.page;this.domainName=f.domainName;this.galleryLocation=f.galleryLocation;this.galleryId=f.galleryId;this.aLangs=f.aLangs;this.albumId=f.albumId;this.albumName=f.albumName;this.albumPrivacyLevel=f.albumPrivacyLevel;this.imageIndex=f.imageIndex;this.page=f.page?f.page:1;this.tag=f.tag;this.album=f.album;this.aAlbums=f.aAlbums;this.aImages=f.aImages;this.aLoaded=[];this.albumsViewable=f.albumsViewable;this.imagesViewable=f.imagesViewable;this.newComment=f.permitNewComment;this.delComment=f.permitDelComment;this.softLog=f.softLog;this.numAlbumsPerPage=f.numAlbumsPerPage?f.numAlbumsPerPage:4;this.domShareDiv=f.domShareDiv;this.domInfoComments=f.domInfoComments;this.domInfoCaption=f.domInfoCaption;this.aRestrict=new Array(1024,920,784,720,640,540,464,400);this.container=$(this.ID_CONTAINER_DIV);this.thumbnails=$(this.ID_THUMBNAILS);this.pageNumbers=$(this.ID_PAGE_NUMBERS);this.albumDescription=$(this.ID_ALBUM_DESCRIPTION);this.functions=$(this.ID_FUNCTIONS_DIV);this.loadingImg=$(this.ID_LOADING_IMG);this.controls=$("#controls li");this.sidePanel=$("div.sidePanel");this.mainPanel=$(this.ID_MAIN_PANEL_DIV);this.imageDiv=$(this.ID_IMAGE_DIV);this.imageMain=$("#imageDiv img.mainDivImage");this.exifDiv=$(this.ID_EXIF_DIV);this.exifTable=$("table",this.exifDiv);this.exifImageIndex=$("span",this.exifDiv);this.commentAnchor=$(this.ID_COMMENT_ANCHOR);this.commentBlock=$(this.ID_COMMENT_BLOCK_DIV);this.comments=$(this.ID_COMMENTS_DIV);this.commentMessage=$("#msgInput");this.domAlbumList=document.getElementById(this.ID_ALBUM_LIST);this.domDownloadLink=document.getElementById("downloadLink");this.domExifLink=document.getElementById("exifLink");this.domNextLink=document.getElementById("nextImageLink");this.domPrevLink=document.getElementById("prevImageLink");this.domLogin=document.getElementById("loginDiv");this.domRegister=document.getElementById("registerDiv");this.thumbSpriteSize=70;this.newPage=f.page;this.numPagesPerScreen=5;this.cacheExpiry=f.cacheExpiry?f.cacheExpiry:300000;this.newImageIndex=f.imageIndex?f.imageIndex:0;this.numImagesShortPage=f.numImagesShortPage?f.numImagesShortPage:3;this.numImagesPerPage=f.numImagesPerPage?f.numImagesPerPage:18;var h=jQuery.browser;if(h.msie){this.isIE=true;if(parseInt(h.version)<7){this.isIE6=true}}var e=this.imageDiv.get(0);e.style.overflow="hidden";var c=this;this.GetWindowSize();this.ResizeContainer();if(this.imageMain.length){var g=this.imageMain.get(0);this.url=g.src;this.xImageOrig=g.width;this.yImageOrig=g.height;this.ResizeImage()}this.loadingImg.fadeIn("slow");this.isAjaxReady=false;this.canBeResized=true;$(window).resize(function(){if(!c.canBeResized){return}c.GetWindowSize();var n=c.yWindow;c.ResizeImage();c.ResizeContainer();c.GetWindowSize();if(c.yWindow!=n){c.ResizeContainer()}c.canBeResized=false;setTimeout(function(){c.canBeResized=true},50)});if(this.galleryId==null){return}$("#slideShowObj").css("z-index","20");$("div.sidePanel").click(function(r){var r=r||window.event;var q=r.target||r.srcElement;if(q.tagName.toLowerCase()!="img"&&q.parentNode.tagName.toLowerCase()!="h2"&&!$(q).hasClass("coverImage")){if(c.softLog&&(q.className=="albumInfoEdit"||q.className=="albumInfoDelete")){if(c.domRegister){if(c.domRegister.collapsed){c.domRegister.collapsed=false;c.domRegister.Slide()}}else{if(c.domLogin.collapsed){c.domLogin.collapsed=false;c.domLogin.Slide()}}return false}return}var o;if(q.src){o=q.parentNode.href?q.parentNode.href:q.parentNode.parentNode.href}else{if(q.href){o=q.href}else{return}}if(!c.isAjaxReady){return false}$("div.albumInfo a").blur();c.HideOverlays();c.loadingImg.fadeIn("slow");c.isAjaxReady=false;var n=parseInt(o.match(/\d+$/));if(c.mode==c.MODE_IMAGES){var p=c.albumName;c.loadAlbums(function(u){var t=false;$("#thumbnailsList div.slidingPage").animate({height:"hide",opacity:"hide"},"normal",function(){if(t){return}t=true;var v=0;var x=c.toJSON(u);for(var w=0;w<x.albums.length;++w){if(n==x.albums[w].id){v=w}}c.newPage=Math.floor(v/c.numAlbumsPerPage)+1;document.getElementById("thumbnailsList").innerHTML="";c.Process(u);$("#album"+n+" h2 a").html(p);c.isAjaxReady=true})})}else{$("#slideShowObj").css("z-index","20");c.newPage=1;c.newImageIndex=0;c.albumId=n;c.loadAlbum(function(v){document.getElementById("thumbnailsList").innerHTML="";c.thumbnails.css("display","block");var t=$("div.albumInfo");if(t.length>1){var u=false;if(!c.isIE6){t.css("marginBottom","-1px")}t.not(document.getElementById("album"+n)).animate({height:"0",opacity:"0"},"normal",function(){$(this).remove();if($("div.albumInfo").length==1&&!u){u=true;c.Process(v);c.isAjaxReady=true}})}else{c.Process(v);c.isAjaxReady=true}})}return false});$(this.ID_THUMBNAILS).click(function(q){var q=q||top.event;var p=q.target||q.srcElement;if((p.tagName.toLowerCase()!="img"&&p.tagName.toLowerCase()!="a")||$(p).hasClass("selectedThumbnail")){return false}if(p.tagName.toLowerCase()=="a"){p=p.firstChild}$("#thumbnailsList a").removeClass("selectedThumbnail");if(p.parentNode.href){$(p.parentNode).addClass("selectedThumbnail")}else{$(p.parentNode.parentNode).addClass("selectedThumbnail")}p.parentNode.blur();if(c.imageIndex==p.imageIndex){return false}if(!c.isAjaxReady){return false}c.loadingImg.fadeIn("slow");c.isAjaxReady=false;c.HideOverlays(true);c.ShowImage(c.aImages[p.imageIndex]);var o=c.GetImageId(p.imageIndex);if(c.tag!=null&&c.tag!=""){var n=c.galleryLocation+"?TagXML&tag="+c.tag+"&image="+o;c.jQueryGetCache(n,function(r){c.Process(r);c.isAjaxReady=true})}else{c.setImage(p.imageIndex)}if(document.getElementById("slideShowObj")&&document.getElementById("slideShowObj").sendToActionScript){document.getElementById("slideShowObj").sendToActionScript(c.albumId,o)}else{if(window.flashSlideshow&&window.flashSlideshow.sendToActionScript){window.flashSlideshow.sendToActionScript(c.albumId,o)}}return false});$(this.ID_IMAGE_DIV).click(function(q){var q=q||top.event;var p=q.target||q.srcElement;if(p.className!="mainDivImage"){return}if(!c.isAjaxReady){return false}c.loadingImg.fadeIn("slow");c.isAjaxReady=false;if(c.mode==c.MODE_ALBUMS){c.HideOverlays();var o=c.aAlbums[(c.page-1)*c.numAlbumsPerPage];c.imageId=o.coverImage.id;c.albumId=o.id;var n=$("#album"+c.albumId);c.loadAlbum(function(t){$("#thumbnailsList *").unbind();c.thumbnails.empty();c.thumbnails.css("display","block");var r=$("div.albumInfo");if(r.length>1){if(!c.isIE6){r.css("marginBottom","-1px")}r.not(n).animate({height:"hide",opacity:"hide"},"normal",function(){$(this).remove();if($("div.albumInfo").length==1){c.Process(t);c.isAjaxReady=true}})}else{c.Process(t);c.isAjaxReady=true}})}else{if(c.mode==c.MODE_IMAGES){c.HideOverlays(true);c.UseControl("nextImageLink")}}});this.imageDiv.mouseover(function(o){var p=Math.max(parseInt(c.imageMain.css("width")),c.X_IMAGE_MINIMUM);var n=parseInt((parseInt(c.imageMain.css("width"))+parseInt(p))/2)-31;$("#slideShowObj").stop(true);$("#slideShowObj").animate({left:n+"px"},"normal")});this.imageDiv.mouseout(function(o){var p=Math.max(parseInt(c.imageMain.css("width")),c.X_IMAGE_MINIMUM);var n=parseInt((parseInt(c.imageMain.css("width"))+parseInt(p))/2)-31+50;$("#slideShowObj").stop(true);$("#slideShowObj").animate({left:n+50+"px"},"normal")});$(this.ID_PAGE_NUMBERS).click(function(p){var p=p||top.event;var o=p.target||p.srcElement;if(o.tagName.toLowerCase()!="a"||o.className=="selectedPage"){return false}if(!c.isAjaxReady){return false}c.loadingImg.fadeIn("slow");c.isAjaxReady=false;var n;if(o.id=="nextThumbPageLink"){n=parseInt(c.page)+1}else{if(o.id=="prevThumbPageLink"){n=parseInt(c.page)-1}else{n=$(o).text()}}if(c.mode==c.MODE_ALBUMS){c.HideOverlays();c.setPage(n)}else{if(c.mode==c.MODE_IMAGES){c.HideOverlays(true);c.newImageIndex=(n-1)*c.numImagesPerPage-(n>1&&c.albumDescription?c.numImagesPerPage-c.numImagesShortPage:0);c.newPage=n;c.loadAlbum(function(q){c.Process(q);if(document.flashSlideshow&&document.flashSlideshow.sendToActionScript){document.flashSlideshow.sendToActionScript(c.albumId,c.imageId)}else{if(window.flashSlideshow&&window.flashSlideshow.sendToActionScript){window.flashSlideshow.sendToActionScript(c.albumId,c.imageId)}}})}else{if(c.tag!=null&&c.tag!=""){c.jQueryGetCache(c.galleryLocation+"?TagXML&tag="+c.tag+"&page="+n,function(r){c.Process(r,true);c.isAjaxReady=true;var q=c.GetImageId(c.imageIndex);if(document.flashSlideshow&&document.flashSlideshow.sendToActionScript){document.flashSlideshow.sendToActionScript(c.albumId,c.imageId)}else{if(window.flashSlideshow&&window.flashSlideshow.sendToActionScript){window.flashSlideshow.sendToActionScript(c.albumId,c.imageId)}}})}}}return false});$(document).keydown(function(o){var o=o||top.event;var n=o.charCode?o.charCode:o.keyCode?o.keyCode:0;if((n==37||n==39)&&!c.commentFocused){if(c.domLogin){if(c.domLogin.style.display=="none"){return false}}else{return false}}return});$(document).keyup(function(o){var o=o||top.event;var n=o.charCode?o.charCode:o.keyCode?o.keyCode:0;if((n!=37&&n!=39)||c.commentFocused||(c.domLogin&&(c.domLogin.style.display=="block"))){return}if(!c.isAjaxReady){return false}c.loadingImg.fadeIn("slow");c.isAjaxReady=false;c.HideOverlays(true);switch(n){case 39:c.UseControl("nextImageLink");break;case 37:c.UseControl("prevImageLink");break}return});$("#prevImageLink, #nextImageLink").click(function(p){var p=p||top.event;var o=p.target||p.srcElement;var n=o.id;if(o.tagName.toLowerCase()!="a"||(n!="nextImageLink"&&n!="prevImageLink")){return}o.blur();if(!c.isAjaxReady){return false}c.loadingImg.fadeIn("slow");c.isAjaxReady=false;c.HideOverlays(true);c.UseControl(n);return false});$("#functionsAnchor").click(function(n){$("#albumListDiv div.slidingPage").toggle();c.thumbnails.toggle();c.pageNumbers.toggle();if(c.page==1){$(c.ID_ALBUM_DESCRIPTION).toggle()}c.functions.toggle();return false});$(this.ID_COMMENT_ANCHOR).click(function(){c.commentBlock.toggle();return false});$("#commentForm").submit(function(){c.AddComment();return false});$(this.ID_COMMENTS_DIV).click(function(n){c.DeleteComment(n);return false});$("#msgInput").focus(function(){c.commentFocused=true});$("#msgInput").blur(function(){c.commentFocused=false});$("a.share").click(function(){$(c.domShareDiv).toggle();return false});$("body:not(a.share)").click(function(){$(c.domShareDiv).hide();return});$(this.domShareDiv).click(function(n){return false});if(this.albumId!=null||(this.tag!=null&&this.tag!="")){this.mode=this.MODE_ALBUMS;this.thumbnails.empty();$(window).bind("load",function(){setTimeout(function(){c.Preload(0)},2000)});if(this.newImageIndex){this.newPage=this.getPage()}var k=function(n){c.Process(n);c.isAjaxReady=true;c.PreloadMain(c.imageIndex*1+1)};var d=this.GetImageId(this.imageIndex);this.pageNew=this.getPage();if(this.tag!=null&&this.tag!=""){var b=this.galleryLocation+"?TagXML&tag="+this.tag+"&image="+d;this.jQueryGetCache(b,k)}else{this.loadAlbum(k)}setTimeout(function(){if(document.getElementById("slideShowObj")&&document.getElementById("slideShowObj").sendToActionScript){document.getElementById("slideShowObj").sendToActionScript(c.albumId,d)}else{if(window.flashSlideshow&&window.flashSlideshow.sendToActionScript){window.flashSlideshow.sendToActionScript(c.albumId,d)}}},500)}else{this.mode=this.MODE_IMAGES;if(this.imageMain.length<1){var a=$("div.sidePanel");var m=a.css("border-top-width");var l=a.css("border-bottom-width");var j=parseInt(m)+parseInt(l);this.imageDiv.height(this.Y_NOIMAGE_MINIMUM+j)}$("div.albumInfo").remove();this.loadAlbums(function(n){c.Process(n);c.isAjaxReady=true});this.imageMain.css("cursor","pointer")}}Display.prototype={ID_CONTAINER_DIV:"#containerDiv",ID_LOADING_IMG:"#loadingImg",ID_ALBUM_LIST:"albumListDiv",ID_THUMBNAILS:"#thumbnailsList",ID_PAGE_NUMBERS:"#pageNumPara",ID_ALBUM_DESCRIPTION:"#albumDescriptionPara",ID_FUNCTIONS_DIV:"#functionsDiv",ID_MAIN_PANEL_DIV:"#mainPanelDiv",ID_IMAGE_DIV:"#imageDiv",ID_EXIF_DIV:"#exifDiv",ID_COMMENT_ANCHOR:"#commentAnchor",ID_COMMENT_BLOCK_DIV:"#commentBlockDiv",ID_COMMENTS_DIV:"#commentsDiv",X_IMAGE_MINIMUM:320,Y_IMAGE_MINIMUM:425,Y_IMAGE_OFFSET:130,Y_NOIMAGE_MINIMUM:460,X_CONTAINER_MINIMUM:950,W_SPRITE:70,H_SPRITE:70,NUM_SPRITE_ROWS:10,NUM_SPRITE_COLS:10,NUM_SPRITES:100,MODE_ALBUMS:"albums",MODE_IMAGES:"images",FLASH_VERSION_REQUIRED:9,isIE:false,isIE6:false,commentFocused:false,isAjaxReady:true,isDataParsed:false,isImageLoaded:false,albumDescription:"",Cleanup:function(){$("*").unbind();for(var a in this){this[a]=null}},Process:function(F){var m=this;var D=this.toJSON(F);if(D.albums){$("#slideShowObj").css("z-index","-100");this.aAlbums=new Array();this.aImages=new Array();document.getElementById("commentAnchorPara").style.display="none";this.commentBlock.css("display","none");for(var C=0;C<D.albums.length;++C){this.aAlbums.push(D.albums[C])}this.ShowAlbums();if(this.mode==this.MODE_IMAGES){this.controls.css("visibility","hidden");$("#embedShareSpan").css("display","none");this.albumDescription="";var c=$("#infoCaptionDiv");document.getElementById("numAlbums").style.display="block";if(!document.getElementById("numImages")){var o=document.createElement("p");o.id="numImages";var v=parseInt(this.imageMain.width());var g=parseInt(this.imageMain.css("border-left-width"))+parseInt(this.imageMain.css("border-right-width"));$(o).width(v+g);o.innerHTML='<img src="http://ilostatic.one.com/iloapp/gallery/Images/system/transparent.gif" alt="'+this.aLangs.images+'"/>';o.innerHTML+="<span>"+this.imagesViewable+"</span>";c.empty();c.append(o)}}var a=((this.newPage?this.newPage:1)-1)*this.numAlbumsPerPage;if(this.aAlbums[a]){var d=this.aAlbums[a].coverImage;var q=new Image;q.onload=function(){$(this).unbind();m.ShowImage(d,false)};q.src=d.urlThumbnail}else{this.isImageLoaded=true}this.mode=this.MODE_ALBUMS}if(D.album){this.album=D.album;this.albumPrivacyLevel=D.album.privacyLevel}if(D.album&&D.album.images){this.albumId=D.album.id;this.albumName=D.album.name;this.albumDescription=D.album.description;var A=new Array();if(!D.album.isDecompressed){var h=D.album.privacyLevel=="public"||D.album.privacyLevel=="private";for(var C=0;C<D.album.images.length;++C){D.album.images[C].index=C;D.album.images[C].url=D.album.baseUrl+D.album.images[C].url;D.album.images[C].spriteIndex=null;if(D.album.images[C].urlThumbnail){D.album.images[C].urlThumbnail=D.album.baseUrl+D.album.images[C].urlThumbnail}else{D.album.images[C].spriteIndex=h?C:null}if(D.album.images[C].comments){for(var B=0;B<D.album.images[C].comments.length;++B){if(!D.album.images[C].comments[B][1]){continue}var w=D.album.images[C].comments[B];D.album.images[C].comments[B]={id:w[0],postedBy:w[1],message:w[2]}}}}D.album.isDecompressed=true}$("#slideShowObj").css("z-index","20");var E;this.indexFirst=-1;this.aImages=D.album.images;var k=this.getPage(),f=k;var e=(k-1)*this.numImagesPerPage-(k>1&&D.album.description?this.numImagesPerPage-this.numImagesShortPage:0);var p=e+(k==1&&D.album.description?this.numImagesShortPage:this.numImagesPerPage)-1;this.imageIndexFirst=e;this.imageIndexLast=p;for(var C=0;C<this.aImages.length;++C){var u=this.aImages[C];if(e<=u.index&&u.index<=p){A[u.index]=u}if(this.newImageIndex!=null){if(this.newImageIndex==C){this.imageIndex=u.index;E=u.caption;this.newImageIndex=null}}else{if(u.selected){this.imageIndex=u.index;E=u.caption}}}this.domInfoCaption.innerHTML=E?E.replace(/\n/g,"<br/>"):"";if(this.mode==this.MODE_ALBUMS){$("#album"+this.albumId+" h2 a").html("&#xab; "+this.albumName);Reset();document.getElementById("numAlbums").style.display="none";this.controls.css("visibility","visible");Reset();if(D.album.embedable){$("#embedShareSpan").css("display","inline")}if(!D.album.downloadable){$("#downloadLink").parents("li").css("visibility","hidden")}var l=this.imageIndex+1;var y=this.aLangs.image+" <span>"+l+"</span> "+this.aLangs.imageXofY+" "+D.album.imageCount+"<br/>";var b=D.album.ownerName;if(b!==""){y+=this.aLangs.albumCreated+" "+b}$("p",this.exifDiv).html(y);this.ShowThumbnails(A,f);this.ShowImage(A[this.imageIndex]);this.imageId=A[this.imageIndex].id;var m=this;if(document.getElementById("slideShowObj")&&document.getElementById("slideShowObj").sendToActionScript){document.getElementById("slideShowObj").sendToActionScript(D.album.id,m.imageId)}else{if(window.flashSlideshow&&window.flashSlideshow.sendToActionScript){window.flashSlideshow.sendToActionScript(D.album.id,m.imageId)}}setTimeout(function(){m.Preload()},1500)}else{if(f<this.page){this.ShowImage(A[this.imageIndex]);this.ShowThumbPage(A,"left")}else{if(f>this.page){this.ShowImage(A[this.imageIndex]);this.ShowThumbPage(A,"right")}}}this.page=f;this.newPage=null;this.mode=this.MODE_IMAGES}if(this.newPage){this.page=this.newPage;this.newPage=null}this.ShowPages();var u=D.album&&D.album.images?D.album.images[this.imageIndex]:null;if(u&&u.exif){this.exifTable.empty();for(var z in u.exif){var x=u.exif[z];var r=document.createElement("tr");var n=document.createElement("td");var t=document.createElement("td");n.className="exifVariable";n.innerHTML=z+":";t.className="exifValue";t.innerHTML=x;this.exifTable.append(r);r.appendChild(n);r.appendChild(t)}$("span",this.exifDiv).text(parseInt(this.imageIndex)+1)}if(D.album){document.getElementById("commentAnchorPara").style.display="block";this.ShowComments(u&&u.comments?u.comments:[])}if(this.albumDescription===""||this.page!=1){$(this.ID_ALBUM_DESCRIPTION).remove()}this.isDataParsed=true;if(this.isImageLoaded){this.isImageLoaded=false;this.isDataParsed=false;this.loadingImg.stop(true,true);this.loadingImg.hide()}},ShowAlbums:function(){var E=this.newPage<this.page?"left":"right";var B=this.mode!=this.MODE_IMAGES;var c=this.aAlbums;var y=c.length;if(y==0){return}var o=0;for(var C=0;C<c.length;C++){var F=c[C].mod;o=F>o?F:o}var j=(this.newPage-1)*this.numAlbumsPerPage;var g=j+this.numAlbumsPerPage;g=g<y?g:y;var H="album"+this.albumId;var q=document.getElementById(H);var G=true;var A;var p;if(B){var A=$("div.slidingPage",this.domAlbumList);var d=document.createElement("div");d.className="slidingPage";p=$(d)}else{var p=$("div.slidingPage",this.domAlbumList)}for(var C=j,x;(x=c[C])&&C<g;C++){if(H=="album"+x.id){G=false;continue}if(C==j&&x.coverImage){var v=new Image;v.src=x.coverImage.urlThumbnail}var u=document.createElement("div");u.id="album"+x.id;u.className="albumInfo";if(!B){u.style.display="none"}if(q&&G){$(u).insertBefore(q)}else{p.append(u)}var f=document.createElement("h2");var t=document.createElement("a");var r=document.createElement("a");var h=document.createElement("img");var k=document.createElement("p");u.appendChild(f);u.appendChild(r);u.appendChild(k);f.appendChild(t);r.appendChild(h);t.innerHTML=x.name;t.href=this.galleryLocation+"?Album&album="+x.id;var e=x.coverImage;r.href=this.galleryLocation+"?Album&album="+x.id;r.className="coverImage";h.alt="Thumbnail";h.style.display="none";var b=(x.privacyLevel=="public"||x.privacyLevel=="private")&&x.spriteIndex!=null;if(b){var D=Math.floor(x.spriteIndex/200);var a=x.spriteIndex%200;h.style.width="45px";h.style.height="45px";h.style.backgroundImage="url(../data/_gallery/"+x.privacyLevel+"/cover-sprites-"+D+".jpg"+(o?"?_m="+o:"")+")";h.style.backgroundPosition=(-1*a*45)+"px 0px";h.style.backgroundRepeat="no-repeat"}else{if(e.height>0){var n=e.width/e.height}else{var n=1}var m=$(r);if(parseInt(e.width)>parseInt(e.height)){m.addClass("landscape");var z=45;var w=parseInt(z*n);h.style.marginLeft="-"+((w-45)/2)+"px"}else{m.addClass("portrait");var w=45;var z=parseInt(w/n);h.style.marginTop="-"+((z-45)/2)+"px"}}h.onload=function(){$(this).unbind();$(this).fadeIn("normal");this.style.display="block";var I=this;setTimeout(function(){$(I).css("opacity",null);I.style.filter=null},500)};if(b){h.src="http://ilostatic.one.com/iloapp/gallery/Images/system/transparent.gif"}else{h.src=x.coverImage.urlThumbnail}k.innerHTML=x.timeCreated+"<br/>"+x.numImages+"<br/>";if(x.editable){k.innerHTML+='<a class="albumInfoEdit" href="'+this.galleryLocation+"?EditAlbum&album="+x.id+'">'+this.aLangs.editAlbum+"</a>";if(x.deletable){k.innerHTML+='<a class="albumInfoDelete" href="'+this.galleryLocation+"?DeleteAlbum&album="+x.id+'">'+this.aLangs.deleteAlbum+"</a>"}}else{k.innerHTML+="<br/>"}}if(!B){if(this.isIE){setTimeout(function(){$("div.albumInfo").each(function(){$(this).show("normal")})},200)}else{$("div.albumInfo").each(function(){$(this).show("normal")})}}else{this.domAlbumList.style.width=2*A.width()+"px";var l=this;setTimeout(function(){if(E=="left"){p.insertBefore(A);$("div.slidingPage").css("left","-185px");$("div.slidingPage").animate({left:"+=185px"},500,function(){A.remove();p.css("left","0px");l.isAjaxReady=true})}else{if(E=="right"){p.insertAfter(A);$("div.slidingPage").animate({left:"-=185px"},500,function(){A.remove();p.css("left","0px");l.isAjaxReady=true})}}},500)}this.albumId=null},ShowThumbnails:function(A,f,G){var D=G?true:false;if(!D){document.getElementById("thumbnailsList").innerHTML=""}else{var C=$("div.slidingPage",this.thumbnails)}var b=document.createElement("div");b.className="slidingPage";var H=document.createElement("ul");this.thumbnails.append(b);b.appendChild(H);var o=this;var r=this.aImages.length%this.NUM_SPRITES;var q=this.NUM_SPRITE_ROWS*this.W_SPRITE;var l=true;for(var E in A){var w=A[E];var k=w.index;if(l){this.imageIndexFirst=parseInt(k);l=false}var a=(this.albumPrivacyLevel=="public"||this.albumPrivacyLevel=="private")&&w.spriteIndex!=null;var d=document.createElement("li");var j=document.createElement("a");var h;var z=document.createElement("img");if(this.tag!=null&&this.tag!=""){j.href=this.galleryLocation+"?Tags&tag="+this.tag+"&image="+w.id}else{j.href=this.galleryLocation+"?Album&album="+this.albumId+"&image="+w.id}if(k==this.imageIndex){j.className="selectedThumbnail"}if(a){h=document.createElement("div");h.style.position="relative";h.style.width="45px";h.style.height="45px";h.style.overflow="hidden";var F=Math.floor(w.spriteIndex/this.NUM_SPRITES);var p=w.spriteIndex%this.NUM_SPRITE_ROWS;var J=Math.floor(w.spriteIndex/this.NUM_SPRITE_COLS)-F*this.NUM_SPRITE_ROWS;var t=parseInt(w.width);var v=parseInt(w.height);if(t>v){var n=t/v;var K=this.W_SPRITE/n;var I=45/K}else{var n=v/t;var c=this.H_SPRITE/n;var I=45/c}var g=Math.floor((this.W_SPRITE*I-45)/2);if(this.aImages.length-w.spriteIndex<=r){var e=Math.ceil(r/this.NUM_SPRITE_COLS);var u=Math.floor(this.H_SPRITE*I*e)}else{var u=Math.floor(q*I)}z.style.position="absolute";z.style.left=(-g-Math.ceil(p*this.W_SPRITE*I))+"px";z.style.top=(-g-Math.ceil(J*this.H_SPRITE*I))+"px";z.style.height=u+"px"}else{if(w.height>0){var n=w.width/w.height}else{var n=1}var m=$(j);if(parseInt(w.width)>parseInt(w.height)){m.addClass("landscape");var B=45;var x=parseInt(B*n);z.style.marginLeft="-"+((x-45)/2)+"px"}else{m.addClass("portrait");var x=45;var B=parseInt(x/n);z.style.marginTop="-"+((B-45)/2)+"px"}}z.imageIndex=k;z.alt="Thumbnail";z.title="";if(a){h.appendChild(z);j.appendChild(h)}else{j.appendChild(z)}d.appendChild(j);H.appendChild(d);if(a){z.src="../data/_gallery/"+this.albumPrivacyLevel+"/"+this.albumId+"/thumb-sprites-"+F+".jpg"+(this.album&&this.album.mod?"?_m="+this.album.mod:"")}else{z.src=w.urlThumbnail}z=null}this.imageIndexLast=parseInt(k);if(!D){this.ShowDescription(f)}else{this.thumbnails.width(2*C.width());var y=$("div.slidingPage",this.thumbnails);setTimeout(function(){if(G=="left"){$(b).insertBefore(C);y.css("left","-185px");y.animate({left:"+=185px"},500,"swing",function(){C.remove();b.style.left="0px";o.ShowDescription(o.page);o.isAjaxReady=true})}else{if(G=="right"){$(b).insertAfter(C);y.animate({left:"-=185px"},500,"swing",function(){C.remove();b.style.left="0px";o.ShowDescription(o.page);o.isAjaxReady=true})}}},500)}},ShowThumbPage:function(b,a){return this.ShowThumbnails(b,null,a)},ShowPages:function(p){this.pageNumbers.empty();var g;var e;if(this.mode==this.MODE_ALBUMS){g=this.galleryLocation+"?Home&page=";p=[];var d=this.aAlbums;var c=d.length;e=Math.ceil(c/this.numAlbumsPerPage)}else{if(this.mode==this.MODE_IMAGES){g=this.galleryLocation+"?Album&album="+this.albumId+"&page=";var k=this.aImages;var l=k.length;e=Math.ceil((l+(this.albumDescription?this.numImagesPerPage-this.numImagesShortPage:0))/this.numImagesPerPage)}else{if(this.tag!=null&&this.tag!=""){g=this.galleryLocation+"?Tags&tag="+this.tag+"&page="}}}if(this.mode==this.MODE_ALBUMS||this.mode==this.MODE_IMAGES){var n=Math.floor(this.numPagesPerScreen/2);this.page=this.page*1;var b=this.page-n+(this.numPagesPerScreen%2-1);b=b>1?b:1;var f=this.page+n;f=f<=e?f:e;var o=n+(this.numPagesPerScreen%2-1)-(this.page-b);if(o>0){f+=o;f=f<=e?f:e}else{var a=n-(f-this.page);if(a>0){b-=a;b=b>1?b:1}}p=[];for(var h=b;h<=f;++h){p.push({number:h,selected:h==this.page})}}if(p.length<=1){return}if(this.page!=1){var q=document.createElement("a");q.id="prevThumbPageLink";q.href=g+(parseInt(this.page)-1);q.innerHTML="&#xab;";this.pageNumbers.append(q)}this.pageNumbers.append("&nbsp;|&nbsp;");var j;for(var h=0,m;m=p[h];h++){j=m.number;var q=document.createElement("a");if(m.selected){q.className="selectedPage"}q.href=g+m.number;q.innerHTML=m.number;this.pageNumbers.append(q);this.pageNumbers.append("&nbsp;|&nbsp;")}if(this.page!=j){var q=document.createElement("a");q.id="nextThumbPageLink";q.href=g+(parseInt(this.page)+1);q.innerHTML="&#xbb;";this.pageNumbers.append(q)}},ShowComments:function(e){this.comments.empty();var b=this.GetImageId(this.imageIndex);var c,g="";if(this.delComment){var c='<a class="delCommentAnchor" href="'+this.galleryLocation+"?Album&album="+this.albumId+"&image="+b+"&delete=";var j='"><img class="delCommentBtn sprite" src="http://ilostatic.one.com/iloapp/gallery/Images/system/transparent.gif" alt="trash can" title="'+this.aLangs.deleteComment+'"/></a>'}if(e.length>0||this.newComment){this.commentAnchor.text(this.aLangs.comments+" ("+e.length+")");this.commentAnchor.css("visibility","visible")}else{this.commentAnchor.css("visibility","hidden")}for(var d=0,f;f=e[d];d++){var a="";if(this.delComment){a=c+f.id+j}var h=document.createElement("div");h.commentId=f.id;h.className="comment";h.innerHTML='<h3 class="time">'+f.postedBy+a+'</h3><p class="commentText">'+f.message+"</p>";this.comments.prepend(h)}},showImageId:null,ShowImage:function(w){if(!w){w=this.getCurrentImage()}if(!w){return}this.showImageId=w.id;this.url=w.url;this.xImageOrig=w.width;this.yImageOrig=w.height;if(this.albumId!=null){document.cookie="gmsg"+this.galleryId+"="+this.albumId+"."+w.id+";path=/;domain=."+this.domainName}else{if(this.page>1){document.cookie="gmsg"+this.galleryId+"=home."+this.page+";path=/;domain=."+this.domainName}else{document.cookie="gmsg"+this.galleryId+"=home;path=/;domain=."+this.domainName}}if(this.tag!=null&&this.tag!=""){this.domDownloadLink.href=this.galleryLocation+"?Download&album="+this.albumId+"&image="+w.originalId;if($("#imageDiv .jsSlideShow").length){document.getElementById("slideShowObj").href=this.galleryLocation+"?SlideShow&tag="+this.tag+"&image="+w.id}var A=this.galleryLocation+"?Tags&tag="+this.tag+"&image="}else{this.domDownloadLink.href=this.galleryLocation+"?Download&album="+this.albumId+"&image="+w.id;if($("#imageDiv .jsSlideShow").length){document.getElementById("slideShowObj").href=this.galleryLocation+"?SlideShow&album="+this.albumId+"&image="+w.id}var A=this.galleryLocation+"?Album&album="+this.albumId+"&image="}var t=this.aImages;var l=w.index-1;l=!t[l]?t.length:l;var q=w.index+1;q=!t[q]?0:q;var c=this.GetImageId(l);var v=this.GetImageId(q);this.domExifLink.href=A+w.id+"&show=exif";this.domPrevLink.href=A+c;this.domNextLink.href=A+v;var u=document.createElement("img");u.style.display="none";u.style.visibility="hidden";u.className="mainDivImage";var B=this.FitImage(this.xImageOrig,this.yImageOrig);$("img.mainDivImage").each(function(){if(this.loaded){$(this).unbind();$(this).remove()}else{this.style.display="none"}});var f;var D;var b=(this.albumPrivacyLevel=="public"||this.albumPrivacyLevel=="private")&&w.spriteIndex!=null;if(this.aLoaded[(this.albumId?this.albumId:this.getAlbumId())+"-"+w.id]){b=false}var o=document.getElementById("fakeMainImage");if(b){u.style.position="absolute";u.style.left="-9999em";u.style.zIndex="5";f=document.createElement("div");f.id="fakeMainImage";f.style.position="absolute";f.style.width=(parseInt(B.width)+2)+"px";f.style.height=(parseInt(B.height)+2)+"px";f.style.overflow="hidden";f.style.border="1px solid black";f.style.left="0em";f.style.zIndex="10";var H=1,m=0,G=0;if(parseInt(w.width)>parseInt(w.height)){H=B.width/this.thumbSpriteSize;m=H*Math.round((this.thumbSpriteSize-Math.round(B.height/H))/2)}else{H=B.height/this.thumbSpriteSize;G=H*Math.round((this.thumbSpriteSize-Math.round(B.width/H))/2)}var j=parseInt(w.width)>parseInt(w.height)?w.width/w.height:w.height/w.width;spriteMapIndex=Math.floor(w.spriteIndex/50);spriteIndex=w.spriteIndex%50;D=document.createElement("img");D.style.position="absolute";D.style.left=Math.round(-G-spriteIndex*H*this.thumbSpriteSize)+"px";D.style.top=Math.round(-m)+"px";if(!this.isIE){D.height=Math.round(H*this.thumbSpriteSize)}else{var h=this;D.onload=function(){var I=D.width;D.width=Math.round(H*I);D.height=Math.round(H*h.thumbSpriteSize)}}D.src="../data/_gallery/"+this.albumPrivacyLevel+"/"+this.albumId+"/thumb-sprites-"+spriteMapIndex+".jpg"+(this.album&&this.album.mod?"?_m="+this.album.mod:"");f.appendChild(D)}else{f=document.createElement("img");f.id="fakeMainImage";f.src=this.aLoaded[w.id]?w.url:w.urlThumbnail;f.width=B.width;f.height=B.height;f.style.display="inline";f.style.marginBottom=-1*B.height-2+"px"}if(o){$(o).unbind();$(o).replaceWith(f)}else{this.imageDiv.append(f)}var k=$("div.sidePanel");var r=parseInt(k.css("padding-bottom"))+parseInt(k.css("padding-top"));var F=$(f);if(b){var F=$(D)}var p=F.css("border-left-width");var n=F.css("border-right-width");var e=F.css("border-top-width");var E=F.css("border-bottom-width");var d=0;var z=0;if(typeof p!="undefined"&&typeof n!="undefined"){d=parseInt(p)+parseInt(n)}if(typeof e!="undefined"&&typeof E!="undefined"){z=parseInt(e)+parseInt(E)}$("#numImages").width(B.width+d);var x=Math.max(B.width,this.X_IMAGE_MINIMUM);var a=Math.max(B.height,this.Y_IMAGE_MINIMUM);this.imageDiv.width(x+d);this.imageDiv.height(a+z);var C=$("div.overlay");var y=$("div.formOverlay");C.height(a);y.width(x);y.height(a);if(typeof this.container.get(0).style.maxHeight!="undefined"){k.css("min-height",a-r+"px")}else{k.css("height",a-r+"px")}var h=this;var g=(new Date()).getTime();u.id=w.id;u.onload=function(){var I=parseInt(this.id);if(I==h.showImageId){this.loaded=true;u.style.left="0em";g=(new Date()).getTime()-g;if(!h.aLoaded[(h.albumId?h.albumId:h.getAlbumId())+"-"+I]&&g>100){$(f).fadeOut(1000)}else{$(f).unbind();$(f).remove()}h.aLoaded[(h.albumId?h.albumId:h.getAlbumId())+"-"+I]=true}else{$(this).unbind();$(this).remove();$(f).unbind();$(f).remove()}};if(B.width==this.xImageOrig&&B.height==this.yImageOrig){u.src=this.url}else{u.src=this.url+"?width="+B.width+"&height="+B.height}this.imageMain=$(u);u.style.position="relative";this.imageDiv.append(u);if(document.all||jQuery.browser.opera){this.ResizeImage();u.style.display="inline";u.style.visibility="visible";this.isImageLoaded=true;if(this.isDataParsed){this.isImageLoaded=false;this.isDataParsed=false;this.loadingImg.stop(true,true);this.loadingImg.hide()}}else{(function(){if(u.width<1||u.height<1){setTimeout(arguments.callee,20);return}h.GetWindowSize();h.ResizeImage();u.style.display="inline";u.style.visibility="visible";h.isImageLoaded=true;if(h.isDataParsed){h.isImageLoaded=false;h.isDataParsed=false;h.loadingImg.stop(true,true);h.loadingImg.hide()}})()}},ShowDescription:function(b){if(!document.getElementById("albumDescriptionPara")&&this.albumDescription!==""&&b==1){var a=document.createElement("p");a.id="albumDescriptionPara";a.innerHTML=this.albumDescription.replace(/\n/g,"<br/>");$(a).insertAfter(this.pageNumbers)}},Preload:function(){var a=0;var b=this;(function(){if(b.aImages[a]&&b.aImages[a].thumbnail){if(b.aImages[a].thumbnail.width){a++}else{setTimeout(arguments.callee,25);return}}if(a>=b.imageIndexFirst&&a<=b.imageIndexLast){a++}if(a<b.aImages.length&&b.aImages[a].urlThumbnail){b.aImages[a].thumbnail=new Image();b.aImages[a].thumbnail.src=b.aImages[a].urlThumbnail;setTimeout(arguments.callee,25)}})()},PreloadMain:function(a){var b=a;if(!this.aImages[b]){b=0}var d=this.aImages[b];var g=d.url;if(d.width!=null&&d.height!=null){this.GetWindowSize();var c=this.FitImage(d.width,d.height);if(c.width!=d.width&&c.height!=d.height){g+="?width="+c.width+"&height="+c.height}}var f=this;if(document.all){var h=document.createElement("img");h.id=d.id;h.onload=function(){$(this).unbind();$(this).remove();f.aLoaded[(f.albumId?f.albumId:f.getAlbumId())+"-"+this.id]=true};h.style.position="absolute";h.style.left="-9999em";h.width="1px";h.height="1px";h.src=g}else{var e=new Image();e.src=g;e.id=d.id;e.onload=function(){f.aLoaded[(f.albumId?f.albumId:f.getAlbumId())+"-"+this.id]=true}}},AddComment:function(){var d=this;var c=this.commentMessage.val();if(c==""){$("#commentForm span").text(aLangs.commentError);return}if(!this.isAjaxReady){return}this.loadingImg.fadeIn("slow");this.isAjaxReady=false;var b=this.GetImageId(this.imageIndex);var a=this.galleryLocation+"?AlbumJSON&album="+this.albumId+"&image="+b;this.jQueryClearCache();this.newImageIndex=this.imageIndex;jQuery.post(a,{message:c},function(e){d.isImageLoaded=true;d.Process(e);d.isAjaxReady=true});this.commentMessage.val("")},DeleteComment:function(f){var f=f||top.event;var d=f.target||f.srcElement;if(d.className!="delCommentBtn sprite"&&d.className!="delCommentAnchor"){return}var h=$(d).parents(".comment");if(h.length!=1){return}if(!this.isAjaxReady){return}if(!confirm(this.aLangs.deleteCommentConfirm)){return false}this.loadingImg.fadeIn("slow");this.isAjaxReady=false;var c=h.get(0).commentId;var b=this.GetImageId(this.imageIndex);var a=this.galleryLocation+"?AlbumJSON&album="+this.albumId+"&image="+b;var g=this;this.jQueryClearCache();this.newImageIndex=this.imageIndex;jQuery.post(a,{"delete":c},function(e){g.isImageLoaded=true;g.Process(e);g.isAjaxReady=true})},UseControl:function(c){var h=this;var b;switch(c){case"nextImageLink":var a=parseInt(this.imageIndex)+1;if(!this.aImages[a]){a=0}this.newImageIndex=this.imageIndex=a;b=a+1;break;case"prevImageLink":var e=parseInt(this.imageIndex)-1;if(!this.aImages[e]){e=this.aImages.length-1}this.newImageIndex=this.imageIndex=e;b=e-1;break;default:return;break}if(this.imageIndex>=this.imageIndexFirst&&this.imageIndex<=this.imageIndexLast){this.ShowImage(this.aImages[this.imageIndex]);$("#thumbnailsList a").removeClass("selectedThumbnail");var g=$("img[imageIndex="+this.imageIndex+"]").parent();if(g.is("a")){g.addClass("selectedThumbnail")}else{if(g.parent()){g.parent().addClass("selectedThumbnail")}}}var f=this.GetImageId(this.imageIndex);if(this.tag!=null&&this.tag!=""){var d=this.galleryLocation+"?TagXML&tag="+this.tag+"&image="+f;this.jQueryGetCache(d,function(j){h.Process(j);h.isAjaxReady=true})}else{this.loadAlbum(function(j){h.Process(j);h.isAjaxReady=true})}if(document.flashSlideshow&&document.flashSlideshow.sendToActionScript){document.flashSlideshow.sendToActionScript(this.albumId,f)}else{if(window.flashSlideshow&&window.flashSlideshow.sendToActionScript){window.flashSlideshow.sendToActionScript(this.albumId,f)}}this.PreloadMain(b)},HideOverlays:function(a){if(a){textSlider.HideAllExceptExif()}else{textSlider.HideAll()}$("#albumListDiv div.slidingPage").css("display","block");this.thumbnails.css("display","block");this.pageNumbers.css("display","block");if(this.page==1){$(this.ID_ALBUM_DESCRIPTION).css("display","block")}this.functions.css("display","none");return false},IsFlashCapable:function(){var b=0;var a="";if(navigator.plugins!=null&&navigator.plugins.length>0){if(navigator.plugins["Shockwave Flash"]&&navigator.plugins["Shockwave Flash"].description){a=navigator.plugins["Shockwave Flash"].description}}else{if(jQuery.browser.msie){try{var c=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");a=c.GetVariable("$version")}catch(d){return 0}}}b=a.match(/\d+/);return(b>=this.FLASH_VERSION_REQUIRED)},FitImage:function(q,a){var f=q/a;if(q=="undefined"||a=="undefined"){return{width:0,height:0}}var j=this.imageMain.css("border-left-width");var g=this.imageMain.css("border-right-width");var d=this.imageMain.css("border-top-width");var y=this.imageMain.css("border-bottom-width");var e=0;var r=0;if(typeof j!="undefined"&&typeof g!="undefined"&&j!=""&&g!=""){j=parseInt(j);g=parseInt(g);e=j+g}else{j=0;g=0}if(typeof d!="undefined"&&typeof y!="undefined"){d=parseInt(d);y=parseInt(y);r=d+y}else{d=0;y=0}var l=parseInt(this.mainPanel.css("padding-left"))+parseInt(this.mainPanel.css("padding-right"));var p=this.mainPanel.width()-l-e;var m=this.yWindow-this.Y_IMAGE_OFFSET;if(this.isIE6){p-=42;m-=42}var n,t;if(q<p&&a<m){return{width:q,height:a}}var w,x;var k=false;for(var u=0,h;h=this.aRestrict[u];u++){w=h;x=h/f;if(p>=w&&m>=x){k=true;break}}if(!k){w=this.aRestrict[this.aRestrict.length-1];x=w/f}var b,c;var k=false;for(var u=0,h;h=this.aRestrict[u];u++){c=h;b=h*f;if(p>=b&&m>=c){k=true;break}}if(!k){c=this.aRestrict[this.aRestrict.length-1];b=c*f}if((w<=p&&x<=m)==(b<=p&&c<=m)){var v=w*x;var o=b*c;if(v>=o){n=w;t=x}else{n=b;t=c}}else{var v=w*x;var o=b*c;if(v<o){n=w;t=x}else{n=b;t=c}}n=parseInt(n);t=parseInt(t);return{width:n,height:t}},ResizeImage:function(){var t=$("div.overlay");var p=$("div.formOverlay");var h=$("div.sidePanel");var u=this.imageMain.get(0);if(!u){return}var c=$("img.mainDivImage, #fakeMainImage",this.imageDiv);var l=parseInt(h.css("padding-bottom"))+parseInt(h.css("padding-top"));var k=this.imageMain.css("border-left-width");var j=this.imageMain.css("border-right-width");var d=this.imageMain.css("border-top-width");var v=this.imageMain.css("border-bottom-width");var e=0;var q=0;if(typeof k!="undefined"&&typeof j!="undefined"){k=parseInt(k);j=parseInt(j);e=k+j}else{k=0;j=0}if(typeof d!="undefined"&&typeof v!="undefined"){d=parseInt(d);v=parseInt(v);q=d+v}else{d=0;v=0}var n=this.FitImage(this.xImageOrig,this.yImageOrig);var m=n.width;var r=n.height;var f="";if(m==this.xImageOrig&&r==this.yImageOrig){f=this.url}else{f=this.url+"?width="+m+"&height="+r}if(m!=u.width||r!=u.height){u.src=f;c.width(m);c.height(r)}$("#numImages").width(m+e);var o=Math.max(m,this.X_IMAGE_MINIMUM);var b=Math.max(r,this.Y_NOIMAGE_MINIMUM);this.imageDiv.width(o+e);this.imageDiv.height(b+q);var g=parseInt((parseInt(m)+parseInt(o))/2)-31;$("#slideShowObj").css("left",g+"px");t.height(b);p.width(o);p.height(b);var a=Math.max(r,this.Y_NOIMAGE_MINIMUM);if(typeof u.style.maxHeight!="undefined"){h.css("min-height",a-l+"px")}else{h.css("height",a-l+"px")}return},ResizeContainer:function(){var e=this.container.offset();var c=parseInt(this.container.css("padding-bottom"))+parseInt(this.container.css("padding-top"));var d=e.left*2;var f=e.top*2+c;var a=this.xWindow-d;var b=this.yWindow-f;if(typeof document.getElementById("containerDiv").style.maxHeight!="undefined"){this.container.css("min-height",b+"px")}else{if((a-2)<this.X_CONTAINER_MINIMUM){this.container.width(this.X_CONTAINER_MINIMUM)}else{this.container.css("width",a-2)}this.container.height(b)}},GetWindowSize:function(){if(self.opera){this.xWindow=(window.innerWidth||document.documentElement.clientWidth);this.yWindow=(window.innerHeight||document.documentElement.clientHeight)}else{this.xWindow=(document.documentElement.clientWidth||window.innerWidth);this.yWindow=(document.documentElement.clientHeight||window.innerHeight)}},GetImageId:function(a){if(this.aImages[a]){return this.aImages[a].id}},Share:function(b){var c="http://iloapp."+this.domainName+"/gallery/"+this.galleryLocation+"?Album&album="+this.albumId;var a=this.albumName;switch(b){case"facebook":window.open("http://www.facebook.com/sharer.php?u="+encodeURIComponent(c)+"&t="+encodeURIComponent(a),"sharer","toolbar=0,status=0,width=626,height=436");break;case"myspace":window.open("http://www.myspace.com/index.cfm?fuseaction=postto&t="+encodeURIComponent(a)+"&c=&u="+encodeURIComponent(c)+"&l=","PostToMyspace","toolbar=0,status=0,width=800,height=650");break;case"linkedin":window.open("http://www.linkedin.com/shareArticle?mini=true&url="+encodeURIComponent(c)+"&title="+encodeURIComponent(a)+"&summary=&source=","share","toolbar=0,status=0,width=626,height=436");break;case"twitter":window.open("http://twitter.com/home?status="+encodeURIComponent(c),"share","toolbar=0,status=0,width=626,height=436");break;default:break}},toString:function(){return"[object Display]"},jQueryCache:{},jQueryGetCache:function(c,b){var d=this;var a=this.jQueryCache[c];if(a&&(new Date()).getTime()-a.time<this.cacheExpiry){b(a.data)}else{jQuery.get(c,function(e){d.jQueryCache[c]={time:(new Date()).getTime(),data:e};b(e)})}},jQueryClearCache:function(){this.jQueryCache={}},setPage:function(a){this.newPage=a;var b=this;this.loadAlbums(function(c){b.Process(c)})},getPage:function(){var f=1;var a=this.newImageIndex;if(a==null&&this.imageId!=null){for(var e=0;e<this.aImages.length;++e){if(this.aImages[e].id==this.imageId){a=e}}this.newImageIndex=a}if(typeof this.albumDescription!="string"){this.albumDescription=""}if(a!=null){var d=1*a+(this.albumDescription?this.numImagesPerPage-this.numImagesShortPage:0);f=Math.floor(d/this.numImagesPerPage)+1}else{if(this.newPage){f=this.newPage}else{f=this.page}}var c=this.aImages.length;var b=Math.ceil((c+(this.albumDescription?this.numImagesPerPage-this.numImagesShortPage:0))/this.numImagesPerPage);if(f>b){f=b}if(f<0){f=0}return f},getAlbumId:function(){var b=this.albumId;if(!b&&this.aAlbums){var c=this.page?this.page:this.getPage();var a=this.aAlbums[(c-1)*this.numAlbumsPerPage];return a?a.id:null}return b},setImage:function(a){this.newImageIndex=a;var c=this;var b=c.GetImageId(a);c.loadAlbum(function(d){c.Process(d);c.isAjaxReady=true})},getCurrentImage:function(){var a=this.newImageIndex!=null?this.newImageIndex:this.imageIndex;if(a&&this.aImages.length>a){return this.aImages[a]}return null},toJSON:function(data){var json={};if(!data.xmlVersion){if(data.split){eval("json = "+data+";")}else{json=data}}else{if($("albums",data).length){json.albums=[];$("album",data).each(function(){json.albums.push({id:parseInt($("id:first",this).text()),name:$("name",this).text(),timeCreated:$("timeCreated",this).text(),privacyLevel:$("privacyLevel",this).text(),spriteIndex:$("spriteIndex",this).text(),numImages:$("numImages",this).text(),editable:($("editable",this).text()=="true")?true:false,deletable:($("deletable",this).text()=="true")?true:false,coverImage:{id:parseInt($("coverImage id:first",this).text()),url:$("coverImage url",this).text(),urlThumbnail:$("coverImage urlThumbnail",this).text(),width:parseInt($("coverImage width",this).text()),height:parseInt($("coverImage height",this).text())}})})}if($("album",data).length){json.album={id:parseInt($("album > id",data).text()),name:$("album > name",data).text(),description:$("description",data).text(),privacyLevel:$("album privacyLevel",data).text(),ownerName:$("ownerName",data).text(),imageCount:$("imageCount",data).text(),embedable:$("embedable",data).text()=="true",downloadable:$("downloadable",data).text()=="true"};if($("album images",data).length){if($("album images",data).length){json.album.images=[];$("album images image",data).each(function(){var image={id:parseInt($("id:first",this).text()),url:$("url",this).text(),urlThumbnail:$("urlThumbnail",this).text(),width:$("width",this).text(),height:$("height",this).text(),spriteIndex:$("spriteIndex",this).text(),caption:$("caption",this).text(),originalId:parseInt($("originalImageId",this).text()),albumId:parseInt($("albumId",this).text()),exif:[],comments:[]};if($("exif",this).length){$("exif value",this).each(function(){image.exif[$(this).attr("variable")]=$(this).text()})}if($("comments",this).length){$("comment",this).each(function(){image.comments.push({id:parseInt($("id",this).text()),postedBy:$("postedBy",this).text(),message:$("message",this).text()})})}json.album.images.push(image)})}}}}return json},loadAlbumsTime:null,loadAlbums:function(a){var b=(new Date()).getTime();if(this.loadAlbumsTime===null){this.loadAlbumsTime=b}if(!this.aAlbums||(b-this.loadAlbumsTime)>this.cacheExpiry){this.loadAlbumsTime=b;this.jQueryGetCache(this.galleryLocation+"?AlbumsJSON",a)}else{a({albums:this.aAlbums})}},loadAlbumTime:null,loadAlbum:function(a){var b=(new Date()).getTime();if(this.loadAlbumTime==null){this.loadAlbumTime=b}if(!this.album||this.album.id!=this.albumId||(b-this.loadAlbumTime)>this.cacheExpiry){this.loadAlbumTime=b;this.jQueryGetCache(this.galleryLocation+"?AlbumJSON&album="+this.albumId,a)}else{a({album:this.album});this.jQueryCache[this.galleryLocation+"?AlbumJSON&album="+this.album.id]={time:b,data:{album:this.album}}}}};function rgbToHex(f){var e=f.match(/rgb\((.+),(.+),(.+)\)/i);if(e==null){return f}var c=parseInt(e[1]),d=parseInt(e[2]),h=parseInt(e[3]);var b=c.toString(16);if(b.length<2){b+=b}var j=d.toString(16);if(j.length<2){j+=j}var a=h.toString(16);if(a.length<2){a+=a}var g="#"+b+j+a;return g}function IsColorDark(a){var b=a.match(/^\#([0-9A-Fa-f]+)$/);a=b[1];red=parseInt(a.substring(0,2),16);green=parseInt(a.substring(2,4),16);if(red<=220||green<=220){return true}else{return false}}function OpenFlashInNewWin(a){var b=window.open(a,"","toolbar=no, menubar=no, scrollbars=yes, resizable=no, location=no, directories=no, fullScreen=yes")}function ShowSelectedImage(b,a){$("#slideShowObj").blur();display.newImageIndex=a;display.ShowImage(display.aImages[a]);display.loadAlbum(function(c){display.Process(c);display.isAjaxReady=true})}var textSlider;var oldWidth=464;var oldHeight=348;function TextSlider(){this.halfPI=Math.PI/2;this.step=this.maxSteps;this.aOverlays=new Array();var c=document.getElementById("aboutGalleryAnchor");var g=document.getElementById("aboutMeAnchor");var k=document.getElementById("exifLink");var j=document.getElementById("embedLink");var d=document.getElementById("loginAnchor");var n=$("#userInfoDiv a").get(0);var m=document.getElementById("aboutGalleryDiv");var h=document.getElementById("aboutMeDiv");var a=document.getElementById("exifDiv");var f=document.getElementById("embedDiv");var l=document.getElementById("loginDiv");var o=document.getElementById("unsubscribeDiv");var b=document.getElementById("registerDiv");var e=document.getElementById("welcomeDiv");if(c&&m){this.AddOverlay(c,m)}if(g&&h){this.AddOverlay(g,h)}if(k&&a){this.AddOverlay(k,a)}if(j&&f){this.AddOverlay(j,f)}if(d&&l){this.AddOverlay(d,l)}if(o){this.AddOverlay(false,o)}if(b){if(n){this.AddOverlay(n,b)}else{this.AddOverlay(false,b)}}if(e){this.AddOverlay(false,e)}}TextSlider.prototype={tickSpeed:10,maxSteps:30,Cleanup:function(){$("*").unbind();for(var a in this){this[a]=null}},AddOverlay:function(b,d){if(d.collapsed){d.step=this.maxSteps}else{d.step=0}d.interval=null;d.contentDiv=$("div.content",d).get(0);if(!d.contentDiv){d.contentDiv=d}d.Slide=Slide;var c=this;if(b){b.onclick=function(f){c.Trigger(f);return false}}$("img.overlayCloser",d).click(function(f){c.Trigger(f);return false});var a=new Array(b,d);this.aOverlays[this.aOverlays.length]=a},HideAll:function(){var f=this;var c=false;var e=this.aOverlays.length;for(var b=0,a;a=this.aOverlays[b];b++){var d=a[1];if(!d.collapsed){d.collapsed=true;d.Slide();c=true}}return c},HideAllExceptExif:function(){var f=this;var c=false;var e=this.aOverlays.length;for(var b=0,a;a=this.aOverlays[b];b++){var d=a[1];if(!d.collapsed&&d.id!="exifDiv"){d.collapsed=true;d.Slide();c=true}}return c},Trigger:function(g){g=g||window.event;var f=g.target||g.srcElement;var d=this.aOverlays.length;for(var b=0,a;a=this.aOverlays[b];b++){var c=a[1];if(a[0].id==f.id||!c.collapsed){c.collapsed=!c.collapsed;c.Slide()}}return false},toString:function(){return"[object TextSlider]"}};function Slide(){var c=this;if(this.collapsed){this.step+=1}else{this.step-=1}this.style.display="block";var a=Math.sin(textSlider.halfPI*(this.step/textSlider.maxSteps));var b=a*this.offsetWidth;this.style.left="-"+b+"px";this.contentDiv.style.overflowX="hidden";if(self.opera){this.contentDiv.style.overflow="auto";if(this.id=="exifDiv"||this.id=="loginDiv"){this.contentDiv.style.overflow="hidden"}}if(this.step==0){this.contentDiv.style.overflowY="auto";clearInterval(this.interval);this.interval=null;if(this.id=="loginDiv"){document.getElementById("loginEmailInput").focus();if(jQuery.browser.msie&&jQuery.browser.version==8){$("input","#loginDiv").keydown(function(d){var d=d||window.event;if(d.keyCode==13&&document.getElementById("loginPwdInput").value!=""){this.parentNode.submit();return false}})}}}else{if(this.step==textSlider.maxSteps){this.style.display="none";clearInterval(this.interval);this.interval=null}else{if(this.interval==null){this.interval=setInterval(function(){c.Slide()},textSlider.tickSpeed);if(navigator.userAgent.indexOf("Firefox")!=-1){this.contentDiv.style.overflowY="hidden"}else{this.contentDiv.style.overflowY="auto"}}}}}function SelectEmbedCode(){document.getElementById("embedInput").focus();document.getElementById("embedInput").select()}function SetWidth(b){if(parseInt(b)!=NaN&&parseInt(b)>=200){oldWidth=parseInt(b);var a=document.getElementById("embedHeight").value;if(parseInt(b)<a){a=parseInt(b);document.getElementById("embedHeight").value=a}SetEmbedInput(b,a)}else{document.getElementById("embedWidth").value=oldWidth}SelectEmbedCode()}function SetHeight(a){if(parseInt(a)!=NaN&&parseInt(a)>=200){oldHeight=parseInt(a);var b=document.getElementById("embedWidth").value;if(parseInt(a)>b){b=parseInt(a);document.getElementById("embedWidth").value=b}SetEmbedInput(b,a)}else{document.getElementById("embedHeight").value=oldHeight}SelectEmbedCode()}function Reset(){oldWidth=width=464;oldHeight=height=348;document.getElementById("embedWidth").value=width;document.getElementById("embedHeight").value=height;SetEmbedInput(width,height)}function SetEmbedInput(b,a){if(!display){setTimeout(function(){SetEmbedInput(b,a)},1000);return}document.getElementById("embedInput").value='<object width="'+parseInt(b)+'" height="'+parseInt(a)+'" type="application/x-shockwave-flash" data="http://iloapp.'+display.domainName+"/gallery/swf/embedFlashGallery.swf?albumId="+display.albumId+"&galleryLocation="+display.galleryLocation+"&domainName="+display.domainName+'" name ="embedFlashGallery"><param name="movie" value="http://iloapp.'+display.domainName+"/gallery/swf/embedFlashGallery.swf?albumId="+display.albumId+"&galleryLocation="+display.galleryLocation+"&domainName="+display.domainName+'"/><param name="quality" value="high"/><param name="bgcolor" value="#000000"/><param name="allowScriptAccess" value="always"/><param name="allowFullScreen" value="true"/><a href="http://'+display.galleryLocation+"."+display.domainName+"/#"+display.albumId+'">http://'+display.galleryLocation+"."+display.domainName+"/#"+display.albumId+"</a></object>"}function ImageUpload(c){this.albumId=c.albumId;this.aGroups=c.aGroups;this.authFlash=c.authFlash;this.domContainer=c.domContainer;this.domHelpText=c.domHelpText;this.domBrowseBtn=c.domBrowseBtn;this.domUploadBtn=c.domUploadBtn;this.domBatchList=c.domBatchList;this.domForm=c.domForm;this.domZoomSlider=c.domZoomSlider;this.wZoomSlider=$(this.domZoomSlider).width()-13;this.moreOptionsAnchor=$("#moreOptionsAnchor");this.moreOptionsDiv=$("#moreOptionsDiv");this.defaultSettingAnchor=$("#defaultSettingAnchor");this.defaultSettingDiv=$("#defaultSettingDiv");this.zoomSlider=$("#zoomSliderDiv img");this.aLangs=c.aLangs;this.isIE=jQuery.browser.msie;var b=this;b.GetImageList();document.getElementById("batchSubmitBtn").disabled=true;if(this.authFlash){this.swfu=new SWFUpload({button_placeholder_id:"uploadImageBtn",button_window_mode:"transparent",button_width:90,button_height:18,upload_url:"../"+galleryLocation+"?UploadImage"+this.authFlash,flash_url:"swf/swfupload.swf",file_size_limit:25165824,file_types:"*.jpg;*.jpeg;*.png;*.gif;*.JPG;*.JPEG;*.PNG;*.GIF",file_types_description:"Image files",swfupload_loaded_handler:function(){$(".swfupload").css("position","absolute");document.getElementById("batchSubmitBtn").disabled=false;$("#uploadImageInput").remove();$(b.domBatchList).unbind("click");b.domBatchList.onclick=function(g){var g=g||window.event;var f=g.target||g.srcElement;if(f.tagName.toLowerCase()=="a"){var d=f.id.slice(4,f.id.length);b.swfu.cancelUpload(d);b.domBatchList.removeChild(f)}return false}},file_queued_handler:function(d){b.QueueFile(d)},upload_start_handler:function(d){b.StartUpload(d);return true},upload_progress_handler:function(d,e){b.UpdateProgress(d,e)},upload_success_handler:function(d,e){b.SaveServerData(d,e)},upload_complete_handler:function(d){b.CompleteUpload(d)},upload_error_handler:function(e,f,d){b.HandleError(e,f,d)},debug:false})}this.items=$(this.domContainer).children();this.items.wrap('<div class="'+this.CLASS_SORTABLE_ITEM+'"></div');this.items.addClass(this.CLASS_SORTABLE_ITEM);document.getElementById("uploadImageInput").onchange=function(){var d=document.createElement("a");d.id="fileSelected";d.href="#";d.className="imageFile";d.innerHTML=b.aLangs.image;b.domBatchList.appendChild(d);document.getElementById("batchSubmitBtn").disabled=false};b.domBatchList.onclick=function(f){var f=f||window.event;var d=f.target||f.srcElement;if(d.id=="fileSelected"){document.getElementById("batchSubmitBtn").disabled=true;b.domBatchList.removeChild(d)}return false};$("#permissionsDiv input").click(function(){var d;switch(this.value){case"public":d="public";$('input[name="groupView[]"]').attr("checked",true);$('input[name="groupView[]"]').attr("disabled",true);$('input[name="groupEdit[]"]').attr("disabled","");break;case"private":d="private";$('input[name="groupView[]"], input[name="groupEdit[]"]').attr("disabled","");break;case"hidden":d="hidden";$('input[name="groupView[]"], input[name="groupEdit[]"]').attr("checked",false);$('input[name="groupView[]"], input[name="groupEdit[]"]').attr("disabled","disabled");break;case"mixed":$('input[name="groupView[]"]').attr("disabled","");if(b.albumId==null){jQuery.get(galleryLocation+"?UploadHelperXML",function(e){b.UpdateGroupSelections(e)})}else{jQuery.get(galleryLocation+"?UploadHelperXML",{album:b.albumId},function(e){b.UpdateGroupSelections(e)})}default:break}if(d!=null){if(b.albumId==null){jQuery.post(galleryLocation+"?UploadHelperXML",{allPrivacy:d,"image-ids[]":b.aImageIds},function(e){b.UpdateThumbnails(e)})}else{jQuery.post(galleryLocation+"?UploadHelperXML&album="+b.albumId,{allPrivacy:d,"image-ids[]":b.aImageIds},function(e){b.UpdateThumbnails(e)})}}});$('input[name="groupEdit[]"]').click(function(){if(this.checked){$('input[name="groupView[]"]',$(this).parents("tr")).attr("checked",true)}});$('input[name="groupView[]"]').click(function(){if(!this.checked){$('input[name="groupEdit[]"]',$(this).parents("tr")).attr("checked",false)}});$("#albumGroupSettingsDiv").click(function(h){if(h.target.tagName.toLowerCase()!="a"){return}var g=h.target;var f=parseInt(g.href.match(/\d+$/));if(b.aGroups[f]){b.group=b.aGroups[f]}else{return false}b.ClearPopup();$('.jsPopup input[name="groupName"]').attr("value",b.group.name);for(var d in b.group.aUserIds){$('.jsPopup input[name="groupUsers['+b.group.aUserIds[d]+']"]').attr("checked",true)}b.ShowPopup(document.getElementById("jsGroupPopupDiv"),300,400);return false});$("#newGroupBtn").click(function(){b.group=new Object();b.group.id="new";b.ClearPopup();b.ShowPopup(document.getElementById("jsGroupPopupDiv"),300,400)});$('#jsGroupPopupDiv input[name="update"]').click(function(){var f=$('input[name="groupName"]',this.domGroupPopup).attr("value");if(f.length==0){return false}var d=new Array();$("#jsGroupPopupDiv input.groupUsers").each(function(){if(this.checked){d.push(this.value)}});var e={update:"update",groupName:f,"groupUsers[]":d};if(b.group.id=="new"){e.newgroup="true"}jQuery.post(galleryLocation+"?UserManager&show=ajax&group="+b.group.id,e,function(j){if(j=="ERROR"){alert("Error saving changes")}else{if(b.group.id=="new"){var g=j;b.aGroups.splice(g,0,{id:g,name:f,aUserIds:d});var k='<tr id="groupRow'+g+'"><td class="textColumn"><a href="#'+g+'">'+f;k+=" ("+d.length+")</a></td>";k+='<td class="inputColumn"><input type="checkbox" name="groupView[]" value="'+g+'"/></td>';k+='<td class="inputColumn"><input type="checkbox" name="groupEdit[]" value="'+g+'"/></td>';k+="</tr>";$("#albumGroupSettingsDiv table").append(k)}else{b.aGroups[b.group.id].aUserIds=d;var h=$("#groupRow"+b.group.id);$("td.textColumn a",h).text(b.group.name+" ("+d.length+")")}b.HidePopup()}});return false});$("#coverDiv").click(function(){b.HidePopup()});$(".jsPopup .closeBtn").click(function(){b.HidePopup()});$('#jsGroupPopupDiv input[name="cancel"]').click(function(){b.HidePopup();return false});this.domZoomSlider.ondragstart=function(){return false};this.domZoomSlider.onmousedown=function(h){b.zoomSlider.attr("movable","true");h=h||window.event;b.xMouseStart=(h.pageX||h.clientX);b.xCaretStart=parseInt(b.zoomSlider.css("left"));var d=b.zoomSlider.offset().left;var f=b.xMouseStart-d;var g=b.xCaretStart+f;if(g<0){g=0}else{if(g>b.wZoomSlider){g=b.wZoomSlider}}b.zoomSlider.css("left",g+"px");b.xCaretStart=g;if(h.preventDefault){h.preventDefault();h.stopPropagation()}return false};this.domZoomSlider.onmousemove=function(g){if(b.zoomSlider.attr("movable")!="true"){return}g=g||window.event;var d=(g.pageX||g.clientX);var f=d-b.xMouseStart+b.xCaretStart;if(f<0){f=0}else{if(f>b.wZoomSlider){f=b.wZoomSlider}}b.zoomSlider.css("left",f+"px");if(g.preventDefault){g.preventDefault();g.stopPropagation()}};this.domZoomSlider.onclick=function(f){f=f||window.event;var d=(f.pageX||f.clientX)};this.domContainer.ondragstart=function(){return false};this.domContainer.onmouseover=function(k){k=k||window.event;var g=k.target||k.srcElement;var l=$(g);if(!l.hasClass(b.CLASS_SORTABLE_ITEM)||g.tagName.toLowerCase()!="img"||b.domDragItem!=null){return}if(l.width()<128){return}var j=l.siblings(".optionsText");if(j.length>0){j.stop();j.animate({height:"20px",top:"114px"},"fast");j.animate({height:"18px",top:"116px"},"fast");return}var d=document.createElement("div");var m=document.createElement("a");var f=$(d);var h=$(m);d.className="optionsText";d.style.height="0px";m.href="#";m.className="optionsText";m.innerHTML=b.aLangs.photoOptions;m.style.height="0px";l.after(d);l.after(m);f.animate({height:"20px",top:"114px"},"fast");h.animate({height:"20px",top:"114px"},"fast");f.animate({height:"18px",top:"116px"},"fast");h.animate({height:"18px",top:"116px"},"fast");var n=g.parentNode;n.onmouseout=function(p){p=p||window.event;var o=p.relatedTarget;while(o&&o!=n){try{o=o.parentNode}catch(e){o=g}}if(o==n){return true}f.stop();h.stop();f.animate({height:"0px",top:"134px"},"normal");h.animate({height:"0px",top:"134px"},"normal",function(){h.remove();f.remove()})}};this.domContainer.onclick=function(g){g=g||window.event;var d=g.target||g.srcElement;var f=$(d);if(d.tagName.toLowerCase()=="img"&&f.hasClass("editThumbnail")){b.ShowImageDetails(d)}else{if(f.hasClass("optionsText")){d=f.siblings("img.editThumbnail").get(0);b.ShowImageDetails(d);return false}}};var a=$("#tagListDiv");$("#tagsInput").keyup(function(){var l=this.value;var k=l.split(",");var j=jQuery.trim(k[k.length-1]);a.empty();if(j===""){return}var g=b.aTags.length;var h=0;for(var f=0;f<g;f++){var d=b.aTags[f];var e=d.slice(0,j.length);if(e>j||h>=5){break}else{if(e==j){a.append('<a href="#">'+d+"</a>");h++}}}});a.click(function(k){k=k||window.event;var j=k.target||k.srcElement;if(j.tagName.toLowerCase()!="a"){return false}var d=j.innerHTML;var g=document.getElementById("tagsInput");var l=g.value;var h=l.split(",");h[h.length-1]=d;for(var f=0,d;d=h[f];f++){h[f]=jQuery.trim(d)}g.value=h.join(", ");return false});this.domContainer.onmousedown=function(d){b.StartThumbnailDrag(d)};document.onmousemove=function(d){b.ContinueThumbnailDrag(d)};document.onmouseup=function(g){b.StopThumbnailDrag(g);b.zoomSlider.attr("movable","false");var h=$("img.editThumbnail");var f=$("div.editThumbnail");var d=parseInt(b.zoomSlider.css("left"));if(d<33){b.zoomSlider.css("left","0px");h.css("width","64px");h.css("height","64px");f.css("margin-bottom","0px");b.zoom=b.ZOOM_MIN;$(".privacyLevel, .caption").css("display","none")}else{if(d>=33&&d<=66){b.zoomSlider.css("left","50px");h.css("width","96px");h.css("height","96px");f.css("margin-bottom","0px");b.zoom=b.ZOOM_MID;$(".privacyLevel, .caption").css("display","none")}else{b.zoomSlider.css("left",b.wZoomSlider+"px");h.css("width","128px");h.css("height","128px");f.css("margin-bottom","10px");b.zoom=b.ZOOM_MAX;$(".privacyLevel, .caption").css("display","block")}}};if(this.authFlash){this.domUploadBtn.onclick=function(){b.swfu.startUpload();return false}}document.getElementById("tabList").onclick=function(f){f=f||window.event;var d=f.target||f.srcElement;switch(d.id){case"privacyTabLink":$(".jsTab").css("display","none");$("#tabList a").removeClass("active");$("#privacyTabLink").addClass("active");$("#privacyTabDiv").css("display","block");break;case"captionTabLink":$(".jsTab").css("display","none");$("#tabList a").removeClass("active");$("#captionTabLink").addClass("active");$("#captionTabDiv").css("display","block");break;case"coverTabLink":$(".jsTab").css("display","none");$("#tabList a").removeClass("active");$("#coverTabLink").addClass("active");$("#coverTabDiv").css("display","block");break;case"tagsTabLink":$(".jsTab").css("display","none");$("#tabList a").removeClass("active");$("#tagsTabLink").addClass("active");$("#tagsTabDiv").css("display","block");default:break}return false};this.defaultSettingAnchor.click(function(){b.defaultSettingDiv.toggle();return false});this.moreOptionsAnchor.click(function(){if(b.moreOptionsDiv.css("display")=="none"){b.moreOptionsAnchor.removeClass("moreOptionsPlus");b.moreOptionsAnchor.addClass("moreOptionsMinus")}else{b.moreOptionsAnchor.removeClass("moreOptionsMinus");b.moreOptionsAnchor.addClass("moreOptionsPlus")}b.moreOptionsDiv.toggle();return false});this.domForm.onsubmit=function(){for(var f=0,e;e=b.aImageIds[f];f++){var d=document.createElement("input");d.type="hidden";d.name="image-ids[]";d.value=e;b.domForm.appendChild(d)}return true}}ImageUpload.prototype={SRC_UNAVAILABLE_IMG:"Images/system/private_image.gif",CLASS_SORTABLE_ITEM:"editThumbnail",X_OFFSET:5,Y_OFFSET:5,ZOOM_MIN:"min",ZOOM_MID:"mid",ZOOM_MAX:"max",ROTATE_CW:"cw",ROTATE_CCW:"ccw",animation:{width:0,marginLeft:0,marginRight:0,borderLeft:0,borderRight:0},galleryLocation:null,albumId:null,aImageIds:new Array(),aErrors:new Array(),domContainer:null,domHelpText:null,domLoadIcon:null,domBrowseBtn:null,domUploadBtn:null,domBatchList:null,zoom:this.ZOOM_MAX,Cleanup:function(){$("*").unbind();for(var a in this){this[a]=null}},GetImageList:function(){if(!window.ActiveXObject&&this.domLoadIcon){this.domLoadIcon.style.display="none"}var a=this;if(this.albumId==null){jQuery.get(galleryLocation+"?UploadHelperXML",function(b){a.UpdateThumbnails(b)})}else{jQuery.get(galleryLocation+"?UploadHelperXML",{album:this.albumId},function(b){a.UpdateThumbnails(b)})}},UpdateThumbnails:function(x){var g=$("image",x);var p=g.length;var b=0;groupInputDisabled=false;var q=$("albumPrivacy",x);if(q.length){$("#permissionsDiv input").attr("checked",false);q=q.text();switch(q){case"private":document.getElementById("permPrivateInput").checked=true;$('input[name="groupView[]"], input[name="groupEdit[]"]').attr("disabled","");break;case"hidden":document.getElementById("permHiddenInput").checked=true;$('input[name="groupView[]"], input[name="groupEdit[]"]').attr("checked",false);$('input[name="groupView[]"], input[name="groupEdit[]"]').attr("disabled","disabled");groupInputDisabled=true;break;case"mixed":document.getElementById("permMixedInput").checked=true;$('input[name="groupView[]"], input[name="groupEdit[]"]').attr("disabled","");break;case"public":default:document.getElementById("permPublicInput").checked=true;$('input[name="groupView[]"]').attr("checked",true);$('input[name="groupView[]"]').attr("disabled",true);$('input[name="groupEdit[]"]').attr("disabled","");break}}if(p<1){this.domContainer.innerHTML='<span class="error">'+aLangs.noImages+".</span>";this.domHelpText.style.display="none";return}this.aImageIds=new Array();this.domContainer.innerHTML="";var h,l,u,o;if(this.zoom==this.ZOOM_MIN){h=l="64px";u="0px";o=false}else{if(this.zoom==this.ZOOM_MID){h=l="96px";u="0px";o=false}else{h=l="128px";u="10px";o=true}}for(var t=0;t<p;t++){var n=g[t];var v=$("id",n).text();var A=$("square",n).text();var k=$("caption",n).text();var z=$("privacy",n).text();var w=$("isCover",n).text();var j=$("tags",n).text();if(!v){continue}var r=document.createElement("div");var d=document.createElement("img");var c=document.createElement("input");var a=document.createElement("div");var m=document.createElement("input");r.imageId=v;r.className=this.CLASS_SORTABLE_ITEM;r.style.marginBottom=u;m.type="button";m.className="button caption";c.type="button";c.className="button privacyLevel";a.className="privacyLevel";var f=this;m.onclick=function(){var B=$(this).siblings("img.editThumbnail").get(0);f.ShowImageDetails(B,"caption")};c.onclick=function(){var B=$(this).siblings("img.editThumbnail").get(0);f.ShowImageDetails(B,"privacy")};this.aImageIds[t]=v;d.imageId=v;d.alt="Image "+v;d.title="";d.index=t;d.style.width=h;d.style.height=l;if(A){d.src=A}else{d.src=SRC_UNAVAILABLE_IMG}if(k){d.caption=k;if(k.length>18){k=k.slice(0,17)+"..."}m.value=k;m.style.fontStyle="normal"}else{d.caption="";m.value=this.aLangs.addCaption;m.style.fontStyle="italic"}if(z){d.privacyLevel=z;if(z=="public"){c.value=this.aLangs.pvcyPublic}else{if(z=="private"){c.value=this.aLangs.pvcyPrivate}else{c.value=this.aLangs.pvcyHidden;if(!groupInputDisabled){$('input[name="groupEdit[]"]').attr("checked",false);$('input[name="groupEdit[]"]').attr("disabled","disabled");groupInputDisabled=true}}}}else{d.privacyLevel="";c.value="Privacy"}if(w&&w=="true"){d.isCover=true}else{d.isCover=false}if(j){d.tags=j}else{d.tags=""}d.className=this.CLASS_SORTABLE_ITEM;if(t==(p-1)){d.className+=" last"}r.appendChild(d);if(o){r.insertBefore(a,d);r.insertBefore(c,d);r.appendChild(m)}this.domContainer.appendChild(r)}if(p>0){this.domHelpText.style.display="block"}this.aTags=new Array();var j=$("tag",x);var e=j.length;var y;for(var t=0;t<e;t++){y=j[t];this.aTags[t]=y.textContent}},UpdateGroupSelections:function(d){var b=$("image",d);var a=false;for(var c=0,e;e=b[c];c++){if($("privacy",e).text()=="hidden"){$('input[name="groupEdit[]"]').attr("checked",false);$('input[name="groupEdit[]"]').attr("disabled","disabled");a=true;break}}if(!a){$('input[name="groupEdit[]"]').attr("disabled","")}},ShowPopup:function(j,a,n){var g=document.innerHeight||document.documentElement.clientHeight;var k=document.getElementById("editAlbumDiv");var b=$(k).offset();var m=b.top;var e=b.left;var h=k.offsetWidth;var f=k.offsetHeight;j.style.position="absolute";var d=(g-n)/2+(document.documentElement.scrollTop||document.body.scrollTop);var c=(h-a)/2+e;j.style.top=d+"px";j.style.left=c+"px";var l=document.getElementById("coverDiv");l.style.position="absolute";l.style.top=m+"px";l.style.left=e+"px";l.style.width=h+"px";l.style.height=f+"px";if(!this.isIE){$(l).fadeIn("fast");$(j).fadeIn("fast",function(){$('input[type="text"]',j).get(0).focus()})}else{l.style.display="block";j.style.display="block";$('input[type="text"]',j).get(0).focus()}},HidePopup:function(){$(".jsPopup").fadeOut("fast");$("#coverDiv").fadeOut("fast")},ClearPopup:function(){$('.jsPopup input[type="text"]').attr("value","");$('.jsPopup input[type="checkbox"]').attr("checked",false)},ShowImageDetails:function(q,g){var r=document.innerHeight||document.documentElement.clientHeight;var e=document.getElementById("editAlbumDiv");var C=$(e).offset();var b=C.top;var h=C.left;var d=e.offsetWidth;var k=e.offsetHeight;var f=document.getElementById("jsImageDetailsDiv");f.imageId=q.imageId;f.linkedApps=q.linkedApps;f.style.position="absolute";var j=(r-200)/2+(document.documentElement.scrollTop||document.body.scrollTop);var B=(d-600)/2+h;f.style.top=j+"px";f.style.left=B+"px";var y=document.getElementById("detailImage");y.src=q.src;var x=document.getElementById("captionInput");x.value=q.caption;if(q.privacyLevel=="public"){document.getElementById("imagePermPublic").checked=true}else{if(q.privacyLevel=="private"){document.getElementById("imagePermPrivate").checked=true}else{if(q.privacyLevel=="hidden"){document.getElementById("imagePermHidden").checked=true}}}var t=document.getElementById("isCoverInput");if(q.isCover){t.checked=true}else{t.checked=false}$("#tagListDiv").empty();var v=document.getElementById("tagsInput");v.value=q.tags;var p=document.getElementById("rotateCCWBtn");p.alt=aLangs.rotateLeft;p.title=aLangs.rotateLeft;var c=document.getElementById("rotateCWBtn");c.alt=aLangs.rotateRight;c.title=aLangs.rotateRight;var o=document.getElementById("closeBtn");var n=document.getElementById("deleteBtn");var w=document.getElementById("submitBtn");var u=document.getElementById("prevBtn");var a=document.getElementById("nextBtn");var A=document.getElementById("p");var z=document.getElementById("coverDiv");z.style.position="absolute";z.style.top=b+"px";z.style.left=h+"px";z.style.width=d+"px";z.style.height=k+"px";if(!this.isIE){$(z).fadeIn("fast");$(f).fadeIn("fast")}else{z.style.display="block";f.style.display="block"}switch(g){case"privacy":$(".jsTab").css("display","none");$("#tabList a").removeClass("active");$("#privacyTabLink").addClass("active");$("#privacyTabDiv").css("display","block");break;case"caption":default:$(".jsTab").css("display","none");$("#tabList a").removeClass("active");$("#captionTabLink").addClass("active");$("#captionTabDiv").css("display","block");break}var m=this;c.onclick=function(){m.Rotate(m.ROTATE_CW)};p.onclick=function(){m.Rotate(m.ROTATE_CCW)};if(q.linkedApps>0){n.onclick=function(){var D=aLangs.delImageExist+" "+f.linkedApps;D+=" "+aLangs.delImageForce;A.innerHTML=D;n.onclick=function(){m.DeleteImage();m.HideImageDetails()}}}else{n.onclick=function(){m.DeleteImage();m.HideImageDetails()}}var l=document.getElementById("activityImg");w.onclick=function(){l.style.display="inline";m.SubmitDetails("update","");m.HideImageDetails()};u.onclick=function(){l.style.display="inline";m.SubmitDetails("prev",q.imageId)};a.onclick=function(){l.style.display="inline";m.SubmitDetails("next",q.imageId)}},HideImageDetails:function(){var a=document.getElementById("jsImageDetailsDiv");var b=document.getElementById("coverDiv");if(!this.isIE){$(b).fadeOut("fast");$(a).fadeOut("fast")}else{$(".jsTab").css("display","none");b.style.display="none";a.style.display="none"}},ShowNextImage:function(k,c){var b=this;var h;for(i=0;i<this.aImageIds.length;i++){if(this.aImageIds[i]==c){h=i}}if(k=="prev"){var j=h-1;if(j<0){j=this.aImageIds.length-1}}if(k=="next"){var j=h+1;if(j>=this.aImageIds.length){j=0}}domTarget=$($(this.domContainer).children().get(j)).children("img").get(0);var d=document.getElementById("jsImageDetailsDiv");d.imageId=domTarget.imageId;d.linkedApps=domTarget.linkedApps;var f=document.getElementById("detailImage");f.src=domTarget.src;var n=document.getElementById("captionInput");n.value=domTarget.caption;if(domTarget.privacyLevel=="public"){document.getElementById("imagePermPublic").checked=true}else{if(domTarget.privacyLevel=="private"){document.getElementById("imagePermPrivate").checked=true}else{if(domTarget.privacyLevel=="hidden"){document.getElementById("imagePermHidden").checked=true}}}var a=document.getElementById("isCoverInput");if(domTarget.isCover){a.checked=true}else{a.checked=false}var m=document.getElementById("tagsInput");m.value=domTarget.tags;$("#tagListDiv").empty();if($("#captionTabDiv").css("display")!="none"){n.focus()}else{if($("#tagTabDiv").css("display")!="none"){m.focus()}}var g=document.getElementById("prevBtn");var e=document.getElementById("nextBtn");var l=document.getElementById("activityImg");g.onclick=function(){l.style.display="inline";b.SubmitDetails("prev",domTarget.imageId)};e.onclick=function(){l.style.display="inline";b.SubmitDetails("next",domTarget.imageId)};l.style.display="none"},StartThumbnailDrag:function(d){d=d||window.event;var b=d.target||d.srcElement;var c=$(b);if(!c.hasClass(this.CLASS_SORTABLE_ITEM)){return}var a=c.parents("."+this.CLASS_SORTABLE_ITEM);if(a.length){c=a;b=a.get(0)}this.domOriginalItem=b;this.domDragItem=document.createElement("img");this.domDragItem.src=c.children("img").get(0).src;this.domDragItem.className="editThumbnail jsDragClone";document.body.appendChild(this.domDragItem);if(d.preventDefault){d.preventDefault();d.stopPropagation()}},ContinueThumbnailDrag:function(g){g=g||window.event;var c=g.target||g.srcElement;if(this.domDragItem==null){return}var j=this.domDragItem.style;j.display="block";$(".optionsText").remove();$(this.domOriginalItem).css("opacity","0.4");var b=(g.pageX||g.clientX);var f=(g.pageY||g.clientY);if(document.all){j.top=f+(document.documentElement.scrollTop)+this.Y_OFFSET+"px";j.left=b+(document.documentElement.scrollLeft||document.body.scrollLeft)+this.X_OFFSET+"px"}else{j.top=f+this.Y_OFFSET+"px";j.left=b+this.X_OFFSET+"px"}var h=$(c);if(h.hasClass(this.CLASS_SORTABLE_ITEM)){var d=h.parents("."+this.CLASS_SORTABLE_ITEM);if(d.length){h=d;c=d.get(0)}if(this.IsMouseOnLeft(c,b)){c.style.paddingLeft="10px";c.style.paddingRight="0px";h.children(".privacyLevel").css("right","1px");var k=h.prev();k.css("padding-left","0px");k.css("padding-right","10px");k.children(".privacyLevel").css("right","11px")}else{c.style.paddingLeft="0px";c.style.paddingRight="10px";h.children(".optionsText, .privacyLevel").css("right","11px");var l=h.next();l.css("padding-left","10px");l.css("padding-right","0px");l.children(".privacyLevel").css("right","1px")}var a=this;c.onmouseout=function(){c.style.paddingLeft="5px";c.style.paddingRight="5px";h.children(".optionsText, .privacyLevel").css("right","6px");var e=h.next();e.css("padding-left","5px");e.css("padding-right","5px");e.children(".privacyLevel").css("right","6px");var m=h.prev();if(m.length&&m.get(0).className==a.CLASS_SORTABLE_ITEM){m.css("padding-left","5px");m.css("padding-right","5px");m.children(".privacyLevel").css("right","6px")}}}},StopThumbnailDrag:function(h){h=h||window.event;var f=h.target||h.srcElement;var g=$(f);if(!this.domDragItem){return}if(this.domDragItem){$(this.domDragItem).remove();this.domDragItem=null}this.items=$(this.domContainer).children();this.items.css({paddingLeft:"5px",paddingRight:"5px",opacity:""});$(".privacyLevel").css("right","6px");if(!g.hasClass(this.CLASS_SORTABLE_ITEM)||f.imageId==this.domOriginalItem.imageId){return}var c=g.parents("."+this.CLASS_SORTABLE_ITEM);if(c.length){g=c;f=c.get(0)}var b=this.items.index(this.domOriginalItem);var d;var j=this.aImageIds[b];this.aImageIds.splice(b,1);var a=(h.pageX||h.clientX);if(this.IsMouseOnLeft(f,a)){g.before(this.domOriginalItem);d=this.items.index(f);if(d>b){d--}}else{g.after(this.domOriginalItem);d=this.items.index(f);if(d<b){d++}}this.aImageIds.splice(d,0,j)},QueueFile:function(a){var b=document.createElement("a");b.id="file"+a.id;b.href="#";b.className="imageFile";b.innerHTML=a.name;this.domBatchList.appendChild(b)},StartUpload:function(a){this.uploading=true;return true},UpdateProgress:function(e,g){var h=g/e.size;var a=document.getElementById("jsStatusPara");if(!a){a=document.createElement("p");a.id="jsStatusPara";$("#uploadDiv").before(a)}$("#uploadDiv p").css("display","none");a.innerHTML=aLangs.uploading+": "+e.name;if(h==1){var d=document.createElement("img");d.id="loadingImgEdit";d.className="loadingEdit";d.src="Images/system/transparent.gif";this.domContainer.appendChild(d)}var c=document.getElementById("progressDiv");var j=document.getElementById("progressBar");var f=document.getElementById("closeAnchor");if(!c){c=document.createElement("div");c.id="progressDiv";j=document.createElement("div");j.id="progressBar";f=document.createElement("a");f.id="closeAnchor";f.href="#";var b=this;f.onclick=function(n){n=n||window.event;var m=n.target||n.srcElement;if(m.tagName.toLowerCase()!="a"){return}b.swfu.stopUpload();b.swfu.cancelUpload();b.uploading=false;b.domBrowseBtn.style.display="inline";b.domUploadBtn.style.display="inline";var l=document.getElementById("editThumbnailsDiv");var k=document.getElementById("loadingImgEdit");if(k){l.removeChild(k)}return false};$("#editThumbnailsDiv span.error").css("display","none");a.appendChild(f);c.appendChild(j);a.appendChild(c)}this.domBrowseBtn.style.display="none";this.domUploadBtn.style.display="none";j.style.width=Math.floor(h*c.offsetWidth)+"px";location.hash="#"+Math.floor(h*c.offsetWidth)+"px"},SaveServerData:function(a,b){if(b!=null&&b.match(/NOT OK/)){this.HandleError(a,-250)}return},CompleteUpload:function(e){this.GetImageList();var f=document.getElementById("file"+e.id);$(f).remove();var a=document.getElementById("jsStatusPara");if(document.getElementById("progressDiv")){a.removeChild(document.getElementById("progressDiv"))}if(this.swfu.getStats().files_queued>0&&this.uploading){this.swfu.startUpload()}else{this.uploading=false;$(a).remove();this.domBrowseBtn.style.display="inline";this.domUploadBtn.style.display="inline";$("#uploadDiv p").css("display","block");if(this.aErrors.length>20){alert(aLangs.errorLots)}else{if(this.aErrors.length>0){var d=aLangs.errorSome+":\r\n";for(var c=0,b;b=this.aErrors[c];c++){d+=b+"\r\n"}alert(d)}}this.aErrors=new Array()}},DeleteImage:function(){var b=document.getElementById("notifyArea");b.innerHTML="";if(confirm(aLangs.delConfirm)){var a=document.getElementById("jsImageDetailsDiv");var f=document.getElementById("coverDiv");var d=a.imageId;var c=0,d;while(d!=this.aImageIds[c]){c++}this.aImageIds.splice(c,1);var e=this;if(this.albumId==null){jQuery.post(galleryLocation+"?UploadHelperXML&image="+d,{"delete":"true","image-ids[]":this.aImageIds},function(g){e.UpdateThumbnails(g)})}else{jQuery.post(galleryLocation+"?UploadHelperXML&album="+this.albumId+"&image="+d,{"delete":"true","image-ids[]":this.aImageIds},function(g){e.UpdateThumbnails(g)})}}},SubmitDetails:function(e,c){var e=e;var c=c;var d=document.getElementById("jsImageDetailsDiv");var j=document.getElementById("coverDiv");var k=document.getElementById("captionInput").value;var a=document.getElementById("isCoverInput");var f,h;var l=document.getElementById("tagsInput").value;var c=d.imageId;if(document.getElementById("imagePermPublic").checked){f="public"}else{if(document.getElementById("imagePermPrivate").checked){f="private"}else{if(document.getElementById("imagePermHidden").checked){f="hidden"}}}if(a.checked){h="true"}else{h="false"}var b=this;if(this.albumId==null){jQuery.post(galleryLocation+"?UploadHelperXML&image="+c,{caption:k,privacy:f,isCover:h,tags:l,"image-ids[]":this.aImageIds},function(m){b.UpdateThumbnails(m);if(e!=="update"){b.ShowNextImage(e,c)}})}else{jQuery.post(galleryLocation+"?UploadHelperXML&album="+this.albumId+"&image="+c,{caption:k,privacy:f,isCover:h,tags:l,"image-ids[]":this.aImageIds},function(m){b.UpdateThumbnails(m);if(e!=="update"){b.ShowNextImage(e,c)}})}if(e=="update"){var g=document.getElementById("activityImg");g.style.display="none"}},Rotate:function(c){var a=document.getElementById("jsImageDetailsDiv");var b=this;if(this.albumId==null){jQuery.post(galleryLocation+"?UploadHelperXML&image="+a.imageId,{rotate:c,"image-ids[]":this.aImageIds},function(d){b.RefreshDetailImage(d,a.imageId);b.UpdateThumbnails(d)})}else{jQuery.post(galleryLocation+"?UploadHelperXML&album="+this.albumId+"&image="+a.imageId,{rotate:c,"image-ids[]":this.aImageIds},function(d){b.RefreshDetailImage(d,a.imageId);b.UpdateThumbnails(d)})}},RefreshDetailImage:function(e,c){var f=document.getElementById("detailImage");var h=$("error",e);if(h.length>0){h=h.get(0);var j=$("error-id",h).text();var a=$("error-image-id",h).text();if(a==c){var b=document.getElementById("errorSpan");if(b){b.innerHTML=""}else{b=document.createElement("span");b.id="errorSpan";b.className="error";f.parentNode.insertBefore(b,f)}if(j=="INVALID_IMAGE_ROTATE"){b.innerHTML=aLangs.errorRotate}}}var g=$("image[selected]",e);if(!g.length){return null}var d=$("square",g).text();f.src=d},HandleError:function(b,c,a){if(c==-280||c==-290){return}this.aErrors.push(b.name)},IsMouseOnLeft:function(c,a){var d=$(c);var b=d.offset().left;var e=d.width();if(a<=b+e/2){return true}else{return false}},toString:function(){return"[Object ImageUpload]"}};function resize_sidepanel(){if(document.all&&document.noResize){return}var d=document.getElementById("albumInfoDiv");var c=document.getElementById("editAlbumDiv");var b=parseInt($(d).css("padding-top"))+parseInt($(d).css("padding-bottom"));var a=parseInt($(c).css("border-top-width"))+parseInt($(c).css("border-bottom-width"));if(typeof d.style.maxHeight!="undefined"){d.style.minHeight=c.offsetHeight-b-a+"px"}else{d.style.height=c.offsetHeight-b-a+"px"}}function resize_container(){if(document.all&&document.noResize){return}var a=document.getElementById("containerDiv");if(a){if(typeof a.style.maxHeight!="undefined"){a.style.minHeight=$(window).height()-67+"px"}else{a.style.height=(document.innerHeight||document.documentElement.clientHeight)-67+"px";if(a.offsetWidth<950){a.style.width="950px"}else{a.style.width="auto"}}document.noResize=true;setTimeout(function(){document.noResize=false},50)}}var swfu;var uploading=false;var batchListDiv;var aErrors=new Array();function FlashUpload(a){$(".swfFallback").addClass("swfUploadUI");swfu=new SWFUpload({upload_url:"../"+galleryLocation+"?UploadImage"+a,flash_url:"swf/swfupload_f9.swf",file_size_limit:8388608,file_types:"*.jpg;*.jpeg;*.png;*.gif",file_types_description:"Image files",swfupload_element_id:"swfUploadUI",degraded_element_id:"swfFallback",swfupload_loaded_handler:GetImageList,file_queued_handler:QueueFile,upload_start_handler:StartUpload,upload_progress_handler:UpdateProgress,upload_success_handler:SaveServerData,upload_complete_handler:CompleteUpload,upload_error_handler:HandleError,debug:false});swfu.customSettings.notLoaded=true;setTimeout(function(){if(swfu.customSettings.notLoaded){$(".swfFallback").removeClass("swfUploadUI")}},1000);batchListDiv=$("#batchListDiv");batchListDiv.click(function(f){f=f||event;var d=f.target||f.srcElement;if(d.tagName.toLowerCase()!="a"){return}var b=d.id;var c=document.getElementById(b);swfu.cancelUpload(b.substring(4));$(c).remove();return false});document.getElementById("browseBtn").onclick=function(){swfu.selectFiles();return false};document.getElementById("batchSubmitBtn").onclick=function(){swfu.startUpload();return false}}function QueueFile(a){var b=document.createElement("a");b.id="file"+a.id;b.href="#";b.className="imageFile";b.innerHTML=a.name;batchListDiv.append(b);ResizeSidePanel()}function StartUpload(a){uploading=true;return true}function UpdateProgress(d,f){var g=f/d.size;var a=document.getElementById("jsStatusPara");if(!a){a=document.createElement("p");a.id="jsStatusPara";$("#uploadDiv").before(a)}$("#uploadDiv p").css("display","none");a.innerHTML=aLangs.uploading+": "+d.name;if(g==1){var h=document.getElementById("editThumbnailsDiv");var c=document.createElement("img");c.id="loadingImgEdit";c.className="loadingEdit";c.src="Images/system/transparent.gif";h.appendChild(c);ResizeSidePanel()}var b=document.getElementById("progressDiv");var j=document.getElementById("progressBar");var e=document.getElementById("closeAnchor");if(!b){b=document.createElement("div");b.id="progressDiv";j=document.createElement("div");j.id="progressBar";e=document.createElement("a");e.id="closeAnchor";e.href="#";e.onclick=function(n){n=n||window.event;var m=n.target||n.srcElement;if(m.tagName.toLowerCase()!="a"){return}swfu.stopUpload();swfu.cancelUpload();uploading=false;document.getElementById("browseBtn").style.display="inline";document.getElementById("batchSubmitBtn").style.display="inline";var l=document.getElementById("editThumbnailsDiv");var k=document.getElementById("loadingImgEdit");if(k){l.removeChild(k)}return false};$("#editThumbnailsDiv span.error").css("display","none");a.appendChild(e);b.appendChild(j);a.appendChild(b)}document.getElementById("browseBtn").style.display="none";document.getElementById("batchSubmitBtn").style.display="none";j.style.width=Math.floor(g*b.offsetWidth)+"px";location.hash="#"+Math.floor(g*b.offsetWidth)+"px"}function SaveServerData(a,b){if(b!=null&&b.match(/NOT OK/)){HandleError(a,-250)}return}function CompleteUpload(e){GetImageList();var f=document.getElementById("file"+e.id);$(f).remove();var a=document.getElementById("jsStatusPara");if(document.getElementById("progressDiv")){a.removeChild(document.getElementById("progressDiv"))}if(swfu.getStats().files_queued>0&&uploading){swfu.startUpload()}else{uploading=false;$(a).remove();document.getElementById("browseBtn").style.display="inline";document.getElementById("batchSubmitBtn").style.display="inline";$("#uploadDiv p").css("display","block");if(aErrors.length>20){alert(aLangs.errorLots)}else{if(aErrors.length>0){var d=aLangs.errorSome+":\r\n";for(var c=0,b;b=aErrors[c];c++){d+=aLangs.errorSome+"\r\n"}alert(d)}}aErrors=new Array()}ResizeSidePanel()}function HandleError(b,c,a){if(c==-280||c==-290){return}aErrors.push(b.name)}var SWFUpload;if(SWFUpload==undefined){SWFUpload=function(a){this.initSWFUpload(a)}}SWFUpload.prototype.initSWFUpload=function(b){try{this.customSettings={};this.settings=b;this.eventQueue=[];this.movieName="SWFUpload_"+SWFUpload.movieCount++;this.movieElement=null;SWFUpload.instances[this.movieName]=this;this.initSettings();this.loadFlash();this.displayDebugInfo()}catch(a){delete SWFUpload.instances[this.movieName];throw a}};SWFUpload.instances={};SWFUpload.movieCount=0;SWFUpload.version="2.2.0 Beta 3";SWFUpload.QUEUE_ERROR={QUEUE_LIMIT_EXCEEDED:-100,FILE_EXCEEDS_SIZE_LIMIT:-110,ZERO_BYTE_FILE:-120,INVALID_FILETYPE:-130};SWFUpload.UPLOAD_ERROR={HTTP_ERROR:-200,MISSING_UPLOAD_URL:-210,IO_ERROR:-220,SECURITY_ERROR:-230,UPLOAD_LIMIT_EXCEEDED:-240,UPLOAD_FAILED:-250,SPECIFIED_FILE_ID_NOT_FOUND:-260,FILE_VALIDATION_FAILED:-270,FILE_CANCELLED:-280,UPLOAD_STOPPED:-290};SWFUpload.FILE_STATUS={QUEUED:-1,IN_PROGRESS:-2,ERROR:-3,COMPLETE:-4,CANCELLED:-5};SWFUpload.BUTTON_ACTION={SELECT_FILE:-100,SELECT_FILES:-110,START_UPLOAD:-120};SWFUpload.CURSOR={ARROW:-1,HAND:-2};SWFUpload.WINDOW_MODE={WINDOW:"window",TRANSPARENT:"transparent",OPAQUE:"opaque"};SWFUpload.prototype.initSettings=function(){this.ensureDefault=function(b,a){this.settings[b]=(this.settings[b]==undefined)?a:this.settings[b]};this.ensureDefault("upload_url","");this.ensureDefault("file_post_name","Filedata");this.ensureDefault("post_params",{});this.ensureDefault("use_query_string",false);this.ensureDefault("requeue_on_error",false);this.ensureDefault("http_success",[]);this.ensureDefault("file_types","*.*");this.ensureDefault("file_types_description","All Files");this.ensureDefault("file_size_limit",0);this.ensureDefault("file_upload_limit",0);this.ensureDefault("file_queue_limit",0);this.ensureDefault("flash_url","swfupload.swf");this.ensureDefault("prevent_swf_caching",true);this.ensureDefault("button_image_url","");this.ensureDefault("button_width",1);this.ensureDefault("button_height",1);this.ensureDefault("button_text","");this.ensureDefault("button_text_style","color: #000000; font-size: 16pt;");this.ensureDefault("button_text_top_padding",0);this.ensureDefault("button_text_left_padding",0);this.ensureDefault("button_action",SWFUpload.BUTTON_ACTION.SELECT_FILES);this.ensureDefault("button_disabled",false);this.ensureDefault("button_placeholder_id","");this.ensureDefault("button_cursor",SWFUpload.CURSOR.ARROW);this.ensureDefault("button_window_mode",SWFUpload.WINDOW_MODE.WINDOW);this.ensureDefault("debug",false);this.settings.debug_enabled=this.settings.debug;this.settings.return_upload_start_handler=this.returnUploadStart;this.ensureDefault("swfupload_loaded_handler",null);this.ensureDefault("file_dialog_start_handler",null);this.ensureDefault("file_queued_handler",null);this.ensureDefault("file_queue_error_handler",null);this.ensureDefault("file_dialog_complete_handler",null);this.ensureDefault("upload_start_handler",null);this.ensureDefault("upload_progress_handler",null);this.ensureDefault("upload_error_handler",null);this.ensureDefault("upload_success_handler",null);this.ensureDefault("upload_complete_handler",null);this.ensureDefault("debug_handler",this.debugMessage);this.ensureDefault("custom_settings",{});this.customSettings=this.settings.custom_settings;if(this.settings.prevent_swf_caching){this.settings.flash_url=this.settings.flash_url}delete this.ensureDefault};SWFUpload.prototype.loadFlash=function(){if(this.settings.button_placeholder_id!==""){this.replaceWithFlash()}else{this.appendFlash()}};SWFUpload.prototype.appendFlash=function(){var b,a;if(document.getElementById(this.movieName)!==null){throw"ID "+this.movieName+" is already in use. The Flash Object could not be added"}b=document.getElementsByTagName("body")[0];if(b==undefined){throw"Could not find the 'body' element."}a=document.createElement("div");a.style.width="1px";a.style.height="1px";a.style.overflow="hidden";b.appendChild(a);a.innerHTML=this.getFlashHTML();if(window[this.movieName]==undefined){window[this.movieName]=this.getMovieElement()}};SWFUpload.prototype.replaceWithFlash=function(){var a,b;if(document.getElementById(this.movieName)!==null){throw"ID "+this.movieName+" is already in use. The Flash Object could not be added"}a=document.getElementById(this.settings.button_placeholder_id);if(a==undefined){throw"Could not find the placeholder element: "+this.settings.button_placeholder_id}b=document.createElement("div");b.innerHTML=this.getFlashHTML();a.parentNode.insertBefore(b.firstChild,a);if(window[this.movieName]==undefined){window[this.movieName]=this.getMovieElement()}};SWFUpload.prototype.getFlashHTML=function(){return['<object id="',this.movieName,'" type="application/x-shockwave-flash" data="',this.settings.flash_url,'" width="',this.settings.button_width,'" height="',this.settings.button_height,'" class="swfupload">','<param name="wmode" value="',this.settings.button_window_mode,'" />','<param name="movie" value="',this.settings.flash_url,'" />','<param name="quality" value="high" />','<param name="menu" value="false" />','<param name="allowScriptAccess" value="always" />','<param name="flashvars" value="'+this.getFlashVars()+'" />',"</object>"].join("")};SWFUpload.prototype.getFlashVars=function(){var b=this.buildParamString();var a=this.settings.http_success.join(",");return["movieName=",encodeURIComponent(this.movieName),"&amp;uploadURL=",encodeURIComponent(this.settings.upload_url),"&amp;useQueryString=",encodeURIComponent(this.settings.use_query_string),"&amp;requeueOnError=",encodeURIComponent(this.settings.requeue_on_error),"&amp;httpSuccess=",encodeURIComponent(a),"&amp;params=",encodeURIComponent(b),"&amp;filePostName=",encodeURIComponent(this.settings.file_post_name),"&amp;fileTypes=",encodeURIComponent(this.settings.file_types),"&amp;fileTypesDescription=",encodeURIComponent(this.settings.file_types_description),"&amp;fileSizeLimit=",encodeURIComponent(this.settings.file_size_limit),"&amp;fileUploadLimit=",encodeURIComponent(this.settings.file_upload_limit),"&amp;fileQueueLimit=",encodeURIComponent(this.settings.file_queue_limit),"&amp;debugEnabled=",encodeURIComponent(this.settings.debug_enabled),"&amp;buttonImageURL=",encodeURIComponent(this.settings.button_image_url),"&amp;buttonWidth=",encodeURIComponent(this.settings.button_width),"&amp;buttonHeight=",encodeURIComponent(this.settings.button_height),"&amp;buttonText=",encodeURIComponent(this.settings.button_text),"&amp;buttonTextTopPadding=",encodeURIComponent(this.settings.button_text_top_padding),"&amp;buttonTextLeftPadding=",encodeURIComponent(this.settings.button_text_left_padding),"&amp;buttonTextStyle=",encodeURIComponent(this.settings.button_text_style),"&amp;buttonAction=",encodeURIComponent(this.settings.button_action),"&amp;buttonDisabled=",encodeURIComponent(this.settings.button_disabled),"&amp;buttonCursor=",encodeURIComponent(this.settings.button_cursor)].join("")};SWFUpload.prototype.getMovieElement=function(){if(this.movieElement==undefined){this.movieElement=document.getElementById(this.movieName)}if(this.movieElement===null){throw"Could not find Flash element"}return this.movieElement};SWFUpload.prototype.buildParamString=function(){var c=this.settings.post_params;var b=[];if(typeof(c)==="object"){for(var a in c){if(c.hasOwnProperty(a)){b.push(encodeURIComponent(a.toString())+"="+encodeURIComponent(c[a].toString()))}}}return b.join("&amp;")};SWFUpload.prototype.destroy=function(){try{this.cancelUpload(null,false);var a=null;a=this.getMovieElement();if(a&&typeof(a.CallFunction)==="unknown"){for(var c in a){try{if(typeof(a[c])==="function"){a[c]=null}}catch(e){}}try{a.parentNode.removeChild(a)}catch(b){}}window[this.movieName]=null;SWFUpload.instances[this.movieName]=null;delete SWFUpload.instances[this.movieName];this.movieElement=null;this.settings=null;this.customSettings=null;this.eventQueue=null;this.movieName=null;return true}catch(d){return false}};SWFUpload.prototype.displayDebugInfo=function(){this.debug(["---SWFUpload Instance Info---\n","Version: ",SWFUpload.version,"\n","Movie Name: ",this.movieName,"\n","Settings:\n","\t","upload_url:               ",this.settings.upload_url,"\n","\t","flash_url:                ",this.settings.flash_url,"\n","\t","use_query_string:         ",this.settings.use_query_string.toString(),"\n","\t","requeue_on_error:         ",this.settings.requeue_on_error.toString(),"\n","\t","http_success:             ",this.settings.http_success.join(", "),"\n","\t","file_post_name:           ",this.settings.file_post_name,"\n","\t","post_params:              ",this.settings.post_params.toString(),"\n","\t","file_types:               ",this.settings.file_types,"\n","\t","file_types_description:   ",this.settings.file_types_description,"\n","\t","file_size_limit:          ",this.settings.file_size_limit,"\n","\t","file_upload_limit:        ",this.settings.file_upload_limit,"\n","\t","file_queue_limit:         ",this.settings.file_queue_limit,"\n","\t","debug:                    ",this.settings.debug.toString(),"\n","\t","prevent_swf_caching:      ",this.settings.prevent_swf_caching.toString(),"\n","\t","button_placeholder_id:    ",this.settings.button_placeholder_id.toString(),"\n","\t","button_image_url:         ",this.settings.button_image_url.toString(),"\n","\t","button_width:             ",this.settings.button_width.toString(),"\n","\t","button_height:            ",this.settings.button_height.toString(),"\n","\t","button_text:              ",this.settings.button_text.toString(),"\n","\t","button_text_style:        ",this.settings.button_text_style.toString(),"\n","\t","button_text_top_padding:  ",this.settings.button_text_top_padding.toString(),"\n","\t","button_text_left_padding: ",this.settings.button_text_left_padding.toString(),"\n","\t","button_action:            ",this.settings.button_action.toString(),"\n","\t","button_disabled:          ",this.settings.button_disabled.toString(),"\n","\t","custom_settings:          ",this.settings.custom_settings.toString(),"\n","Event Handlers:\n","\t","swfupload_loaded_handler assigned:  ",(typeof this.settings.swfupload_loaded_handler==="function").toString(),"\n","\t","file_dialog_start_handler assigned: ",(typeof this.settings.file_dialog_start_handler==="function").toString(),"\n","\t","file_queued_handler assigned:       ",(typeof this.settings.file_queued_handler==="function").toString(),"\n","\t","file_queue_error_handler assigned:  ",(typeof this.settings.file_queue_error_handler==="function").toString(),"\n","\t","upload_start_handler assigned:      ",(typeof this.settings.upload_start_handler==="function").toString(),"\n","\t","upload_progress_handler assigned:   ",(typeof this.settings.upload_progress_handler==="function").toString(),"\n","\t","upload_error_handler assigned:      ",(typeof this.settings.upload_error_handler==="function").toString(),"\n","\t","upload_success_handler assigned:    ",(typeof this.settings.upload_success_handler==="function").toString(),"\n","\t","upload_complete_handler assigned:   ",(typeof this.settings.upload_complete_handler==="function").toString(),"\n","\t","debug_handler assigned:             ",(typeof this.settings.debug_handler==="function").toString(),"\n"].join(""))};SWFUpload.prototype.addSetting=function(b,c,a){if(c==undefined){return(this.settings[b]=a)}else{return(this.settings[b]=c)}};SWFUpload.prototype.getSetting=function(a){if(this.settings[a]!=undefined){return this.settings[a]}return""};SWFUpload.prototype.callFlash=function(functionName,argumentArray){argumentArray=argumentArray||[];var movieElement=this.getMovieElement();var returnValue,returnString;try{returnString=movieElement.CallFunction('<invoke name="'+functionName+'" returntype="javascript">'+__flash__argumentsToXML(argumentArray,0)+"</invoke>");returnValue=eval(returnString)}catch(ex){throw"Call to "+functionName+" failed"}if(returnValue!=undefined&&typeof returnValue.post==="object"){returnValue=this.unescapeFilePostParams(returnValue)}return returnValue};SWFUpload.prototype.selectFile=function(){this.callFlash("SelectFile")};SWFUpload.prototype.selectFiles=function(){this.callFlash("SelectFiles")};SWFUpload.prototype.startUpload=function(a){this.callFlash("StartUpload",[a])};SWFUpload.prototype.cancelUpload=function(a,b){if(b!==false){b=true}this.callFlash("CancelUpload",[a,b])};SWFUpload.prototype.stopUpload=function(){this.callFlash("StopUpload")};SWFUpload.prototype.getStats=function(){return this.callFlash("GetStats")};SWFUpload.prototype.setStats=function(a){this.callFlash("SetStats",[a])};SWFUpload.prototype.getFile=function(a){if(typeof(a)==="number"){return this.callFlash("GetFileByIndex",[a])}else{return this.callFlash("GetFile",[a])}};SWFUpload.prototype.addFileParam=function(a,b,c){return this.callFlash("AddFileParam",[a,b,c])};SWFUpload.prototype.removeFileParam=function(a,b){this.callFlash("RemoveFileParam",[a,b])};SWFUpload.prototype.setUploadURL=function(a){this.settings.upload_url=a.toString();this.callFlash("SetUploadURL",[a])};SWFUpload.prototype.setPostParams=function(a){this.settings.post_params=a;this.callFlash("SetPostParams",[a])};SWFUpload.prototype.addPostParam=function(a,b){this.settings.post_params[a]=b;this.callFlash("SetPostParams",[this.settings.post_params])};SWFUpload.prototype.removePostParam=function(a){delete this.settings.post_params[a];this.callFlash("SetPostParams",[this.settings.post_params])};SWFUpload.prototype.setFileTypes=function(a,b){this.settings.file_types=a;this.settings.file_types_description=b;this.callFlash("SetFileTypes",[a,b])};SWFUpload.prototype.setFileSizeLimit=function(a){this.settings.file_size_limit=a;this.callFlash("SetFileSizeLimit",[a])};SWFUpload.prototype.setFileUploadLimit=function(a){this.settings.file_upload_limit=a;this.callFlash("SetFileUploadLimit",[a])};SWFUpload.prototype.setFileQueueLimit=function(a){this.settings.file_queue_limit=a;this.callFlash("SetFileQueueLimit",[a])};SWFUpload.prototype.setFilePostName=function(a){this.settings.file_post_name=a;this.callFlash("SetFilePostName",[a])};SWFUpload.prototype.setUseQueryString=function(a){this.settings.use_query_string=a;this.callFlash("SetUseQueryString",[a])};SWFUpload.prototype.setRequeueOnError=function(a){this.settings.requeue_on_error=a;this.callFlash("SetRequeueOnError",[a])};SWFUpload.prototype.setHTTPSuccess=function(a){if(typeof a==="string"){a=a.replace(" ","").split(",")}this.settings.http_success=a;this.callFlash("SetHTTPSuccess",[a])};SWFUpload.prototype.setDebugEnabled=function(a){this.settings.debug_enabled=a;this.callFlash("SetDebugEnabled",[a])};SWFUpload.prototype.setButtonImageURL=function(a){if(a==undefined){a=""}this.settings.button_image_url=a;this.callFlash("SetButtonImageURL",[a])};SWFUpload.prototype.setButtonDimensions=function(c,a){this.settings.button_width=c;this.settings.button_height=a;var b=this.getMovieElement();if(b!=undefined){b.style.width=c+"px";b.style.height=a+"px"}this.callFlash("SetButtonDimensions",[c,a])};SWFUpload.prototype.setButtonText=function(a){this.settings.button_text=a;this.callFlash("SetButtonText",[a])};SWFUpload.prototype.setButtonTextPadding=function(b,a){this.settings.button_text_top_padding=a;this.settings.button_text_left_padding=b;this.callFlash("SetButtonTextPadding",[b,a])};SWFUpload.prototype.setButtonTextStyle=function(a){this.settings.button_text_style=a;this.callFlash("SetButtonTextStyle",[a])};SWFUpload.prototype.setButtonDisabled=function(a){this.settings.button_disabled=a;this.callFlash("SetButtonDisabled",[a])};SWFUpload.prototype.setButtonAction=function(a){this.settings.button_action=a;this.callFlash("SetButtonAction",[a])};SWFUpload.prototype.setButtonCursor=function(a){this.settings.button_cursor=a;this.callFlash("SetButtonCursor",[a])};SWFUpload.prototype.queueEvent=function(b,c){if(c==undefined){c=[]}else{if(!(c instanceof Array)){c=[c]}}var a=this;if(typeof this.settings[b]==="function"){this.eventQueue.push(function(){this.settings[b].apply(this,c)});setTimeout(function(){a.executeNextEvent()},0)}else{if(this.settings[b]!==null){throw"Event handler "+b+" is unknown or is not a function"}}};SWFUpload.prototype.executeNextEvent=function(){var a=this.eventQueue?this.eventQueue.shift():null;if(typeof(a)==="function"){a.apply(this)}};SWFUpload.prototype.unescapeFilePostParams=function(c){var e=/[$]([0-9a-f]{4})/i;var f={};var d;if(c!=undefined){for(var a in c.post){if(c.post.hasOwnProperty(a)){d=a;var b;while((b=e.exec(d))!==null){d=d.replace(b[0],String.fromCharCode(parseInt("0x"+b[1],16)))}f[d]=c.post[a]}}c.post=f}return c};SWFUpload.prototype.testExternalInterface=function(){try{return this.callFlash("TestExternalInterface")}catch(a){return false}};SWFUpload.prototype.flashReady=function(){var a=this.getMovieElement();if(!a){this.debug("Flash called back ready but the flash movie can't be found.");return}this.cleanUp(a);this.queueEvent("swfupload_loaded_handler")};SWFUpload.prototype.cleanUp=function(a){try{if(this.movieElement&&typeof(a.CallFunction)==="unknown"){this.debug("Removing Flash functions hooks (this should only run in IE and should prevent memory leaks)");for(var c in a){try{if(typeof(a[c])==="function"){a[c]=null}}catch(b){}}}}catch(d){}};SWFUpload.prototype.fileDialogStart=function(){this.queueEvent("file_dialog_start_handler")};SWFUpload.prototype.fileQueued=function(a){a=this.unescapeFilePostParams(a);this.queueEvent("file_queued_handler",a)};SWFUpload.prototype.fileQueueError=function(a,c,b){a=this.unescapeFilePostParams(a);this.queueEvent("file_queue_error_handler",[a,c,b])};SWFUpload.prototype.fileDialogComplete=function(a,b){this.queueEvent("file_dialog_complete_handler",[a,b])};SWFUpload.prototype.uploadStart=function(a){a=this.unescapeFilePostParams(a);this.queueEvent("return_upload_start_handler",a)};SWFUpload.prototype.returnUploadStart=function(a){var b;if(typeof this.settings.upload_start_handler==="function"){a=this.unescapeFilePostParams(a);b=this.settings.upload_start_handler.call(this,a)}else{if(this.settings.upload_start_handler!=undefined){throw"upload_start_handler must be a function"}}if(b===undefined){b=true}b=!!b;this.callFlash("ReturnUploadStart",[b])};SWFUpload.prototype.uploadProgress=function(a,c,b){a=this.unescapeFilePostParams(a);this.queueEvent("upload_progress_handler",[a,c,b])};SWFUpload.prototype.uploadError=function(a,c,b){a=this.unescapeFilePostParams(a);this.queueEvent("upload_error_handler",[a,c,b])};SWFUpload.prototype.uploadSuccess=function(b,a){b=this.unescapeFilePostParams(b);this.queueEvent("upload_success_handler",[b,a])};SWFUpload.prototype.uploadComplete=function(a){a=this.unescapeFilePostParams(a);this.queueEvent("upload_complete_handler",a)};SWFUpload.prototype.debug=function(a){this.queueEvent("debug_handler",a)};SWFUpload.prototype.debugMessage=function(c){if(this.settings.debug){var a,d=[];if(typeof c==="object"&&typeof c.name==="string"&&typeof c.message==="string"){for(var b in c){if(c.hasOwnProperty(b)){d.push(b+": "+c[b])}}a=d.join("\n")||"";d=a.split("\n");a="EXCEPTION: "+d.join("\nEXCEPTION: ");SWFUpload.Console.writeLine(a)}else{SWFUpload.Console.writeLine(c)}}};SWFUpload.Console={};SWFUpload.Console.writeLine=function(d){var b,a;try{b=document.getElementById("SWFUpload_Console");if(!b){a=document.createElement("form");document.getElementsByTagName("body")[0].appendChild(a);b=document.createElement("textarea");b.id="SWFUpload_Console";b.style.fontFamily="monospace";b.setAttribute("wrap","off");b.wrap="off";b.style.overflow="auto";b.style.width="700px";b.style.height="350px";b.style.margin="5px";a.appendChild(b)}b.value+=d+"\n";b.scrollTop=b.scrollHeight-b.clientHeight}catch(c){alert("Exception: "+c.name+" Message: "+c.message)}};var SWFUpload;if(typeof(SWFUpload)==="function"){SWFUpload.gracefulDegradation={};SWFUpload.prototype.initSettings=(function(a){return function(){if(typeof(a)==="function"){a.call(this)}this.ensureDefault=function(c,b){this.settings[c]=(this.settings[c]==undefined)?b:this.settings[c]};this.ensureDefault("swfupload_element_id","swfupload_container");this.ensureDefault("degraded_element_id","degraded_container");this.settings.user_swfupload_loaded_handler=this.settings.swfupload_loaded_handler;this.settings.swfupload_loaded_handler=SWFUpload.gracefulDegradation.swfUploadLoadedHandler;delete this.ensureDefault}})(SWFUpload.prototype.initSettings);SWFUpload.gracefulDegradation.swfUploadLoadedHandler=function(){var d,b,c,a;this.customSettings.notLoaded=false;d=this.settings.swfupload_element_id;c=this.settings.degraded_element_id;b=$("."+d);if(b.length>0){b.removeClass(d);a=$("."+c);if(a.length>0){a.addClass(d)}}if(typeof(this.settings.user_swfupload_loaded_handler)==="function"){this.settings.user_swfupload_loaded_handler.apply(this)}}}function Organize(c){this.albumId=c.albumId;this.domAlbums=c.domAlbums;this.domAlbumSort=c.domAlbumSort;this.domAlbumOrder=c.domAlbumOrder;this.domFilter=c.domFilter;this.domNewAlbum=c.domNewAlbum;this.domDeleteImage=c.domDeleteImage;this.domTagImage=c.domTagImage;this.domImageSort=c.domImageSort;this.domImageOrder=c.domImageOrder;this.domThumbnailTitle=c.domThumbnailTitle;this.domThumbnails=c.domThumbnails;this.domHelpText=c.domHelpText;this.domForm=c.domForm;this.authFlash=c.authFlash;this.aLangs=c.aLangs;this.container=$(this.domThumbnails);this.items=this.container.children();this.items.wrap('<div class="'+this.CLASS_SORTABLE_ITEM+'"></div');this.items.addClass(this.CLASS_SORTABLE_ITEM);this.domNewAlbum.style.display="block";if(this.domDeleteImage){this.domDeleteImage.style.display="block"}if(this.domTagImage){this.domTagImage.style.display="block"}if(typeof this.domAlbums.style.maxHeight!="undefined"){this.domAlbums.style.maxHeight="180px"}else{this.domAlbums.style.height="180px"}this.domThumbnails.style.maxHeight="228px";this.isIE=jQuery.browser.msie;var b=this;this.domAlbumSort.onchange=function(){var e=new Object;e.orderAlbum=b.orderAlbum;e.sortImage=b.sortImage;e.orderImage=b.orderImage;if(b.filterAlbum!=null){e.filterAlbum=b.filterAlbum}switch(this.value){case"name":e.sortAlbum="name";break;case"count":e.sortAlbum="images";break;case"date":case"default":e.sortAlbum="date";break}jQuery.get(galleryLocation+"?OrganizeXML",e,function(f){b.UpdateAlbums(f)})};this.domAlbumOrder.onclick=function(f){b.orderAlbum=!b.orderAlbum;if(this.className=="descending"){this.className="ascending";this.title=b.aLangs.langAscending}else{this.className="descending";this.title=b.aLangs.langDescending}var g=new Object;g.orderAlbum=b.orderAlbum;g.sortAlbum=b.sortAlbum;if(b.filterAlbum!=null){g.filterAlbum=b.filterAlbum}jQuery.get(galleryLocation+"?OrganizeXML",g,function(e){b.UpdateAlbums(e)})};if(this.domFilter){this.domFilter.onclick=function(j){j=j||window.event;var g=j.target||j.srcElement;if(g.tagName.toLowerCase()!="a"){return}g.blur();var h=$("div."+b.CLASS_ALBUM_INFO);if(h.length>0&&h.queue().length>0){return false}var f=g.id;if(f=="jsPublicOption"||f=="jsPrivateOption"||f=="jsHiddenOption"){if(document.getElementById("jsPublicOption")){document.getElementById("jsPublicOption").className=""}if(document.getElementById("jsPrivateOption")){document.getElementById("jsPrivateOption").className=""}if(document.getElementById("jsHiddenOption")){document.getElementById("jsHiddenOption").className=""}}var k=new Object;k.orderAlbum=b.orderAlbum;if(b.sortAlbum!=null){k.sortAlbum=b.sortAlbum}switch(f){case"jsPublicOption":if(b.filterAlbum!="public"){b.filterAlbum="public";k.filterAlbum="public";g.className="selected"}break;case"jsPrivateOption":if(b.filterAlbum!="private"){b.filterAlbum="private";k.filterAlbum="private";g.className="selected"}break;case"jsHiddenOption":if(b.filterAlbum!="hidden"){b.filterAlbum="private";k.filterAlbum="hidden";g.className="selected"}break;default:break}jQuery.get(galleryLocation+"?OrganizeXML",k,function(e){b.UpdateAlbums(e)});return false}}this.domImageSort.onchange=function(){var e=new Object;e.album=b.albumId;e.sortAlbum=b.sortAlbum;e.orderAlbum=b.orderAlbum;e.orderImage=b.orderImage;if(b.filterAlbum!=null){e.filterAlbum=b.filterAlbum}switch(this.value){case"taken":e.sortImage="taken";break;case"filename":e.sortImage="filename";break;case"actual":case"default":e.sortImage="actual";break}jQuery.get(galleryLocation+"?OrganizeXML",e,function(f){b.UpdateImages(f)})};this.domImageOrder.onclick=function(g){g=g||window.event;var f=g.target||g.srcElement;if(f.id!="imageOrderImg"){return}b.orderImage=!b.orderImage;if(this.className=="descending"){this.className="ascending";this.title=b.aLangs.langAscending}else{this.className="descending";this.title=b.aLangs.langDescending}var h=new Object;h.album=b.albumId;h.sortAlbum=b.sortAlbum;h.orderAlbum=b.orderAlbum;h.sortImage=b.sortImage;h.orderImage=b.orderImage;if(b.filterAlbum!=null){h.filterAlbum=b.filterAlbum}jQuery.get(galleryLocation+"?OrganizeXML",h,function(e){b.UpdateImages(e)})};this.domThumbnails.onclick=function(f){b.Select(f)};this.domThumbnails.ondragstart=function(){return false};this.domThumbnails.onmousedown=function(f){b.StartDrag(f)};document.onmousemove=function(f){b.ContinueDrag(f)};document.onmouseup=function(f){b.StopDrag(f)};var d=$("div.popup img");d.click(function(){var e=$(this).parents("div").get(0);b.RemovePopupForm(e)});var a=$("#tagListDiv");$("#tagsInput").keyup(function(){var m=this.value;var l=m.split(",");var k=jQuery.trim(l[l.length-1]);a.empty();if(k===""){return}var h=b.aTags.length;var j=0;for(var g=0;g<h;g++){var e=b.aTags[g];var f=e.slice(0,k.length);if(f>k||j>=5){break}else{if(f==k){a.append('<a href="#">'+e+"</a>");j++}}}});a.click(function(l){l=l||window.event;var k=l.target||l.srcElement;if(k.tagName.toLowerCase()!="a"){return false}var f=k.innerHTML;var h=document.getElementById("tagsInput");var m=h.value;var j=m.split(",");j[j.length-1]=f;for(var g=0,f;f=j[g];g++){j[g]=jQuery.trim(f)}h.value=j.join(", ");return false});this.domForm.onsubmit=function(){for(var h=0,g;g=b.aImageIds[h];h++){var e=document.createElement("input");e.type="hidden";e.name="aImageIdsSource[]";e.value=g;b.domForm.appendChild(e)}if(b.aImageIds.length>0){var j=document.createElement("input");j.type="hidden";j.name="album";j.value=b.albumId;b.domForm.appendChild(j)}var f=document.createElement("input");f.type="hidden";f.name="albumVersion";f.value=b.albumVersion;b.domForm.appendChild(f);return true};var c=new Object;c.sortAlbum=this.sortAlbum;c.orderAlbum=this.orderAlbum;jQuery.get(galleryLocation+"?OrganizeXML&album="+this.albumId,c,function(f){b.UpdateAlbums(f);b.UpdateImages(f);var e=$('album[selected="true"] name',f).text();b.domThumbnailTitle.innerHTML=b.aLangs.langPhotos+" - "+e})}Organize.prototype={SRC_UNAVAILABLE_IMG:"Images/system/private_image.gif",CLASS_ALBUM_INFO:"albumInfo",CLASS_SORTABLE_ITEM:"editThumbnail",CLASS_DROPPABLE_ITEM:"coverImage",CLASS_SELECTED_ITEM:"selected",X_OFFSET:5,Y_OFFSET:5,WIDTH_ALBUM_INFO:141,ID_NEW_ALBUM_POPUP:"jsNewAlbumPopupDiv",ID_TAGS_POPUP:"jsTagPopupDiv",ROTATE_CW:"cw",ROTATE_CCW:"ccw",MAX_EFFECTS_SELECTED_IMAGES:20,animation:{width:0,marginLeft:0,marginRight:0,borderLeft:0,borderRight:0},albumId:null,aImageIds:new Array(),aErrors:new Array(),aTags:new Array(),domThumbnails:null,domHelpText:null,domLoadIcon:null,domBrowseBtn:null,domUploadBtn:null,domBatchList:null,isIE:false,indexLastSelected:0,sortAlbum:"date",filterAlbum:null,orderAlbum:false,sortImage:"actual",orderImage:false,isBrowserIE6:(jQuery.browser.msie&&jQuery.browser.version<7),Cleanup:function(){$("*").unbind();for(var a in this){this[a]=null}},UpdateAlbums:function(f){var c=$("div."+this.CLASS_ALBUM_INFO);var a=$(this.domAlbums);var d=$("albums",f);this.sortAlbum=d.attr("sort");this.filterAlbum=d.attr("filter");var k=d.attr("order");if(k=="false"){this.orderAlbum=false}else{this.orderAlbum=true}var b=this;if(jQuery.browser.msie&&jQuery.browser.version<7){c.remove();d=$("album",f);d.each(function(){var t=$(this);var p=$("id",this).text();var n=document.createElement("div");g="album"+p;n.id=g;if(p==b.albumId){n.className="albumInfo selected"}else{n.className="albumInfo"}var r=document.createElement("h2");var m=document.createElement("a");m.href=galleryLocation+"?Organize&album="+p;m.innerHTML=$("name",this).text();r.appendChild(m);n.appendChild(r);var q=document.createElement("a");q.href=m.href;var o=document.createElement("img");o.className="coverImage thumbnail";o.src=$("coverImage",this).text();o.title="";q.appendChild(o);n.appendChild(q);var u=document.createElement("p");u.innerHTML=$("createdTime",this).text();u.innerHTML+="<br/>";u.innerHTML+=$("privacy",this).text();u.innerHTML+=' - <span class="imageCount">'+$("imageCount",this).text()+"</span>";u.innerHTML+="<br/>";u.innerHTML+='<a class="albumInfoEdit" href="'+galleryLocation+"?EditAlbum&album="+p+'">'+b.aLangs.langEdit+"</a>";u.innerHTML+='<a class="albumInfoDelete" href="'+galleryLocation+"?DeleteAlbum&album="+p+'">'+b.aLangs.langDelete+"</a>";u.innerHTML+="<br/>";n.appendChild(u);a.append(n)});$("div."+b.CLASS_ALBUM_INFO).click(function(m){return b.SelectAlbum(m,this)});return}var l=a.height();if(l){a.height(l)}var h=a.offset();c.each(function(){var n=$(this);var m=n.offset();n.css("top",m.top-h.top);n.css("left",m.left-h.left)});c.css("position","absolute");c.addClass("deleting");c.animate({top:"0px",left:"0px",opacity:"0.0"},500,null,function(){$(this).remove()});var g;var j=$("#newAlbumDiv");d=$("album",f);d.each(function(){var u=$(this);var t=$("id",this).text();var n=document.createElement("div");g="album"+t;n.id=g;if(t==b.albumId){n.className="albumInfo selected"}else{n.className="albumInfo"}n.style.visibility="hidden";var p=document.createElement("h2");var q=document.createElement("a");q.href=galleryLocation+"?Organize&album="+t;q.innerHTML=$("name",this).text();p.appendChild(q);n.appendChild(p);var r=document.createElement("a");r.href=q.href;var v=document.createElement("img");v.className="coverImage thumbnail";v.src=$("coverImage",this).text();v.title="";r.appendChild(v);n.appendChild(r);var m=document.createElement("p");m.innerHTML=$("createdTime",this).text();m.innerHTML+="<br/>";m.innerHTML+=$("privacy",this).text();m.innerHTML+=' - <span class="imageCount">'+$("imageCount",this).text()+"</span>";m.innerHTML+="<br/>";m.innerHTML+='<a class="albumInfoEdit" href="'+galleryLocation+"?EditAlbum&album="+t+'">'+b.aLangs.langEdit+"</a>";m.innerHTML+='<a class="albumInfoDelete" href="'+galleryLocation+"?DeleteAlbum&album="+t+'">'+b.aLangs.langDelete+"</a>";m.innerHTML+="<br/>";n.appendChild(m);a.append(n);var o=$(n).offset();n.topTrue=o.top-h.top+"px";n.leftTrue=o.left-h.left+"px"});b.domAlbums.scrollTop=0;if(c.length==0){var c=a}var e=false;c.queue(function(){if(e){return}var m=$("div."+b.CLASS_ALBUM_INFO+":not(.deleting)");m.css({position:"absolute",display:"block",visibility:"visible",opacity:"0.0"});m.each(function(){$(this).animate({top:this.topTrue,left:this.leftTrue,opacity:"1.0"},500,null,function(){if(this.id==g){m.css({position:"relative",top:"0px",left:"0px"})}})});m.click(function(n){return b.SelectAlbum(n,this)});e=true;$(this).dequeue})},UpdateImages:function(g){var m=$('album[selected="true"] version',g).text();if(m!=""){this.albumVersion=parseInt(m)}var n=$("images",g);this.sortImage=n.attr("sort");var o=n.attr("order");if(o=="false"){this.orderImage=false}else{this.orderImage=true}n=$("image",g);var l=n.length;var k=0;if(l<1){this.domThumbnails.innerHTML='<span class="error">'+this.aLangs.langNoImages+".</span>";this.domHelpText.style.display="none";this.UpdateAlbums(g);this.aImageIds=new Array();return}this.domThumbnails.scrollTop=0;this.aImageIds=new Array();var b=$(this.domThumbnails).height();this.domThumbnails.style.height=b+"px";this.domThumbnails.innerHTML="";for(var h=0,e;e=n[h];h++){var d=$("id",e).text();var c=$("square",e).text();if(!d){continue}var a=document.createElement("img");var f=document.createElement("div");f.imageId=d;f.className=this.CLASS_SORTABLE_ITEM;this.aImageIds[h]=d;a.imageId=d;a.alt="Image "+d;a.title="";a.index=h;a.style.display="none";a.onload=function(){$(this).fadeIn("normal")};if(c){a.src=c}else{a.src=SRC_UNAVAILABLE_IMG}a.className=this.CLASS_SORTABLE_ITEM;if(h==(l-1)){a.className+=" last"}f.appendChild(a);this.domThumbnails.appendChild(f)}if(l>0){this.domHelpText.style.display="block"}if(this.isBrowserIE6){this.domThumbnails.style.height="202px"}else{this.domThumbnails.style.height="auto"}this.aTags=new Array();var q=$("tag",g);var j=q.length;var p;for(var h=0;h<j;h++){p=q[h];this.aTags[h]=p.textContent}resize_container()},Scroll:function(c,f){c=c||window.event;var b=c.target||c.srcElement;var d=this;var a;if(b.className=="jsScrollUp"||b.className=="jsScrollDown"){if(b.tagName.toLowerCase()!="img"){return}b.blur();if(b.className=="jsScrollUp"){a=-20}else{a=20}b.onmouseout=function(){clearInterval(d.intvlScroll)};b.onmouseup=function(){clearInterval(d.intvlScroll)};this.intvlScroll=setInterval(function(){f.scrollTop+=a},50)}else{if(b!=this.domAlbumScroll&&b!=this.domThumbScroll&&(c.detail||c.wheelDelta)){if(c.detail>0||c.wheelDelta<0){a=40}else{if(c.detail<0||c.wheelDelta>0){a=-40}}f.scrollTop+=a}else{return}}return false},StartDrag:function(f){f=f||window.event;var c=f.target||f.srcElement;var d=$(c);if(!d.hasClass(this.CLASS_SORTABLE_ITEM)){return}var a=d.parents("."+this.CLASS_SORTABLE_ITEM);if(a.length){d=a;c=a.get(0)}this.domOriginalItem=c;$("#jsOptionsDiv").remove();this.domDragItem=document.createElement("img");this.domDragItem.src=d.children().get(0).src;this.domDragItem.className="jsDragClone";var b=$(this.domDragItem);b.css({display:"none",position:"absolute",opacity:"0.75"});document.body.appendChild(this.domDragItem);$("#newAlbumImg, #deleteImage, #tagImage").css("cursor","pointer");if(f.preventDefault){f.preventDefault();f.stopPropagation()}},SelectAlbum:function(g,a){g=g||window.event;var f=g.target||g.srcElement;var c=f.tagName.toLowerCase();if(c!="a"&&c!="h2"&&c!="img"&&c!="div"&&c!="p"){return}if(c=="a"){if(f.parentNode.tagName.toLowerCase()!="h2"){return}}$("#jsOptionsDiv").remove();var b=parseInt(a.id.match(/\d+/));var d=$("h2",a).text();this.domThumbnailTitle.innerHTML=this.aLangs.langPhotos+" - "+d;if(b==this.albumId){return false}$("div."+this.CLASS_ALBUM_INFO).removeClass(this.CLASS_SELECTED_ITEM);$(a).addClass(this.CLASS_SELECTED_ITEM);this.albumId=b;var j=new Object;j.album=this.albumId;j.sortImage=this.sortImage;j.orderImage=this.orderImage;var h=this;jQuery.get(galleryLocation+"?OrganizeXML",j,function(e){h.UpdateImages(e)});$("p.error").remove();return false},Select:function(g){g=g||window.event;var d=g.target||g.srcElement;var f=$(d);if(!f.hasClass(this.CLASS_SORTABLE_ITEM)){return}var b=f.parents("."+this.CLASS_SORTABLE_ITEM);if(b.length){f=b;d=b.get(0)}var a=this.items.index(f);if(g.shiftKey){if(this.indexLastSelected<a){var c=this.items.slice(this.indexLastSelected,a);c.addClass(this.CLASS_SELECTED_ITEM);c.children().addClass(this.CLASS_SELECTED_ITEM)}else{if(this.indexLastSelected>a){var c=this.items.slice(a+1,this.indexLastSelected);c.addClass(this.CLASS_SELECTED_ITEM);c.children().addClass(this.CLASS_SELECTED_ITEM)}}var h=this.items.filter(function(e){return(e!=a)})}else{if(g.ctrlKey){}else{var h=this.items.filter(function(e){return(e!=a)});h.removeClass(this.CLASS_SELECTED_ITEM);h.children().removeClass(this.CLASS_SELECTED_ITEM)}}if(f.hasClass(this.CLASS_SELECTED_ITEM)){f.removeClass(this.CLASS_SELECTED_ITEM);$("img",f).removeClass(this.CLASS_SELECTED_ITEM)}else{f.addClass(this.CLASS_SELECTED_ITEM);$("img",f).addClass(this.CLASS_SELECTED_ITEM)}this.indexLastSelected=a},ContinueDrag:function(g){g=g||window.event;var c=g.target||g.srcElement;if(this.domDragItem==null){return}var j=this.domDragItem.style;j.display="block";$(this.domOriginalItem).css("opacity","0.4");var b=(g.pageX||g.clientX);var f=(g.pageY||g.clientY);if(document.all){j.top=f+(document.documentElement.scrollTop)+this.Y_OFFSET+"px";j.left=b+(document.documentElement.scrollLeft||document.body.scrollLeft)+this.X_OFFSET+"px"}else{j.top=f+this.Y_OFFSET+"px";j.left=b+this.X_OFFSET+"px"}var h=$(c);if(!h.hasClass(this.CLASS_SORTABLE_ITEM)){return}var d=h.parents("."+this.CLASS_SORTABLE_ITEM);if(d.length){h=d;c=d.get(0)}if(this.IsMouseOnLeft(c,b)){c.style.paddingLeft="10px";c.style.paddingRight="0px";var k=h.prev();k.css("padding-left","0px");k.css("padding-right","10px")}else{c.style.paddingLeft="0px";c.style.paddingRight="10px";var l=h.next();l.css("padding-left","10px");l.css("padding-right","0px")}var a=this;c.onmouseout=function(){c.style.paddingLeft="5px";c.style.paddingRight="5px";var e=h.next();e.css("padding-left","5px");e.css("padding-right","5px");var m=h.prev();if(m.hasClass(a.CLASS_SORTABLE_ITEM)){m.css("padding-left","5px");m.css("padding-right","5px")}}},StopDrag:function(m){m=m||window.event;var j=m.target||m.srcElement;var n=$(j);if(!this.domDragItem){return}if(this.domDragItem){$(this.domDragItem).remove();this.domDragItem=null}this.items=$(this.domThumbnails).children();this.items.css({paddingLeft:"5px",paddingRight:"5px",opacity:"1.0"});$("#newAlbumImg").css("cursor","default");$("#deleteImage").css("cursor","default");var d=this;if(n.hasClass(this.CLASS_SORTABLE_ITEM)&&j.imageId!=this.domOriginalItem.imageId){var k=n.parents("."+this.CLASS_SORTABLE_ITEM);if(k.length){n=k;j=k.get(0)}var f=this.items.index(this.domOriginalItem);var q;var b=this.aImageIds[f];this.aImageIds.splice(f,1);var c=(m.pageX||m.clientX);if(this.IsMouseOnLeft(j,c)){n.before(this.domOriginalItem);q=this.items.index(j);if(q>f){q--}}else{n.after(this.domOriginalItem);q=this.items.index(j);if(q<f){q++}}this.aImageIds.splice(q,0,b)}else{if(n.hasClass(this.CLASS_DROPPABLE_ITEM)){var r=n.parents("div.albumInfo");var p=r.attr("id").match(/\d+/);if(p==this.albumId){return}var o=this.GetSelectedImageIds();var g=document.createElement("div");g.id="jsOptionsDiv";var a=document.createElement("input");a.type="button";a.value="Move";a.className="button";var t=document.createElement("input");t.type="button";t.value="Copy";t.className="button";var h={desAlbumId:p,albumVersion:d.albumVersion,"aImageIds[]":o,"aImageIdsSource[]":d.aImageIds};a.onclick=function(){var u=$("span.imageCount",r);var e=parseInt(u.text());e+=o.length;u.text(e);var v=$("#album"+d.albumId+" span.imageCount");if(v.length==1){e=parseInt(v.text());e-=o.length;if(e>0){v.text(e)}}h.type="move";jQuery.post(galleryLocation+"?OrganizeXML&orderAlbum=false&album="+d.albumId,h,function(x){if(!d.HandleErrors(x)){return}var w=$("coverChange",x);if(w.text()=="true"){d.UpdateAlbums(x)}d.UpdateImages(x);$(g).remove()})};t.onclick=function(){var u=$("span.imageCount",r);var e=parseInt(u.text());e+=o.length;u.text(e);h.type="copy";jQuery.post(galleryLocation+"?OrganizeXML&orderAlbum=false&album="+d.albumId,h,function(w){if(!d.HandleErrors(w)){return}var v=$("coverChange",w);if(v.text()=="true"){d.UpdateAlbums(w)}d.UpdateImages(w);$(g).remove()})};g.appendChild(a);g.appendChild(t);r.append(g)}else{if(j.id=="newAlbumImg"){var o=this.GetSelectedImageIds();var l=document.getElementById(this.ID_NEW_ALBUM_POPUP);this.DisplayPopup(l);$("#jsMoveNewBtn, #jsCopyNewBtn").click(function(w){if(document.getElementById("jsNameInput").value==""){alert(d.aLangs.langAlbumNameError+".");return false}var x=new Object;var v;if(document.getElementById("albumPublicInput").checked){v=document.getElementById("albumPublicInput").value}else{if(document.getElementById("albumPrivateInput").checked){v=document.getElementById("albumPrivateInput").value}else{if(document.getElementById("albumHiddenInput").checked){v=document.getElementById("albumHiddenInput").value}else{if(document.getElementById("albumMixedInput").checked){v=document.getElementById("albumMixedInput").value}}}}var u;if(this.id=="jsMoveNewBtn"){u="move"}else{if(this.id=="jsCopyNewBtn"){u="copy"}}jQuery.post(galleryLocation+"?OrganizeXML&album="+d.albumId+"&orderAlbum=false",{type:u,albumName:document.getElementById("jsNameInput").value,albumVersion:d.albumVersion,description:document.getElementById("jsDescriptionInput").value,privacy:v,"aImageIds[]":o,"aImageIdsSource[]":d.aImageIds},function(e){if(!d.HandleErrors(e)){return}d.UpdateImages(e);d.UpdateAlbums(e);d.RemovePopupForm(l)});$("#jsMoveNewBtn, #jsCopyNewBtn").unbind("click");return false})}else{if(j.id=="deleteImage"){if(!confirm(this.aLangs.langDelImagesConfirm+"?")){return false}var o=this.GetSelectedImageIds();jQuery.post(galleryLocation+"?OrganizeXML&album="+d.albumId+"&orderAlbum=false",{type:"delete",albumVersion:d.albumVersion,"aImageIds[]":o},function(v){if(!d.HandleErrors(v)){return}var w=$("#album"+d.albumId+" span.imageCount");if(w.length==1){numAlbumImages=parseInt(w.text());numAlbumImages-=o.length;if(numAlbumImages>0){w.text(numAlbumImages)}}var e=$("coverChange",v);if(e.text()=="true"){d.UpdateAlbums(v)}if(w.length==1&&numAlbumImages==0){d.UpdateImages(v)}if(o.length<d.MAX_EFFECTS_SELECTED_IMAGES){var u;if(d.isIE){u={width:"0px",opacity:"0.0"}}else{u={margin:"0px",paddingRight:"0px",paddingLeft:"0px",width:"0px",opacity:"0.0"}}$("."+d.CLASS_SELECTED_ITEM,d.domThumbnails).animate(u,300,function(){$("."+d.CLASS_SELECTED_ITEM,d.domThumbnails).remove()});$(d.domOriginalItem).animate(u,300,function(){$(d.domOriginalItem).remove()})}else{$("."+d.CLASS_SELECTED_ITEM,d.domThumbnails).remove();$(d.domOriginalItem).remove()}});return false}else{if(j.id=="tagImage"){var o=this.GetSelectedImageIds();var l=document.getElementById(this.ID_TAGS_POPUP);this.DisplayPopup(l);$("#jsTagAddBtn, #jsTagReplaceBtn").click(function(w){var u=document.getElementById("tagsInput").value;var v;if(this.id=="jsTagAddBtn"){v="addtag"}else{if(this.id=="jsTagReplaceBtn"){v="replacetag"}}jQuery.post(galleryLocation+"?OrganizeXML&album="+d.albumId+"&orderAlbum=false",{type:v,albumVersion:albumVersion,"aImageIds[]":o,tags:u},function(e){if(!d.HandleErrors(e)){return}d.UpdateImages(e);d.RemovePopupForm(l)});return false})}}}}}},DisplayPopup:function(d){var g=this.GetSelectedImageIds();var c=document.createElement("div");c.id="jsCoverDiv";if(this.isBrowserIE6){var l=$("#organizeDiv");var h=parseInt(l.css("padding-left"))+parseInt(l.css("padding-right"));c.style.width=l.width()+h+"px";c.style.height=l.height()+h+"px"}document.getElementById("organizeDiv").appendChild(c);var e=document.createElement("div");e.id="jsFauxDiv";var b=document.innerHeight||document.documentElement.clientHeight;var j=$(d).height();var f=document.documentElement.scrollTop||document.body.scrollTop;var k=parseInt(b/2-200+f);d.style.top=k+"px";e.appendChild(d);document.getElementById("organizeDiv").appendChild(e);$(d).fadeIn("normal");var a=this;e.onclick=function(n){n=n||window.event;var m=n.target||n.srcElement;if(m.id==this.id){a.RemovePopupForm(d)}}},RemovePopupForm:function(a){var c=document.getElementById("jsCoverDiv");var b=document.getElementById("jsFauxDiv");$(c).remove();$(".formField",a).attr("value","");$("#tagListDiv").empty();$(a).fadeOut("normal",function(){document.getElementById("newAlbumDiv").appendChild(a);a.style.display="none";$(b).remove()})},HandleErrors:function(c){if($("error",c).length>0&&$("error-id",c).text()=="REVISION_NUMBER_CHANGED"){var b=$("#organizeSection p.error");if(b.length>0){b.text(this.aLangs.langRevisionChanged)}else{var a=document.createElement("p");a.className="error";a.innerHTML=this.aLangs.langRevisionChanged;$("#imageSortOptionsDiv").before(a)}return false}else{return true}},IsMouseOnLeft:function(c,a){var d=$(c);var b=d.offset().left;var e=d.width();if(a<=b+e/2){return true}else{return false}},GetSelectedImageIds:function(){var d=new Array();var b=0;$("img."+this.CLASS_SELECTED_ITEM).each(function(){d[b++]=this.imageId});var c=false;for(var b=0,a;a=d[b];b++){if(this.domOriginalItem.imageId==a){c=true;break}}if(!c){d[b]=this.domOriginalItem.imageId}return d}};function resize_container(){if(document.all&&document.noResize){return}var a=document.getElementById("containerDiv");if(typeof a.style.maxHeight!="undefined"){a.style.minHeight=$(window).height()-67+"px"}else{a.style.height=(document.innerHeight||document.documentElement.clientHeight)-67+"px";if(a.offsetWidth<950){a.style.width="950px"}else{a.style.width="auto"}}document.noResize=true;setTimeout(function(){document.noResize=false},50)}function UserManager(b){this.aUsers=b.aUsers;this.aGroups=b.aGroups;this.aLangs=b.aLangs;this.domDetailsDiv=b.domDetailsDiv;this.domUserGroupsDiv=b.domUserGroupsDiv;this.domUserPopup=b.domUserPopup;this.domGroupPopup=b.domGroupPopup;var a=this;$("table").click(function(f){if(f.target.tagName.toLowerCase()!="a"){return}var d=f.target;if($(d).parent("td.groupname").length){var c=parseInt(d.href.match(/\d+$/));a.ShowGroup(c,f);return false}});$("td.username a").click(function(d){var c=parseInt(this.href.match(/\d+$/));a.ShowUser(c,d);return false});$('input[name="newgroup"]').click(function(c){a.group=new Object();a.group.id="new";a.ClearPopup();a.ShowPopup(document.getElementById("jsGroupPopupDiv"),c);return false});$('input.button[name="delete"]',this.domUserPopup).click(function(){if(!confirm(a.aLangs.confirmDelUser)){return false}var c={"delete":"true"};jQuery.post(galleryLocation+"?UserManager&show=ajax&user="+a.user.id,c,function(d){if(d=="ERROR"){alert(a.aLangs.ajaxError)}else{$("#userRow"+a.user.id).remove();a.HidePopup()}});return false});$('input.button[name="delete"]',this.domGroupPopup).click(function(){if(!confirm(a.aLangs.confirmDelGroup)){return false}var c={"delete":"true"};jQuery.post(galleryLocation+"?UserManager&show=ajax&group="+a.group.id,c,function(d){if(d=="ERROR"){alert(a.aLangs.ajaxError)}else{$("#groupRow"+a.group.id).remove();delete a.aGroups[a.group.id];a.HidePopup()}});return false});$('input.button[name="update"]',this.domUserPopup).click(function(){a.UpdateUser();if(a.user.name.length==0){return false}var c={update:"update",username:a.user.name,"userGroups[]":a.user.aGroupIds};if(a.user.permEditAlbum){c.permEditAlbum="true"}if(a.user.permNewComment){c.permNewComment="true"}if(a.user.permDelComment){c.permDelComment="true"}if(a.user.permInvite){c.permInvite="true"}if(a.user.permSuperuser){c.permSuperuser="true"}jQuery.post(galleryLocation+"?UserManager&show=ajax&user="+a.user.id,c,function(g){if(g=="ERROR"){alert(a.aLangs.ajaxError)}else{var d=$("#userRow"+a.user.id);$("td.username a",d).text(a.user.name);$('input[type="checkbox"]',d).attr("checked",false);var f='input[name="userPermissionsMatrix['+a.user.id+"]";if(a.user.permEditAlbum){$(f+'[editAlbum]"]',d).attr("checked",true)}if(a.user.permNewComment){$(f+'[newComment]"]',d).attr("checked",true)}if(a.user.permDelComment){$(f+'[delComment]"]',d).attr("checked",true)}if(a.user.permInvite){$(f+'[invite]"]',d).attr("checked",true)}if(a.user.permSuperuser){$(f+'[superuser]"]',d).attr("checked",true)}f='input[name="userGroupMatrix[';for(var e in a.user.aGroupIds){$(f+a.user.aGroupIds[e]+'][]"]',d).attr("checked",true)}a.HidePopup()}});return false});$('input.button[name="update"]',this.domGroupPopup).click(function(){a.UpdateGroup();if(a.group.name.length==0){return false}var c={update:"update",groupName:a.group.name,"groupUsers[]":a.group.aUserIds};if(a.group.id=="new"){c.newgroup="true"}jQuery.post(galleryLocation+"?UserManager&show=ajax&group="+a.group.id,c,function(f){if(f=="ERROR"){alert(a.aLangs.ajaxError)}else{if(a.group.id=="new"){var d=f;a.group.id=d;a.aGroups.splice(d,0,a.group);var g='<tr id="groupRow'+d+'"><td class="groupname"><a href="#'+d+'">'+a.group.name;g+='<td class="checkbox userCount">'+a.group.aUserIds.length+"</td>";g+='<td class="checkbox">0</td>';g+="</tr>";$("table").append(g)}else{var e=$("#groupRow"+a.group.id);$("td.groupname a",e).text(a.group.name);$("td.userCount",e).text(a.group.aUserIds.length)}a.HidePopup()}});return false});$("#coverDiv").click(function(){a.HidePopup()});$(".jsPopup .closeBtn").click(function(){a.HidePopup()})}UserManager.prototype={aUsers:new Array(),aGroups:new Array(),user:null,Cleanup:function(){$("*").unbind();for(var a in this){this[a]=null}},ShowUser:function(a,b){if(this.aUsers[a]){this.user=this.aUsers[a]}else{return}this.ClearPopup();this.SelectUser(this.user);this.ShowPopup(document.getElementById("jsUserPopupDiv"),b)},ShowGroup:function(a,b){if(this.aGroups[a]){this.group=this.aGroups[a]}else{return}this.ClearPopup();this.SelectGroup(this.group);this.ShowPopup(document.getElementById("jsGroupPopupDiv"),b)},UpdateUser:function(){var a=this.user;a.name=$('input[name="username"]',this.domUserPopup).attr("value");a.permEditAlbum=$('input[name="permEditAlbum"]',this.domUserPopup).attr("checked");a.permNewComment=$('input[name="permNewComment"]',this.domUserPopup).attr("checked");a.permDelComment=$('input[name="permDelComment"]',this.domUserPopup).attr("checked");a.permInvite=$('input[name="permInvite"]',this.domUserPopup).attr("checked");a.permSuperuser=$('input[name="permSuperuser"]',this.domUserPopup).attr("checked");a.aGroupIds=new Array();$("input.userGroups",this.domUserPopup).each(function(){if(this.checked){a.aGroupIds.push(this.value)}})},UpdateGroup:function(){var a=this.group;a.name=$('input[name="groupName"]',this.domGroupPopup).attr("value");a.aUserIds=new Array();$("input.groupUsers",this.domGroupPopup).each(function(){if(this.checked){a.aUserIds.push(this.value)}})},ClearPopup:function(){$('.jsPopup input[type="text"]').attr("value","");$('.jsPopup input[type="checkbox"]').attr("checked",false)},SelectUser:function(a){$('input[name="username"]').attr("value",a.name);if(a.permEditAlbum){$('input[name="permEditAlbum"]').attr("checked",true)}if(a.permNewComment){$('input[name="permNewComment"]').attr("checked",true)}if(a.permDelComment){$('input[name="permDelComment"]').attr("checked",true)}if(a.permInvite){$('input[name="permInvite"]').attr("checked",true)}if(a.permSuperuser){$('input[name="permSuperuser"]').attr("checked",true)}for(var d in this.aGroups){var c=this.aGroups[d].id;var e=false;for(var b in a.aGroupIds){if(c==a.aGroupIds[b]){e=true}}if(e){$('input[name="userGroups['+c+']"]').attr("checked",true)}}},SelectGroup:function(b){$('input[name="groupName"]').attr("value",b.name);for(var a in b.aUserIds){$('input[name="groupUsers['+b.aUserIds[a]+']"]',"#jsGroupPopupDiv").attr("checked",true)}},ShowPopup:function(j,l){l=l||window.event;var h=document.innerHeight||document.documentElement.clientHeight;var m=document.getElementById("organizeDiv");var b=$(m).offset();var o=b.top;var f=b.left;var k=m.offsetWidth;var g=m.offsetHeight;var a=(l.pageX||l.clientX);j.style.position="absolute";var d=(h-400)/2+(document.documentElement.scrollTop||document.body.scrollTop);var c=a+(document.documentElement.scrollLeft||document.body.scrollLeft)+50;j.style.top=d+"px";j.style.left=c+"px";var n=document.getElementById("coverDiv");n.style.position="absolute";n.style.top=o+"px";n.style.left=f+"px";n.style.width=k+"px";n.style.height=g+"px";if(!this.isIE){$(n).fadeIn("fast");$(j).fadeIn("fast",function(){$('input[type="text"]',j).get(0).focus()})}else{n.style.display="block";j.style.display="block";$('input[type="text"]',j).get(0).focus()}},HidePopup:function(){this.user=null;this.group=null;resize_container();$(".jsPopup").fadeOut("fast");$("#coverDiv").fadeOut("fast")}};function resize_container(){if(document.all&&document.noResize){return}var c=document.getElementById("containerDiv");var a=$("div.userManagerSection");var e=$("div.sidePanel");if(typeof c.style.maxHeight!="undefined"){c.style.minHeight=$(window).height()-67+"px"}else{c.style.height=(document.innerHeight||document.documentElement.clientHeight)-67+"px";if(c.offsetWidth<950){c.style.width="950px"}else{c.style.width="auto"}}var d=$("#organizeDiv").outerHeight();var b=parseInt(e.css("padding-bottom"))+parseInt(e.css("padding-top"));e.css("height",d-b-2+"px");document.noResize=true;setTimeout(function(){document.noResize=false},50)}M={dom:{addClass:function(c,a){if(!M.dom.hasClass(c,a)){var b=c.className.split(" ");b.push(a);c.className=b.join(" ")}},removeClass:function(d,a){var c=d.className.split(" ");for(var b=c.length-1;b>=0;b--){if(c[b]==a){c.splice(b,1)}}d.className=c.join(" ")},hasClass:function(d,a){var c=d.className.split(" ");for(var b=c.length-1;b>=0;b--){if(c[b]==a){return true}}return false},getOffset:function(b,a){var c=b[a];while(b=b.offsetParent){c+=b[a]}return parseInt(c)}},postObj:function(c){var b=document.createElement("form");b.action=document.location.href;b.method="post";b.target="_self";for(property in c){var a=document.createElement("input");a.type="hidden";a.name=property;a.value=c[property];b.appendChild(a)}document.body.appendChild(b);b.submit()}};function detectBrowser(){var BO=new Object();BO.ie=false
/*@cc_on || true @*/
;BO.ie4=BO.ie&&(document.getElementById==null);BO.ie5=BO.ie&&(document.namespaces==null)&&(!BO.ie4);BO.ie6=BO.ie&&(document.implementation!=null)&&(document.implementation.hasFeature!=null);BO.ie55=BO.ie&&(document.namespaces!=null)&&(!BO.ie6);
/*@cc_on
    BO["ie7"]       = @_jscript_version == '5.7';
    @*/
BO.ns4=!BO.ie&&(document.layers!=null)&&(window.confirm!=null)&&(document.createElement==null);BO.opera=(self.opera!=null);BO.gecko=(document.getBoxObjectFor!=null);BO.khtml=(navigator.vendor=="KDE");BO.konq=((navigator.vendor=="KDE")||(document.childNodes)&&(!document.all)&&(!navigator.taintEnabled));BO.safari=(document.childNodes)&&(!document.all)&&(!navigator.taintEnabled)&&(!navigator.accentColorName);BO["safari1.2"]=(parseInt(0).toFixed==null)&&(BO.safari&&(window.XMLHttpRequest!=null));BO["safari2.0"]=(parseInt(0).toFixed!=null)&&BO.safari&&!BO["safari1.2"];BO["safari1.1"]=BO.safari&&!BO["safari1.2"]&&!BO["safari2.0"];return BO}var BO=new detectBrowser();Events={_events:new Array(),_cleanup:new Array(),attach:function(c,b,a){if(c===window&&b=="unload"){this._cleanup[this._cleanup.length]={obj:c,type:b,fn:a}}else{if(c.addEventListener){c.addEventListener(b,a,false)}else{if(c.attachEvent){c["e"+b+a]=a;c[b+a]=function(){var d=window.event;d.target=d.srcElement;c["e"+b+a](d)};c.attachEvent("on"+b,c[b+a])}}this._events[this._events.length]={obj:c,type:b,fn:a}}},detach:function(e,d,c,b){if(e.removeEventListener){e.removeEventListener(d,c,false)}else{if(e.detachEvent){e.detachEvent("on"+d,e[d+c]);e[d+c]=null;e["e"+d+c]=null}}if(!b){for(var a=0;a<this._events.length;a++){if(this._events[a].obj==e&&this._events[a].type==d&&this._events[a].fn==c){this._events.splice(a,1);break}}}},cleanup:function(b){while(this._events.length){var a=this._events.pop();this.detach(a.obj,a.type,a.fn,true);a=null}while(this._cleanup.length){this._cleanup.pop().fn(b)}},stop:function(a){a=a||window.event;if(a){a.cancelBubble=true;if(a.stopPropagation){a.stopPropagation()}}}};window.onunload=function(a){Events.cleanup(a)};HideFileInput.prototype={toString:function(){return"[object HideFileInput]"},xMin:0,xMax:0,yMin:0,yMax:0,fileInput:null,fileInputOffset:0,fileInputWidth:0,alternateElementRef:null,register:function(c){var c=c||window.event;var b=c.target||c.srcElement;var a=$(b).offset();this.xMin=a.left;this.yMin=a.top;this.xMax=this.xMin+b.offsetWidth;this.yMax=this.yMin+b.offsetHeight;this.fileInput.style.display="block";this.fileInputOffset=Math.floor(this.fileInput.offsetHeight/2);this.fileInputWidth=this.fileInput.offsetWidth},mousemove:function(c){var c=c||window.event;var a=c.pageX||c.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft);var d=c.pageY||c.clientY+(document.documentElement.scrollTop||document.body.scrollTop);if(this.fileInput.style.display!="none"&&(a<this.xMin||a>this.xMax||d<this.yMin||d>this.yMax)){this.fileInput.style.display="none"}if(this.fileInput.offsetParent&&!BO.safari){var b=$(this.fileInput).offsetParent().offset();a-=b.left;d-=b.top}this.fileInput.style.left=a-this.fileInputWidth+this.fileInputOffset+"px";this.fileInput.style.top=d-this.fileInputOffset+"px"},destruct:function(){this.alternateElementRef.onmouseover=null;this.fileInput.onmousedown=null;this.fileInput.onmouseup=null;this.fileInput.onmouseover=null;this.fileInput.onclick=null;Events.detach(document,"mousemove",this.closure);this.fileInput.style.display="";this.fileInput.style.top="";this.fileInput.style.left="";this.fileInput.className="";this.fileInput=null;this.closure=null}};function HideFileInput(b,a){if(BO&&(BO.ie5||BO.ie4||BO.khtml)){return false}this.alternateElementRef=a;this.fileInput=b;M.dom.addClass(this.alternateElementRef,"active");M.dom.addClass(this.fileInput,"moving");this.fileInput.style.display="none";var c=this;this.alternateElementRef.onmouseover=function(d){c.register(d)};this.closure=function(d){return function(f){d.mousemove(f)}}(this);Events.attach(document,"mousemove",this.closure)}(function(a){a.fn.bgIframe=a.fn.bgiframe=function(c){if(a.browser.msie&&/6.0/.test(navigator.userAgent)){c=a.extend({top:"auto",left:"auto",width:"auto",height:"auto",opacity:true,src:"javascript:false;"},c||{});var d=function(e){return e&&e.constructor==Number?e+"px":e},b='<iframe class="bgiframe"frameborder="0"tabindex="-1"src="'+c.src+'"style="display:block;position:absolute;z-index:-1;'+(c.opacity!==false?"filter:Alpha(Opacity='0');":"")+"top:"+(c.top=="auto"?"expression(((parseInt(this.parentNode.currentStyle.borderTopWidth)||0)*-1)+'px')":d(c.top))+";left:"+(c.left=="auto"?"expression(((parseInt(this.parentNode.currentStyle.borderLeftWidth)||0)*-1)+'px')":d(c.left))+";width:"+(c.width=="auto"?"expression(this.parentNode.offsetWidth+'px')":d(c.width))+";height:"+(c.height=="auto"?"expression(this.parentNode.offsetHeight+'px')":d(c.height))+';"/>';return this.each(function(){if(a("> iframe.bgiframe",this).length==0){this.insertBefore(document.createElement(b),this.firstChild)}})}return this}})(jQuery);(function(d){d.fn.extend({renderCalendar:function(q){var B=function(r){return document.createElement(r)};q=d.extend({month:null,year:null,renderCallback:null,showHeader:d.dpConst.SHOW_HEADER_SHORT,dpController:null,hoverClass:"dp-hover"},q);if(q.showHeader!=d.dpConst.SHOW_HEADER_NONE){var n=d(B("tr"));for(var v=Date.firstDayOfWeek;v<Date.firstDayOfWeek+7;v++){var h=v%7;var u=Date.dayNames[h];n.append(jQuery(B("th")).attr({scope:"col",abbr:u,title:u,"class":(h==0||h==6?"weekend":"weekday")}).html(q.showHeader==d.dpConst.SHOW_HEADER_SHORT?u.substr(0,1):u))}}var e=d(B("table")).attr({cellspacing:2,className:"jCalendar"}).append((q.showHeader!=d.dpConst.SHOW_HEADER_NONE?d(B("thead")).append(n):B("thead")));var f=d(B("tbody"));var y=(new Date()).zeroTime();var A=q.month==undefined?y.getMonth():q.month;var o=q.year||y.getFullYear();var l=new Date(o,A,1);var k=Date.firstDayOfWeek-l.getDay()+1;if(k>1){k-=7}var p=Math.ceil(((-1*k+1)+l.getDaysInMonth())/7);l.addDays(k-1);var z=function(){if(q.hoverClass){d(this).addClass(q.hoverClass)}};var g=function(){if(q.hoverClass){d(this).removeClass(q.hoverClass)}};var m=0;while(m++<p){var t=jQuery(B("tr"));for(var v=0;v<7;v++){var j=l.getMonth()==A;var x=d(B("td")).text(l.getDate()+"").attr("className",(j?"current-month ":"other-month ")+(l.isWeekend()?"weekend ":"weekday ")+(j&&l.getTime()==y.getTime()?"today ":"")).hover(z,g);if(q.renderCallback){q.renderCallback(x,l,A,o)}t.append(x);l.addDays(1)}f.append(t)}e.append(f);return this.each(function(){d(this).empty().append(e)})},datePicker:function(e){if(!d.event._dpCache){d.event._dpCache=[]}e=d.extend({month:undefined,year:undefined,startDate:undefined,endDate:undefined,inline:false,renderCallback:[],createButton:true,showYearNavigation:true,closeOnSelect:true,displayClose:false,selectMultiple:false,clickInput:false,verticalPosition:d.dpConst.POS_TOP,horizontalPosition:d.dpConst.POS_LEFT,verticalOffset:0,horizontalOffset:0,hoverClass:"dp-hover"},e);return this.each(function(){var g=d(this);var j=true;if(!this._dpId){this._dpId=d.event.guid++;d.event._dpCache[this._dpId]=new a(this);j=false}if(e.inline){e.createButton=false;e.displayClose=false;e.closeOnSelect=false;g.empty()}var f=d.event._dpCache[this._dpId];f.init(e);if(!j&&e.createButton){f.button=d('<a href="#" class="dp-choose-date" title="'+d.dpText.TEXT_CHOOSE_DATE+'">'+d.dpText.TEXT_CHOOSE_DATE+"</a>").bind("click",function(){g.dpDisplay(this);this.blur();return false});g.after(f.button)}if(!j&&g.is(":text")){g.bind("dateSelected",function(l,k,m){this.value=k.asString()}).bind("change",function(){var k=Date.fromString(this.value);if(k){f.setSelected(k,true,true)}});if(e.clickInput){g.bind("click",function(){g.dpDisplay()})}var h=Date.fromString(this.value);if(this.value!=""&&h){f.setSelected(h,true,true)}}g.addClass("dp-applied")})},dpSetDisabled:function(e){return b.call(this,"setDisabled",e)},dpSetStartDate:function(e){return b.call(this,"setStartDate",e)},dpSetEndDate:function(e){return b.call(this,"setEndDate",e)},dpGetSelected:function(){var e=c(this[0]);if(e){return e.getSelected()}return null},dpSetSelected:function(g,f,e){if(f==undefined){f=true}if(e==undefined){e=true}return b.call(this,"setSelected",Date.fromString(g),f,e)},dpSetDisplayedMonth:function(e,f){return b.call(this,"setDisplayedMonth",Number(e),Number(f))},dpDisplay:function(f){return b.call(this,"display",f)},dpSetRenderCallback:function(e){return b.call(this,"setRenderCallback",e)},dpSetPosition:function(e,f){return b.call(this,"setPosition",e,f)},dpSetOffset:function(e,f){return b.call(this,"setOffset",e,f)},dpClose:function(){return b.call(this,"_closeCalendar",false,this[0])},_dpDestroy:function(){}});var b=function(h,g,e,j){return this.each(function(){var f=c(this);if(f){f[h](g,e,j)}})};function a(e){this.ele=e;this.displayedMonth=null;this.displayedYear=null;this.startDate=null;this.endDate=null;this.showYearNavigation=null;this.closeOnSelect=null;this.displayClose=null;this.selectMultiple=null;this.verticalPosition=null;this.horizontalPosition=null;this.verticalOffset=null;this.horizontalOffset=null;this.button=null;this.renderCallback=[];this.selectedDates={};this.inline=null;this.context="#dp-popup"}d.extend(a.prototype,{init:function(e){this.setStartDate(e.startDate);this.setEndDate(e.endDate);this.setDisplayedMonth(Number(e.month),Number(e.year));this.setRenderCallback(e.renderCallback);this.showYearNavigation=e.showYearNavigation;this.closeOnSelect=e.closeOnSelect;this.displayClose=e.displayClose;this.selectMultiple=e.selectMultiple;this.verticalPosition=e.verticalPosition;this.horizontalPosition=e.horizontalPosition;this.hoverClass=e.hoverClass;this.setOffset(e.verticalOffset,e.horizontalOffset);this.inline=e.inline;if(this.inline){this.context=this.ele;this.display()}},setStartDate:function(e){if(e){this.startDate=Date.fromString(e)}if(!this.startDate){this.startDate=(new Date()).zeroTime()}this.setDisplayedMonth(this.displayedMonth,this.displayedYear)},setEndDate:function(e){if(e){this.endDate=Date.fromString(e)}if(!this.endDate){this.endDate=(new Date("12/31/2999"))}if(this.endDate.getTime()<this.startDate.getTime()){this.endDate=this.startDate}this.setDisplayedMonth(this.displayedMonth,this.displayedYear)},setPosition:function(e,f){this.verticalPosition=e;this.horizontalPosition=f},setOffset:function(e,f){this.verticalOffset=parseInt(e)||0;this.horizontalOffset=parseInt(f)||0},setDisabled:function(e){$e=d(this.ele);$e[e?"addClass":"removeClass"]("dp-disabled");if(this.button){$but=d(this.button);$but[e?"addClass":"removeClass"]("dp-disabled");$but.attr("title",e?"":d.dpText.TEXT_CHOOSE_DATE)}if($e.is(":text")){$e.attr("disabled",e?"disabled":"")}},setDisplayedMonth:function(f,k){if(this.startDate==undefined||this.endDate==undefined){return}var h=new Date(this.startDate.getTime());h.setDate(1);var j=new Date(this.endDate.getTime());j.setDate(1);var g;if((!f&&!k)||(isNaN(f)&&isNaN(k))){g=new Date().zeroTime();g.setDate(1)}else{if(isNaN(f)){g=new Date(k,this.displayedMonth,1)}else{if(isNaN(k)){g=new Date(this.displayedYear,f,1)}else{g=new Date(k,f,1)}}}if(g.getTime()<h.getTime()){g=h}else{if(g.getTime()>j.getTime()){g=j}}this.displayedMonth=g.getMonth();this.displayedYear=g.getFullYear()},setSelected:function(g,e,f){if(this.selectMultiple==false){this.selectedDates={};d("td.selected",this.context).removeClass("selected")}if(f){this.setDisplayedMonth(g.getMonth(),g.getFullYear())}this.selectedDates[g.toString()]=e},isSelected:function(e){return this.selectedDates[e.toString()]},getSelected:function(){var e=[];for(s in this.selectedDates){if(this.selectedDates[s]==true){e.push(Date.parse(s))}}return e},display:function(e){if(d(this.ele).is(".dp-disabled")){return}e=e||this.ele;var m=this;var h=d(e);var l=h.offset();var n;var o;var g;var j;if(m.inline){n=d(this.ele);o={id:"calendar-"+this.ele._dpId,className:"dp-popup dp-popup-inline"};j={}}else{n=d("body");o={id:"dp-popup",className:"dp-popup"};j={top:l.top+m.verticalOffset,left:l.left+m.horizontalOffset};var k=function(r){var p=r.target;var q=d("#dp-popup")[0];while(true){if(p==q){return true}else{if(p==document){m._closeCalendar();return false}else{p=d(p).parent()[0]}}}};this._checkMouse=k;this._closeCalendar(true)}n.append(d("<div></div>").attr(o).css(j).append(d("<h2></h2>"),d('<div class="dp-nav-prev"></div>').append(d('<a class="dp-nav-prev-year" href="#" title="'+d.dpText.TEXT_PREV_YEAR+'">&lt;&lt;</a>').bind("click",function(){return m._displayNewMonth.call(m,this,0,-1)}),d('<a class="dp-nav-prev-month" href="#" title="'+d.dpText.TEXT_PREV_MONTH+'">&lt;</a>').bind("click",function(){return m._displayNewMonth.call(m,this,-1,0)})),d('<div class="dp-nav-next"></div>').append(d('<a class="dp-nav-next-year" href="#" title="'+d.dpText.TEXT_NEXT_YEAR+'">&gt;&gt;</a>').bind("click",function(){return m._displayNewMonth.call(m,this,0,1)}),d('<a class="dp-nav-next-month" href="#" title="'+d.dpText.TEXT_NEXT_MONTH+'">&gt;</a>').bind("click",function(){return m._displayNewMonth.call(m,this,1,0)})),d("<div></div>").attr("className","dp-calendar")).bgIframe());var f=this.inline?d(".dp-popup",this.context):d("#dp-popup");if(this.showYearNavigation==false){d(".dp-nav-prev-year, .dp-nav-next-year",m.context).css("display","none")}if(this.displayClose){f.append(d('<a href="#" id="dp-close">'+d.dpText.TEXT_CLOSE+"</a>").bind("click",function(){m._closeCalendar();return false}))}m._renderCalendar();d(this.ele).trigger("dpDisplayed",f);if(!m.inline){if(this.verticalPosition==d.dpConst.POS_BOTTOM){f.css("top",l.top+h.height()-f.height()+m.verticalOffset)}if(this.horizontalPosition==d.dpConst.POS_RIGHT){f.css("left",l.left+h.width()-f.width()+m.horizontalOffset)}d(document).bind("mousedown",this._checkMouse)}},setRenderCallback:function(e){if(e&&typeof(e)=="function"){e=[e]}this.renderCallback=this.renderCallback.concat(e)},cellRender:function(k,e,h,g){var l=this.dpController;var j=new Date(e.getTime());k.bind("click",function(){var n=d(this);if(!n.is(".disabled")){l.setSelected(j,!n.is(".selected")||!l.selectMultiple);var m=l.isSelected(j);d(l.ele).trigger("dateSelected",[j,k,m]);d(l.ele).trigger("change");if(l.closeOnSelect){l._closeCalendar()}else{n[m?"addClass":"removeClass"]("selected")}}});if(l.isSelected(j)){k.addClass("selected")}for(var f=0;f<l.renderCallback.length;f++){l.renderCallback[f].apply(this,arguments)}},_displayNewMonth:function(f,e,g){if(!d(f).is(".disabled")){this.setDisplayedMonth(this.displayedMonth+e,this.displayedYear+g);this._clearCalendar();this._renderCalendar();d(this.ele).trigger("dpMonthChanged",[this.displayedMonth,this.displayedYear])}f.blur();return false},_renderCalendar:function(){d("h2",this.context).html(Date.monthNames[this.displayedMonth]+" "+this.displayedYear);d(".dp-calendar",this.context).renderCalendar({month:this.displayedMonth,year:this.displayedYear,renderCallback:this.cellRender,dpController:this,hoverClass:this.hoverClass});if(this.displayedYear==this.startDate.getFullYear()&&this.displayedMonth==this.startDate.getMonth()){d(".dp-nav-prev-year",this.context).addClass("disabled");d(".dp-nav-prev-month",this.context).addClass("disabled");d(".dp-calendar td.other-month",this.context).each(function(){var h=d(this);if(Number(h.text())>20){h.addClass("disabled")}});var g=this.startDate.getDate();d(".dp-calendar td.current-month",this.context).each(function(){var h=d(this);if(Number(h.text())<g){h.addClass("disabled")}})}else{d(".dp-nav-prev-year",this.context).removeClass("disabled");d(".dp-nav-prev-month",this.context).removeClass("disabled");var g=this.startDate.getDate();if(g>20){var f=new Date(this.startDate.getTime());f.addMonths(1);if(this.displayedYear==f.getFullYear()&&this.displayedMonth==f.getMonth()){d("dp-calendar td.other-month",this.context).each(function(){var h=d(this);if(Number(h.text())<g){h.addClass("disabled")}})}}}if(this.displayedYear==this.endDate.getFullYear()&&this.displayedMonth==this.endDate.getMonth()){d(".dp-nav-next-year",this.context).addClass("disabled");d(".dp-nav-next-month",this.context).addClass("disabled");d(".dp-calendar td.other-month",this.context).each(function(){var h=d(this);if(Number(h.text())<14){h.addClass("disabled")}});var g=this.endDate.getDate();d(".dp-calendar td.current-month",this.context).each(function(){var h=d(this);if(Number(h.text())>g){h.addClass("disabled")}})}else{d(".dp-nav-next-year",this.context).removeClass("disabled");d(".dp-nav-next-month",this.context).removeClass("disabled");var g=this.endDate.getDate();if(g<13){var e=new Date(this.endDate.getTime());e.addMonths(-1);if(this.displayedYear==e.getFullYear()&&this.displayedMonth==e.getMonth()){d(".dp-calendar td.other-month",this.context).each(function(){var h=d(this);if(Number(h.text())>g){h.addClass("disabled")}})}}}},_closeCalendar:function(e,f){if(!f||f==this.ele){d(document).unbind("mousedown",this._checkMouse);this._clearCalendar();d("#dp-popup a").unbind();d("#dp-popup").empty().remove();if(!e){d(this.ele).trigger("dpClosed",[this.getSelected()])}}},_clearCalendar:function(){d(".dp-calendar td",this.context).unbind();d(".dp-calendar",this.context).empty()}});d.dpConst={SHOW_HEADER_NONE:0,SHOW_HEADER_SHORT:1,SHOW_HEADER_LONG:2,POS_TOP:0,POS_BOTTOM:1,POS_LEFT:0,POS_RIGHT:1};d.dpText={TEXT_PREV_YEAR:"Previous year",TEXT_PREV_MONTH:"Previous month",TEXT_NEXT_YEAR:"Next year",TEXT_NEXT_MONTH:"Next month",TEXT_CLOSE:"Close",TEXT_CHOOSE_DATE:"Choose date"};d.dpVersion="$Id: jquery.datePicker.js 3739 2007-10-25 13:55:30Z kelvin.luck $";function c(e){if(e._dpId){return d.event._dpCache[e._dpId]}return false}if(d.fn.bgIframe==undefined){d.fn.bgIframe=function(){return this}}d(window).bind("unload",function(){var f=d.event._dpCache||[];for(var e in f){d(f[e].ele)._dpDestroy()}})})(jQuery);Date.dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];Date.abbrDayNames=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];Date.monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];Date.abbrMonthNames=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];Date.firstDayOfWeek=1;Date.format="dd/mm/yyyy";Date.fullYearStart="20";(function(){function b(c,d){if(!Date.prototype[c]){Date.prototype[c]=d}}b("isLeapYear",function(){var c=this.getFullYear();return(c%4==0&&c%100!=0)||c%400==0});b("isWeekend",function(){return this.getDay()==0||this.getDay()==6});b("isWeekDay",function(){return !this.isWeekend()});b("getDaysInMonth",function(){return[31,(this.isLeapYear()?29:28),31,30,31,30,31,31,30,31,30,31][this.getMonth()]});b("getDayName",function(c){return c?Date.abbrDayNames[this.getDay()]:Date.dayNames[this.getDay()]});b("getMonthName",function(c){return c?Date.abbrMonthNames[this.getMonth()]:Date.monthNames[this.getMonth()]});b("getDayOfYear",function(){var c=new Date("1/1/"+this.getFullYear());return Math.floor((this.getTime()-c.getTime())/86400000)});b("getWeekOfYear",function(){return Math.ceil(this.getDayOfYear()/7)});b("setDayOfYear",function(c){this.setMonth(0);this.setDate(c);return this});b("addYears",function(c){this.setFullYear(this.getFullYear()+c);return this});b("addMonths",function(d){var c=this.getDate();this.setMonth(this.getMonth()+d);if(c>this.getDate()){this.addDays(-this.getDate())}return this});b("addDays",function(c){this.setDate(this.getDate()+c);return this});b("addHours",function(c){this.setHours(this.getHours()+c);return this});b("addMinutes",function(c){this.setMinutes(this.getMinutes()+c);return this});b("addSeconds",function(c){this.setSeconds(this.getSeconds()+c);return this});b("zeroTime",function(){this.setMilliseconds(0);this.setSeconds(0);this.setMinutes(0);this.setHours(0);return this});b("asString",function(){var c=Date.format;return c.split("yyyy").join(this.getFullYear()).split("yy").join((this.getFullYear()+"").substring(2)).split("mmm").join(this.getMonthName(true)).split("mm").join(a(this.getMonth()+1)).split("dd").join(a(this.getDate()))});Date.fromString=function(g){var h=Date.format;var k=new Date("01/01/1977");var l=h.indexOf("yyyy");if(l>-1){k.setFullYear(Number(g.substr(l,4)))}else{k.setFullYear(Number(Date.fullYearStart+g.substr(h.indexOf("yy"),2)))}var c=h.indexOf("mmm");if(c>-1){var j=g.substr(c,3);for(var e=0;e<Date.abbrMonthNames.length;e++){if(Date.abbrMonthNames[e]==j){break}}k.setMonth(e)}else{k.setMonth(Number(g.substr(h.indexOf("mm"),2))-1)}k.setDate(Number(g.substr(h.indexOf("dd"),2)));if(isNaN(k.getTime())){return false}return k};var a=function(c){var d="0"+c;return d.substring(d.length-2)}})();