/* JCE Editor - 2.5.8 | 16 September 2015 | http://www.joomlacontenteditor.net | Copyright (C) 2006 - 2015 Ryan Demmer. All rights reserved | GNU/GPL Version 2 or later - http://www.gnu.org/licenses/gpl-2.0.html */
(function($){var docElement=document.documentElement;var smile=':)';var $input=document.createElement('input');var $div=document.createElement('div');$.support.input={};$.support.input.attr=(function(at){var o={},i;for(i=0,n=at.length;i<n;i++){o[at[i]]=!!(at[i]in $input);}
return o;})('placeholder max min pattern number'.split(' '));$.support.input.type=(function(props){var o={};for(var i=0,bool,inputElemType,defaultView,len=props.length;i<len;i++){$input.setAttribute('type',inputElemType=props[i]);bool=$input.type!=='text';if(bool){$input.value=smile;$input.style.cssText='position:absolute;visibility:hidden;';if(/^range$/.test(inputElemType)&&$input.style.WebkitAppearance!==undefined){docElement.appendChild($input);defaultView=document.defaultView;bool=defaultView.getComputedStyle&&defaultView.getComputedStyle($input,null).WebkitAppearance!=='textfield'&&($input.offsetHeight!==0);docElement.removeChild($input);}else if(/^(search|tel)$/.test(inputElemType)){}else if(/^(url|email)$/.test(inputElemType)){bool=$input.checkValidity&&$input.checkValidity()===false;}else if(/^color$/.test(inputElemType)){docElement.appendChild($input);docElement.offsetWidth;bool=$input.value!=smile;docElement.removeChild($input);}else{bool=$input.value!=smile;}}
o[props[i]]=!!bool;}
return o;})('search tel url email datetime date month week time datetime-local number range color'.split(' '));$.support.draggable=(function(){return'draggable'in $div;});$.fn.drag=function(){if(!$.support.draggable){$(this).draggable({axis:$(this).data('axis')});}else{$(this).bind('dragstart',function(e){e.dataTransfer.setData('Text',this.id);});}
return this;};$.fn.range=function(){if(!$.support.input.type.range){var self=this;var step=$(this).attr('step')||1;var min=$(this).attr('min');var max=$(this).attr('max');if(typeof min=='undefined'){min=0;}
if(typeof max=='undefined'){max=100;}
var slider=$('<div />').attr({id:$(this).attr('id'),'class':$(this).attr('class'),name:$(this).attr('name')}).slider({min:parseInt(min),max:parseInt(max),step:parseInt(step),value:$(this).val(),slide:function(e,ui){$(self).val(ui.value).change();},start:function(){$(self).mousedown();},stop:function(){$(self).mouseup();}}).insertBefore(this);$(this).hide();return slider;}
return this;};$.fn.number=function(){if(!$.support.input.type.number){return this.change(function(){var v=parseFloat($(this).val()),pv=$(this).attr('placeholder');if(typeof pv=='undefined'){pv='';}
if($.isNumeric(v)===false){$(this).val(pv);}});}
return this;};$.fn.placeholder=function(){if(!$.support.input.attr.placeholder){return this.each(function(){var v=$(this).attr('placeholder'),iv=$(this).val();if(iv===''||iv==v){$(this).addClass('placeholder').val(v).click(function(){if($(this).hasClass('placeholder')){$(this).val('').removeClass('placeholder');}}).blur(function(){iv=$(this).val();if(iv===''||iv==v){$(this).addClass('placeholder').val(v);}});}
$(this).change(function(){iv=$(this).val();if(iv===''){$(this).addClass('placeholder').val(v);}else{$(this).removeClass('placeholder');}});});}
return this;};$.fn.min=function(){if(!$.support.input.attr.min){return this.change(function(){var m=parseFloat($(this).attr('min')),v=parseFloat($(this).val()),pv=$(this).attr('placeholder');if(pv!='undefined'&&pv==v){return this;}
if(v<m){$(this).val(m);}});}
return this;};$.fn.max=function(){if(!$.support.input.attr.max){return this.change(function(){var m=parseFloat($(this).attr('max')),v=parseFloat($(this).val()),pv=$(this).attr('placeholder');if(pv!='undefined'&&pv==v){return this;}
if(v>m){$(this).val(m);}});}
return this;};$.fn.pattern=function(){this.change(function(){var pattern=$(this).attr('pattern'),v=$(this).val(),pv=$(this).attr('placeholder');if(pv!='undefined'&&pv==v){return this;}
if(!new RegExp('^(?:'+pattern+')$').test(v)){var n=new RegExp('('+pattern+')').exec(v);if(n){$(this).val(n[0]);}}});return this;};})(jQuery);var Validator={isEmail:function(s){return this.test(s,'^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+@[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$');},isAbsUrl:function(s){return this.test(s,'^(news|telnet|nttp|file|http|ftp|https)://[-A-Za-z0-9\\.]+\\/?.*$');},isSize:function(s){return this.test(s,'^[0-9.]+(%|in|cm|mm|em|ex|pt|pc|px)?$');},isId:function(s){return this.test(s,'^[A-Za-z_]([A-Za-z0-9_])*$');},isEmpty:function(s){var nl,i;if(s.nodeName=='SELECT'&&s.selectedIndex<1)
return true;if(s.type=='checkbox'&&!s.checked)
return true;if(s.type=='radio'){for(i=0,nl=s.form.elements;i<nl.length;i++){if(nl[i].type=="radio"&&nl[i].name==s.name&&nl[i].checked)
return false;}
return true;}
return new RegExp('^\\s*$').test(s.nodeType==1?s.value:s);},isNumber:function(s,d){return!isNaN(s.nodeType==1?s.value:s)&&(!d||!this.test(s,'^-?[0-9]*\\.[0-9]*$'));},test:function(s,p){s=s.nodeType==1?s.value:s;return s==''||new RegExp(p).test(s);}};var AutoValidator={settings:{id_cls:'id',int_cls:'int',url_cls:'url',number_cls:'number',email_cls:'email',size_cls:'size',required_cls:'required',invalid_cls:'invalid',min_cls:'min',max_cls:'max'},init:function(s){var n;for(n in s)
this.settings[n]=s[n];},validate:function(f){var i,nl,s=this.settings,c=0;nl=this.tags(f,'label');for(i=0;i<nl.length;i++){this.removeClass(nl[i],s.invalid_cls);nl[i].setAttribute('aria-invalid',false);}
c+=this.validateElms(f,'input');c+=this.validateElms(f,'select');c+=this.validateElms(f,'textarea');return c==3;},invalidate:function(n){this.mark(n.form,n);},getErrorMessages:function(f){var nl,i,s=this.settings,field,msg,values,messages=[],ed=tinyMCEPopup.editor;nl=this.tags(f,"label");for(i=0;i<nl.length;i++){if(this.hasClass(nl[i],s.invalid_cls)){field=document.getElementById(nl[i].getAttribute("for"));values={field:nl[i].textContent};if(this.hasClass(field,s.min_cls,true)){message=ed.getLang('invalid_data_min');values.min=this.getNum(field,s.min_cls);}else if(this.hasClass(field,s.number_cls)){message=ed.getLang('invalid_data_number');}else if(this.hasClass(field,s.size_cls)){message=ed.getLang('invalid_data_size');}else{message=ed.getLang('invalid_data');}
message=message.replace(/{\#([^}]+)\}/g,function(a,b){return values[b]||'{#'+b+'}';});messages.push(message);}}
return messages;},reset:function(e){var t=['label','input','select','textarea'];var i,j,nl,s=this.settings;if(e==null)
return;for(i=0;i<t.length;i++){nl=this.tags(e.form?e.form:e,t[i]);for(j=0;j<nl.length;j++){this.removeClass(nl[j],s.invalid_cls);nl[j].setAttribute('aria-invalid',false);}}},validateElms:function(f,e){var nl,i,n,s=this.settings,st=true,va=Validator,v;nl=this.tags(f,e);for(i=0;i<nl.length;i++){n=nl[i];this.removeClass(n,s.invalid_cls);if(this.hasClass(n,s.required_cls)&&va.isEmpty(n))
st=this.mark(f,n);if(this.hasClass(n,s.number_cls)&&!va.isNumber(n))
st=this.mark(f,n);if(this.hasClass(n,s.int_cls)&&!va.isNumber(n,true))
st=this.mark(f,n);if(this.hasClass(n,s.url_cls)&&!va.isAbsUrl(n))
st=this.mark(f,n);if(this.hasClass(n,s.email_cls)&&!va.isEmail(n))
st=this.mark(f,n);if(this.hasClass(n,s.size_cls)&&!va.isSize(n))
st=this.mark(f,n);if(this.hasClass(n,s.id_cls)&&!va.isId(n))
st=this.mark(f,n);if(this.hasClass(n,s.min_cls,true)){v=this.getNum(n,s.min_cls);if(isNaN(v)||parseInt(n.value)<parseInt(v))
st=this.mark(f,n);}
if(this.hasClass(n,s.max_cls,true)){v=this.getNum(n,s.max_cls);if(isNaN(v)||parseInt(n.value)>parseInt(v))
st=this.mark(f,n);}}
return st;},hasClass:function(n,c,d){return new RegExp('\\b'+c+(d?'[0-9]+':'')+'\\b','g').test(n.className);},getNum:function(n,c){c=n.className.match(new RegExp('\\b'+c+'([0-9]+)\\b','g'))[0];c=c.replace(/[^0-9]/g,'');return c;},addClass:function(n,c,b){var o=this.removeClass(n,c);n.className=b?c+(o!=''?(' '+o):''):(o!=''?(o+' '):'')+c;},removeClass:function(n,c){c=n.className.replace(new RegExp("(^|\\s+)"+c+"(\\s+|$)"),' ');return n.className=c!=' '?c:'';},tags:function(f,s){return f.getElementsByTagName(s);},mark:function(f,n){var s=this.settings;this.addClass(n,s.invalid_cls);n.setAttribute('aria-invalid','true');this.markLabels(f,n,s.invalid_cls);return false;},markLabels:function(f,n,ic){var nl,i;nl=this.tags(f,"label");for(i=0;i<nl.length;i++){if(nl[i].getAttribute("for")==n.id||nl[i].htmlFor==n.id)
this.addClass(nl[i],ic);}
return null;}};(function($){$.widget("ui.combobox",{options:{label:'Add Value',change:$.noop},_init:function(options){var self=this;$(this.element).removeClass('mceEditableSelect').addClass('editable');$('<span role="button" class="editable-edit" title="'+this.options.label+'"></span>').insertAfter(this.element).click(function(e){if($(this).hasClass('disabled'))
return;self._onChangeEditableSelect(e);});if($(this.element).is(':disabled')){$(this.element).next('span.editable-edit').addClass('disabled');}},_onChangeEditableSelect:function(e){var self=this;this.input=document.createElement('input');$(this.input).attr('type','text').addClass('editable-input').val($(this.element).val()).insertBefore($(this.element)).width($(this.element).width());$(this.input).blur(function(){self._onBlurEditableSelectInput();}).keydown(function(e){self._onKeyDown(e);});$(this.element).hide();this.input.focus();},_onBlurEditableSelectInput:function(){var self=this,o,found,v=$(this.input).val();if(v!=''){$('option:selected',this.element).prop('selected',false);if($('option[value="'+v+'"]',this.element).is('option')){$(this.element).val(v).change();}else{if(!found){var pattern=$(this.element).data('pattern');if(pattern&&!new RegExp('^(?:'+pattern+')$').test(v)){var n=new RegExp('('+pattern+')').exec(v);v=n?n[0]:'';}
if(v!=''){if($('option[value="'+v+'"]',this.element).length==0){$(this.element).append(new Option(v,v));}
$(this.element).val(v).change();}}}
self.options.change.call(self,v);}else{$(this.element).val('')||$('option:first',this.element).attr('selected','selected');}
$(this.element).show();$(this.input).remove();},_onKeyDown:function(e){if(e.which==13||e.which==27){this._onBlurEditableSelectInput();}},destroy:function(){$.Widget.prototype.destroy.apply(this,arguments);}});$.extend($.ui.combobox,{version:"2.5.8"});})(jQuery);(function($){$.support.canvas=false;var isMobile={Android:function(){return navigator.userAgent.match(/Android/i);},BlackBerry:function(){return navigator.userAgent.match(/BlackBerry/i);},iOS:function(){return navigator.userAgent.match(/iPhone|iPad|iPod/i);},Opera:function(){return navigator.userAgent.match(/Opera Mini/i);},Windows:function(){return navigator.userAgent.match(/IEMobile/i);},any:function(){return(isMobile.Android()||isMobile.BlackBerry()||isMobile.iOS()||isMobile.Opera()||isMobile.Windows());}};$.widget("ui.tips",{options:{speed:150,position:'top center',opacity:0.9,className:'',offsets:{'x':16,'y':16},width:200,fixed:true,parent:'body',trigger:'hover',show:$.noop,hide:$.noop,disabled:':disabled, .disabled'},_init:function(options){var self=this;$.extend(this.options,options);if($(this.element).hasClass('wf-tooltip-cancel-ondrag')){this._cancelOnDrag();}
$(this.element).click(function(e){if(self.options.trigger=='click'&&$(this).is(self.options.disabled)){return;}
if(this.nodeName=='A'||$('a',this).length||$(this).hasClass('wf-tooltip-cancel-ondrag')){return;}
if(self.options.trigger=='click'){if($('#jce-tooltip').is(':visible')){return self._end();}
self._start(e);}
if($('#jce-tooltip').hasClass('sticky')){self._unpin();}else{self._pin();}});if(this.options.trigger=='hover'){$(this.element).hover(function(e){if($('#jce-tooltip').hasClass('sticky')||$(this).hasClass('nohover')){return;}
return self._start(e);},function(e){if($('#jce-tooltip').hasClass('sticky')||$(this).hasClass('nohover')){return;}
return self._end();});}},_createTips:function(){var self=this,$tips=$('#jce-tooltip');if(!$tips.get(0)){$tips=$('<div id="jce-tooltip" role="tooltip" aria-hidden="true">'+'<span class="ui-icon ui-icon-close" title="Close"></span>'+'<div class="jce-tooltip-content"></div>'+'</div>').appendTo(this.options.parent);$('#jce-tooltip').append('<div class="jce-tooltip-pointer"></div>');if($.support.leadingWhitespace===false){$('#jce-tooltip div.jce-tooltip-pointer').append('<div class="jce-tooltip-pointer-inner"></div>');}
$('span.ui-icon-close',$tips).click(function(){self._end();}).hide();if($.support.cssFloat){$tips.css('opacity',0);}}
$tips.removeAttr('class').addClass('jce-tooltip').addClass(this.options.className);},_start:function(e){var self=this;this._createTips();var $tips=$('#jce-tooltip');$tips.data('source',this.element);if(this.options.content){var h=this.options.content;}else{var text=$(this.element).attr('title')||'',title='';if(/::/.test(text)){var parts=text.split('::');title=$.trim(parts[0]);text=$.trim(parts[1]);}
$(this.element).data('title',$(this.element).attr('title')).attr('title','');$(this.element).attr('aria-describedby','jce-tooltip');var h='';if(title){h+='<h4>'+title+'</h4>';}
if(text){h+='<p>'+text+'</p>';}}
$('div.jce-tooltip-content',$tips).html(h);$tips.show().attr('aria-hidden','false');if($.support.cssFloat){$tips.animate({'opacity':this.options.opacity},this.options.speed);}else{if(!window.XMLHttpRequest){$tips.css('width',200);}}
this._trigger('show');window.setTimeout(function(){self._position();$tips.css('visibility','visible');},1);},close:function(){return this._end();},_end:function(){var $tips=$('#jce-tooltip'),element=$tips.data('source')||this.element;if($(element).data('title')){$(element).attr('title',$(element).data('title'));}
$(element).removeAttr('aria-describedby');$tips.css('visibility','hidden').attr('aria-hidden','true').hide();if($.support.cssFloat){$tips.css('opacity',0);}
this._trigger('hide');this._unpin();},_cancelOnDrag:function(){var self=this;$(this.element).bind('mousedown',function(){$(this).addClass('nohover');self._end();$(this).data('title',$(this).attr('title')).attr('title','');}).bind('mouseup',function(){$(this).removeClass('nohover');$(this).attr('title',$(this).data('title'));});},_pin:function(){var self=this;$('#jce-tooltip').addClass('sticky');$('span.ui-icon-close','#jce-tooltip').show();$(window).on('click.tooltip-blur',function(e){var el=$(self.element).get(0),n=e.target;if(n==el||(el.nodeName=='LABEL'&&$(el).attr('for')&&n==$('#'+$(el).attr('for')).get(0))||n==$('#jce-tooltip').get(0)){return;}
if($(n).parents('#jce-tooltip').length===0){self._end();}});},_unpin:function(){$('#jce-tooltip').removeClass('sticky');$('span.ui-icon-close','#jce-tooltip').hide();$(window).off('click.tooltip-blur');},_position:function(){var $tips=$('#jce-tooltip');var $pointer=$('.jce-tooltip-pointer',$tips);var o=this.options.offsets;var tip={'width':$tips.outerWidth(),'height':$tips.outerHeight()};$($pointer).attr('style','');var position=this.options.position;var at=position.replace(/\s*center\s*/,'');var my=at.replace(/(left|right|top|bottom)/,function(s){switch(s){case'left':return'right-'+o.x;break;case'right':return'left+'+o.x;break;case'top':return'bottom-'+o.y;break;case'bottom':return'top+'+o.y;break;}});var pos={},ww=Math.round($(window).width()),wh=Math.round($(window).height()),pw=10,ph=10,st=$(window).scrollTop();$tips.position({my:my,at:at,of:$(this.element),collision:'flipfit flipfit',using:function(props,fb){if(Math.round(props.top)==0){props.top+=10;}
if(Math.round(props.left)==0){props.left+=10;}
if(Math.round(props.top+tip.height)==wh){props.top-=10;}
if(Math.round(props.left+tip.width)==ww){props.left-=10;}
if(/left|right/.test(position)){$pointer.css('top',Math.round(fb.target.top-fb.element.top)+fb.target.height/2);}
if(/top|bottom/.test(position)&&Math.round(fb.element.left)==0){$pointer.css('left',fb.target.left+Math.round(fb.target.width/2)-pw);}
if(fb.element.left<fb.target.left){position=position.replace('right','left');}else{position=position.replace('left','right');}
if(fb.element.top<fb.target.top){position=position.replace('bottom','top');}else{position=position.replace('top','bottom');}
$tips.css(props);}});$pointer.removeClass('top right bottom left center').addClass(position);},_createPointer:function(position){var $tips=$('#jce-tooltip'),canvas=$('canvas',$tips).get(0),context=canvas.getContext('2d');var w=canvas.width,h=canvas.height;context.clearRect(0,0,canvas.width,canvas.height);context.fillStyle=$tips.css('background-color');context.strokeStyle=$tips.css('border-top-color');context.lineWidth=1.8;context.beginPath();var pos=/(top|bottom|left|right)/.exec(position)||['','top'];switch(pos[1]){case'top':context.moveTo(0,0);context.lineTo(w/2,h);context.lineTo(w,0);break;case'bottom':context.moveTo(0,h);context.lineTo(w/2,0);context.lineTo(w,h);break;case'left':context.moveTo(0,0);context.lineTo(w,h/2);context.lineTo(0,h);break;case'right':context.moveTo(w,0);context.lineTo(0,h/2);context.lineTo(w,h);break;}
context.fill();context.stroke();context.closePath();},_locate:function(e){this._createTips();var $tips=$('#jce-tooltip');var o=this.options.offsets;var page={'x':e.pageX,'y':e.pageY};var tip={'x':$tips.outerWidth(),'y':$tips.outerHeight()};var offset=$(e.target).offset();var pos={'x':page.x+o.x,'y':page.y+o.y};var position=this.options.position;var scrollTop=$(document).scrollTop();if((pos.y-tip.y)<0||offset.top<(scrollTop+tip.y)){$tips.removeClass('jce-'+this.options.className+'-top');position=position.replace('top','bottom');$tips.addClass('jce-'+this.options.className+'-bottom');}else{$tips.removeClass('jce-'+this.options.className+'-bottom');position=position.replace('bottom','top');$tips.addClass('jce-'+this.options.className+'-top');}
switch(position){case'top center':pos.x=(page.x-Math.round((tip.x/2)))+o.x;pos.y=(page.y-tip.y)-o.y;break;case'bottom center':pos.x=(page.x-(tip.x/2))+o.x;pos.y=page.y+o.y;break;}
if(pos.x<0){pos.x=5;}
if(pos.x>parseFloat($(window).width())){pos.x=parseFloat($(window).width())-(tip.x/2+5);}
$tips.css({top:pos.y,left:pos.x});},destroy:function(){$.Widget.prototype.destroy.apply(this,arguments);}});$.extend($.ui.tips,{version:"2.5.8"});})(jQuery);(function($){$.widget("ui.colorpicker",{instance:null,options:{color:'#FFFFFF',detail:50,speed:200,'stylesheets':[],custom_colors:'',forcedHighContrastMode:false,labels:{picker:'Picker',title:'Color Picker',palette:'Web Colors',named:'Named Colors',template:'Template Colors',custom:'Custom Colors',color:'Color',apply:'Apply',name:'Name'},insert:$.noop,close:$.noop,dialog:false,parent:'body'},_strhex:"0123456789abcdef",_colors:["#000000","#000033","#000066","#000099","#0000cc","#0000ff","#330000","#330033","#330066","#330099","#3300cc","#3300ff","#660000","#660033","#660066","#660099","#6600cc","#6600ff","#990000","#990033","#990066","#990099","#9900cc","#9900ff","#cc0000","#cc0033","#cc0066","#cc0099","#cc00cc","#cc00ff","#ff0000","#ff0033","#ff0066","#ff0099","#ff00cc","#ff00ff","#003300","#003333","#003366","#003399","#0033cc","#0033ff","#333300","#333333","#333366","#333399","#3333cc","#3333ff","#663300","#663333","#663366","#663399","#6633cc","#6633ff","#993300","#993333","#993366","#993399","#9933cc","#9933ff","#cc3300","#cc3333","#cc3366","#cc3399","#cc33cc","#cc33ff","#ff3300","#ff3333","#ff3366","#ff3399","#ff33cc","#ff33ff","#006600","#006633","#006666","#006699","#0066cc","#0066ff","#336600","#336633","#336666","#336699","#3366cc","#3366ff","#666600","#666633","#666666","#666699","#6666cc","#6666ff","#996600","#996633","#996666","#996699","#9966cc","#9966ff","#cc6600","#cc6633","#cc6666","#cc6699","#cc66cc","#cc66ff","#ff6600","#ff6633","#ff6666","#ff6699","#ff66cc","#ff66ff","#009900","#009933","#009966","#009999","#0099cc","#0099ff","#339900","#339933","#339966","#339999","#3399cc","#3399ff","#669900","#669933","#669966","#669999","#6699cc","#6699ff","#999900","#999933","#999966","#999999","#9999cc","#9999ff","#cc9900","#cc9933","#cc9966","#cc9999","#cc99cc","#cc99ff","#ff9900","#ff9933","#ff9966","#ff9999","#ff99cc","#ff99ff","#00cc00","#00cc33","#00cc66","#00cc99","#00cccc","#00ccff","#33cc00","#33cc33","#33cc66","#33cc99","#33cccc","#33ccff","#66cc00","#66cc33","#66cc66","#66cc99","#66cccc","#66ccff","#99cc00","#99cc33","#99cc66","#99cc99","#99cccc","#99ccff","#cccc00","#cccc33","#cccc66","#cccc99","#cccccc","#ccccff","#ffcc00","#ffcc33","#ffcc66","#ffcc99","#ffcccc","#ffccff","#00ff00","#00ff33","#00ff66","#00ff99","#00ffcc","#00ffff","#33ff00","#33ff33","#33ff66","#33ff99","#33ffcc","#33ffff","#66ff00","#66ff33","#66ff66","#66ff99","#66ffcc","#66ffff","#99ff00","#99ff33","#99ff66","#99ff99","#99ffcc","#99ffff","#ccff00","#ccff33","#ccff66","#ccff99","#ccffcc","#ccffff","#ffff00","#ffff33","#ffff66","#ffff99","#ffffcc","#ffffff"],_named:{'#F0F8FF':'AliceBlue','#FAEBD7':'AntiqueWhite','#00FFFF':'Aqua','#7FFFD4':'Aquamarine','#F0FFFF':'Azure','#F5F5DC':'Beige','#FFE4C4':'Bisque','#000000':'Black','#FFEBCD':'BlanchedAlmond','#0000FF':'Blue','#8A2BE2':'BlueViolet','#A52A2A':'Brown','#DEB887':'BurlyWood','#5F9EA0':'CadetBlue','#7FFF00':'Chartreuse','#D2691E':'Chocolate','#FF7F50':'Coral','#6495ED':'CornflowerBlue','#FFF8DC':'Cornsilk','#DC143C':'Crimson','#00FFFF':'Cyan','#00008B':'DarkBlue','#008B8B':'DarkCyan','#B8860B':'DarkGoldenRod','#A9A9A9':'DarkGray','#006400':'DarkGreen','#BDB76B':'DarkKhaki','#8B008B':'DarkMagenta','#556B2F':'DarkOliveGreen','#FF8C00':'Darkorange','#9932CC':'DarkOrchid','#8B0000':'DarkRed','#E9967A':'DarkSalmon','#8FBC8F':'DarkSeaGreen','#483D8B':'DarkSlateBlue','#2F4F4F':'DarkSlateGrey','#00CED1':'DarkTurquoise','#9400D3':'DarkViolet','#FF1493':'DeepPink','#00BFFF':'DeepSkyBlue','#696969':'DimGrey','#1E90FF':'DodgerBlue','#B22222':'FireBrick','#FFFAF0':'FloralWhite','#228B22':'ForestGreen','#FF00FF':'Fuchsia','#DCDCDC':'Gainsboro','#F8F8FF':'GhostWhite','#FFD700':'Gold','#DAA520':'GoldenRod','#808080':'Gray','#808080':'Grey','#008000':'Green','#ADFF2F':'GreenYellow','#F0FFF0':'HoneyDew','#FF69B4':'HotPink','#CD5C5C':'IndianRed','#4B0082':'Indigo','#FFFFF0':'Ivory','#F0E68C':'Khaki','#E6E6FA':'Lavender','#FFF0F5':'LavenderBlush','#7CFC00':'LawnGreen','#FFFACD':'LemonChiffon','#ADD8E6':'LightBlue','#F08080':'LightCoral','#E0FFFF':'LightCyan','#FAFAD2':'LightGoldenRodYellow','#D3D3D3':'LightGray','#D3D3D3':'LightGrey','#90EE90':'LightGreen','#FFB6C1':'LightPink','#FFA07A':'LightSalmon','#20B2AA':'LightSeaGreen','#87CEFA':'LightSkyBlue','#778899':'LightSlateGray','#778899':'LightSlateGrey','#B0C4DE':'LightSteelBlue','#FFFFE0':'LightYellow','#00FF00':'Lime','#32CD32':'LimeGreen','#FAF0E6':'Linen','#FF00FF':'Magenta','#800000':'Maroon','#66CDAA':'MediumAquaMarine','#0000CD':'MediumBlue','#BA55D3':'MediumOrchid','#9370D8':'MediumPurple','#3CB371':'MediumSeaGreen','#7B68EE':'MediumSlateBlue','#00FA9A':'MediumSpringGreen','#48D1CC':'MediumTurquoise','#C71585':'MediumVioletRed','#191970':'MidnightBlue','#F5FFFA':'MintCream','#FFE4E1':'MistyRose','#FFE4B5':'Moccasin','#FFDEAD':'NavajoWhite','#000080':'Navy','#FDF5E6':'OldLace','#808000':'Olive','#6B8E23':'OliveDrab','#FFA500':'Orange','#FF4500':'OrangeRed','#DA70D6':'Orchid','#EEE8AA':'PaleGoldenRod','#98FB98':'PaleGreen','#AFEEEE':'PaleTurquoise','#D87093':'PaleVioletRed','#FFEFD5':'PapayaWhip','#FFDAB9':'PeachPuff','#CD853F':'Peru','#FFC0CB':'Pink','#DDA0DD':'Plum','#B0E0E6':'PowderBlue','#800080':'Purple','#FF0000':'Red','#BC8F8F':'RosyBrown','#4169E1':'RoyalBlue','#8B4513':'SaddleBrown','#FA8072':'Salmon','#F4A460':'SandyBrown','#2E8B57':'SeaGreen','#FFF5EE':'SeaShell','#A0522D':'Sienna','#C0C0C0':'Silver','#87CEEB':'SkyBlue','#6A5ACD':'SlateBlue','#708090':'SlateGray','#708090':'SlateGrey','#FFFAFA':'Snow','#00FF7F':'SpringGreen','#4682B4':'SteelBlue','#D2B48C':'Tan','#008080':'Teal','#D8BFD8':'Thistle','#FF6347':'Tomato','#40E0D0':'Turquoise','#EE82EE':'Violet','#F5DEB3':'Wheat','#FFFFFF':'White','#F5F5F5':'WhiteSmoke','#FFFF00':'Yellow','#9ACD32':'YellowGreen'},_translate:function(s,d){var o=this.options;var v=o.labels[s]||d||'';if(typeof tinyMCEPopup!=='undefined'){v=tinyMCEPopup.getLang('colorpicker.'+s,v);}
return v;},_init:function(){var self=this,o=this.options;this._getStylesheetColors();if(this.options.dialog){if($('#tab-content .colorpicker_generated').length){return;}
var color=$(this.element).val()||'#000000';if(/rgb/.test(color)){color=this._rgbToHex(color);}
if($(self.element).hasClass('placeholder')){color='';}
this._createTabs();$('#colorpicker_insert').button({icons:{primary:'ui-icon-check'}}).click(function(e){e.preventDefault();self._insert();});if(self._wheel){self._wheel.setColor(color);}}else{if(this.options.widget){this.widget=$(this.options.widget);}else{this.widget=$('<span class="colorpicker_widget"></span>').insertAfter(this.element);}
$(this.widget).css('background-color',$(this.element).val()||'#000000').tips({trigger:'click',position:'right center',content:'<div id="colorpicker" title="Color Picker">'+self._getContent()+'</div>',className:'wf-colorpicker',opacity:1,parent:this.options.parent,show:function(){var color=$(self.element).val()||'#000000';if(/rgb/.test(color)){color=this._rgbToHex(color);}
if($(self.element).hasClass('placeholder')){color='';}
if($('#tab-content .colorpicker_generated').length){return;}
$('#colorpicker_tabs').html(function(i,h){return h.replace(/\{#(\w+)\}/gi,function(a,b){return self._translate(b);});});$('#colorpicker').append('<div id="colorpicker_preview">'+' <div id="colorpicker_preview_text">'+'  <input type="text" id="colorpicker_color" size="8" maxlength="8" value="'+color+'" class="ui-corner-all" aria-required="true" />'+' </div>'+' <div id="colorpicker_preview_color" class="ui-widget-content ui-corner-all"></div>'+' <div id="colorpicker_insert" class="btn btn-small"><i class="icon-ok"></i>&nbsp;'+o.labels.apply+'</div>'+'</div>');$('#colorpicker_preview_color').css('background-color',color);$('#colorpicker_insert').button({icons:{primary:'ui-icon-check'}}).click(function(e){e.preventDefault();self._insert();});self._createTabs();if(self._wheel){self._wheel.setColor(color);}}});}},_getContent:function(){var self=this,h='',o=this.options;h+='<div id="colorpicker_tabs">';h+='<ul class="nav nav-tabs">';h+='<li class="active"><a href="#colorpicker_picker" aria-controls="colorpicker_picker" class="active">{#picker}</a></li>';h+='<li><a href="#colorpicker_web" aria-controls="colorpicker_web">{#palette}</a></li>';h+='<li><a href="#colorpicker_named" aria-controls="colorpicker_named">{#named}</a></li>';if(o.stylesheets.length){h+='<li><a href="#colorpicker_template" aria-controls="colorpicker_template">{#template}</a></li>';}
h+='</ul>';h+='<div class="tab-content">';h+='<div id="colorpicker_picker" data-type="picker" class="tab-pane active"></div>';h+='<div id="colorpicker_web" data-type="web" class="tab-pane"></div>';h+='<div id="colorpicker_named" data-type="named" class="tab-pane"></div>';if(o.stylesheets.length){h+='<div id="colorpicker_template" data-type="template" class="tab-pane"></div>';}
h+='</div>';h+='</div>';return h;},_createTabs:function(){var self=this;if($.isFunction($.fn.tab)){$('#colorpicker_tabs a').on('show',function(e){var id=$(e.target).attr('href'),type=$(id).data('type');self['_create'+type].call(self,$(id));$('#colorpicker_insert').toggle(type=='picker');}).click(function(e){e.preventDefault();$(this).tab('show');});}else{$('#colorpicker_tabs','#colorpicker').tabs({activate:function(event,ui){var type=$(ui.newPanel).data('type');self['_create'+type].call(self,$(ui.newPanel));$('#colorpicker_insert').toggle(type=='picker');},beforeActivate:function(event,ui){$(ui.oldTab).removeClass('active');$(ui.newTab).addClass('active');}});}
self._createpicker($('#colorpicker_picker','#colorpicker_tabs'));},_blur:function(e){var t=this;if(e){if(e.target==this.picker||e.target==this.picker.colorpicker){return false;}
var matched=false;$(this.picker.colorpicker).find('*').each(function(){if(this==e.target){matched=true;return false;}});if(!matched){t.close();}}},_close:function(){this._trigger('close',null);$(this.widget).tips('close');},_insert:function(){var color=$('#colorpicker_color').val();this._trigger('insert',null,color);if(color){$(this.element).val(color).removeClass('placeholder').change();$(this.widget).css('background-color',color);}
this._close();},_rgbToHex:function(c){var r,g,b,re=new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)","gi");if(!c){return c;}
var rgb=c.replace(re,"$1,$2,$3").split(',');if(rgb.length==3){r=parseInt(rgb[0]).toString(16);g=parseInt(rgb[1]).toString(16);b=parseInt(rgb[2]).toString(16);r=r.length==1?'0'+r:r;g=g.length==1?'0'+g:g;b=b.length==1?'0'+b:b;return"#"+r+g+b;}
return c;},_hexToRGB:function(c){var r,g,b;if(c.indexOf('#')!=-1){c=c.replace(new RegExp('[^0-9A-F]','gi'),'');r=parseInt(c.substring(0,2),16);g=parseInt(c.substring(2,4),16);b=parseInt(c.substring(4,6),16);return{r:r,g:g,b:b};}
return null;},_createpicker:function(parent){var self=this;if($(parent).hasClass('colorpicker_generated')){return;}
self._wheel=$.farbtastic(parent,$('#colorpicker_color').val(),function(color){self._showColor(color);});$(parent).addClass('colorwheel colorpicker_generated');},_createweb:function(parent){var self=this,h='';if($(parent).hasClass('colorpicker_generated')){return;}
h+='<div role="listbox" aria-labelledby="colorpicker_web" tabindex="0">';h+='<ul>';$.each(this._colors,function(i,v){h+='<li style="background-color:'+v+'"><span class="colorpicker_webblock" role="option" aria-labelledby="web_colors_'+i+'" title="'+v+'"></span></li>';if(self.options.forcedHighContrastMode){h+='<canvas class="mceColorSwatch" data-color="'+v+'"></canvas>';}
h+='<span class="mceVoiceLabel" id="web_colors_'+i+'">'+v.toUpperCase()+'</span>';if((i+1)%18==0){}});h+='</ul></div>';$(parent).append(h).append('<br style="clear:both;" />').addClass('colorpicker_generated');$('span.colorpicker_webblock',parent).click(function(){self._insert();}).mouseover(function(){self._showColor($(this).attr('title'));});this._paintCanvas(parent);},_createnamed:function(parent){var self=this,h='',i=0;if($(parent).hasClass('colorpicker_generated')){return;}
h+='<div role="listbox" aria-labelledby="colorpicker_named" tabindex="0">';h+='<ul>';$.each(this._named,function(k,v){h+='<li style="background-color:'+k+'"><span class="colorpicker_namedblock" aria-labelledby="named_colors_'+k+'" title="'+self._translate(k.replace(/[^\w]/g,''),v)+'"></span></li>';if(self.options.forcedHighContrastMode){h+='<canvas class="mceColorSwatch" data-color="'+v+'"></canvas>';}
h+='<span class="mceVoiceLabel" id="named_colors_'+k+'">'+v.toUpperCase()+'</span>';if((i+1)%18==0){}
i++;});h+='</ul></div>';$(parent).append(h).append('<br style="clear:both;" />').addClass('colorpicker_generated').append('<div id="colorpicker_colorname">'+this.options.labels.name+'</div>');$('span.colorpicker_namedblock',parent).click(function(){self._insert();}).mouseover(function(){self._showColor($(this).parent('li').css('background-color'),$(this).attr('title'));});this._paintCanvas(parent);},_createtemplate:function(parent){var self=this,h='';if($(parent).hasClass('colorpicker_generated')){return;}
if(this.template_colors){var templateColors=this.template_colors;if($.type(this.template_colors)=='string'){templateColors=templateColors.split(',');}
h+='<div role="listbox" aria-labelledby="colorpicker_template_label" tabindex="0">';h+='<ul>';$.each(templateColors,function(i,v){if(v.length==4){v=v+v.substr(1);}
h+='<li style="background-color:'+v+'"><span class="colorpicker_templateblock" aria-labelledby="template_colors_'+i+'" title="'+v+'"></span></li>';if(self.options.forcedHighContrastMode){h+='<canvas class="mceColorSwatch" data-color="'+v+'"></canvas>';}
h+='<span class="mceVoiceLabel" id="template_colors_'+i+'">'+v.toUpperCase()+'</span>';if((i+1)%18==0){}});h+='</ul></div>';$(parent).append(h);}
if(this.options.custom_colors){var h='';$(parent).append('<p id="colorpicker_custom_label">'+this.options.labels.custom+'</p>');var customColors=this.options.custom_colors.split(',');h+='<div role="listbox" aria-labelledby="colorpicker_custom_label" tabindex="0">';h+='<ul>';$.each(customColors,function(i,v){if(v.length==4){v=v+v.replace('#','');}
h+='<li style="background-color:'+v+'"><span class="colorpicker_templateblock" aria-labelledby="custom_colors_'+i+'" title="'+v+'"></span></li>';if(self.options.forcedHighContrastMode){h+='<canvas class="mceColorSwatch" data-color="'+v+'"></canvas>';}
h+='<span class="mceVoiceLabel" style="display:none;" id="custom_colors_'+i+'">'+v.toUpperCase()+'</span>';if((i+1)%18==0){h+='</ul><ul>';}});h+='</div>';$(parent).append(h);this._paintCanvas(parent);}
$(parent).addClass('colorpicker_generated');$('span.colorpicker_templateblock',parent).click(function(){self._insert();}).mouseover(function(){self._showColor($(this).attr('title'));});},_showColor:function(color,name){if(name){$("#colorpicker_colorname").html(this.options.labels.name+': '+name);}
if(/rgb/.test(color)){color=this._rgbToHex(color);}
$("#colorpicker_preview_color").css('background-color',color);$("#colorpicker_color").val(color.toLowerCase());},_changeFinalColor:function(color){if(!/#/.test(color)){color=this._rgbToHex(color);}
$('#colorpicker_preview').css('background-color',color);$('#colorpicker_color').val(color);},_paintCanvas:function(el){$('canvas.mceColorSwatch',el).each(function(){$canvas=$(this).get(0);if($canvas.getContext&&(context=$canvas.getContext("2d"))){context.fillStyle=$canvas.getAttribute('data-color');context.fillRect(0,0,10,10);}});},_sort_colors:function(colors){var sorted=[],s=[];$.each(colors,function(x,color){color=color.replace('#','').toLowerCase();if(color.length==6){var condensed='';$.each(color.split(''),function(i,c){if(i%2==0){condensed+=c;}});var color_str=condensed;}
var v=0;$.each(color_str.split(''),function(i,c){v+=parseInt(c,16);});if(color){sorted[v+x]='#'+color;}});$.each(sorted,function(i,c){if(c){s.push(c);}});return s;},_getStylesheetColors:function(){var self=this,o=this.options,colors=[],href,hex,rgb;var hexRe=/#[0-9a-f]{3,6}/gi,rgbRe=new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)","gi");function addColor(s){if($.inArray(s,colors)==-1){colors.push(s);}}
function parseCSS(s){if(s.imports){$.each(s.imports,function(i,r){parseCSS(r);});}
$.each(s.cssRules||s.rules,function(i,r){switch(r.type||1){case 1:var css=r.cssText||r.style.cssText;if(css){hex=css.match(hexRe);rgb=css.match(rgbRe);if(rgb){addColor(self._rgbToHex(rgb[0]));}
if(hex){addColor(hex[0]);}}
break;case 3:if(r.href.indexOf('://')!=-1){return;}
parseCSS(r.styleSheet);break;}});};function processStyleSheets(stylesheets){try{$.each(stylesheets,function(i,s){parseCSS(s);});}catch(ex){}
return colors;}
if($.type(o.stylesheets[0])=='string'){var doc,el,ifr;if(document.getElementById('stylsheets_iframe')){return;}
var h='<!DOCTYPE html><html><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge">';$.each(o.stylesheets,function(i,s){h+='<link href="'+s+'" rel="stylesheet" type="text/css" />';});h+='</head><body></body></html>';ifr=document.createElement('iframe');$(ifr).attr({'src':'javascript:""','id':'stylsheets_iframe'}).hide().appendTo('body').load(function(e){el=e.target,doc=el.contentWindow.document;if(doc&&doc.styleSheets){self.template_colors=processStyleSheets(doc.styleSheets);}
$(ifr).remove();});doc=ifr.contentWindow.document;if(doc){doc.open();doc.write(h);doc.close();}}else{this.template_colors=processStyleSheets(o.stylesheets);}},destroy:function(){$.Widget.prototype.destroy.apply(this,arguments);}});$.extend($.ui.colorpicker,{version:"2.5.8"});})(jQuery);(function($){$.fn.farbtastic=function(callback){$.farbtastic(this,callback);return this;};$.farbtastic=function(container,color,callback){var container=$(container).get(0);return container.farbtastic||(container.farbtastic=new $._farbtastic(container,color,callback));};$._farbtastic=function(container,color,callback){var fb=this;$(container).html('<div class="farbtastic"><div class="color"></div><div class="wheel"></div><div class="overlay"></div><div class="h-marker marker"></div><div class="sl-marker marker"></div></div>');var e=$('.farbtastic',container);fb.wheel=$('.wheel',container).get(0);fb.radius=84;fb.square=100;fb.width=194;if(navigator.appVersion.match(/MSIE [0-6]\./)){$('*',e).each(function(){if(this.currentStyle.backgroundImage!='none'){var image=this.currentStyle.backgroundImage;image=this.currentStyle.backgroundImage.substring(5,image.length-2);$(this).css({'backgroundImage':'none','filter':"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='"+image+"')"});}});}
fb.linkTo=function(callback){if(typeof fb.callback=='object'){$(fb.callback).unbind('keyup',fb.updateValue);}
fb.color=null;if(typeof callback=='function'){fb.callback=callback;}
else if(typeof callback=='object'||typeof callback=='string'){fb.callback=$(callback);fb.callback.bind('keyup',fb.updateValue);if(fb.callback.get(0).value){fb.setColor(fb.callback.get(0).value);}}
return this;}
fb.updateValue=function(event){if(this.value&&this.value!=fb.color){fb.setColor(this.value);}}
fb.setColor=function(color){var unpack=fb.unpack(color);if(fb.color!=color&&unpack){fb.color=color;fb.rgb=unpack;fb.hsl=fb.RGBToHSL(fb.rgb);fb.updateDisplay();}
return this;}
fb.setHSL=function(hsl){fb.hsl=hsl;fb.rgb=fb.HSLToRGB(hsl);fb.color=fb.pack(fb.rgb);fb.updateDisplay();return this;}
fb.widgetCoords=function(event){var x,y;var el=event.target||event.srcElement;var reference=fb.wheel;if(typeof event.offsetX!='undefined'){var pos={x:event.offsetX,y:event.offsetY};var e=el;while(e){e.mouseX=pos.x;e.mouseY=pos.y;pos.x+=e.offsetLeft;pos.y+=e.offsetTop;e=e.offsetParent;}
var e=reference;var offset={x:0,y:0}
while(e){if(typeof e.mouseX!='undefined'){x=e.mouseX-offset.x;y=e.mouseY-offset.y;break;}
offset.x+=e.offsetLeft;offset.y+=e.offsetTop;e=e.offsetParent;}
e=el;while(e){e.mouseX=undefined;e.mouseY=undefined;e=e.offsetParent;}}
else{var pos=fb.absolutePosition(reference);x=(event.pageX||0*(event.clientX+$('html').get(0).scrollLeft))-pos.x;y=(event.pageY||0*(event.clientY+$('html').get(0).scrollTop))-pos.y;}
return{x:x-fb.width/2,y:y-fb.width/2};}
fb.mousedown=function(event){var pos=fb.widgetCoords(event);fb.circleDrag=Math.max(Math.abs(pos.x),Math.abs(pos.y))*2>fb.square;fb.mousemove(event);return false;}
fb.touchconvert=function(e){var e=e.originalEvent.touches.item(0);return e;}
fb.touchmove=function(e){fb.mousemove(fb.touchconvert(e));event.preventDefault();return false;}
fb.touchend=function(event){$(document).unbind('touchmove',fb.touchmove);$(document).unbind('touchend',fb.touchend);document.dragging=false;event.preventDefault();return false;}
fb.mousemove=function(event){var pos=fb.widgetCoords(event);if(fb.circleDrag){var hue=Math.atan2(pos.x,-pos.y)/6.28;if(hue<0)
hue+=1;fb.setHSL([hue,fb.hsl[1],fb.hsl[2]]);}
else{var sat=Math.max(0,Math.min(1,-(pos.x/fb.square)+.5));var lum=Math.max(0,Math.min(1,-(pos.y/fb.square)+.5));fb.setHSL([fb.hsl[0],sat,lum]);}
return false;}
fb.mouseup=function(){$(document).unbind('mousemove',fb.mousemove);$(document).unbind('mouseup',fb.mouseup);document.dragging=false;}
fb.updateDisplay=function(){var angle=fb.hsl[0]*6.28;$('.h-marker',e).css({left:Math.round(Math.sin(angle)*fb.radius+fb.width/2)+'px',top:Math.round(-Math.cos(angle)*fb.radius+fb.width/2)+'px'});$('.sl-marker',e).css({left:Math.round(fb.square*(.5-fb.hsl[1])+fb.width/2)+'px',top:Math.round(fb.square*(.5-fb.hsl[2])+fb.width/2)+'px'});$('.color',e).css('backgroundColor',fb.pack(fb.HSLToRGB([fb.hsl[0],1,0.5])));if(typeof fb.callback=='object'){$(fb.callback).css({backgroundColor:fb.color,color:fb.hsl[2]>0.5?'#000':'#fff'});$(fb.callback).each(function(){if(this.value&&this.value!=fb.color){this.value=fb.color;}});}
else if(typeof fb.callback=='function'){fb.callback.call(fb,fb.color);}}
fb.absolutePosition=function(el){var r={x:el.offsetLeft,y:el.offsetTop};if(el.offsetParent){var tmp=fb.absolutePosition(el.offsetParent);r.x+=tmp.x;r.y+=tmp.y;}
return r;};fb.pack=function(rgb){var r=Math.round(rgb[0]*255);var g=Math.round(rgb[1]*255);var b=Math.round(rgb[2]*255);return'#'+(r<16?'0':'')+r.toString(16)+
(g<16?'0':'')+g.toString(16)+
(b<16?'0':'')+b.toString(16);}
fb.unpack=function(color){if(color.length==7){return[parseInt('0x'+color.substring(1,3))/255,parseInt('0x'+color.substring(3,5))/255,parseInt('0x'+color.substring(5,7))/255];}
else if(color.length==4){return[parseInt('0x'+color.substring(1,2))/15,parseInt('0x'+color.substring(2,3))/15,parseInt('0x'+color.substring(3,4))/15];}}
fb.HSLToRGB=function(hsl){var m1,m2,r,g,b;var h=hsl[0],s=hsl[1],l=hsl[2];m2=(l<=0.5)?l*(s+1):l+s-l*s;m1=l*2-m2;return[this.hueToRGB(m1,m2,h+0.33333),this.hueToRGB(m1,m2,h),this.hueToRGB(m1,m2,h-0.33333)];}
fb.hueToRGB=function(m1,m2,h){h=(h<0)?h+1:((h>1)?h-1:h);if(h*6<1)
return m1+(m2-m1)*h*6;if(h*2<1)
return m2;if(h*3<2)
return m1+(m2-m1)*(0.66666-h)*6;return m1;}
fb.RGBToHSL=function(rgb){var min,max,delta,h,s,l;var r=rgb[0],g=rgb[1],b=rgb[2];min=Math.min(r,Math.min(g,b));max=Math.max(r,Math.max(g,b));delta=max-min;l=(min+max)/2;s=0;if(l>0&&l<1){s=delta/(l<0.5?(2*l):(2-2*l));}
h=0;if(delta>0){if(max==r&&max!=g)
h+=(g-b)/delta;if(max==g&&max!=b)
h+=(2+(b-r)/delta);if(max==b&&max!=r)
h+=(4+(r-g)/delta);h/=6;}
return[h,s,l];}
$('*',e).mousedown(function(e){if(!document.dragging){$(document).bind('mousemove',fb.mousemove).bind('mouseup',fb.mouseup);document.dragging=true;}
fb.mousedown(e);});$('*',e).bind("touchstart",function(e){if(!document.dragging){$(document).bind('touchmove',fb.touchmove).bind('touchend',fb.touchend);document.dragging=true;}
fb.mousedown(fb.touchconvert(e));e.preventDefault();return false;});fb.setColor('#000000');if(callback){fb.linkTo(callback);}};})(jQuery);(function($){var standalone=true;if(window.tinyMCEPopup){var TinyMCE_Utils={};TinyMCE_Utils.fillClassList=function(id){var ed=tinyMCEPopup.editor,lst=document.getElementById(id),v,cl;if(v=tinyMCEPopup.getParam('theme_advanced_styles')){cl=[];tinymce.each(v.split(';'),function(v){var p=v.split('=');cl.push({'title':p[0],'class':p[1]});});}else{cl=ed.dom.getClasses();}
tinymce.each(['jcepopup','jcetooltip'],function(o){lst.options[lst.options.length]=new Option(o,o);});if(cl.length>0){tinymce.each(cl,function(o){lst.options[lst.options.length]=new Option(o.title||o['class'],o['class']);});}};TinyMCE_Utils.updateColor=function(parent){if(typeof parent=='string'){parent=document.getElementById(parent);}
document.getElementById(parent.id+'_pick').style.backgroundColor=parent.value;};TinyMCE_Utils.addClassesToList=function(list_id,specific_option){var styleSelectElm=document.getElementById(list_id);var styles=tinyMCEPopup.getParam('theme_advanced_styles',false);styles=tinyMCEPopup.getParam(specific_option,styles);if(styles){var stylesAr=styles.split(';');for(var i=0;i<stylesAr.length;i++){if(stylesAr!=""){var key,value;key=stylesAr[i].split('=')[0];value=stylesAr[i].split('=')[1];styleSelectElm.options[styleSelectElm.length]=new Option(key,value);}}}else{tinymce.each(tinyMCEPopup.editor.dom.getClasses(),function(o){styleSelectElm.options[styleSelectElm.length]=new Option(o.title||o['class'],o['class']);});}};this.TinyMCE_Utils=TinyMCE_Utils;standalone=false;}
var $tmp=document.createElement('div');$.support.canvas=!!document.createElement('canvas').getContext;$.support.backgroundSize=(function(){var s=false;$.each(['backgroundSize','MozBackgroundSize','WebkitBackgroundSize','OBackgroundSize'],function(){if(typeof $tmp.style[this]!=='undefined'){s=true;}});return s;})();$.support.pdf=(function(){try{if(!$.support.cssFloat){var control=null;try{control=new ActiveXObject('AcroPDF.PDF');}
catch(e){}
if(!control){try{control=new ActiveXObject('PDF.PdfCtrl');}
catch(e){}}
return control?true:false;}else if(navigator.plugins){for(var n in navigator.plugins){if(n=='Adobe Acrobat'){return true;}
if(navigator.plugins[n].name&&(navigator.plugins[n].name=='Adobe Acrobat'||navigator.plugins[n].name=='Chrome PDF Viewer')){return true;}}}else if(navigator.mimeTypes){var mime=navigator.mimeTypes["application/pdf"];if(mime&&mime.enabledPlugin){return true;}}}
catch(e){}
return false;})();$.support.video=(function(){var el=document.createElement('video'),bool=false;try{if(bool=!!el.canPlayType){bool=new Boolean(bool);bool.ogg=el.canPlayType('video/ogg; codecs="theora"');var h264='video/mp4; codecs="avc1.42E01E';bool.mp4=el.canPlayType(h264+'"')||el.canPlayType(h264+', mp4a.40.2"');bool.webm=el.canPlayType('video/webm; codecs="vp8, vorbis"');}}catch(e){}
return bool;})();$.support.audio=(function(){var el=document.createElement('audio'),bool=false;try{if(bool=!!el.canPlayType){bool=new Boolean(bool);bool.ogg=el.canPlayType('audio/ogg; codecs="vorbis"');bool.mp3=el.canPlayType('audio/mpeg;');bool.wav=el.canPlayType('audio/wav; codecs="1"');bool.m4a=el.canPlayType('audio/x-m4a;')||el.canPlayType('audio/aac;');bool.webm=el.canPlayType('audio/webm; codecs="vp8, vorbis"');}}catch(e){}
return bool;})();$.Plugin={i18n:{},language:'',options:{selectChange:$.noop,site:'',root:'',help:$.noop,alerts:''},getURI:function(absolute){if(!standalone){return tinyMCEPopup.editor.documentBaseURI.getURI(absolute);}
return(absolute)?this.options.root:this.options.site;},init:function(options){var self=this;$.extend(this.options,options);if(!$.support.cssFloat&&document.querySelector){$('#jce').addClass('ie8');}
$('button#insert, input#insert, button#update, input#update').button({icons:{primary:'ui-icon-check'}});$('button#refresh, input#refresh').button({icons:{primary:'ui-icon-refresh'}});$('button#cancel, input#cancel').button({icons:{primary:'ui-icon-close'}});if(standalone){return;}
$('button#apply, input#apply').button({icons:{primary:'ui-icon-plus'}});$('button#help, input#help').button({icons:{primary:'ui-icon-help'}});$('button#cancel, input#cancel').click(function(e){tinyMCEPopup.close();e.preventDefault();});$('#jce').addClass('ui-widget-content');$('#tabs').tabs({activate:function(e,ui){$(ui.newPanel).removeClass('ui-tabs-hide').siblings('.ui-tabs-panel').addClass('ui-tabs-hide');}});this.createColourPickers();this.createBrowsers();$('select.editable, select.mceEditableSelect').combobox({label:self.translate('select_label','Add Value'),change:this.options.change});$('.hastip, .tip, .tooltip').tips();this._formWidgets();},_formWidgets:function(){var self=this;$('input[placeholder], textarea[placeholder]').placeholder();$(':input[pattern]').pattern();$(':input[max]').max();$(':input[min]').min();},getName:function(){return $('body').data('plugin');},getPath:function(plugin){if(!standalone){return tinyMCEPopup.getParam('site_url')+'components/com_jce/editor/tiny_mce/plugins/'+this.getName();}
return this.options.site+'components/com_jce/editor/tiny_mce/plugins/'+this.getName();},loadLanguage:function(){if(!standalone){var ed=tinyMCEPopup.editor,u=ed.getParam('document_base_url')+'components/com_jce/editor/tiny_mce';if(u&&ed.settings.language&&ed.settings.language_load!==false){u+='/langs/'+ed.settings.language+'_dlg.js';if(!tinymce.ScriptLoader.isDone(u)){document.write('<script type="text/javascript" src="'+tinymce._addVer(u)+'"></script>');tinymce.ScriptLoader.markDone(u);}}}},help:function(){if(!standalone){var ed=tinyMCEPopup.editor;ed.windowManager.open({url:tinyMCEPopup.getParam('site_url')+'index.php?option=com_jce&view=help&tmpl=component&lang='+ed.settings.language+'&section=editor&category='+this.getName(),width:768,height:560,resizable:1,inline:1,close_previous:0});}else{this.options.help.call(this,this.getName());}},setDimensions:function(wo,ho,prefix){prefix=prefix||'';var w=$('#'+prefix+wo).val();var h=$('#'+prefix+ho).val();if(!w||!h)
return;var th=$('#'+prefix+'tmp_'+ho).val();var tw=$('#'+prefix+'tmp_'+wo).val();if(th&&tw){if($('#'+prefix+'constrain').is(':checked')){var temp=(w/$('#'+prefix+'tmp_'+wo).val())*$('#'+prefix+'tmp_'+ho).val();h=temp.toFixed(0);$('#'+prefix+ho).val(h);}}
$('#'+prefix+'tmp_'+ho).val(h);$('#'+prefix+'tmp_'+wo).val(w);},setDefaults:function(s){var n,v;for(n in s){v=s[n];if(v=='default'){v='';}
if($('#'+n).is(':checkbox')){$('#'+n).prop('checked',parseFloat(v));}else{$('#'+n).val(v);}}},setClasses:function(v,n){n=n||'classes';var $tmp=$('<span/>').addClass($('#'+n).val()).addClass(v);$('#'+n).val($tmp.attr('class'));},createColourPickers:function(){var self=this,ed=tinyMCEPopup.editor,doc=ed.getDoc();$('input.color').each(function(){var id=$(this).attr('id');var ev=$(this).get(0).onchange;var $picker=$('<span role="button" class="pickcolor_icon" title="'+self.translate('browse')+'" id="'+id+'_pick"></span>').insertAfter(this).toggleClass('disabled',$(this).is(':disabled')).attr('aria-disabled',function(){return $(this).hasClass('disabled');});$(this).bind('pick',function(){$(this).next('span.pickcolor_icon').css('background-color',$(this).val());});$(this).change(function(e){e.preventDefault();e.stopPropagation();$(this).trigger('pick');if($.isFunction(ev)){ev.call(this);}});var stylesheets=[];if(doc.styleSheets.length){$.each(doc.styleSheets,function(i,s){if(s.href&&s.href.indexOf('tiny_mce')==-1){stylesheets.push(s);}});}
var settings=$.extend(ColorPicker.settings,{widget:$picker,labels:{picker_tab:'Picker',title:'Color Picker',palette_tab:'Palette',palette:'Web Colors',named_tab:'Named',named:'Named Colors',template_tab:'Template',template:'Template Colors',color:'Color',apply:'Apply',name:'Name'},stylesheets:stylesheets,custom_colors:ed.getParam('colorpicker_custom_colors','')});$(this).colorpicker(settings);});},createBrowsers:function(){var self=this;$('input.browser').each(function(){var input=this,type=$(this).hasClass('image')?'image':'file';var ev=$(this).get(0).onchange;$('<span role="button" class="browser_icon" title="'+self.translate('browse')+'"></span>').click(function(){return tinyMCEPopup.openBrowser($(input).attr('id'),type,'file_browser_callback');}).insertAfter(this);$(this).get(0).onchange=function(){if($.isFunction(ev)){ev.call(this);}};});},getLanguage:function(){if(!this.language){var s=$('body').attr('lang')||'en';if(s.length>2){s=s.substr(0,2);}
this.language=s;}
return this.language;},sizeToFit:function(o,c){var x=c.width;var y=c.height;var w=o.width;var h=o.height;var ratio=x/w;if(w/h>ratio){h=h*(x/w);w=x;if(h>y){w=w*(y/h);h=y;}}else{w=w*(y/h);h=y;if(w>x){h=h*(x/w);w=x;}}
return{width:Math.round(w),height:Math.round(h)};},addI18n:function(p,o){var i18n=this.i18n;if($.type(p)=='string'){$.each(o,function(k,o){i18n[p+'.'+k]=o;});}else{$.each(p,function(lc,o){$.each(o,function(g,o){$.each(o,function(k,o){if(g==='common')
i18n[lc+'.'+k]=o;else
i18n[lc+'.'+g+'.'+k]=o;});});});}},translate:function(s,ds){if(!standalone){return tinyMCEPopup.getLang('dlg.'+s,ds);}
if(!$.isPlainObject(this.i18n))
this.i18n={};return this.i18n[this.getLanguage()+'.dlg.'+s]||ds;}};$.Cookie={get:function(n,s){var c=document.cookie,e,p=n+"=",b,v;if(!c){return s;}
b=c.indexOf("; "+p);if(b==-1){b=c.indexOf(p);if(b!=0){return s;}}else{b+=2;}
e=c.indexOf(";",b);if(e==-1){e=c.length;}
v=unescape(c.substring(b+p.length,e));if(typeof v=='undefined'){return s;}
return v;},set:function(n,v,e,p,d,s){document.cookie=n+"="+escape(v)+
((e)?"; expires="+e.toGMTString():"")+
((p)?"; path="+escape(p):"")+
((d)?"; domain="+d:"")+
((s)?"; secure":"");}};$.JSON={queue:function(o){var _old=o.complete;o.complete=function(){if(_old)
_old.apply(this,arguments);};$([$.JSON.queue]).queue("ajax",function(){window.setTimeout(function(){$.ajax(o);},500);});$.dequeue($.JSON.queue,"ajax");},request:function(func,data,callback,scope){var json={'fn':func};callback=callback||$.noop;var args={'format':'raw'};var fields=$(':input','form').serializeArray();$.each(fields,function(i,field){args[field.name]=field.value;});if($.type(data)==='string'||$.type(data)==='array'){$.extend(json,{'args':$.type(data)==='string'?$.String.encodeURI(data):$.map(data,function(s){if(s&&$.type(s)==='string'){return $.String.encodeURI(s);}
return s;})});}else{if($.type(data)==='object'&&data.json){$.extend(json,{'args':data.json});delete data.json;}
$.extend(args,data);}
var url=document.location.href;url=url.replace(/&wf([a-z0-9]+)=1/,'');function showError(e){var txt=$.type(e)==='array'?e.join('\n'):e;txt=txt.replace(/<br([^>]+?)>/,'');$.Dialog.alert(txt);}
function isJSON(s){return/^[\],:{}\s]*$/.test(s.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,'@').replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,']').replace(/(?:^|:|,)(?:\s*\[)+/g,''));}
$.JSON.queue({context:scope||this,type:'POST',url:url,data:'json='+$.JSON.serialize(json)+'&'+$.param(args),dataType:'text',success:function(o){var r;if(o){if($.type(o)==='string'&&isJSON(o)){var s=$.parseJSON(o);if(s){o=s;}}
if($.isPlainObject(o)){if(o.error){showError(o.text||o.error||'');}
r=o.result||null;if(r&&r.error&&r.error.length){showError(r.error);}}else{showError(o);}}else{o={'error':''};}
if($.isFunction(callback)){callback.call(scope||this,r);}else{return r;}},error:function(e,txt,status){$.Dialog.alert(status||('SERVER ERROR - '+txt.toUpperCase()));}});},serialize:function(o){return JSON.stringify(o);}},$.URL={toAbsolute:function(url){if(!standalone){return tinyMCEPopup.editor.documentBaseURI.toAbsolute(url);}
if(/http(s)?:\/\//.test(url)){return url;}
return $.Plugin.getURI(true)+url.substr(0,url.indexOf('/'));},toRelative:function(url){if(!standalone){return tinyMCEPopup.editor.documentBaseURI.toRelative(url);}
if(/http(s)?:\/\//.test(url)){return url.substr(url.indexOf('/'));}
return url;}},$.Dialog={counter:0,_uid:function(p){return(!p?'wf_':p)+(this.counter++);},dialog:function(title,data,options){var div=document.createElement('div');options=$.extend(options,{minWidth:options.minWidth||options.width||300,minHeight:options.minHeight||options.height||150,modal:(typeof options.modal==='undefined')?true:options.modal,open:function(){$(div).dialog('widget').next('div.ui-widget-overlay').css({width:'100%',height:'100%'});$('div.ui-dialog-buttonset button[icons]',$(div).dialog('widget')).each(function(){var icon=$(this).attr('icons');$(this).prepend('<span class="ui-button-icon-primary ui-icon '+icon+'"/>');}).addClass('ui-button-text-icon-primary').removeClass('ui-button-text-only');if($.isFunction(options.onOpen)){options.onOpen.call();}},close:function(){$(this).dialog('destroy').remove();}});$(div).attr({'title':title,id:options.id||'dialog'+this._uid()}).append(data).dialog(options);return div;},confirm:function(s,cb,options){var html='<div class="confirm"><span class="icon"></span>'+s+'</div>';options=$.extend({resizable:false,buttons:[{text:$.Plugin.translate('yes','Yes'),icons:{primary:'ui-icon-check'},click:function(){cb.call(this,true);$(this).dialog("close");}},{text:$.Plugin.translate('no','No'),icons:{primary:'ui-icon-close'},click:function(){cb.call(this,false);$(this).dialog("close");}}]},options);return $.Dialog.dialog($.Plugin.translate('confirm','Confirm'),html,options);},alert:function(s){var html='<div class="alert"><span class="icon"></span>'+s+'</div>';var options={resizable:false,buttons:[{text:$.Plugin.translate('ok','OK'),click:function(){$(this).dialog("close");}}]};return $.Dialog.dialog($.Plugin.translate('alert','Alert'),html,options);},prompt:function(title,options){var html='<p>';var id=options.id||'dialog-prompt',name=options.name||'prompt',v=options.value||'';if(options.text){html+='<label for="'+id+'">'+options.text+'</label>';}
if(options.multiline){html+='<textarea id="'+id+'" style="width:200px;height:75px;">'+v+'</textarea>';}else{html+='<input id="'+id+'" name="'+name+'" type="text" value="'+v+'" style="width:200px;" />';}
html+='</p>';if(options.elements){html+=options.elements;}
options=$.extend({resizable:false,width:320,buttons:[{text:$.Plugin.translate('ok','Ok'),icons:{primary:'ui-icon-check'},click:function(){if($.isFunction(options.confirm)){options.confirm.call(this,$('#'+id).val());}else{$(this).dialog("close");}}}],onOpen:function(){$('#'+options.id).focus();}},options);return $.Dialog.dialog(title,html,options);},upload:function(options){var div=document.createElement('div');$(div).attr('id','upload-body').append('<div id="upload-queue-block">'+'  <ul id="upload-queue"><li style="display:none;"></li></ul>'+' <input type="hidden" id="upload-dir" name="upload-dir" />'+' <input type="file" name="file" size="40" style="position:relative;" />'+'</div>'+'<div id="upload-options"></div>');$(div).find('#upload-options').append(options.elements);options=$.extend({minWidth:460,minHeight:350,resizable:false,buttons:[{text:$.Plugin.translate('browse','Browse'),id:'upload-browse',icons:{primary:'ui-icon-search'}},{text:$.Plugin.translate('upload','Upload'),click:function(){if($.isFunction(options.upload)){options.upload.call();}},icons:{primary:'ui-icon-arrowthick-1-n'}},{text:$.Plugin.translate('close','Close'),click:function(){$(this).dialog("close");},icons:{primary:'ui-icon-close'}}]},options);return $.Dialog.dialog($.Plugin.translate('upload','Upload'),div,options);},iframe:function(name,url,options){var div=document.createElement('div');options=$.extend({width:$(window).width()-100,height:$(window).height()-50,onOpen:function(){var iframe=document.createElement('iframe');$(div).addClass('loading');$(iframe).attr({'src':url,'scrolling':'auto','frameborder':0}).css({width:'100%',height:'99%'}).load(function(){var win=this.contentWindow,d=win.document,b=d.body;var w=win.innerWidth||b.clientWidth;var h=win.innerHeight||b.clientHeight;$(this).css({width:w,height:h});if($.isFunction(options.onFrameLoad)){options.onFrameLoad.call(this);}
$(div).removeClass('loading');});$(div).addClass('iframe-preview').append(iframe);$(div.parentNode).dialog("option","position",'center');}},options);var name=name||$.Plugin.translate('preview','Preview');return $.Dialog.dialog(name,div,options);},media:function(name,url,options){var self=this;options=options||{};var div=document.createElement('div');var ww=$(window).width(),wh=$(window).height();$.extend(options,{width:ww-Math.round(ww/100*10),height:wh-Math.round(wh/100*10),resizable:false,close:function(){$(div).empty();$(this).dialog('destroy').remove();},dialogClass:'ui-preview',onOpen:function(){var parent=div.parentNode;if(/\.(jpg|jpeg|gif|png)/i.test(url)){$(div).addClass('image-preview big-loader');var img=new Image(),loaded=false;var dw=$(parent).width(),dh=$(parent).height();img.onload=function(){if(loaded)
return false;if($.support.backgroundSize){$('div.image-preview').removeClass('loader').addClass('background').css({'background-image':'url("'+img.src+'")'});if(img.width>dw||img.height>dh){$('div.image-preview').addClass('resize');}}else{if(img.width>dw||img.height>dh){var dim=$.Plugin.sizeToFit(img,{width:Math.round($(window).width())-160,height:Math.round($(window).height())-190});$('div.image-preview').removeClass('loader').append('<img src="'+url+'" width="'+dim.width+'" height="'+dim.height+'" alt="'+$.Plugin.translate('preview','Preview')+'" />');$('div.image-preview').css('margin-top',($(parent).height()-dim.height)/2);}else{$('div.image-preview').removeClass('loader').addClass('background').css({'background-image':'url('+url+')'});}}
$(parent).click(function(){$(div.parentNode).dialog('close');});$(parent).dialog("option","position",'center');loaded=true;$(div).removeClass('big-loader');};img.src=url+(/\?/.test(url)?'&':'?')+new Date().getTime();}else if(/\.pdf$/i.test(url)){$(div).addClass('media-preview big-loader').height($(parent).height()-20);if($.support.pdf){$(div).html('<object data="'+url+'" type="application/pdf" width="'+$(div).innerWidth()+'" height="'+$(div).innerHeight()+'"></object>').removeClass('big-loader');}else{$(div).html('<iframe src="'+url+'" width="'+$(div).innerWidth()+'" height="'+$(div).innerHeight()+'" frameborder="0"></iframe>').removeClass('big-loader');}}else{$(div).addClass('media-preview big-loader').height($(parent).height()-20);var mediaTypes={"flash":{classid:"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000",type:"application/x-shockwave-flash",codebase:"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"},"shockwave":{classid:"clsid:166b1bca-3f9c-11cf-8075-444553540000",type:"application/x-director",codebase:"http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0"},"windowsmedia":{classid:"clsid:6bf52a52-394a-11d3-b153-00c04f79faa6",type:"application/x-mplayer2",codebase:"http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"},"quicktime":{classid:"clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b",type:"video/quicktime",codebase:"http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0"},"divx":{classid:"clsid:67dabfbf-d0ab-41fa-9c46-cc0f21721616",type:"video/divx",codebase:"http://go.divx.com/plugin/DivXBrowserPlugin.cab"},"realmedia":{classid:"clsid:cfcdaa03-8be4-11cf-b84b-0020afbbccfa",type:"audio/x-pn-realaudio-plugin"},"java":{classid:"clsid:8ad9c840-044e-11d1-b3e9-00805f499d93",type:"application/x-java-applet",codebase:"http://java.sun.com/products/plugin/autodl/jinstall-1_5_0-windows-i586.cab#Version=1,5,0,0"},"silverlight":{classid:"clsid:dfeaf541-f3e1-4c24-acac-99c30715084a",type:"application/x-silverlight-2"},"video":{type:'video/mp4'},"audio":{type:'audio/mp3'}};var mimes={};(function(data){var items=data.split(/,/),i,y,ext;for(i=0;i<items.length;i+=2){ext=items[i+1].split(/ /);for(y=0;y<ext.length;y++)
mimes[ext[y]]=items[i];}})("application/x-director,dcr,"+"application/x-mplayer2,wmv wma avi,"+"video/divx,divx,"+"application/x-shockwave-flash,swf swfl,"+"audio/mpeg,mpga mpega mp2 mp3,"+"audio/ogg,ogg spx oga,"+"audio/x-wav,wav,"+"video/mpeg,mpeg mpg mpe,"+"video/mp4,mp4 m4v,"+"video/ogg,ogg ogv,"+"video/webm,webm,"+"video/quicktime,qt mov,"+"video/x-flv,flv,"+"video/vnd.rn-realvideo,rv,"+"video/3gpp,3gp,"+"video/x-matroska,mkv");var ext=$.String.getExt(url);var mt=mimes[ext];var type,props;$.each(mediaTypes,function(k,v){if(v.type&&v.type==mt){type=k;props=v;}});if(/^(mp4|m4v|og(g|v)|webm)$/i.test(ext)){type='video';props={type:mt};}
if(/^(mp3|og(g|a)|webm)$/i.test(ext)){type='audio';props={type:mt};}
if(/^(flv|f4v)$/i.test(ext)){type='flv';props={};}
var swf=$.Plugin.getURI(true)+'components/com_jce/editor/libraries/mediaplayer/mediaplayer.swf';if(type&&props){switch(type){case'audio':case'video':var fb,ns='<p style="margin-left:auto;">'+$.Plugin.translate('media_not_supported','Media type not supported by this browser')+'</p>';var support={video:{'mp4':['mp4','m4v'],'webm':['webm'],'ogg':['ogv','ogg']},audio:{'mp3':['mp3'],'ogg':['oga','ogg']}}
var hasSupport=false;for(var n in support[type]){if(support[type][n].indexOf(ext)!=-1){hasSupport=$.support[type][n];}
if(hasSupport===true){break;}}
if(hasSupport){if(type=='video'){$(div).append('<video autoplay="autoplay" controls="controls" preload="none" type="'+props.type+'" style="width:100%;height:100%;" src="'+url+'"></video>');}else{$(div).append('<audio autoplay="autoplay" controls="controls" preload="none" type="'+props.type+'" src="'+url+'"></audio>');}}else if(/^m(p3|p4|4v)$/i.test(ext)){url=$.URL.toAbsolute(url);$(div).html('<object type="application/x-shockwave-flash" data="'+swf+'"><param name="movie" value="'+swf+'" /><param name="flashvars" value="src='+url+'&autoPlay=true&controlBarAutoHide=false&playButtonOverlay=false" /></object>');if(ext=='mp3'){$('object',div).addClass('audio');}}else{$(div).html(ns).removeClass('loader');}
break;case'flv':url=$.URL.toAbsolute(url);$(div).append('<object type="application/x-shockwave-flash" data="'+swf+'"><param name="movie" value="'+swf+'" /><param name="flashvars" value="src='+url+'&autoPlay=true&controlBarAutoHide=false" /></object>');break;case'flash':$(div).append('<object type="'+props.type+'" data="'+url+'" style="width:100%;height:100%;"><param name="movie" value="'+url+'" /></object>');break;default:$(div).append('<object classid="'+props.classid+'" style="width:100%;height:100%;"><param name="src" value="'+url+'" /><embed src="'+url+'" style="width:100%;height:100%;" type="'+props.type+'"></embed></object>');break;}
$(div).removeClass('big-loader');}}}});return $.Dialog.dialog($.Plugin.translate('preview','Preview')+' - '+name,div,options);}};$.String={basename:function(s){return s.replace(/^.*[\/\\]/g,'');},dirname:function(s){if(/[\\\/]+/.test(s)){return s.replace(/\\/g,'/').replace(/\/[^\/]*\/?$/,'');}
return'';},filename:function(s){return this.stripExt(this.basename(s));},getExt:function(s){return s.substring(s.length,s.lastIndexOf('.')+1).toLowerCase();},stripExt:function(s){return s.replace(/\.[^.]+$/i,'');},pathinfo:function(s){var info={'basename':this.basename(s),'dirname':this.dirname(s),'extension':this.getExt(s),'filename':this.filename(s)};return info;},path:function(a,b){a=this.clean(a);b=this.clean(b);if(a.substring(a.length-1)!='/')
a+='/';if(b.charAt(0)=='/')
b=b.substring(1);return a+b;},clean:function(s){if(!/:\/\//.test(s)){return s.replace(/\/+/g,'/');}
return s;},replaceDiacritic:function(s){var i,lookup;lookup=[/[\300-\306]/g,'A',/[\340-\346]/g,'a',/\307/g,'C',/\347/g,'c',/[\310-\313]/g,'E',/[\350-\353]/g,'e',/[\314-\317]/g,'I',/[\354-\357]/g,'i',/\321/g,'N',/\361/g,'n',/[\322-\330]/g,'O',/[\362-\370]/g,'o',/[\331-\334]/g,'U',/[\371-\374]/g,'u'];for(i=0;i<lookup.length;i+=2){s=s.replace(lookup[i],lookup[i+1]);}
return s;},_toUnicode:function(s){var c=s.toString(16).toUpperCase();while(c.length<4){c='0'+c;}
return'\\u'+c;},safe:function(s,mode,spaces,textcase){mode=mode||'utf-8';if(!spaces){s=s.replace(/[\s ]/g,'_');}
if(mode=='ascii'){s=this.replaceDiacritic(s);s=s.replace(/[^\w\.\-~\s ]/gi,'');}else{s=s.replace(/[\+\\\/\?\#%&<>"\'=\[\]\{\},;@\^\(\)£€$]/g,'');var r='';for(var i=0,ln=s.length;i<ln;i++){var ch=s[i];if(/[^\w\.\-~\s ]/.test(ch)){if(this._toUnicode(ch.charCodeAt(0))<'\\u007F'){continue;}}
r+=ch;}
s=r;}
s=s.replace(/(\.){2,}/g,'');s=s.replace(/^\./,'');s=s.replace(/\.$/,'');s=this.basename(s);if(textcase){switch(textcase){case'lowercase':s=s.toLowerCase();break;case'uppercase':s=s.toUpperCase();break;}}
return s;},query:function(s){var p={};s=this.decode(s);if(s.indexOf('=')===-1){return p;}
if(/\?/.test(s)){s=s.substring(s.indexOf('?')+1);}
if(/#/.test(s)){s=s.substr(0,s.indexOf('#'));}
var pairs=s.replace(/&amp;/g,'&').split('&');$.each(pairs,function(){var pair=this.split('=');p[pair[0]]=pair[1];});return p;},encode:function(s){var baseEntities={'"':'&quot;',"'":'&#39;','<':'&lt;','>':'&gt;','&':'&amp;'};return(''+s).replace(/[<>&\"\']/g,function(chr){return baseEntities[chr]||chr;});},decode:function(s){var reverseEntities={'&lt;':'<','&gt;':'>','&amp;':'&','&quot;':'"','&apos;':"'"};return s.replace(/&(#)?([\w]+);/g,function(all,numeric,value){if(numeric)
return String.fromCharCode(value);return reverseEntities[all];});},escape:function(s){return encodeURI(s);},unescape:function(s){return decodeURI(s);},encodeURI:function(s,preserve_urls){if(s&&s.indexOf('file://')===0){return s;}
s=encodeURIComponent(decodeURIComponent(s)).replace(/%2F/g,'/');if(preserve_urls){s=s.replace(/%(21|2A|27|28|29|3B|3A|40|26|3D|2B|24|2C|3F|25|23|5B|5D)/g,function(a,b){return String.fromCharCode(parseInt(b,16));});}
return s;},buildURI:function(s){if(/^\s*www\./.test(s)){s='http://'+s;}
return s.replace(/ /g,'%20');},toHex:function(color){var re=new RegExp("rgb\\s*\\(\\s*([0-9]+).*,\\s*([0-9]+).*,\\s*([0-9]+).*\\)","gi");var rgb=color.replace(re,"$1,$2,$3").split(',');if(rgb.length==3){r=parseInt(rgb[0]).toString(16);g=parseInt(rgb[1]).toString(16);b=parseInt(rgb[2]).toString(16);r=r.length==1?0+r:r;g=g.length==1?0+g:g;b=b.length==1?0+b:b;return"#"+r+g+b;}
return color;},toRGB:function(color){if(color.indexOf('#')!=-1){color=color.replace(new RegExp('[^0-9A-F]','gi'),'');r=parseInt(color.substring(0,2),16);g=parseInt(color.substring(2,4),16);b=parseInt(color.substring(4,6),16);return"rgb("+r+","+g+","+b+")";}
return color;},ucfirst:function(s){return s.charAt(0).toUpperCase()+s.substring(1);},formatSize:function(s){if(s>1048576){return Math.round((s/1048576)*100)/100+" "+$.Plugin.translate('size_mb','MB');}
if(s>1024){return Math.round((s/1024)*100)/100+" "+$.Plugin.translate('size_kb','KB');}
return s+" "+$.Plugin.translate('size_bytes','Bytes');},formatDate:function(time,fmt){var date=new Date(time*1000);fmt=fmt||'%d/%m/%Y, %H:%M';function addZeros(value,len){var i;value=""+value;if(value.length<len){for(i=0;i<(len-value.length);i++)
value="0"+value;}
return value;}
fmt=fmt.replace("%D","%m/%d/%y");fmt=fmt.replace("%r","%I:%M:%S %p");fmt=fmt.replace("%Y",""+date.getFullYear());fmt=fmt.replace("%y",""+date.getYear());fmt=fmt.replace("%m",addZeros(date.getMonth()+1,2));fmt=fmt.replace("%d",addZeros(date.getDate(),2));fmt=fmt.replace("%H",""+addZeros(date.getHours(),2));fmt=fmt.replace("%M",""+addZeros(date.getMinutes(),2));fmt=fmt.replace("%S",""+addZeros(date.getSeconds(),2));fmt=fmt.replace("%I",""+((date.getHours()+11)%12+1));fmt=fmt.replace("%p",""+(date.getHours()<12?"AM":"PM"));fmt=fmt.replace("%%","%");return fmt;}};$.Plugin.loadLanguage();})(jQuery);if(typeof ColorPicker==='undefined'){var ColorPicker={settings:{}};}
(function($,prototype){var _trigger=prototype._trigger;prototype._trigger=function(type,event,data){var ret=_trigger.apply(this,arguments);if(!ret){return false;}
if(type==="beforeActivate"){ret=_trigger.call(this,"select",event,data);}else if(type==="activate"){ret=_trigger.call(this,"selected",event,data);}
return ret;}}(jQuery,jQuery.ui.tabs.prototype));(function($,prototype){prototype.activate=prototype._activate;}(jQuery,jQuery.ui.accordion.prototype));(function($,prototype){var _trigger=prototype._trigger;prototype._trigger=function(type,event,data){var ret=_trigger.apply(this,arguments);if(!ret){return false;}
if(type==="beforeActivate"){ret=_trigger.call(this,"changestart",event,data);}else if(type==="activate"){ret=_trigger.call(this,"change",event,data);}
return ret;}}(jQuery,jQuery.ui.accordion.prototype));(function($,prototype){prototype.options.heightStyle="content";}(jQuery,jQuery.ui.accordion.prototype));(function($,ui){$(document).ready(function(){$.each(['resize','crop','rotate','sortable'],function(i,k){if(ui[k]){var proto=ui[k].prototype;var _init=proto._init;proto._init=function(){_init.apply(this,arguments);$(this.element).data(k,true);};}});});}(jQuery,jQuery.ui));var WFExtensions={types:{},add:function(n,o){this[n]=o;return this[n];},addType:function(n){this.types[n]={};},addExtension:function(type,n,o){if(typeof this.types[type]=='undefined'){this.addType(type);}
this.types[type][n]=o;},getType:function(type){return this.types[type]||false;},getExtension:function(type,ext){var s=this.getType(type);return s[ext];}};var WFAggregator=WFExtensions.add('Aggregator',{aggregators:{},add:function(name,o){this.aggregators[name]=o||{};},get:function(name){return this.aggregators[name]||null;},setup:function(options){var self=this;options=options||{};tinymce.each(this.aggregators,function(o,k){self.setParams(o,options);return self._call(o,'setup');});},getTitle:function(name){var f=this.get(name);if(f){return f.title;}
return name;},getType:function(name){var f=this.get(name);if(f){return f.getType();}
return'';},getValues:function(name,src){var f=this.get(name);if(f){return this._call(f,'getValues',src);}},setValues:function(name,data){var f=this.get(name);if(f){return this._call(f,'setValues',data);}},getAttributes:function(name,args){var f=this.get(name);if(f){return this._call(f,'getAttributes',args);}},setAttributes:function(name,args){var f=this.get(name);if(f){return this._call(f,'setAttributes',args);}},isSupported:function(args){var self=this,r,v;tinymce.each(this.aggregators,function(o){if(v=self._call(o,'isSupported',args)){r=v;}});return r;},getParam:function(name,param){var f=this.get(name);if(f){return f.params[param]||'';}
return'';},setParams:function(name,o){var f=this.get(name);if(f){tinymce.extend(f.params,o);}},onSelectFile:function(name){var f=this.get(name);if(f){return this._call(f,'onSelectFile');}},onInsert:function(name){var self=this,f=this.get(name);if(f){return self._call(f,'onInsert');}},_call:function(o,fn,vars){var f=o[fn]||function(){};return f.call(o,vars);}});var WFMediaPlayer=WFExtensions.add('MediaPlayer',{params:{extensions:'flv,f4v',dimensions:{},path:''},type:'flash',init:function(o){tinymce.extend(this,o);return this;},setup:function(){},getTitle:function(){return this.title||this.name;},getType:function(){return this.type;},isSupported:function(){return false;},getParam:function(param){return this.params[param]||'';},setParams:function(o){tinymce.extend(this.params,o);},getPath:function(){return this.getParam('path');},onSelectFile:function(file){},onInsert:function(){},onChangeType:function(){}});var WFPopups=WFExtensions.add('Popups',{popups:{},popup:'',config:{},addPopup:function(n,o){this.popups[n]=o;WFExtensions.addExtension('popups',n,o);},getPopups:function(){return this.popups;},setup:function(){var self=this,ed=tinyMCEPopup.editor,s=ed.selection,n;$('#popup_list').change(function(){self.selectPopup(this.value);}).change();if(!s.isCollapsed()){n=s.getNode();var state=true,v;function setText(state,v){if(state&&v){$('#popup_text').val(v);$('#popup_text').attr('disabled',false);}else{$('#popup_text').val(tinyMCEPopup.getLang('dlg.element_selection','Element Selection'));$('#popup_text').attr('disabled',true);$('#popup_text').addClass('disabled');}}
v=s.getContent({format:'text'});if(n){var children=tinymce.grep(n.childNodes,function(node){return ed.dom.is(node,'br[data-mce-bogus]')==false;});state=children.length==1&&children[0].nodeType==3;}
setText(state,v);}
$.each(this.popups,function(k,v){self._call('setup','',v);});},isPopup:function(n,v){return n&&n.nodeName=='A'&&this._call('check',n,v);},getPopup:function(n,index){var self=this,ed=tinyMCEPopup.editor,popup,popups=this.getPopups();if(n.nodeName!='A'){n=ed.dom.getParent(n,'a');}
$.each(this.popups,function(k,v){if(self.isPopup(n,k)){self.popup=k;}});if(n&&this.popup){this.selectPopup(this.popup);return this.getAttributes(n,index);}
return'';},setPopup:function(s){this.popup=s;},setConfig:function(config){$.extend(this.config,config);},setParams:function(n,p){var popup=this.popups[n];if(popup){if(typeof popup.params=='undefined'){popup.params={};}
$.extend(popup.params,p);}},getParams:function(n){return this.popups[n].params||{};},getParam:function(n,p){var params=this.getParams(n);return params[p]||null;},selectPopup:function(v){var self=this;self.popup=v;$('#popup_list').val(v).children('option').each(function(){if(this.value){$('#popup_extension_'+this.value).hide();}});if(v){$('#popup_extension_'+v).show();self._call('onSelect',[],v);}},setAttributes:function(n,args,index){var ed=tinyMCEPopup.editor;if(this.config['map']){$.each(this.config['map'],function(to,from){var v=args[from]||$('#'+from).val();ed.dom.setAttrib(n,to,v);delete args[from];});}
return this._call('setAttributes',[n,args,index]);},getAttributes:function(n,index){var ed=tinyMCEPopup.editor,k,v,at,data;if(n||n.nodeName!='A'){n=ed.dom.getParent(n,'a');}
if(n&&this.isPopup(n)){data=this._call('getAttributes',[n,index]);}
return data;},isEnabled:function(){return this.popup;},createPopup:function(n,args,index){var self=this,ed=tinyMCEPopup.editor,o,el;args=args||{};if(this.isEnabled()){if(n&&(n.nodeName=='A'||ed.dom.getParent(n,'A'))){if(n.nodeName!='A'){n=ed.dom.getParent(n,'A');}
this.removePopups(n);this.setAttributes(n,args,index);}else{var se=ed.selection,marker;if(se.isCollapsed()){ed.execCommand('mceInsertContent',false,'<a href="#" id="__mce_tmp">'+$('#popup_text').val()+'</a>',{skip_undo:1});}else{var n=n||se.getNode();ed.execCommand('mceInsertLink',false,{'href':'#','id':'__mce_tmp'},{skip_undo:1});ed.dom.setAttrib(n,'style',ed.dom.getAttrib(n,'data-mce-style'));}
n=ed.dom.get('__mce_tmp');if(n){ed.dom.setAttrib(n,'id',null);self.setAttributes(n,args,index);}}}else{var s=false;$.each(this.popups,function(k,v){if(self.isPopup(n,v)){s=true;}});if(s){ed.dom.remove(n,true);}}},removePopups:function(n){var self=this;$.each(this.popups,function(k,v){self._call('remove',n,v);});},onSelectFile:function(args){this._call('onSelectFile',args);},_call:function(fn,args,popup){if(!popup){popup=this.popup;}
if(typeof popup=='string'){popup=this.popups[popup]||{};}
fn=popup[fn];if(fn){if(typeof args=='object'&&args instanceof Array){return fn.apply(popup,args);}else{return fn.call(popup,args);}}
return false;}});