// swfobject
if(typeof deconcept=="undefined"){var deconcept=new Object();}if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params=new Object();this.variables=new Object();this.attributes=new Array();if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){deconcept.SWFObject.doPrepUnload=true;}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10];},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15];},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=new Array();var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+this.getAttribute("style")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(deconcept.SWFObject.doPrepUnload){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;

/*
 * jqModal - Minimalist Modaling with jQuery
 *
 * Copyright (c) 2007 Brice Burgess <bhb@iceburg.net>, http://www.iceburg.net
 * Licensed under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 * 
 * $Version: 2007.08.17 +r11
 * 
 */
(function($) {
$.fn.jqm=function(o){
var _o = {
zIndex: 3000,
overlay: 50,
overlayClass: 'jqmOverlay',
closeClass: 'jqmClose',
trigger: '.jqModal',
ajax: false,
target: false,
modal: false,
toTop: false,
onShow: false,
onHide: false,
onLoad: false
};
return this.each(function(){if(this._jqm)return; s++; this._jqm=s;
H[s]={c:$.extend(_o, o),a:false,w:$(this).addClass('jqmID'+s),s:s};
if(_o.trigger)$(this).jqmAddTrigger(_o.trigger);
});};

$.fn.jqmAddClose=function(e){hs(this,e,'jqmHide'); return this;};
$.fn.jqmAddTrigger=function(e){hs(this,e,'jqmShow'); return this;};
$.fn.jqmShow=function(t){return this.each(function(){if(!H[this._jqm].a)$.jqm.open(this._jqm,t)});};
$.fn.jqmHide=function(t){return this.each(function(){if(H[this._jqm].a)$.jqm.close(this._jqm,t)});};

$.jqm = {
hash:{},
open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(/^\d+$/.test(h.w.css('z-index')))?h.w.css('z-index'):c.zIndex,o=$('<div></div>').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});h.t=t;h.a=true;h.w.css('z-index',z);
 if(c.modal) {if(!A[0])F('bind');A.push(s);o.css('cursor','wait');}
 else if(c.overlay > 0)h.w.jqmAddClose(o);
 else o=false;

 h.o=(o)?o.addClass(c.overlayClass).prependTo('body'):false;
 if(ie6){$('html,body').css({height:'100%',width:'100%'});if(o){o=o.css({position:'absolute'})[0];for(var y in {Top:1,Left:1})o.style.setExpression(y.toLowerCase(),"(_=(document.documentElement.scroll"+y+" || document.body.scroll"+y+"))+'px'");}}

 if(c.ajax) {var r=c.target||h.w,u=c.ajax,r=(typeof r == 'string')?$(r,h.w):$(r),u=(u.substr(0,1) == '@')?$(t).attr(u.substring(1)):u;
  r.load(u,function(){if(c.onLoad)c.onLoad.call(this,h);if(cc)h.w.jqmAddClose($(cc,h.w));e(h);});}
 else if(cc)h.w.jqmAddClose($(cc,h.w));

 if(c.toTop&&h.o)h.w.before('<span id="jqmP'+h.w[0]._jqm+'"></span>').insertAfter(h.o);	
 (c.onShow)?c.onShow(h):h.w.show();e(h);return false;
},
close:function(s){var h=H[s];h.a=false;
 if(A[0]){A.pop();if(!A[0])F('unbind');}
 if(h.c.toTop&&h.o)$('#jqmP'+h.w[0]._jqm).after(h.w).remove();
 if(h.c.onHide)h.c.onHide(h);else{h.w.hide();if(h.o)h.o.remove();} return false;
}};
var s=0,H=$.jqm.hash,A=[],ie6=$.browser.msie&&($.browser.version == "6.0"),
i=$('<iframe src="javascript:false;document.write(\'\');" class="jqm"></iframe>').css({opacity:0}),
e=function(h){if(ie6)if(h.o)h.o.html('<p style="width:100%;height:100%"/>').prepend(i);else if(!$('iframe.jqm',h.w)[0])h.w.prepend(i); f(h);},
f=function(h){try{$(':input:visible',h.w)[0].focus();}catch(e){}},
F=function(t){$()[t]("keypress",m)[t]("keydown",m)[t]("mousedown",m);},
m=function(e){var h=H[A[A.length-1]],r=(!$(e.target).parents('.jqmID'+h.s)[0]);if(r)f(h);return !r;},
hs=function(w,e,y){var s=[];w.each(function(){s.push(this._jqm)});
 $(e).each(function(){if(this[y])$.extend(this[y],s);else{this[y]=s;$(this).click(function(){for(var i in {jqmShow:1,jqmHide:1})for(var s in this[i])if(H[this[i][s]])H[this[i][s]].w[i](this);return false;});}});};
})(jQuery);








eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(5($){$.8.V=5(r){2(!3.F){Q(\'V: 3d D 3e - 3f 3g 1C\');6 3}2(O r==\'5\')r={N:r};r=$.1X({1h:3.S(\'1l\')||18.3b.3h(),E:3.S(\'29\')||\'28\'},r||{});4 u={};3.J(\'9-26-23\',[3,r,u]);2(u.1N){Q(\'V: D 1J 1D 9-26-23 J\');6 3}4 a=3.1E(r.3j);2(r.P){r.1g=r.P;H(4 n 2f r.P)a.B({7:n,z:r.P[n]})}2(r.1F&&r.1F(a,3,r)===I){Q(\'V: D 3k 1D 1F 3l\');6 3}3.J(\'9-D-2u\',[a,3,r,u]);2(u.1N){Q(\'V: D 1J 1D 9-D-2u J\');6 3}4 q=$.1z(a);2(r.E.3m()==\'28\'){r.1h+=(r.1h.3n(\'?\')>=0?\'&\':\'?\')+q;r.P=A}C r.P=q;4 v=3,R=[];2(r.1A)R.B(5(){v.1A()});2(r.1x)R.B(5(){v.1x()});2(!r.11&&r.15){4 w=r.N||5(){};R.B(5(a){$(r.15).3c(a).K(w,2p)})}C 2(r.N)R.B(r.N);r.N=5(a,b){H(4 i=0,G=R.F;i<G;i++)R[i](a,b,v)};4 x=$(\'12:3a\',3).Y();4 y=I;H(4 j=0;j<x.F;j++)2(x[j])y=X;2(r.2g||y){2($.1d.33&&r.2h)$.39(r.2h,1B);C 1B()}C $.2Y(r);3.J(\'9-D-2Z\',[3,r]);6 3;5 1B(){4 i=v[0];4 j=$.1X({},$.30,r);4 k=\'31\'+(1w 2W().32());4 l=$(\'<2g 34="\'+k+\'" 7="\'+k+\'" />\');4 m=l[0];2($.1d.2o||$.1d.2n)m.35=\'36:I;1p.37("");\';l.38({3o:\'3i\',2k:\'-2i\',2c:\'-2i\'});4 o={14:A,1a:A,3p:0,3N:\'n/a\',3s:5(){},2e:5(){},3I:5(){}};4 g=j.3J;2(g&&!$.2r++)$.19.J("3K");2(g)$.19.J("2V",[o,j]);4 p=0;4 q=0;1c(5(){4 t=v.S(\'15\'),a=v.S(\'1l\');v.S({15:k,3L:\'2s/9-P\',3G:\'2s/9-P\',29:\'3M\',1l:j.1h});2(j.1s)1c(5(){q=X;T()},j.1s);4 b=[];2t{2(r.1g)H(4 n 2f r.1g)b.B($(\'<12 E="3O" 7="\'+n+\'" z="\'+r.1g[n]+\'" />\').2d(i)[0]);l.2d(\'1f\');m.25?m.25(\'2a\',T):m.3P(\'1Q\',T,I);i.D()}3Q{v.S(\'1l\',a);t?v.S(\'15\',t):v.3R(\'15\');$(b).1P()}},10);5 T(){2(p++)6;m.1O?m.1O(\'2a\',T):m.3S(\'1Q\',T,I);4 c=0;4 d=X;2t{2(q)3H\'1s\';4 f,M;M=m.1K?m.1K.1p:m.1R?m.1R:m.1p;2(M.1f==A&&!c&&$.1d.2n){c=1;p--;1c(T,22);6}o.14=M.1f?M.1f.3F:A;o.1a=M.1S?M.1S:M;o.2e=5(a){4 b={\'3y-E\':j.11};6 b[a]};2(j.11==\'3E\'||j.11==\'3t\'){4 h=M.1n(\'1v\')[0];o.14=h?h.z:o.14}C 2(j.11==\'24\'&&!o.1a&&o.14!=A){o.1a=27(o.14)}f=$.3u(o,j.11)}3v(e){d=I;$.3w(j,o,\'20\',e)}2(d){j.N(f,\'N\');2(g)$.19.J("3r",[o,j])}2(g)$.19.J("3x",[o,j]);2(g&&!--$.2r)$.19.J("3z");2(j.1T)j.1T(o,d?\'N\':\'20\');1c(5(){l.1P();o.1a=A},22)};5 27(s,a){2(18.1W){a=1w 1W(\'3A.3B\');a.3C=\'I\';a.3D(s)}C a=(1w 2X()).3q(s,\'1H/24\');6(a&&a.2q&&a.2q.1k!=\'2E\')?a:A}}};$.8.2D=5(c){6 3.1Z().1Y(\'D.9-1m\',5(){$(3).V(c);6 I}).K(5(){$(":D,12:16",3).1Y(\'1V.9-1m\',5(e){4 a=3.9;a.W=3;2(3.E==\'16\'){2(e.21!=U){a.13=e.21;a.17=e.2N}C 2(O $.8.1U==\'5\'){4 b=$(3).1U();a.13=e.1M-b.2c;a.17=e.1L-b.2k}C{a.13=e.1M-3.2H;a.17=e.1L-3.2w}}1c(5(){a.W=a.13=a.17=A},10)})})};$.8.1Z=5(){3.2b(\'D.9-1m\');6 3.K(5(){$(":D,12:16",3).2b(\'1V.9-1m\')})};$.8.1E=5(b){4 a=[];2(3.F==0)6 a;4 c=3[0];4 d=b?c.1n(\'*\'):c.2C;2(!d)6 a;H(4 i=0,G=d.F;i<G;i++){4 e=d[i];4 n=e.7;2(!n)1u;2(b&&c.W&&e.E=="16"){2(!e.1j&&c.W==e)a.B({7:n+\'.x\',z:c.13},{7:n+\'.y\',z:c.17});1u}4 v=$.Y(e,X);2(v&&v.1i==1b){H(4 j=0,2j=v.F;j<2j;j++)a.B({7:n,z:v[j]})}C 2(v!==A&&O v!=\'U\')a.B({7:n,z:v})}2(!b&&c.W){4 f=c.1n("12");H(4 i=0,G=f.F;i<G;i++){4 g=f[i];4 n=g.7;2(n&&!g.1j&&g.E=="16"&&c.W==g)a.B({7:n+\'.x\',z:c.13},{7:n+\'.y\',z:c.17})}}6 a};$.8.2K=5(a){6 $.1z(3.1E(a))};$.8.2M=5(b){4 a=[];3.K(5(){4 n=3.7;2(!n)6;4 v=$.Y(3,b);2(v&&v.1i==1b){H(4 i=0,G=v.F;i<G;i++)a.B({7:n,z:v[i]})}C 2(v!==A&&O v!=\'U\')a.B({7:3.7,z:v})});6 $.1z(a)};$.8.Y=5(a){H(4 b=[],i=0,G=3.F;i<G;i++){4 c=3[i];4 v=$.Y(c,a);2(v===A||O v==\'U\'||(v.1i==1b&&!v.F))1u;v.1i==1b?$.2I(b,v):b.B(v)}6 b};$.Y=5(b,c){4 n=b.7,t=b.E,Z=b.1k.1t();2(O c==\'U\')c=X;2(c&&(!n||b.1j||t==\'1e\'||t==\'2P\'||(t==\'1r\'||t==\'1q\')&&!b.1o||(t==\'D\'||t==\'16\')&&b.9&&b.9.W!=b||Z==\'L\'&&b.1G==-1))6 A;2(Z==\'L\'){4 d=b.1G;2(d<0)6 A;4 a=[],1y=b.2B;4 e=(t==\'L-2m\');4 f=(e?d+1:1y.F);H(4 i=(e?d:0);i<f;i++){4 g=1y[i];2(g.1C){4 v=$.1d.2o&&!(g.2G[\'z\'].2A)?g.1H:g.z;2(e)6 v;a.B(v)}}6 a}6 b.z};$.8.1x=5(){6 3.K(5(){$(\'12,L,1v\',3).2l()})};$.8.2l=$.8.2R=5(){6 3.K(5(){4 t=3.E,Z=3.1k.1t();2(t==\'1H\'||t==\'2U\'||Z==\'1v\')3.z=\'\';C 2(t==\'1r\'||t==\'1q\')3.1o=I;C 2(Z==\'L\')3.1G=-1})};$.8.1A=5(){6 3.K(5(){2(O 3.1e==\'5\'||(O 3.1e==\'2J\'&&!3.1e.2L))3.1e()})};$.8.2O=5(b){2(b==U)b=X;6 3.K(5(){3.1j=!b})};$.8.L=5(b){2(b==U)b=X;6 3.K(5(){4 t=3.E;2(t==\'1r\'||t==\'1q\')3.1o=b;C 2(3.1k.1t()==\'2v\'){4 a=$(3).2T(\'L\');2(b&&a[0]&&a[0].E==\'L-2m\'){a.2Q(\'2v\').L(I)}3.1C=b}})};5 Q(){2($.8.V.2S&&18.1I&&18.1I.Q)18.1I.Q(\'[2x.9] \'+1b.2y.2z.2F(2p,\'\'))}})(3T);',62,242,'||if|this|var|function|return|name|fn|form||||||||||||||||||||||||||value|null|push|else|submit|type|length|max|for|false|trigger|each|select|doc|success|typeof|data|log|callbacks|attr|cb|undefined|ajaxSubmit|clk|true|fieldValue|tag||dataType|input|clk_x|responseText|target|image|clk_y|window|event|responseXML|Array|setTimeout|browser|reset|body|extraData|url|constructor|disabled|tagName|action|plugin|getElementsByTagName|checked|document|radio|checkbox|timeout|toLowerCase|continue|textarea|new|clearForm|ops|param|resetForm|fileUpload|selected|via|formToArray|beforeSubmit|selectedIndex|text|console|vetoed|contentWindow|pageY|pageX|veto|detachEvent|remove|load|contentDocument|XMLDocument|complete|offset|click|ActiveXObject|extend|bind|ajaxFormUnbind|error|offsetX|100|serialize|xml|attachEvent|pre|toXml|GET|method|onload|unbind|left|appendTo|getResponseHeader|in|iframe|closeKeepAlive|1000px|jmax|top|clearFields|one|opera|msie|arguments|documentElement|active|multipart|try|validate|option|offsetTop|jquery|prototype|join|specified|options|elements|ajaxForm|parsererror|call|attributes|offsetLeft|merge|object|formSerialize|nodeType|fieldSerialize|offsetY|enable|button|find|clearInputs|debug|parent|password|ajaxSend|Date|DOMParser|ajax|notify|ajaxSettings|jqFormIO|getTime|safari|id|src|javascript|write|css|get|file|location|html|skipping|process|no|element|toString|absolute|semantic|aborted|callback|toUpperCase|indexOf|position|status|parseFromString|ajaxSuccess|getAllResponseHeaders|script|httpData|catch|handleError|ajaxComplete|content|ajaxStop|Microsoft|XMLDOM|async|loadXML|json|innerHTML|enctype|throw|setRequestHeader|global|ajaxStart|encoding|POST|statusText|hidden|addEventListener|finally|removeAttr|removeEventListener|jQuery'.split('|'),0,{}))
	
	
	
	
	
	
	
	
// bbCode control by
// subBlue design
// www.subBlue.com

// Startup variables
var imageTag = false;
var theSelection = false;

// Check for Browser & Platform for PC & IE specific bits
// More details from: http://www.mozilla.org/docs/web-developer/sniffer/browser_type.html
var clientPC = navigator.userAgent.toLowerCase(); // Get client info
var clientVer = parseInt(navigator.appVersion); // Get browser version

var is_ie = ((clientPC.indexOf("msie") != -1) && (clientPC.indexOf("opera") == -1));
var is_nav = ((clientPC.indexOf('mozilla')!=-1) && (clientPC.indexOf('spoofer')==-1)
                && (clientPC.indexOf('compatible') == -1) && (clientPC.indexOf('opera')==-1)
                && (clientPC.indexOf('webtv')==-1) && (clientPC.indexOf('hotjava')==-1));
var is_moz = 0;

var is_win = ((clientPC.indexOf("win")!=-1) || (clientPC.indexOf("16bit") != -1));
var is_mac = (clientPC.indexOf("mac")!=-1);

// Helpline messages
b_help = "Жирный текст: [b]текст[/b]  (alt+b)";
i_help = "Наклонный текст: [i]текст[/i]  (alt+i)";
u_help = "Подчёркнутый текст: [u]текст[/u]  (alt+u)";
q_help = "Цитата: [quote]текст[/quote]  (alt+q)";
c_help = "Код (программа): [code]код[/code]  (alt+c)";
l_help = "Список: [list]текст[/list] (alt+l)";
o_help = "Нумерованный список: [list=]текст[/list]  (alt+o)";
p_help = "Вставить картинку: [img]http://image_url[/img]  (alt+p)";
w_help = "Вставить ссылку: [url]http://url[/url] или [url=http://url]текст ссылки[/url]  (alt+w)";
a_help = "Закрыть все открытые теги bbCode";
s_help = "Цвет шрифта: [color=red]текст[/color]  Подсказка: можно использовать color=#FF0000";
f_help = "Размер шрифта: [size=x-small]маленький текст[/size]";
qs_help = "Процитировать выделенный текст";
cn_help = "Центрировать выделенный текст";
t_help = "Транслит (alt+t) - выделите и нажмите";

// Define the bbCode tags
bbcode = new Array();
bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[quote]','[/quote]','[code]','[/code]','[list]','[/list]','[list=]','[/list]','[img]','[/img]','[url]','[/url]','[center]','[/center]');
imageTag = false;

// Shows the help messages in the helpline window
function helpline(help) {
	document.post.helpbox.value = eval(help + "_help");
}

function helpclear(){
    document.post.helpbox.value ="Р_Р_Р_С_РєР°Р·РєР°: Р_Р_РР_Р_ Р+С<С_С'С_Р_ РїС_РёР_РчР_РёС'С_ С_С'РёР>Рё Рє Р_С<Р_РчР>РчР_Р_Р_Р_С_ С'РчРєС_С'С_";
}

// Replacement for arrayname.length property
function getarraysize(thearray) {
	for (i = 0; i < thearray.length; i++) {
		if ((thearray[i] == "undefined") || (thearray[i] == "") || (thearray[i] == null))
			return i;
		}
	return thearray.length;
}

// Replacement for arrayname.push(value) not implemented in IE until version 5.5
// Appends element to the array
function arraypush(thearray,value) {
	thearray[ getarraysize(thearray) ] = value;
}

// Replacement for arrayname.pop() not implemented in IE until version 5.5
// Removes and returns the last element of an array
function arraypop(thearray) {
	thearraysize = getarraysize(thearray);
	retval = thearray[thearraysize - 1];
	delete thearray[thearraysize - 1];
	return retval;
}


function checkForm() {

	formErrors = false;

	if (document.post.tex.value.length < 2) {
		formErrors = "Р'С< Р_Р_Р>РР_С< Р_Р_РчС_С'Рё С'РчРєС_С' С_Р_Р_Р+С%РчР_РёС_";
	}

	if (formErrors) {
		alert(formErrors);
		return false;
	} else {
		bbstyle(-1);
		//formObj.preview.disabled = true;
		//formObj.submit.disabled = true;
		return true;
	}
}

function emoticon(text) {
	var txtarea = document.post.tex;
	text = ' ' + text + ' ';
	if (txtarea.createTextRange && txtarea.caretPos) {
		var caretPos = txtarea.caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
		txtarea.focus();
	} else {
		txtarea.value  += text;
		txtarea.focus();
	}
}

function bbfontstyle(bbopen, bbclose) {
	var txtarea = document.post.tex;

	if ((clientVer >= 4) && is_ie && is_win) {
		theSelection = document.selection.createRange().text;
		if (!theSelection) {
			txtarea.value += bbopen + bbclose;
			txtarea.focus();
			return;
		}
		document.selection.createRange().text = bbopen + theSelection + bbclose;
		txtarea.focus();
		return;
	}
	else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
	{
		mozWrap(txtarea, bbopen, bbclose);
		return;
	}
	else
	{
		txtarea.value += bbopen + bbclose;
		txtarea.focus();
	}
	storeCaret(txtarea);
}


function bbstyle(bbnumber) {
	var txtarea = document.post.tex;

	donotinsert = false;
	theSelection = false;
	bblast = 0;

	if (bbnumber == -1) { // Close all open tags & default button names
		while (bbcode[0]) {
			butnumber = arraypop(bbcode) - 1;
			txtarea.value += bbtags[butnumber + 1];
			buttext = eval('document.post.addbbcode' + butnumber + '.value');
			eval('document.post.addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
		}
		imageTag = false; // All tags are closed including image tags :D
		txtarea.focus();
		return;
	}

	if ((clientVer >= 4) && is_ie && is_win)
	{
		theSelection = document.selection.createRange().text; // Get text selection
		if (theSelection) {
			// Add tags around selection
			document.selection.createRange().text = bbtags[bbnumber] + theSelection + bbtags[bbnumber+1];
			txtarea.focus();
			theSelection = '';
			return;
		}
	}
	else if (txtarea.selectionEnd && (txtarea.selectionEnd - txtarea.selectionStart > 0))
	{
		mozWrap(txtarea, bbtags[bbnumber], bbtags[bbnumber+1]);
		return;
	}

	// Find last occurance of an open tag the same as the one just clicked
	for (i = 0; i < bbcode.length; i++) {
		if (bbcode[i] == bbnumber+1) {
			bblast = i;
			donotinsert = true;
		}
	}

	if (donotinsert) {		// Close all open tags up to the one just clicked & default button names
		while (bbcode[bblast]) {
				butnumber = arraypop(bbcode) - 1;
				txtarea.value += bbtags[butnumber + 1];
				buttext = eval('document.post.addbbcode' + butnumber + '.value');
				eval('document.post.addbbcode' + butnumber + '.value ="' + buttext.substr(0,(buttext.length - 1)) + '"');
				imageTag = false;
			}
			txtarea.focus();
			return;
	} else { // Open tags

		if (imageTag && (bbnumber != 14)) {		// Close image tag before adding another
			txtarea.value += bbtags[15];
			lastValue = arraypop(bbcode) - 1;	// Remove the close image tag from the list
			document.post.addbbcode14.value = "Img";	// Return button back to normal state
			imageTag = false;
		}

		// Open tag
		txtarea.value += bbtags[bbnumber];
		if ((bbnumber == 14) && (imageTag == false)) imageTag = 1; // Check to stop additional tags after an unclosed image tag
		arraypush(bbcode,bbnumber+1);
		eval('document.post.addbbcode'+bbnumber+'.value += "*"');
		txtarea.focus();
		return;
	}
	storeCaret(txtarea);
}

// From http://www.massless.org/mozedit/
function mozWrap(txtarea, open, close)
{
	var selLength = txtarea.textLength;
	var selStart = txtarea.selectionStart;
	var selEnd = txtarea.selectionEnd;
	if (selEnd == 1 || selEnd == 2)
		selEnd = selLength;

	var s1 = (txtarea.value).substring(0,selStart);
	var s2 = (txtarea.value).substring(selStart, selEnd)
	var s3 = (txtarea.value).substring(selEnd, selLength);
	txtarea.value = s1 + open + s2 + close + s3;
	return;
}

// Insert at Claret position. Code from
// http://www.faqts.com/knowledge_base/view.phtml/aid/1052/fid/130
function storeCaret(textEl) {
	if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}

var selection = false; // Selection data


l_empty_message = "Р'С< Р_Р_Р>РР_С< Р_Р_РчС_С'Рё С'РчРєС_С' С_Р_Р_Р+С%РчР_РёС_";
l_no_text_selected = "Р'С<Р_РчР>РёС'Рч С'РчРєС_С' Р_Р° С_С'С_Р°Р_РёС┼Рч Рё РїР_РїС_Р_Р+С_Р№С'Рч РчС%Рч С_Р°Р·";




// Catching selection
function catchSelection()
{
	if (window.getSelection)
	{
		selection = window.getSelection().toString();
	}
	else if (document.getSelection)
	{
		selection = document.getSelection();
	}
	else if (document.selection)
	{
		selection = document.selection.createRange().text;
	}
}


// Putting selection to the post box
function quoteSelection()
{
	if (selection)
	{
		emoticon_wospaces('[quote=]' + selection + '[/quote]\n');
		selection = '';
		document.post.message.focus();
		return;
	}
	else
	{
		alert(l_no_text_selected);
		return;
	}
}

function emoticon_wospaces(text) {
	var txtarea = document.post.message;
	if (txtarea.createTextRange && txtarea.caretPos) {
		var caretPos = txtarea.caretPos;
		caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
		txtarea.focus();
	} else {
		txtarea.value  += text;
		txtarea.focus();
	}
}
        
//

// Функции перевода транслита в нормальный русский язык добавлена 01/01/2002 Андреем Мазлиным
//
var lat = new Array("je","jo","ayu","ay","aj","oju","oje","oja","oj","uj","yi","ya","ja","ju","yu","ja","juju","aja","y","zh","i'","shch","sch","ch","sh","ea","a","b","v","w","g","d","e","z","i","k","l","m","n","o","p","r","s","t","u","f","x","c","ea","'e","'","`","j","h");
var cyr = new Array("э","ё","aю","ай","ай","ою","ое","оя","ой","уй","ый","я","я","ю","ю","я","юю","ая","ы","ж","й","щ","щ","ч","ш","э","а","б","в","в","г","д","е","з","и","к","л","м","н","о","п","р","с","т","у","ф","х","ц","э","э","ь","ъ","й","х");

var latcap = new Array("Yo","Jo","Ey","Je","Ay","Oy","Oj","Uy","Uj","Ya","Ja","Ju","Yu","Ja","Y","Zh","I'","Sch","Ch","Sh","Ea","Tz","A","B","V","W","G","D","E","Z","I","K","L","M","N","O","P","R","S","T","U","F","X","C","EA","J","H");
var cyrcap = new Array("Ё","Ё","Ей","Э","Ай","Ой","Ой","Уй","Уй","Я","Я","Ю","Ю","Я","Ы","Ж","Й","Щ","Ч","Ш","Э","Ц","А","Б","В","В","Г","Д","Е","З","И","К","Л","М","Н","О","П","Р","С","Т","У","Ф","Х","Ц","Э","Й","Х");

function translit()
{
	var buf = new String;
	var selection = false;
	var txtarea = document.post.tex;
	var regexp;
	var i;
	
	if (document.selection)
	{
		selection = document.selection.createRange().text;
	}
	
	if (selection)
	{
		buf = selection;
	}
	else
	{
		buf = txtarea.value;
	}
	
	for (i = 0; i < latcap.length; i++)
	{
		eval('regexp = /'+latcap[i]+'/g');
		buf = buf.replace(regexp, cyrcap[i]);
	}
	
	for (i = 0; i < lat.length; i++)
	{
		eval('regexp = /'+lat[i]+'/g');
		buf = buf.replace(regexp, cyr[i]);
	}

	if (selection)
	{
		eval('regexp = /'+selection+'/');
		txtarea.value = txtarea.value.replace(regexp, buf);
	}
	else
	{
		txtarea.value = buf;
	}
	
	selection = '';
	
	txtarea.focus();

	return;
}        






$(document).ready(function() {
    $('#saveBbForm').click(function() {
				if($('#new_foto').val()=='') {alert('Выберите картинку');return;}
        $(this).val("отправка данных на сервер").attr('disabled','disabled');
        $("#imageBbForm").ajaxSubmit(function(data){
				    
					  data = data.replace('<pre>','');
						data = data.replace('</pre>','');
						data = data.replace('<PRE>','');
						data = data.replace('</PRE>','');
						data = data.replace(/&amp;/g,'&');
						data = data.replace(/&gt;/g,'>');
						data = data.replace(/&lt;/g,'<');
						data = data.replace(/&quot;/g,'\\"');
						data = data.replace('\?','\"');
						data = data.replace(/'/g,'');
						data = data.replace(/\r/g,'');
						data = data.replace(/\n/g,'');
						
						data = eval(data);
						if(data.status=='ok')
						{
							var cont = data.content;
            	$("#imageBbResult").prepend(cont);
						}
						else
						{
							alert(data.content);
						}
           $('#saveBbForm').val("Добавить картинку").attr('disabled','');
            $('#new_foto').val("");
         });
        return false;
    });

});

function f1(x)
{
 x.focus();
 x.select();
};

function delBbImgItem(fn)
{
	$.get("/ajax/bb/delete", { num: fn },
		function(data){
			if(data=='ok') 
			{
				var str = $('#bbimgcode'+fn).val();
				if(str.length>4)
				{
					var tex = $('#tex_id').val();
			    tex = tex.replace(str, '');
					$('#tex_id').val(tex);
				}
				$('#bbimgitem'+fn).replaceWith('');
			}
			return;
	});
	return false;
}	







(function($) {
  $.facebox = function(data, klass) {
    $.facebox.loading()

    if (data.ajax) fillFaceboxFromAjax(data.ajax)
    else if (data.image) fillFaceboxFromImage(data.image)
    else if (data.div) fillFaceboxFromHref(data.div)
    else if ($.isFunction(data)) data.call($)
    else $.facebox.reveal(data, klass)
  }

  /*
   * Public, $.facebox methods
   */

  $.extend($.facebox, {
    settings: {
      opacity      : 0,
      overlay      : false,
      loadingImage : '/i/facebox/loading.gif',
      closeImage   : '/i/facebox/closelabel.gif',
      imageTypes   : [ 'png', 'jpg', 'jpeg', 'gif' ],
      faceboxHtml  : '\
    <div id="facebox" style="display:none;"> \
      <div class="popup"> \
        <table> \
          <tbody> \
            <tr> \
              <td class="tl"/><td class="b"/><td class="tr"/> \
            </tr> \
            <tr> \
              <td class="b"/> \
              <td class="body"> \
                <div class="content"> \
                </div> \
                <div class="footer"> \
                  <a href="#" class="close"> \
                    <img src="/i/facebox/closelabel.gif" title="close" class="close_image" /> \
                  </a> \
                </div> \
              </td> \
              <td class="b"/> \
            </tr> \
            <tr> \
              <td class="bl"/><td class="b"/><td class="br"/> \
            </tr> \
          </tbody> \
        </table> \
      </div> \
    </div>'
    },

    loading: function() {
      init()
      if ($('#facebox .loading').length == 1) return true
      showOverlay()

      $('#facebox .content').empty()
      $('#facebox .body').children().hide().end().
        append('<div class="loading"><img src="'+$.facebox.settings.loadingImage+'"/></div>')

      $('#facebox').css({
        top:	getPageScroll()[1] + (getPageHeight() / 10),
        left:	385.5
      }).show()

      $(document).bind('keydown.facebox', function(e) {
        if (e.keyCode == 27) $.facebox.close()
        return true
      })
      $(document).trigger('loading.facebox')
    },

    reveal: function(data, klass) {
      $(document).trigger('beforeReveal.facebox')
      if (klass) $('#facebox .content').addClass(klass)
      $('#facebox .content').append(data)
      $('#facebox .loading').remove()
      $('#facebox .body').children().fadeIn('normal')
      $('#facebox').css('left', $(window).width() / 2 - ($('#facebox table').width() / 2))
      $(document).trigger('reveal.facebox').trigger('afterReveal.facebox')
    },

    close: function() {
      $(document).trigger('close.facebox')
      return false
    }
  })

  /*
   * Public, $.fn methods
   */

  $.fn.facebox = function(settings) {
    init(settings)

    function clickHandler() {
      $.facebox.loading(true)

      // support for rel="facebox.inline_popup" syntax, to add a class
      // also supports deprecated "facebox[.inline_popup]" syntax
      var klass = this.rel.match(/facebox\[?\.(\w+)\]?/)
      if (klass) klass = klass[1]

      fillFaceboxFromHref(this.href, klass)
      return false
    }

    return this.click(clickHandler)
  }

  /*
   * Private methods
   */

  // called one time to setup facebox on this page
  function init(settings) {
    if ($.facebox.settings.inited) return true
    else $.facebox.settings.inited = true

    $(document).trigger('init.facebox')
    makeCompatible()

    var imageTypes = $.facebox.settings.imageTypes.join('|')
    $.facebox.settings.imageTypesRegexp = new RegExp('\.' + imageTypes + '$', 'i')

    if (settings) $.extend($.facebox.settings, settings)
    $('body').append($.facebox.settings.faceboxHtml)

    var preload = [ new Image(), new Image() ]
    preload[0].src = $.facebox.settings.closeImage
    preload[1].src = $.facebox.settings.loadingImage

    $('#facebox').find('.b:first, .bl, .br, .tl, .tr').each(function() {
      preload.push(new Image())
      preload.slice(-1).src = $(this).css('background-image').replace(/url\((.+)\)/, '$1')
    })

    $('#facebox .close').click($.facebox.close)
    $('#facebox .close_image').attr('src', $.facebox.settings.closeImage)
  }
  
  // getPageScroll() by quirksmode.com
  function getPageScroll() {
    var xScroll, yScroll;
    if (self.pageYOffset) {
      yScroll = self.pageYOffset;
      xScroll = self.pageXOffset;
    } else if (document.documentElement && document.documentElement.scrollTop) {	 // Explorer 6 Strict
      yScroll = document.documentElement.scrollTop;
      xScroll = document.documentElement.scrollLeft;
    } else if (document.body) {// all other Explorers
      yScroll = document.body.scrollTop;
      xScroll = document.body.scrollLeft;	
    }
    return new Array(xScroll,yScroll) 
  }

  // Adapted from getPageSize() by quirksmode.com
  function getPageHeight() {
    var windowHeight
    if (self.innerHeight) {	// all except Explorer
      windowHeight = self.innerHeight;
    } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
      windowHeight = document.documentElement.clientHeight;
    } else if (document.body) { // other Explorers
      windowHeight = document.body.clientHeight;
    }	
    return windowHeight
  }

  // Backwards compatibility
  function makeCompatible() {
    var $s = $.facebox.settings

    $s.loadingImage = $s.loading_image || $s.loadingImage
    $s.closeImage = $s.close_image || $s.closeImage
    $s.imageTypes = $s.image_types || $s.imageTypes
    $s.faceboxHtml = $s.facebox_html || $s.faceboxHtml
  }

  // Figures out what you want to display and displays it
  // formats are:
  //     div: #id
  //   image: blah.extension
  //    ajax: anything else
  function fillFaceboxFromHref(href, klass) {
    // div
    if (href.match(/#/)) {
      var url    = window.location.href.split('#')[0]
      var target = href.replace(url,'')
      $.facebox.reveal($(target).clone().show(), klass)

    // image
    } else if (href.match($.facebox.settings.imageTypesRegexp)) {
      fillFaceboxFromImage(href, klass)
    // ajax
    } else {
      fillFaceboxFromAjax(href, klass)
    }
  }

  function fillFaceboxFromImage(href, klass) {
    var image = new Image()
    image.onload = function() {
      $.facebox.reveal('<div class="image"><img src="' + image.src + '" /></div>', klass)
    }
    image.src = href
  }

  function fillFaceboxFromAjax(href, klass) {
    $.get(href, function(data) { $.facebox.reveal(data, klass) })
  }

  function skipOverlay() {
    return $.facebox.settings.overlay == false || $.facebox.settings.opacity === null 
  }

  function showOverlay() {
    if (skipOverlay()) return

    if ($('facebox_overlay').length == 0) 
      $("body").append('<div id="facebox_overlay" class="facebox_hide"></div>')

    $('#facebox_overlay').hide().addClass("facebox_overlayBG")
      .css('opacity', $.facebox.settings.opacity)
      .click(function() { $(document).trigger('close.facebox') })
      .fadeIn(200)
    return false
  }

  function hideOverlay() {
    if (skipOverlay()) return

    $('#facebox_overlay').fadeOut(200, function(){
      $("#facebox_overlay").removeClass("facebox_overlayBG")
      $("#facebox_overlay").addClass("facebox_hide") 
      $("#facebox_overlay").remove()
    })
    
    return false
  }

  /*
   * Bindings
   */

  $(document).bind('close.facebox', function() {
    $(document).unbind('keydown.facebox')
    $('#facebox').fadeOut(function() {
      $('#facebox .content').removeClass().addClass('content')
      hideOverlay()
      $('#facebox .loading').remove()
    })
  })

})(jQuery);























jQuery.autocomplete = function(input, options) {
// Create a link to self
var me = this;

// Create jQuery object for input element
var $input = $(input).attr("autocomplete", "off");

// Apply inputClass if necessary
if (options.inputClass) {
$input.addClass(options.inputClass);
}

// Create results
var results = document.createElement("div");

// Create jQuery object for results
// var $results = $(results);
var $results = $(results).hide().addClass(options.resultsClass).css("position", "absolute");
if( options.width > 0 ) {
$results.css("width", options.width);
}

// Add to body element
$("body").append(results);

input.autocompleter = me;

var timeout = null;
var prev = "";
var active = -1;
var cache = {};
var keyb = false;
var hasFocus = false;
var lastKeyPressCode = null;
var mouseDownOnSelect = false;
var hidingResults = false;

// flush cache
function flushCache(){
cache = {};
cache.data = {};
cache.length = 0;
};

// flush cache
flushCache();

// if there is a data array supplied
if( options.data != null ){
var sFirstChar = "", stMatchSets = {}, row = [];

// no url was specified, we need to adjust the cache length to make sure it fits the local data store
if( typeof options.url != "string" ) {
options.cacheLength = 1;
}

// loop through the array and create a lookup structure
for( var i=0; i < options.data.length; i++ ){
// if row is a string, make an array otherwise just reference the array
row = ((typeof options.data[i] == "string") ? [options.data[i]] : options.data[i]);

// if the length is zero, don't add to list
if( row[0].length > 0 ){
// get the first character
sFirstChar = row[0].substring(0, 1).toLowerCase();
// if no lookup array for this character exists, look it up now
if( !stMatchSets[sFirstChar] ) stMatchSets[sFirstChar] = [];
// if the match is a string
stMatchSets[sFirstChar].push(row);
}
}

// add the data items to the cache
for( var k in stMatchSets ) {
// increase the cache size
options.cacheLength++;
// add to the cache
addToCache(k, stMatchSets[k]);
}
}

$input
.keydown(function(e) {
// track last key pressed
lastKeyPressCode = e.keyCode;
switch(e.keyCode) {
case 38: // up
e.preventDefault();
moveSelect(-1);
break;
case 40: // down
e.preventDefault();
moveSelect(1);
break;
case 9:  // tab
case 13: // return
if( selectCurrent() ){
// make sure to blur off the current field
$input.get(0).blur();
e.preventDefault();
}
break;
default:
active = -1;
if (timeout) clearTimeout(timeout);
timeout = setTimeout(function(){onChange();}, options.delay);
break;
}
})
.focus(function(){
// track whether the field has focus, we shouldn't process any results if the field no longer has focus
hasFocus = true;
})
.blur(function() {
// track whether the field has focus
hasFocus = false;
if (!mouseDownOnSelect) {
hideResults();
}
});

hideResultsNow();

function onChange() {
// ignore if the following keys are pressed: [del] [shift] [capslock]
if( lastKeyPressCode == 46 || (lastKeyPressCode > 8 && lastKeyPressCode < 32) ) return $results.hide();
var v = $input.val();
if (v == prev) return;
prev = v;
if (v.length >= options.minChars) {
$input.addClass(options.loadingClass);
requestData(v);
} else {
$input.removeClass(options.loadingClass);
$results.hide();
}
};

 function moveSelect(step) {

var lis = $("li", results);
if (!lis) return;

active += step;

if (active < 0) {
active = 0;
} else if (active >= lis.size()) {
active = lis.size() - 1;
}

lis.removeClass("ac_over");

$(lis[active]).addClass("ac_over");

// Weird behaviour in IE
// if (lis[active] && lis[active].scrollIntoView) {
// lis[active].scrollIntoView(false);
// }

};

function selectCurrent() {
var li = $("li.ac_over", results)[0];
if (!li) {
var $li = $("li", results);
if (options.selectOnly) {
if ($li.length == 1) li = $li[0];
} else if (options.selectFirst) {
li = $li[0];
}
}
if (li) {
selectItem(li);
return true;
} else {
return false;
}
};

function selectItem(li) {
if (!li) {
li = document.createElement("li");
li.extra = [];
li.selectValue = "";
}
var v = $.trim(li.selectValue ? li.selectValue : li.innerHTML);
input.lastSelected = v;
prev = v;
$results.html("");
$input.val(v);
hideResultsNow();
if (options.onItemSelect) {
setTimeout(function() { options.onItemSelect(li) }, 1);
}
};

// selects a portion of the input string
function createSelection(start, end){
// get a reference to the input element
var field = $input.get(0);
if( field.createTextRange ){
var selRange = field.createTextRange();
selRange.collapse(true);
selRange.moveStart("character", start);
selRange.moveEnd("character", end);
selRange.select();
} else if( field.setSelectionRange ){
field.setSelectionRange(start, end);
} else {
if( field.selectionStart ){
field.selectionStart = start;
field.selectionEnd = end;
}
}
field.focus();
};

// fills in the input box w/the first match (assumed to be the best match)
function autoFill(sValue){
// if the last user key pressed was backspace, don't autofill
if( lastKeyPressCode != 8 ){
// fill in the value (keep the case the user has typed)
$input.val($input.val() + sValue.substring(prev.length));
// select the portion of the value not typed by the user (so the next character will erase)
createSelection(prev.length, sValue.length);
}
};

function showResults() {
// get the position of the input field right now (in case the DOM is shifted)
var pos = findPos(input);
// either use the specified width, or autocalculate based on form element
var iWidth = (options.width > 0) ? options.width : $input.width();
// reposition
$results.css({
width: parseInt(iWidth) + "px",
top: (pos.y + input.offsetHeight) + "px",
left: pos.x + "px"
}).show();
};

function hideResults() {
if (timeout) clearTimeout(timeout);
timeout = setTimeout(hideResultsNow, 200);
};

function hideResultsNow() {
if (hidingResults) {
return;
}
hidingResults = true;

if (timeout) {
clearTimeout(timeout);
}

var v = $input.removeClass(options.loadingClass).val();

if ($results.is(":visible")) {
$results.hide();
}

if (options.mustMatch) {
if (!input.lastSelected || input.lastSelected != v) {
selectItem(null);
}
}

hidingResults = false;
};

function receiveData(q, data) {
if (data) {
$input.removeClass(options.loadingClass);
results.innerHTML = "";

// if the field no longer has focus or if there are no matches, do not display the drop down
if( !hasFocus || data.length == 0 ) return hideResultsNow();

if ($.browser.msie) {
// we put a styled iframe behind the calendar so HTML SELECT elements don't show through
$results.append(document.createElement('iframe'));
}
results.appendChild(dataToDom(data));
// autofill in the complete box w/the first match as long as the user hasn't entered in more data
if( options.autoFill && ($input.val().toLowerCase() == q.toLowerCase()) ) autoFill(data[0][0]);
showResults();
} else {
hideResultsNow();
}
};

function parseData(data) {
if (!data) return null;
var parsed = [];
var rows = data.split(options.lineSeparator);
for (var i=0; i < rows.length; i++) {
var row = $.trim(rows[i]);
if (row) {
parsed[parsed.length] = row.split(options.cellSeparator);
}
}
return parsed;
};

function dataToDom(data) {
var ul = document.createElement("ul");
var num = data.length;

// limited results to a max number
if( (options.maxItemsToShow > 0) && (options.maxItemsToShow < num) ) num = options.maxItemsToShow;

for (var i=0; i < num; i++) {
var row = data[i];
if (!row) continue;
var li = document.createElement("li");
if (options.formatItem) {
li.innerHTML = options.formatItem(row, i, num);
li.selectValue = row[0];
} else {
li.innerHTML = row[0];
li.selectValue = row[0];
}
var extra = null;
if (row.length > 1) {
extra = [];
for (var j=1; j < row.length; j++) {
extra[extra.length] = row[j];
}
}
li.extra = extra;
ul.appendChild(li);

$(li).hover(
function() { $("li", ul).removeClass("ac_over"); $(this).addClass("ac_over"); active = $("li", ul).indexOf($(this).get(0)); },
function() { $(this).removeClass("ac_over"); }
).click(function(e) { 
e.preventDefault();
e.stopPropagation();
selectItem(this)
});

}
$(ul).mousedown(function() {
mouseDownOnSelect = true;
}).mouseup(function() {
mouseDownOnSelect = false;
});
return ul;
};

function requestData(q) {
if (!options.matchCase) q = q.toLowerCase();
var data = options.cacheLength ? loadFromCache(q) : null;
// recieve the cached data
if (data) {
receiveData(q, data);
// if an AJAX url has been supplied, try loading the data now
} else if( (typeof options.url == "string") && (options.url.length > 0) ){
$.get(makeUrl(q), function(data) {
data = parseData(data);
addToCache(q, data);
receiveData(q, data);
});
// if there's been no data found, remove the loading class
} else {
$input.removeClass(options.loadingClass);
}
};

function makeUrl(q) {
var sep = options.url.indexOf('?') == -1 ? '?' : '&'; 
var url = options.url + sep + "q=" + encodeURI(q);
for (var i in options.extraParams) {
url += "&" + i + "=" + encodeURI(options.extraParams[i]);
}
return url;
};

function loadFromCache(q) {
if (!q) return null;
if (cache.data[q]) return cache.data[q];
if (options.matchSubset) {
for (var i = q.length - 1; i >= options.minChars; i--) {
var qs = q.substr(0, i);
var c = cache.data[qs];
if (c) {
var csub = [];
for (var j = 0; j < c.length; j++) {
var x = c[j];
var x0 = x[0];
if (matchSubset(x0, q)) {
csub[csub.length] = x;
}
}
return csub;
}
}
}
return null;
};

function matchSubset(s, sub) {
if (!options.matchCase) s = s.toLowerCase();
var i = s.indexOf(sub);
if (i == -1) return false;
return i == 0 || options.matchContains;
};

this.flushCache = function() {
flushCache();
};

this.setExtraParams = function(p) {
options.extraParams = p;
};

this.findValue = function(){
var q = $input.val();

if (!options.matchCase) q = q.toLowerCase();
var data = options.cacheLength ? loadFromCache(q) : null;
if (data) {
findValueCallback(q, data);
} else if( (typeof options.url == "string") && (options.url.length > 0) ){
$.get(makeUrl(q), function(data) {
data = parseData(data)
addToCache(q, data);
findValueCallback(q, data);
});
} else {
// no matches
findValueCallback(q, null);
}
}

function findValueCallback(q, data){
if (data) $input.removeClass(options.loadingClass);

var num = (data) ? data.length : 0;
var li = null;

for (var i=0; i < num; i++) {
var row = data[i];

if( row[0].toLowerCase() == q.toLowerCase() ){
li = document.createElement("li");
if (options.formatItem) {
li.innerHTML = options.formatItem(row, i, num);
li.selectValue = row[0];
} else {
li.innerHTML = row[0];
li.selectValue = row[0];
}
var extra = null;
if( row.length > 1 ){
extra = [];
for (var j=1; j < row.length; j++) {
extra[extra.length] = row[j];
}
}
li.extra = extra;
}
}

if( options.onFindValue ) setTimeout(function() { options.onFindValue(li) }, 1);
}

function addToCache(q, data) {
if (!data || !q || !options.cacheLength) return;
if (!cache.length || cache.length > options.cacheLength) {
flushCache();
cache.length++;
} else if (!cache[q]) {
cache.length++;
}
cache.data[q] = data;
};

function findPos(obj) {
var curleft = obj.offsetLeft || 0;
var curtop = obj.offsetTop || 0;
while (obj = obj.offsetParent) {
curleft += obj.offsetLeft
curtop += obj.offsetTop
}
return {x:curleft,y:curtop};
}
}

jQuery.fn.autocomplete = function(url, options, data) {
// Make sure options exists
options = options || {};
// Set url as option
options.url = url;
// set some bulk local data
options.data = ((typeof data == "object") && (data.constructor == Array)) ? data : null;

// Set default values for required options
options = $.extend({
inputClass: "ac_input",
resultsClass: "ac_results",
lineSeparator: "\n",
cellSeparator: "|",
minChars: 1,
delay: 400,
matchCase: 0,
matchSubset: 1,
matchContains: 0,
cacheLength: 0,
mustMatch: 0,
extraParams: {},
loadingClass: "ac_loading",
selectFirst: false,
selectOnly: false,
maxItemsToShow: -1,
autoFill: false,
width: 423
}, options);
options.width = parseInt(options.width, 10);

this.each(function() {
var input = this;
new jQuery.autocomplete(input, options);
});

// Don't break the chain
return this;
}

jQuery.fn.autocompleteArray = function(data, options) {
return this.autocomplete(null, options, data);
}

jQuery.fn.indexOf = function(e){
for( var i=0; i<this.length; i++ ){
if( this[i] == e ) return i;
}
return -1;
};


/*
 * Treeview 1.4 - jQuery plugin to hide and show branches of a tree
 * 
 * http://bassistance.de/jquery-plugins/jquery-plugin-treeview/
 * http://docs.jquery.com/Plugins/Treeview
 *
 * Copyright (c) 2007 JР"Вrn Zaefferer
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * Revision: $Id: jquery.treeview.js 4684 2008-02-07 19:08:06Z joern.zaefferer $
 *
 */

;(function($) {

	$.extend($.fn, {
		swapClass: function(c1, c2) {
			var c1Elements = this.filter('.' + c1);
			this.filter('.' + c2).removeClass(c2).addClass(c1);
			c1Elements.removeClass(c1).addClass(c2);
			return this;
		},
		replaceClass: function(c1, c2) {
			return this.filter('.' + c1).removeClass(c1).addClass(c2).end();
		},
		hoverClass: function(className) {
			className = className || "hover";
			return this.hover(function() {
				$(this).addClass(className);
			}, function() {
				$(this).removeClass(className);
			});
		},
		heightToggle: function(animated, callback) {
			animated ?
				this.animate({ height: "toggle" }, animated, callback) :
				this.each(function(){
					jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ]();
					if(callback)
						callback.apply(this, arguments);
				});
		},
		heightHide: function(animated, callback) {
			if (animated) {
				this.animate({ height: "hide" }, animated, callback);
			} else {
				this.hide();
				if (callback)
					this.each(callback);				
			}
		},
		prepareBranches: function(settings) {
			if (!settings.prerendered) {
				// mark last tree items
				this.filter(":last-child:not(ul)").addClass(CLASSES.last);
				// collapse whole tree, or only those marked as closed, anyway except those marked as open
				this.filter((settings.collapsed ? "" : "." + CLASSES.closed) + ":not(." + CLASSES.open + ")").find(">ul").hide();
			}
			// return all items with sublists
			return this.filter(":has(>ul)");
		},
		applyClasses: function(settings, toggler) {
			this.filter(":has(>ul):not(:has(>a))").find(">span").click(function(event) {
				toggler.apply($(this).next());
			}).add( $("a", this) ).hoverClass();
			
			if (!settings.prerendered) {
				// handle closed ones first
				this.filter(":has(>ul:hidden)")
						.addClass(CLASSES.expandable)
						.replaceClass(CLASSES.last, CLASSES.lastExpandable);
						
				// handle open ones
				this.not(":has(>ul:hidden)")
						.addClass(CLASSES.collapsable)
						.replaceClass(CLASSES.last, CLASSES.lastCollapsable);
						
	            // create hitarea
				this.prepend("<div class=\"" + CLASSES.hitarea + "\"/>").find("div." + CLASSES.hitarea).each(function() {
					var classes = "";
					$.each($(this).parent().attr("class").split(" "), function() {
						classes += this + "-hitarea ";
					});
					$(this).addClass( classes );
				});
			}
			
			// apply event to hitarea
			this.find("div." + CLASSES.hitarea).click( toggler );
		},
		treeview: function(settings) {
			
			settings = $.extend({
				cookieId: "treeview"
			}, settings);
			
			if (settings.add) {
				return this.trigger("add", [settings.add]);
			}
			
			if ( settings.toggle ) {
				var callback = settings.toggle;
				settings.toggle = function() {
					return callback.apply($(this).parent()[0], arguments);
				};
			}
		
			// factory for treecontroller
			function treeController(tree, control) {
				// factory for click handlers
				function handler(filter) {
					return function() {
						// reuse toggle event handler, applying the elements to toggle
						// start searching for all hitareas
						toggler.apply( $("div." + CLASSES.hitarea, tree).filter(function() {
							// for plain toggle, no filter is provided, otherwise we need to check the parent element
							return filter ? $(this).parent("." + filter).length : true;
						}) );
						return false;
					};
				}
				// click on first element to collapse tree
				$("a:eq(0)", control).click( handler(CLASSES.collapsable) );
				// click on second to expand tree
				$("a:eq(1)", control).click( handler(CLASSES.expandable) );
				// click on third to toggle tree
				$("a:eq(2)", control).click( handler() ); 
			}
		
			// handle toggle event
			function toggler() {
				$(this)
					.parent()
					// swap classes for hitarea
					.find(">.hitarea")
						.swapClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea )
						.swapClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea )
					.end()
					// swap classes for parent li
					.swapClass( CLASSES.collapsable, CLASSES.expandable )
					.swapClass( CLASSES.lastCollapsable, CLASSES.lastExpandable )
					// find child lists
					.find( ">ul" )
					// toggle them
					.heightToggle( settings.animated, settings.toggle );
				if ( settings.unique ) {
					$(this).parent()
						.siblings()
						// swap classes for hitarea
						.find(">.hitarea")
							.replaceClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea )
							.replaceClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea )
						.end()
						.replaceClass( CLASSES.collapsable, CLASSES.expandable )
						.replaceClass( CLASSES.lastCollapsable, CLASSES.lastExpandable )
						.find( ">ul" )
						.heightHide( settings.animated, settings.toggle );
				}
			}
			
			function serialize() {
				function binary(arg) {
					return arg ? 1 : 0;
				}
				var data = [];
				branches.each(function(i, e) {
					data[i] = $(e).is(":has(>ul:visible)") ? 1 : 0;
				});
				$.cookie(settings.cookieId, data.join("") );
			}
			
			function deserialize() {
				var stored = $.cookie(settings.cookieId);
				if ( stored ) {
					var data = stored.split("");
					branches.each(function(i, e) {
						$(e).find(">ul")[ parseInt(data[i]) ? "show" : "hide" ]();
					});
				}
			}
			
			// add treeview class to activate styles
			this.addClass("treeview");
			
			// prepare branches and find all tree items with child lists
			var branches = this.find("li").prepareBranches(settings);
			
			switch(settings.persist) {
			case "cookie":
				var toggleCallback = settings.toggle;
				settings.toggle = function() {
					serialize();
					if (toggleCallback) {
						toggleCallback.apply(this, arguments);
					}
				};
				deserialize();
				break;
			case "location":
				var current = this.find("a").filter(function() { return this.href.toLowerCase() == location.href.toLowerCase(); });
				if ( current.length ) {
					current.addClass("selected").parents("ul, li").add( current.next() ).show();
				}
				break;
			}
			
			branches.applyClasses(settings, toggler);
				
			// if control option is set, create the treecontroller and show it
			if ( settings.control ) {
				treeController(this, settings.control);
				$(settings.control).show();
			}
			
			return this.bind("add", function(event, branches) {
				$(branches).prev()
					.removeClass(CLASSES.last)
					.removeClass(CLASSES.lastCollapsable)
					.removeClass(CLASSES.lastExpandable)
				.find(">.hitarea")
					.removeClass(CLASSES.lastCollapsableHitarea)
					.removeClass(CLASSES.lastExpandableHitarea);
				$(branches).find("li").andSelf().prepareBranches(settings).applyClasses(settings, toggler);
			});
		}
	});
	
	// classes used by the plugin
	// need to be styled via external stylesheet, see first example
	var CLASSES = $.fn.treeview.classes = {
		open: "open",
		closed: "closed",
		expandable: "expandable",
		expandableHitarea: "expandable-hitarea",
		lastExpandableHitarea: "lastExpandable-hitarea",
		collapsable: "collapsable",
		collapsableHitarea: "collapsable-hitarea",
		lastCollapsableHitarea: "lastCollapsable-hitarea",
		lastCollapsable: "lastCollapsable",
		lastExpandable: "lastExpandable",
		last: "last",
		hitarea: "hitarea"
	};
	
	// provide backwards compability
	$.fn.Treeview = $.fn.treeview;
	
})(jQuery);

(function(C){if(!C){return }C.ajax_upload=function(E,D){E=C(E);if(E.size()!=1){console.error("You passed ",E.size()," elements to ajax_upload at once");return false}return new A(E,D)};var B=function(){var D=0;return function(){return D++}}();var A=function(E,D){this.button=E;this.wrapper=null;this.form=null;this.input=null;this.iframe=null;this.disabled=false;this.submitting=false;this.settings={action:"upload.php",name:"userfile",data:{},onSubmit:function(F,G){},onComplete:function(G,F){},onSuccess:function(F){},onError:function(G,F){}};C.extend(this.settings,D);this.create_wrapper();this.create_input();if(jQuery.browser.msie){this.make_parent_opaque()}this.create_iframe()};A.prototype={set_data:function(D){this.settings.data=D},disable:function(){this.disabled=true;if(!this.submitting){this.input.attr("disabled",true)}},enable:function(){this.disabled=false;this.input.attr("disabled",false)},create_wrapper:function(){var E=this.button,F;F=this.wrapper=C("<div></div>").insertAfter(E).append(E);setTimeout(function(){F.css({position:"relative",display:"block",overflow:"hidden",height:E.outerHeight(true),width:E.outerWidth(true)})},1);var D=this;F.mousemove(function(G){if(!D.input){return }D.input.css({top:G.pageY-F.offset().top-5+"px",left:G.pageX-F.offset().left-170+"px"})})},create_input:function(){var D=this;this.input=C('<input type="file" />').attr("name",this.settings.name).css({position:"absolute",margin:0,padding:0,width:"220px",heigth:"10px",opacity:0}).change(function(){if(C(this).val()==""){return }D.submitting=true;D.submit();D.submitting=false}).appendTo(this.wrapper).hover(function(){D.button.addClass("hover")},function(){D.button.removeClass("hover")});if(this.disabled){this.input.attr("disabled",true)}},create_iframe:function(){var D="iframe_au"+B();this.iframe=C('<iframe name="'+D+'"></iframe>').css("display","none").appendTo("body")},submit:function(){var D=this,G=this.settings;var E=this.file_from_path(this.input.val());if(G.onSubmit.call(this,E,this.get_ext(E))===false){if(D.disabled){this.input.attr("disabled",true)}return }this.create_form();this.input.appendTo(this.form);this.form.submit();this.input.remove();this.input=null;this.form.remove();this.form=null;this.submitting=false;this.create_input();var F=this.iframe;F.load(function(){var H=F.contents().find("body").html();G.onComplete.call(D,E,H);if(H=="success"){G.onSuccess.call(D,E)}else{G.onError.call(D,E,H)}setTimeout(function(){F.remove()},1)});this.create_iframe()},create_form:function(){this.form=C('<form method="post" enctype="multipart/form-data"></form>').appendTo("body").attr({action:this.settings.action,target:this.iframe.attr("name")});for(var D in this.settings.data){C('<input type="hidden" />').appendTo(this.form).attr({name:D,value:this.settings.data[D]})}},file_from_path:function(E){var D=E.lastIndexOf("\\");if(D!==-1){return E.slice(D+1)}return E},get_ext:function(E){var D=E.lastIndexOf(".");if(D!==-1){return E.slice(D+1)}return""},make_parent_opaque:function(){this.button.add(this.button.parents()).each(function(){var D=C(this).css("backgroundColor");var E=C(this).css("backgroundImage");if(D!="transparent"||E!="none"){C(this).css("opacity",1);return false}})}}})(jQuery);

/*jquery.dimensions*/(function(g){var a=g.fn.height,e=g.fn.width;g.fn.extend({height:function(){if(!this[0]){d()}if(this[0]==window){if(g.browser.opera||(g.browser.safari&&parseInt(g.browser.version)>520)){return self.innerHeight-((g(document).height()>self.innerHeight)?b():0)}else{if(g.browser.safari){return self.innerHeight}else{return g.boxModel&&document.documentElement.clientHeight||document.body.clientHeight}}}if(this[0]==document){return Math.max((g.boxModel&&document.documentElement.scrollHeight||document.body.scrollHeight),document.body.offsetHeight)}return a.apply(this,arguments)},width:function(){if(!this[0]){d()}if(this[0]==window){if(g.browser.opera||(g.browser.safari&&parseInt(g.browser.version)>520)){return self.innerWidth-((g(document).width()>self.innerWidth)?b():0)}else{if(g.browser.safari){return self.innerWidth}else{return g.boxModel&&document.documentElement.clientWidth||document.body.clientWidth}}}if(this[0]==document){if(g.browser.mozilla){var j=self.pageXOffset;self.scrollTo(99999999,self.pageYOffset);var i=self.pageXOffset;self.scrollTo(j,self.pageYOffset);return document.body.offsetWidth+i}else{return Math.max(((g.boxModel&&!g.browser.safari)&&document.documentElement.scrollWidth||document.body.scrollWidth),document.body.offsetWidth)}}return e.apply(this,arguments)},innerHeight:function(){if(!this[0]){d()}return this[0]==window||this[0]==document?this.height():this.is(":visible")?this[0].offsetHeight-c(this,"borderTopWidth")-c(this,"borderBottomWidth"):this.height()+c(this,"paddingTop")+c(this,"paddingBottom")},innerWidth:function(){if(!this[0]){d()}return this[0]==window||this[0]==document?this.width():this.is(":visible")?this[0].offsetWidth-c(this,"borderLeftWidth")-c(this,"borderRightWidth"):this.width()+c(this,"paddingLeft")+c(this,"paddingRight")},outerHeight:function(i){if(!this[0]){d()}i=g.extend({margin:false},i||{});return this[0]==window||this[0]==document?this.height():this.is(":visible")?this[0].offsetHeight+(i.margin?(c(this,"marginTop")+c(this,"marginBottom")):0):this.height()+c(this,"borderTopWidth")+c(this,"borderBottomWidth")+c(this,"paddingTop")+c(this,"paddingBottom")+(i.margin?(c(this,"marginTop")+c(this,"marginBottom")):0)},outerWidth:function(i){if(!this[0]){d()}i=g.extend({margin:false},i||{});return this[0]==window||this[0]==document?this.width():this.is(":visible")?this[0].offsetWidth+(i.margin?(c(this,"marginLeft")+c(this,"marginRight")):0):this.width()+c(this,"borderLeftWidth")+c(this,"borderRightWidth")+c(this,"paddingLeft")+c(this,"paddingRight")+(i.margin?(c(this,"marginLeft")+c(this,"marginRight")):0)},scrollLeft:function(i){if(!this[0]){d()}if(i!=undefined){return this.each(function(){if(this==window||this==document){window.scrollTo(i,g(window).scrollTop())}else{this.scrollLeft=i}})}if(this[0]==window||this[0]==document){return self.pageXOffset||g.boxModel&&document.documentElement.scrollLeft||document.body.scrollLeft}return this[0].scrollLeft},scrollTop:function(i){if(!this[0]){d()}if(i!=undefined){return this.each(function(){if(this==window||this==document){window.scrollTo(g(window).scrollLeft(),i)}else{this.scrollTop=i}})}if(this[0]==window||this[0]==document){return self.pageYOffset||g.boxModel&&document.documentElement.scrollTop||document.body.scrollTop}return this[0].scrollTop},position:function(i){return this.offset({margin:false,scroll:false,relativeTo:this.offsetParent()},i)},offset:function(j,p){if(!this[0]){d()}var o=0,n=0,z=0,s=0,A=this[0],m=this[0],l,i,w=g.css(A,"position"),v=g.browser.mozilla,q=g.browser.msie,u=g.browser.opera,C=g.browser.safari,k=g.browser.safari&&parseInt(g.browser.version)>520,r=false,t=false,j=g.extend({margin:true,border:false,padding:false,scroll:true,lite:false,relativeTo:document.body},j||{});if(j.lite){return this.offsetLite(j,p)}if(j.relativeTo.jquery){j.relativeTo=j.relativeTo[0]}if(A.tagName=="BODY"){o=A.offsetLeft;n=A.offsetTop;if(v){o+=c(A,"marginLeft")+(c(A,"borderLeftWidth")*2);n+=c(A,"marginTop")+(c(A,"borderTopWidth")*2)}else{if(u){o+=c(A,"marginLeft");n+=c(A,"marginTop")}else{if((q&&jQuery.boxModel)){o+=c(A,"borderLeftWidth");n+=c(A,"borderTopWidth")}else{if(k){o+=c(A,"marginLeft")+c(A,"borderLeftWidth");n+=c(A,"marginTop")+c(A,"borderTopWidth")}}}}}else{do{i=g.css(m,"position");o+=m.offsetLeft;n+=m.offsetTop;if((v&&!m.tagName.match(/^t[d|h]$/i))||q||k){o+=c(m,"borderLeftWidth");n+=c(m,"borderTopWidth");if(v&&i=="absolute"){r=true}if(q&&i=="relative"){t=true}}l=m.offsetParent||document.body;if(j.scroll||v){do{if(j.scroll){z+=m.scrollLeft;s+=m.scrollTop}if(u&&(g.css(m,"display")||"").match(/table-row|inline/)){z=z-((m.scrollLeft==m.offsetLeft)?m.scrollLeft:0);s=s-((m.scrollTop==m.offsetTop)?m.scrollTop:0)}if(v&&m!=A&&g.css(m,"overflow")!="visible"){o+=c(m,"borderLeftWidth");n+=c(m,"borderTopWidth")}m=m.parentNode}while(m!=l)}m=l;if(m==j.relativeTo&&!(m.tagName=="BODY"||m.tagName=="HTML")){if(v&&m!=A&&g.css(m,"overflow")!="visible"){o+=c(m,"borderLeftWidth");n+=c(m,"borderTopWidth")}if(((C&&!k)||u)&&i!="static"){o-=c(l,"borderLeftWidth");n-=c(l,"borderTopWidth")}break}if(m.tagName=="BODY"||m.tagName=="HTML"){if(((C&&!k)||(q&&g.boxModel))&&w!="absolute"&&w!="fixed"){o+=c(m,"marginLeft");n+=c(m,"marginTop")}if(k||(v&&!r&&w!="fixed")||(q&&w=="static"&&!t)){o+=c(m,"borderLeftWidth");n+=c(m,"borderTopWidth")}break}}while(m)}var B=h(A,j,o,n,z,s);if(p){g.extend(p,B);return this}else{return B}},offsetLite:function(q,l){if(!this[0]){d()}var n=0,m=0,k=0,p=0,o=this[0],j,q=g.extend({margin:true,border:false,padding:false,scroll:true,relativeTo:document.body},q||{});if(q.relativeTo.jquery){q.relativeTo=q.relativeTo[0]}do{n+=o.offsetLeft;m+=o.offsetTop;j=o.offsetParent||document.body;if(q.scroll){do{k+=o.scrollLeft;p+=o.scrollTop;o=o.parentNode}while(o!=j)}o=j}while(o&&o.tagName!="BODY"&&o.tagName!="HTML"&&o!=q.relativeTo);var i=h(this[0],q,n,m,k,p);if(l){g.extend(l,i);return this}else{return i}},offsetParent:function(){if(!this[0]){d()}var i=this[0].offsetParent;while(i&&(i.tagName!="BODY"&&g.css(i,"position")=="static")){i=i.offsetParent}return g(i)}});var d=function(){throw"Dimensions: jQuery collection is empty"};var c=function(i,j){return parseInt(g.css(i.jquery?i[0]:i,j))||0};var h=function(m,l,j,n,i,k){if(!l.margin){j-=c(m,"marginLeft");n-=c(m,"marginTop")}if(l.border&&((g.browser.safari&&parseInt(g.browser.version)<520)||g.browser.opera)){j+=c(m,"borderLeftWidth");n+=c(m,"borderTopWidth")}else{if(!l.border&&!((g.browser.safari&&parseInt(g.browser.version)<520)||g.browser.opera)){j-=c(m,"borderLeftWidth");n-=c(m,"borderTopWidth")}}if(l.padding){j+=c(m,"paddingLeft");n+=c(m,"paddingTop")}if(l.scroll&&(!g.browser.opera||m.offsetLeft!=m.scrollLeft&&m.offsetTop!=m.scrollLeft)){i-=m.scrollLeft;k-=m.scrollTop}return l.scroll?{top:n-k,left:j-i,scrollTop:k,scrollLeft:i}:{top:n,left:j}};var f=0;var b=function(){if(!f){var i=g("<div>").css({width:100,height:100,overflow:"auto",position:"absolute",top:-1000,left:-1000}).appendTo("body");f=100-i.append("<div>").find("div").css({width:"100%",height:200}).width();i.remove()}return f}})(jQuery);
/*jqueyr.hoverIntent*/(function(a){a.fn.hoverIntent=function(k,j){var l={sensitivity:7,interval:100,timeout:0};l=a.extend(l,j?{over:k,out:j}:k);var n,m,h,d;var e=function(f){n=f.pageX;m=f.pageY};var c=function(g,f){f.hoverIntent_t=clearTimeout(f.hoverIntent_t);if((Math.abs(h-n)+Math.abs(d-m))<l.sensitivity){a(f).unbind("mousemove",e);f.hoverIntent_s=1;return l.over.apply(f,[g])}else{h=n;d=m;f.hoverIntent_t=setTimeout(function(){c(g,f)},l.interval)}};var i=function(g,f){f.hoverIntent_t=clearTimeout(f.hoverIntent_t);f.hoverIntent_s=0;return l.out.apply(f,[g])};var b=function(q){var o=(q.type=="mouseover"?q.fromElement:q.toElement)||q.relatedTarget;while(o&&o!=this){try{o=o.parentNode}catch(q){o=this}}if(o==this){return false}var g=jQuery.extend({},q);var f=this;if(f.hoverIntent_t){f.hoverIntent_t=clearTimeout(f.hoverIntent_t)}if(q.type=="mouseover"){h=g.pageX;d=g.pageY;a(f).bind("mousemove",e);if(f.hoverIntent_s!=1){f.hoverIntent_t=setTimeout(function(){c(g,f)},l.interval)}}else{a(f).unbind("mousemove",e);if(f.hoverIntent_s==1){f.hoverIntent_t=setTimeout(function(){i(g,f)},l.timeout)}}};return this.mouseover(b).mouseout(b)}})(jQuery);
/*jquery.cluetip*/(function(e){var i,h,g,d,f,j,c;e.fn.cluetip=function(k){var l={width:275,height:"auto",cluezIndex:97,positionBy:"auto",topOffset:15,leftOffset:15,local:false,hideLocal:true,attribute:"rel",titleAttribute:"title",splitTitle:"",showTitle:true,cluetipClass:"default",hoverClass:"",waitImage:true,cursor:"help",arrows:false,dropShadow:true,dropShadowSteps:6,sticky:false,mouseOutClose:false,activation:"hover",closePosition:"top",closeText:"Close",truncate:0,fx:{open:"show",openSpeed:""},hoverIntent:{sensitivity:3,interval:50,timeout:0},onActivate:function(m){return true},onShow:function(m,n){},ajaxCache:true,ajaxProcess:function(m){m=e(m).not("style, meta, link, script, title");return m},ajaxSettings:{dataType:"html"}};if(k&&k.ajaxSettings){e.extend(l.ajaxSettings,k.ajaxSettings);delete k.ajaxSettings}if(k&&k.fx){e.extend(l.fx,k.fx);delete k.fx}if(k&&k.hoverIntent){e.extend(l.hoverIntent,k.hoverIntent);delete k.hoverIntent}e.extend(l,k);return this.each(function(){var y=false;var P=parseInt(l.cluezIndex,10)-1;var J=false;if(!i){h=e('<div id="cluetip-inner"></div>');d=e('<h3 id="cluetip-title"></h3>');g=e('<div id="cluetip-outer"></div>').append(h).prepend(d);i=e("<div></div>").attr({id:"cluetip"}).css({zIndex:l.cluezIndex}).append(g).append('<div id="cluetip-extra"></div>')[b](a).hide();e('<div id="cluetip-waitimage"></div>').css({position:"absolute",zIndex:P-1}).insertBefore("#cluetip").hide();i.css({position:"absolute",zIndex:P});g.css({position:"relative",zIndex:P+1});f=e('<div id="cluetip-arrows" class="cluetip-arrows"></div>').css({zIndex:P+1}).appendTo("#cluetip")}var O=(l.dropShadow)?+l.dropShadowSteps:0;if(!j){j=e([]);for(var K=0;K<O;K++){j=j.add(e("<div></div>").css({zIndex:P-K-1,opacity:0.1,top:1+K,left:1+K}))}j.css({position:"absolute",backgroundColor:"#000"}).prependTo(i)}var r=e(this);var B=r.attr(l.attribute),p=l.cluetipClass;if(!B&&!l.splitTitle){return true}if(l.local&&l.hideLocal){e(B+":first").hide()}var H=parseInt(l.topOffset,10),q=parseInt(l.leftOffset,10);var C,s;var z=isNaN(parseInt(l.height,10))?"auto":(/\D/g).test(l.height)?l.height:l.height+"px";var R,m,t,E,v;var N=parseInt(l.width,10)+parseInt(i.css("paddingLeft"))+parseInt(i.css("paddingRight"))+O;if(isNaN(N)){N=275}var M=this.offsetWidth;var G,u,F,w,A;var L;var n=(l.attribute!="title")?r.attr(l.titleAttribute):"";if(l.splitTitle){L=n.split(l.splitTitle);n=L.shift()}var I;var o=function(V){if(!l.onActivate(r)){return false}J=true;i.removeClass().css({width:l.width});if(B==r.attr("href")){r.css("cursor",l.cursor)}r.attr("title","");if(l.hoverClass){r.addClass(l.hoverClass)}m=t=r.offset().top;G=r.offset().left;w=V.pageX;v=V.pageY;if(r[0].tagName.toLowerCase()!="area"){R=e(document).scrollTop();A=e(window).width()}if(l.positionBy=="fixed"){u=M+G+q;i.css({left:u})}else{u=(M>G&&G>N)||G+M+N+q>A?G-N-q:M+G+q;if(r[0].tagName.toLowerCase()=="area"||l.positionBy=="mouse"||M+N>A){if(w+20+N>A){u=(w-N-q)>=0?w-N-q:w-(N/2)}else{u=w+q}var T=u<0?V.pageY+H:V.pageY}i.css({left:(u>0&&l.positionBy!="bottomTop")?u:(w+(N/2)>A)?A/2-N/2:Math.max(w-(N/2),0)})}s=e(window).height();if(L){for(var U=0;U<L.length;U++){if(U==0){h.html(L[U])}else{h.append('<div class="split-body">'+L[U]+"</div>")}}D(T)}else{if(!l.local&&B.indexOf("#")!=0){if(y&&l.ajaxCache){h.html(y);D(T)}else{var W=l.ajaxSettings;W.url=B;W.beforeSend=function(){g.children().empty();if(l.waitImage){e("#cluetip-waitimage").css({top:v-10,left:parseInt(u+(N/2),10)}).show()}};W.error=function(){if(J){h.html("<i>sorry, the contents could not be loaded</i>")}};W.success=function(Y){y=l.ajaxProcess(Y);if(J){h.html(y)}};W.complete=function(){c=e("#cluetip-inner img").length;if(c){e("#cluetip-inner img").load(function(){c--;if(c<1){e("#cluetip-waitimage").hide();if(J){D(T)}}})}else{e("#cluetip-waitimage").hide();if(J){D(T)}}};e.ajax(W)}}else{if(l.local){var X=e(B+":first");var S=e.fn.wrapInner?X.wrapInner("<div></div>").children().clone(true):X.html();e.fn.wrapInner?h.empty().append(S):h.html(S);D(T)}}}};var D=function(U){i.addClass("cluetip-"+p);if(l.truncate){var V=h.text().slice(0,l.truncate)+"...";h.html(V)}function S(){}n?d.show().html(n):(l.showTitle)?d.show().html("&nbsp;"):d.hide();if(l.sticky){var T=e('<div id="cluetip-close"><a href="#">'+l.closeText+"</a></div>");(l.closePosition=="bottom")?T.appendTo(h):(l.closePosition=="title")?T.prependTo(d):T.prependTo(h);T.click(function(){x();return false});if(l.mouseOutClose){i.hover(function(){S()},function(){T.trigger("click")})}else{i.unbind("mouseout")}}var W="";g.css({overflow:z=="auto"?"visible":"auto",height:z});C=z=="auto"?i.outerHeight():parseInt(z,10);E=t;if(l.positionBy=="fixed"){E=t-l.dropShadowSteps+H}else{if((u<w&&Math.max(u,0)+N>w)||l.positionBy=="bottomTop"){if(t+C+H>R+s&&v-R>C+H){E=v-C-H;W="top"}else{E=v+H;W="bottom"}}else{if(t+C+H>R+s){E=(C>=s)?R:R+s-C-H}else{if(r.css("display")=="block"||r[0].tagName.toLowerCase()=="area"||l.positionBy=="mouse"){E=U-H}else{E=t-l.dropShadowSteps}}}}if(W==""){u<G?W="left":W="right"}i.css({top:E+"px"}).removeClass().addClass("clue-"+W+"-"+p).addClass(" cluetip-"+p);if(l.arrows){var X=(t-E-l.dropShadowSteps);f.css({top:(/(left|right)/.test(W)&&u>=0&&X>0)?X+"px":/(left|right)/.test(W)?0:""}).show()}else{f.hide()}j.hide();i.hide()[l.fx.open](l.fx.open!="show"&&l.fx.openSpeed);if(l.dropShadow){j.css({height:C,width:l.width}).show()}l.onShow(i,h)};var Q=function(){J=false;e("#cluetip-waitimage").hide();if(!l.sticky){x()}if(l.hoverClass){r.removeClass(l.hoverClass)}};var x=function(){g.parent().hide().removeClass().end().children().empty();if(n){r.attr("title",n)}r.css("cursor","");if(l.arrows){f.css({top:""})}};if(l.activation=="click"||l.activation=="toggle"){r.click(function(S){if(i.is(":hidden")){o(S)}else{Q(S)}this.blur();return false})}else{r.click(function(){if(B==r.attr("href")){return false}});if(e.fn.hoverIntent&&l.hoverIntent){r.hoverIntent({sensitivity:l.hoverIntent.sensitivity,interval:l.hoverIntent.interval,over:function(S){o(S)},timeout:l.hoverIntent.timeout,out:function(S){Q(S)}})}else{r.hover(function(S){o(S)},function(S){Q(S)})}}})};var b="appendTo",a="body";e.cluetip={};e.cluetip.setup=function(k){if(k&&k.insertionType&&(k.insertionType).match(/appendTo|prependTo|insertBefore|insertAfter/)){b=k.insertionType}if(k&&k.insertionElement){a=k.insertionElement}}})(jQuery);
/*jquery.cookie*/jQuery.cookie=function(b,j,m){if(typeof j!="undefined"){m=m||{};if(j===null){j="";m.expires=-1}var e="";if(m.expires&&(typeof m.expires=="number"||m.expires.toUTCString)){var f;if(typeof m.expires=="number"){f=new Date();f.setTime(f.getTime()+(m.expires*24*60*60*1000))}else{f=m.expires}e="; expires="+f.toUTCString()}var l=m.path?"; path="+(m.path):"";var g=m.domain?"; domain="+(m.domain):"";var a=m.secure?"; secure":"";document.cookie=[b,"=",encodeURIComponent(j),e,l,g,a].join("")}else{var d=null;if(document.cookie&&document.cookie!=""){var k=document.cookie.split(";");for(var h=0;h<k.length;h++){var c=jQuery.trim(k[h]);if(c.substring(0,b.length+1)==(b+"=")){d=decodeURIComponent(c.substring(b.length+1));break}}}return d}};
/*jquery.suggest*/(function(a){a.suggest=function(q,h){var c=a(q).attr("autocomplete","on");var p=false;var d=0;var s=[];var r=0;var f=a("<ul>").addClass(h.resultsClass).attr("id","results_"+c.attr("name")).appendTo("body");k();a(window).load(k).resize(k);c.blur(function(){setTimeout(function(){f.hide()},200)});if(f.bgiFrame){try{f.bgiframe()}catch(v){}}if(a.browser.mozilla||a.browser.opera){c.keypress(o)}else{c.keydown(o)}function k(){var e=c.offset();f.css({top:(e.top+q.offsetHeight)+"px",left:e.left+"px"})}function o(A){if(c.attr("autocomplete")=="off"){return}var z=a("ul."+h.resultsClass+"[id$='"+a(this).attr("name")+"']");if(z.is(":visible")&&(A.keyCode==27||A.keyCode==38||A.keyCode==40||A.keyCode==13)){switch(A.keyCode){case 38:m();break;case 40:w();break;case 27:z.hide();break;case 13:if(x()){u();A.preventDefault();return false}break}if(A.keyCode==13&&h.stopOnEmpty==false){}else{if(A.preventDefault){A.preventDefault()}if(A.stopPropagation){A.stopPropagation()}A.cancelBubble=true;A.returnValue=false}}else{if(A.keyCode!=9&&((g().length!=d)||!d)){if(p){clearTimeout(p)}if(h.delay>0){p=setTimeout(n,h.delay)}else{n()}d=g().length}}if(A.keyCode==9){if(z.is(":visible")){if(x()){u()}}z.hide()}}function n(){k();var e=a.trim(g());if(e.length>=h.minchars&&((typeof(h.maxchars)=="undefined")||(e.length<=h.maxchars))){cached=y(e);if(cached){j(cached.items)}else{a.get(h.source,{q:e},function(z){f.hide();var A=b(z,e);j(A);i(e,A,z.length)})}}else{f.hide()}}function y(z){for(var e=0;e<s.length;e++){if(s[e]["q"]==z){s.unshift(s.splice(e,1)[0]);return s[0]}}return false}function i(B,e,z){while(s.length&&(r+z>h.maxCacheSize)){var A=s.pop();r-=A.size}s.push({q:B,size:z,items:e});r+=z}function j(e){if(!e){return}if(!e.length){f.hide();return}var A="";for(var z=0;z<e.length;z++){A+="<li>"+e[z]+"</li>"}a("ul."+h.resultsClass).not(f).hide();f.html(A).show();f.children("li").mouseover(function(){f.children("li").removeClass(h.selectClass);a(this).addClass(h.selectClass)}).click(function(B){B.preventDefault();B.stopPropagation();u()})}function b(e,C){var z=[];var D=e.split(h.delimiter);for(var B=0;B<D.length;B++){var A=a.trim(D[B]);if(A){A=A.replace(new RegExp(C,"ig"),function(E){return'<span class="'+h.matchClass+'">'+E+"</span>"});z[z.length]=A}}return z}function x(){if(!f.is(":visible")){return false}var e=f.children("li."+h.selectClass);if(!e.length){e=false}return e}function u(){$currentResult=x();if($currentResult){var e=c.val();l($currentResult.text());f.hide();if(h.onSelect){h.onSelect.apply(c[0],[e])}}}function w(){$currentResult=x();if($currentResult&&$currentResult.next().length){$currentResult.removeClass(h.selectClass).next().addClass(h.selectClass)}else{if($currentResult){$currentResult.removeClass(h.selectClass)}f.children("li:first-child").addClass(h.selectClass)}}function m(){$currentResult=x();if($currentResult&&$currentResult.prev().length){$currentResult.removeClass(h.selectClass).prev().addClass(h.selectClass)}else{if($currentResult){$currentResult.removeClass(h.selectClass)}f.children("li:last-child").addClass(h.selectClass)}}function g(){var z=c.val();if(""==h.subvaluesSeparator){return z}var e=t(z);if(-1==z.indexOf(h.subvaluesSeparator,e)){return z.split(h.subvaluesSeparator).pop()}return""}function l(A){var z=c.val();if(""==h.subvaluesSeparator){return c.val(A)}var e=t(z);if(-1==z.indexOf(h.subvaluesSeparator,e)){var B=z.split(h.subvaluesSeparator);B.pop();B.push(A);return c.val(B.join(h.subvaluesSeparator))}return c}function t(z){if(c.get(0).createTextRange){var e=document.selection.createRange().duplicate();e.moveEnd("character",z.length);if(e.text==""){return z.length}return z.lastIndexOf(e.text)}return c.get(0).selectionStart}};a.fn.suggest=function(c,b){if(!c){return}b=b||{};b.source=c;b.delay=b.delay||100;b.resultsClass=b.resultsClass||"ac_results";b.selectClass=b.selectClass||"ac_over";b.matchClass=b.matchClass||"ac_match";b.minchars=b.minchars||2;b.delimiter=b.delimiter||"\n";b.onSelect=b.onSelect||false;b.maxCacheSize=b.maxCacheSize||65536;b.subvaluesSeparator=b.subvaluesSeparator||"";this.each(function(){new a.suggest(this,b)});return this}})(jQuery);
/*jquery.textarearesizer*/(function(c){var h,i;var d=0;var a=32;var e;c.fn.TextAreaResizer=function(){return this.each(function(){h=c(this).addClass("processed"),i=null;c(this).wrap('<div class="resizable-textarea"><span></span></div>').parent().append(c('<div class="grippie"></div>').bind("mousedown",{el:this},b));var k=c("div.grippie",c(this).parent())[0];k.style.marginRight=(k.offsetWidth-c(this)[0].offsetWidth)+"px"})};function b(k){h=c(k.data.el);h.blur();d=j(k).y;i=h.height()-d;h.css("opacity",0.25);c(document).mousemove(g).mouseup(f);return false}function g(m){var k=j(m).y;var l=i+k;if(d>=(k)){l-=5}d=k;l=Math.max(a,l);h.height(l+"px");if(l<a){f(m)}return false}function f(k){c(document).unbind("mousemove",g).unbind("mouseup",f);h.css("opacity",1);h.focus();h=null;i=null;d=0}function j(k){return{x:k.clientX+document.documentElement.scrollLeft,y:k.clientY+document.documentElement.scrollTop}}})(jQuery);
/*jquery.blockUI*/(function(f){f.fn._fadeIn=f.fn.fadeIn;f.blockUI=function(m){c(window,m)};f.unblockUI=function(m){g(window,m)};f.growlUI=function(p,n,o){var m=f('<div class="growlUI"></div>');if(p){m.append("<h1>"+p+"</h1>")}if(n){m.append("<h2>"+n+"</h2>")}if(o==undefined){o=3000}f.blockUI({message:m,fadeIn:700,fadeOut:1000,centerY:false,timeout:o,showOverlay:false,css:f.blockUI.defaults.growlCSS})};f.fn.block=function(m){return this.each(function(){if(f.css(this,"position")=="static"){this.style.position="relative"}if(f.browser.msie){this.style.zoom=1}c(this,m)})};f.fn.unblock=function(m){return this.each(function(){g(this,m)})};f.blockUI.version=2.14;f.blockUI.defaults={message:"<h1>Please wait...</h1>",css:{padding:0,margin:0,width:"30%",top:"40%",left:"35%",textAlign:"center",color:"#000",border:"3px solid #aaa",backgroundColor:"#fff",cursor:"wait"},overlayCSS:{backgroundColor:"#000",opacity:"0.6"},growlCSS:{width:"350px",top:"10px",left:"",right:"10px",border:"none",padding:"5px",opacity:"0.6",cursor:null,color:"#fff",backgroundColor:"#000","-webkit-border-radius":"10px","-moz-border-radius":"10px"},baseZ:1000,centerX:true,centerY:true,allowBodyStretch:true,constrainTabKey:true,fadeIn:200,fadeOut:400,timeout:0,showOverlay:true,focusInput:true,applyPlatformOpacityRules:true,onUnblock:null,quirksmodeOffsetHack:4};var d=f.browser.msie&&/MSIE 6.0/.test(navigator.userAgent);var b=null;var e=[];function c(o,m){var y=(o==window);var p=m&&m.message!==undefined?m.message:undefined;m=f.extend({},f.blockUI.defaults,m||{});m.overlayCSS=f.extend({},f.blockUI.defaults.overlayCSS,m.overlayCSS||{});var x=f.extend({},f.blockUI.defaults.css,m.css||{});p=p===undefined?m.message:p;if(y&&b){g(window,{fadeOut:0})}if(p&&typeof p!="string"&&(p.parentNode||p.jquery)){var r=p.jquery?p[0]:p;var w={};f(o).data("blockUI.history",w);w.el=r;w.parent=r.parentNode;w.display=r.style.display;w.position=r.style.position;if(w.parent){w.parent.removeChild(r)}}var A=m.baseZ;var v=(f.browser.msie)?f('<iframe class="blockUI" style="z-index:'+(A++)+';display:none;border:none;margin:0;padding:0;position:absolute;width:100%;height:100%;top:0;left:0" src="about:blank"></iframe>'):f('<div class="blockUI" style="display:none"></div>');var u=f('<div class="blockUI blockOverlay" style="z-index:'+(A++)+';display:none;cursor:wait;border:none;margin:0;padding:0;width:100%;height:100%;top:0;left:0"></div>');var q=y?f('<div class="blockUI blockMsg blockPage" style="z-index:'+A+';display:none;position:fixed"></div>'):f('<div class="blockUI blockMsg blockElement" style="z-index:'+A+';display:none;position:absolute"></div>');if(p){q.css(x)}if(!m.applyPlatformOpacityRules||!(f.browser.mozilla&&/Linux/.test(navigator.platform))){u.css(m.overlayCSS)}u.css("position",y?"fixed":"absolute");if(f.browser.msie){v.css("opacity","0.0")}f([v[0],u[0],q[0]]).appendTo(y?"body":o);var D=f.browser.msie&&(!f.boxModel||f("object,embed",y?null:o).length>0);if(d||D&&q[0].style.setExpression){if(y&&m.allowBodyStretch&&f.boxModel){f("html,body").css("height","100%")}if((d||!f.boxModel)&&!y){var E=j(o,"borderTopWidth"),s=j(o,"borderLeftWidth");var C=E?"(0 - "+E+")":0;var n=s?"(0 - "+s+")":0}f.each([v,u,q],function(t,H){var z=H[0].style;z.position="absolute";if(t<2){y?z.setExpression("height","Math.max(document.body.scrollHeight, document.body.offsetHeight) - (jQuery.boxModel?0:"+m.quirksmodeOffsetHack+') + "px"'):z.setExpression("height",'this.parentNode.offsetHeight + "px"');y?z.setExpression("width",'jQuery.boxModel && document.documentElement.clientWidth || document.body.clientWidth + "px"'):z.setExpression("width",'this.parentNode.offsetWidth + "px"');if(n){z.setExpression("left",n)}if(C){z.setExpression("top",C)}}else{if(m.centerY){if(y){z.setExpression("top",'(document.documentElement.clientHeight || document.body.clientHeight) / 2 - (this.offsetHeight / 2) + (blah = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "px"')}z.marginTop=0}else{if(!m.centerY&&y){var F=(m.css&&m.css.top)?parseInt(m.css.top):0;var G="((document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop) + "+F+') + "px"';z.setExpression("top",G)}}}})}if(p){q.append(p);if(p.jquery||p.nodeType){f(p).show()}}if(f.browser.msie&&m.showOverlay){v.show()}if(m.fadeIn){if(m.showOverlay){u._fadeIn(m.fadeIn)}if(p){q.fadeIn(m.fadeIn)}}else{if(m.showOverlay){u.show()}if(p){q.show()}}i(1,o,m);if(y){b=q[0];e=f(":input:enabled:visible",b);if(m.focusInput){setTimeout(l,20)}}else{a(q[0],m.centerX,m.centerY)}if(m.timeout){var B=setTimeout(function(){y?f.unblockUI(m):f(o).unblock(m)},m.timeout);f(o).data("blockUI.timeout",B)}}function g(p,q){var o=p==window;var n=f(p);var r=n.data("blockUI.history");var s=n.data("blockUI.timeout");if(s){clearTimeout(s);n.removeData("blockUI.timeout")}q=f.extend({},f.blockUI.defaults,q||{});i(0,p,q);var m=o?f("body").children().filter(".blockUI"):f(".blockUI",p);if(o){b=e=null}if(q.fadeOut){m.fadeOut(q.fadeOut);setTimeout(function(){h(m,r,q,p)},q.fadeOut)}else{h(m,r,q,p)}}function h(m,p,o,n){m.each(function(q,r){if(this.parentNode){this.parentNode.removeChild(this)}});if(p&&p.el){p.el.style.display=p.display;p.el.style.position=p.position;if(p.parent){p.parent.appendChild(p.el)}f(p.el).removeData("blockUI.history")}if(typeof o.onUnblock=="function"){o.onUnblock(n,o)}}function i(m,q,r){var p=q==window,o=f(q);if(!m&&(p&&!b||!p&&!o.data("blockUI.isBlocked"))){return}if(!p){o.data("blockUI.isBlocked",m)}if(m&&!r.showOverlay){return}var n="mousedown mouseup keydown keypress";m?f(document).bind(n,r,k):f(document).unbind(n,k)}function k(p){if(p.keyCode&&p.keyCode==9){if(b&&p.data.constrainTabKey){var o=e;var n=!p.shiftKey&&p.target==o[o.length-1];var m=p.shiftKey&&p.target==o[0];if(n||m){setTimeout(function(){l(m)},10);return false}}}if(f(p.target).parents("div.blockMsg").length>0){return true}return f(p.target).parents().children().filter("div.blockUI").length==0}function l(m){if(!e){return}var n=e[m===true?e.length-1:0];if(n){n.focus()}}function a(r,m,v){var u=r.parentNode,q=r.style;var n=((u.offsetWidth-r.offsetWidth)/2)-j(u,"borderLeftWidth");var o=((u.offsetHeight-r.offsetHeight)/2)-j(u,"borderTopWidth");if(m){q.left=n>0?(n+"px"):"0"}if(v){q.top=o>0?(o+"px"):"0"}}function j(m,n){return parseInt(f.css(m,n))||0}})(jQuery);