(function($){$.fn.jqm=function(o){var p={overlay:50,overlayClass:'jqmOverlay',closeClass:'jqmClose',trigger:'.jqModal',ajax:F,ajaxText:'',target:F,modal:F,toTop:F,onShow:F,onHide:F,onLoad:F};return this.each(function(){if(this._jqm)return H[this._jqm].c=$.extend({},H[this._jqm].c,o);s++;this._jqm=s;H[s]={c:$.extend(p,$.jqm.params,o),a:F,w:$(this).addClass('jqmID'+s),s:s};if(p.trigger)$(this).jqmAddTrigger(p.trigger);});};$.fn.jqmAddClose=function(e){return hs(this,e,'jqmHide');};$.fn.jqmAddTrigger=function(e){return hs(this,e,'jqmShow');};$.fn.jqmShow=function(t){return this.each(function(){t=t||window.event;$.jqm.open(this._jqm,t);});};$.fn.jqmHide=function(t){return this.each(function(){t=t||window.event;$.jqm.close(this._jqm,t)});};$.jqm={hash:{},open:function(s,t){var h=H[s],c=h.c,cc='.'+c.closeClass,z=(parseInt(h.w.css('z-index'))),z=(z>0)?z:3000,o=$('<div></div>').css({height:'100%',width:'100%',position:'fixed',left:0,top:0,'z-index':z-1,opacity:c.overlay/100});if(h.a)return F;h.t=t;h.a=true;h.w.css('z-index',z);if(c.modal){if(!A[0])L('bind');A.push(s);}
else if(c.overlay>0)h.w.jqmAddClose(o);else o=F;h.o=(o)?o.addClass(c.overlayClass).prependTo('body'):F;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.html(c.ajaxText).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 F;},close:function(s){var h=H[s];if(!h.a)return F;h.a=F;if(A[0]){A.pop();if(!A[0])L('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 F;},params:{}};var s=0,H=$.jqm.hash,A=[],ie6=$.browser.msie&&($.browser.version=="6.0"),F=false,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(_){}},L=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,t,c){return w.each(function(){var s=this._jqm;$(t).each(function(){if(!this[c]){this[c]=[];$(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 F;});}this[c].push(s);});});};})(jQuery);function ue_modal(params)
{$('#popup_container').html('').load(params.src,function(){$('#base_modal').modal({'backdrop':false}).modal('show');});}
function UE_addMsg(ib_text,fixed){$('#infobar').prepend('<div id="msg"><div id="ib_text">'+ib_text+'</div><div id="close">close</div></div>');if(!fixed){$('#infobar div:eq(0)').slideDown(300).delay(5000).slideUp(300);$('#close').hide();}
else{$('#infobar div:eq(0)').slideDown(300);$('#close').click(function(){$(this).parent().slideUp(300);});}}
function isiPad(){return((navigator.platform.indexOf("iPad")!=-1)||(navigator.platform.indexOf("iPhone")!=-1));}
function initEditor(object)
{if($(object).data('editor'))$(object).data('editor').destroy();$(object).data('editor',$(object).redactor({toolbar:'userecho',attachment:global_is_staff,path:'/s/js/redactor/'}));}
function initUtex(object,b_autoGrow,embed_object){initEditor(object,true);return;if(isiPad())return;if(!b_autoGrow)
b_autoGrow=false;if(!embed_object)
embed_object=$(object).attr('id');$(object).wysiwyg({rmUnusedControls:true,controls:{bold:{visible:true},italic:{visible:true},underline:{visible:true},strikeThrough:{visible:true},insertOrderedList:{visible:true},insertUnorderedList:{visible:true},h1:{visible:true},h2:{visible:true},h3:{visible:true},h4:{visible:true,className:'h4',command:($.browser.msie||$.browser.safari)?'formatBlock':'heading',arguments:($.browser.msie||$.browser.safari)?'<h4>':'h4',tags:['h4'],tooltip:'Header 4'},h5:{visible:true,className:'h5',command:($.browser.msie||$.browser.safari)?'formatBlock':'heading',arguments:($.browser.msie||$.browser.safari)?'<h5>':'h5',tags:['h5'],tooltip:'Header 5'},quote:{visible:true,className:'blockquote',command:($.browser.msie||$.browser.safari)?'formatBlock':'blockquote',arguments:($.browser.msie||$.browser.safari)?'<blockquote>':'blockquote',tags:['blockquote'],tooltip:'Quote'},code:{visible:true,className:'code',command:($.browser.msie||$.browser.safari)?'formatBlock':'code',arguments:($.browser.msie||$.browser.safari)?'<code>':'code',tags:['code'],tooltip:'Code'},embed:{visible:true,exec:function(){embedContent(embed_object);},className:'embed'},fullscreen:{visible:true,exec:function(){if($.wysiwyg.fullscreen){$.wysiwyg.fullscreen.init(this);}},tooltip:"Fullscreen"}},initialContent:"",autoGrow:b_autoGrow,css:"/s/css/utex_ed.css?2"});}
function utexBlockquote(obj){var range=obj.getInternalRange(),common=range.commonAncestorContainer,blockquote=obj.dom.getElement("blockquote");if(common.nodeType===3){common=common.parentNode;}
if(blockquote&&$(blockquote).hasClass("quote")){$(common).unwrap();}
else{if("body"!==common.nodeName.toLowerCase()){$(common).wrap("<blockquote/>");}}}
function utexCode(obj){var range=obj.getInternalRange(),common=range.commonAncestorContainer,blockquote=obj.dom.getElement("code");if(common.nodeType===3){common=common.parentNode;}
if(blockquote&&$(blockquote).hasClass("code")){$(common).unwrap();}
else{if("body"!==common.nodeName.toLowerCase()){$(common).wrap("<code/>");}}}
var ActiveEditor="";function embedContentUe(obj){ActiveEditor=obj;$('#embed_content').jqm({ajax:'/popup/embed/image/',ajaxText:'{% include "popups/loading.html" %}'}).jqmShow();}
function embedFileUe(obj){ActiveEditor=obj;$('#embed_content').jqm({ajax:'/popup/embed/file/',ajaxText:'{% include "popups/loading.html" %}'}).jqmShow();}
function embedContent(text_field){$('#embed_content').jqm({ajax:'/popup/embed/'+text_field+'/',ajaxText:'{% include "popups/loading.html" %}'}).jqmShow();}
function embedVideoUe(obj){ActiveEditor=obj;$('#embed_video').jqm({ajax:'/popup/embedvideo/',ajaxText:'{% include "popups/loading.html" %}',zIndex:10000}).jqmShow();}
function getUserEnv()
{resolution=window.screen.availWidth+'x'+window.screen.availHeight;user_agent=navigator.userAgent;f_version=getFlashVersion().replace(/\,/g,'.');return'{"resolution":"'+resolution+'","user_agent":"'+user_agent+'","flash_version":"'+f_version+'"}';}
function getFlashVersion(){try{try{var axo=new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6');try{axo.AllowScriptAccess='always';}
catch(e){return'6.0.0';}}catch(e){}
return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g,',').match(/^,?(.+),?$/)[1];}catch(e){try{if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){return(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g,",").match(/^,?(.+),?$/)[1];}}catch(e){}}
return'0.0.0';}
(function($){$.ifixpng=function(customPixel){$.ifixpng.pixel=customPixel;};$.ifixpng.getPixel=function(){return $.ifixpng.pixel||'images/pixel.gif';};var hack={ltie7:$.browser.msie&&$.browser.version<7,filter:function(src){return"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src='"+src+"')";}};$.fn.ifixpng=hack.ltie7?function(){return this.each(function(){var $$=$(this);var base=$('base').attr('href');if(base){base=base.replace(/\/[^\/]+$/,'/');}
if($$.is('img')||$$.is('input')){if($$.attr('src')){if($$.attr('src').match(/.*\.png([?].*)?$/i)){var source=(base&&$$.attr('src').search(/^(\/|http:)/i))?base+$$.attr('src'):$$.attr('src');$$.css({filter:hack.filter(source),width:$$.width(),height:$$.height()}).attr({src:$.ifixpng.getPixel()}).positionFix();}}}else{var image=$$.css('backgroundImage');if(image.match(/^url\(["']?(.*\.png([?].*)?)["']?\)$/i)){image=RegExp.$1;image=(base&&image.substring(0,1)!='/')?base+image:image;$$.css({backgroundImage:'none',filter:hack.filter(image)}).children().children().positionFix();}}});}:function(){return this;};$.fn.iunfixpng=hack.ltie7?function(){return this.each(function(){var $$=$(this);var src=$$.css('filter');if(src.match(/src=["']?(.*\.png([?].*)?)["']?/i)){src=RegExp.$1;if($$.is('img')||$$.is('input')){$$.attr({src:src}).css({filter:''});}else{$$.css({filter:'',background:'url('+src+')'});}}});}:function(){return this;};$.fn.positionFix=function(){return this.each(function(){var $$=$(this);var position=$$.css('position');if(position!='absolute'&&position!='relative'){$$.css({position:'relative'});}});};})(jQuery);(function($){$.fn.overlabel=function(options){var opts=$.extend({},$.fn.overlabel.defaults,options);if(opts.query==null)opts.query='label.overlabel';var selection=this.filter(opts.query).map(function(){var label=$(this);var id=label.attr("for");var field=document.getElementById(id);if(!field)return;var o=$.meta?$.extend({},opts,label.data()):opts;label.addClass(o.label_class);var hide_label=function(){label.css(o.hide_css)};var dim_out_label=function(){label.fadeTo('slow',0.3)};var show_label=function(){this.value||label.css(o.show_css).fadeTo('slow',1)};$(field).parent().addClass(o.wrapper_class).end().focus(dim_out_label).keypress(hide_label).blur(show_label).each(hide_label).each(show_label);return this;});return opts.filter?selection:selection.end();};$.fn.overlabel.defaults={label_class:'overlabel-apply',wrapper_class:'overlabel-wrapper',hide_css:{'text-indent':'-10000px'},show_css:{'text-indent':'0px','cursor':'text'},filter:false};})(jQuery);$(document).ready(function(){$("label.overlabel").overlabel();});
