M.yui.add_module=function(modules){for(var modname in modules)YUI_config.modules[modname]=modules[modname]};M.yui.galleryversion='2010.04.21-21-51';M.util=M.util||{};M.str=M.str||{};M.util.image_url=function(imagename,component){if(!component||component==''||component=='moodle'||component=='core')component='core';var url=M.cfg.wwwroot+'/theme/image.php';if(M.cfg.themerev>0&&M.cfg.slasharguments==1){if(!M.cfg.svgicons)url+='/_s';url+='/'+M.cfg.theme+'/'+component+'/'+M.cfg.themerev+'/'+imagename}else{url+='?theme='+M.cfg.theme+'&component='+component+'&rev='+M.cfg.themerev+'&image='+imagename;if(!M.cfg.svgicons)url+='&svg=0'};return url};M.util.in_array=function(item,array){for(var i=0;i');a.setAttribute('title',strtooltip);while(caption.hasChildNodes()){child=caption.get('firstChild');child.remove();a.append(child)};caption.append(a);var height=this.div.get('offsetHeight'),collapsedimage='t/collapsed';if(right_to_left()){collapsedimage='t/collapsed_rtl'}else collapsedimage='t/collapsed';if(this.div.hasClass('collapsed')){this.icon=Y.Node.create('');this.div.setStyle('height',caption.get('offsetHeight')+'px')}else this.icon=Y.Node.create('');a.append(this.icon);var animation=new Y.Anim({node:this.div,duration:0.3,easing:Y.Easing.easeBoth,to:{height:caption.get('offsetHeight')},from:{height:height}});animation.on('end',function(){this.div.toggleClass('collapsed');var collapsedimage='t/collapsed';if(right_to_left()){collapsedimage='t/collapsed_rtl'}else collapsedimage='t/collapsed';if(this.div.hasClass('collapsed')){this.icon.set('src',M.util.image_url(collapsedimage,'moodle'))}else this.icon.set('src',M.util.image_url('t/expanded','moodle'))},this);a.on('click',function(e,animation){e.preventDefault();if(animation.get('running'))animation.stop();animation.set('reverse',this.div.hasClass('collapsed'));if(this.userpref)M.util.set_user_preference(this.userpref,!this.div.hasClass('collapsed'));animation.run()},this,animation)};M.util.CollapsibleRegion.prototype.userpref=null;M.util.CollapsibleRegion.prototype.div=null;M.util.CollapsibleRegion.prototype.icon=null;M.util.set_user_preference=function(name,value){YUI().use('io',function(Y){var url=M.cfg.wwwroot+'/lib/ajax/setuserpref.php?sesskey='+M.cfg.sesskey+'&pref='+encodeURI(name)+'&value='+encodeURI(value),cfg={method:'get',on:{}};if(M.cfg.developerdebug)cfg.on.failure=function(id,o,args){alert("Error updating user preference '"+name+"' using ajax. Clicking this link will repeat the Ajax call that failed so you can see the error: ")};Y.io(url,cfg)})};M.util.show_confirm_dialog=function(e,args){var target=e.target;if(e.preventDefault)e.preventDefault();YUI().use('yui2-container','yui2-event',function(Y){var simpledialog=new Y.YUI2.widget.SimpleDialog('confirmdialog',{width:'300px',fixedcenter:true,modal:true,visible:false,draggable:false});simpledialog.setHeader(M.str.admin.confirmation);simpledialog.setBody(args.message);simpledialog.cfg.setProperty('icon',Y.YUI2.widget.SimpleDialog.ICON_WARN);var handle_cancel=function(){simpledialog.hide()},handle_yes=function(){simpledialog.hide();if(args.callback){var callback=null;if(Y.Lang.isFunction(args.callback)){callback=args.callback}else callback=eval('('+args.callback+')');if(Y.Lang.isObject(args.scope)){var sc=args.scope}else var sc=e.target;if(args.callbackargs){callback.apply(sc,args.callbackargs)}else callback.apply(sc);return};var targetancestor=null,targetform=null;if(target.test('a')){window.location=target.get('href')}else if((targetancestor=target.ancestor('a'))!==null){window.location=targetancestor.get('href')}else if(target.test('input')){targetform=target.ancestor(function(node){return node.get('tagName').toLowerCase()=='form'});if(!targetform)return;if(target.get('name')&&target.get('value'))targetform.append('');targetform.submit()}else if(target.get('tagName').toLowerCase()=='form'){target.submit()}else if(M.cfg.developerdebug)alert("Element of type "+target.get('tagName')+" is not supported by the M.util.show_confirm_dialog function. Use A, INPUT, or FORM")};if(!args.cancellabel)args.cancellabel=M.str.moodle.cancel;if(!args.continuelabel)args.continuelabel=M.str.moodle.yes;var buttons=[{text:args.cancellabel,handler:handle_cancel,isDefault:true},{text:args.continuelabel,handler:handle_yes}];simpledialog.cfg.queueProperty('buttons',buttons);simpledialog.render(document.body);simpledialog.show()})};M.util.init_maximised_embed=function(Y,id){var obj=Y.one('#'+id);if(!obj)return;var get_htmlelement_size=function(el,prop){if(Y.Lang.isString(el))el=Y.one('#'+el);if(el){var val=el.getStyle(prop);if(val=='auto')val=el.getComputedStyle(prop);val=parseInt(val);if(isNaN(val))return 0;return val}else return 0},resize_object=function(){obj.setStyle('width','0px');obj.setStyle('height','0px');var newwidth=get_htmlelement_size('maincontent','width')-35;if(newwidth>500){obj.setStyle('width',newwidth+'px')}else obj.setStyle('width','500px');var headerheight=get_htmlelement_size('page-header','height'),footerheight=get_htmlelement_size('page-footer','height'),newheight=parseInt(Y.one('body').get('winHeight'))-footerheight-headerheight-100;if(newheight<400)newheight=400;obj.setStyle('height',newheight+'px')};resize_object();window.onresize=function(){resize_object()}};M.util.init_select_autosubmit=function(Y,formid,selectid,nothing){if(M.cfg.developerdebug)Y.log("You are using a deprecated function call (M.util.init_select_autosubmit). Please look at rewriting your call to use moodle-core-formautosubmit");Y.use('event-key',function(){var select=Y.one('#'+selectid);if(select){var form=Y.one('#'+formid)||(function(){var form=select;while(form&&form.get('nodeName').toUpperCase()!=='FORM')form=form.ancestor();return form})();if(form){var buttonflag=0,processchange=function(e,paramobject){if((nothing===false||select.get('value')!=nothing)&¶mobject.lastindex!=select.get('selectedIndex'))if(Y.UA.os=='windows'&&Y.UA.chrome){if(buttonflag==1){buttonflag=0;this.submit()}}else this.submit();if(e.button==1)buttonflag=1;paramobject.lastindex=select.get('selectedIndex')},changedown=function(e,paramobject){if((nothing===false||select.get('value')!=nothing)&¶mobject.lastindex!=select.get('selectedIndex')){if(e.keyCode==13)form.submit();paramobject.lastindex=select.get('selectedIndex')}},paramobject=new Object();paramobject.lastindex=select.get('selectedIndex');paramobject.eventchangeorblur=select.on('click',processchange,form,paramobject);if(Y.UA.os=='macintosh'){if(Y.UA.webkit)paramobject.eventchangeorblur=select.on('change',processchange,form,paramobject);paramobject.eventkeypress=Y.on('key',processchange,select,'press:13',form,paramobject)}else{if(Y.UA.os=='windows'&&Y.UA.chrome)paramobject.eventchangeorblur=select.on('change',processchange,form,paramobject);paramobject.eventkeypress=Y.on('keydown',changedown,select,'',form,paramobject)}}}})};M.util.init_url_select=function(Y,formid,selectid,nothing){if(M.cfg.developerdebug)Y.log("You are using a deprecated function call (M.util.init_url_select). Please look at rewriting your call to use moodle-core-formautosubmit");YUI().use('node',function(Y){Y.on('change',function(){if((nothing==false&&Y.Lang.isBoolean(nothing))||Y.one('#'+selectid).get('value')!=nothing)window.location=M.cfg.wwwroot+Y.one('#'+selectid).get('value')},'#'+selectid)})};M.util.init_frametop=function(Y){Y.all('a').each(function(node){node.set('target','_top')});Y.all('form').each(function(node){node.set('target','_top')})};M.util.init_toggle_class_on_click=function(Y,id,cssselector,toggleclassname,togglecssselector){if(togglecssselector=='')togglecssselector=cssselector;var node=Y.one('#'+id);node.all(cssselector).each(function(n){n.on('click',function(e){e.stopPropagation();if(e.target.test(cssselector)&&!e.target.test('a')&&!e.target.test('img'))if(this.test(togglecssselector)){this.toggleClass(toggleclassname)}else this.ancestor(togglecssselector).toggleClass(toggleclassname)},n)});node.on('click',function(e){if(e.target.hasClass('addtoall')){this.all(togglecssselector).addClass(toggleclassname)}else if(e.target.hasClass('removefromall'))this.all(togglecssselector+'.'+toggleclassname).removeClass(toggleclassname)},node)};M.util.init_colour_picker=function(Y,id,previewconf){Y.use('node','event-mouseenter',function(){var colourpicker={box:null,input:null,image:null,preview:null,current:null,eventClick:null,eventMouseEnter:null,eventMouseLeave:null,eventMouseMove:null,width:300,height:100,factor:5,init:function(){this.input=Y.one('#'+id);this.box=this.input.ancestor().one('.admin_colourpicker');this.image=Y.Node.create('');this.image.setAttribute('src',M.util.image_url('i/colourpicker','moodle'));this.preview=Y.Node.create('
');this.preview.setStyle('width',this.height/2).setStyle('height',this.height/2).setStyle('backgroundColor',this.input.get('value'));this.current=Y.Node.create('
');this.current.setStyle('width',this.height/2).setStyle('height',this.height/2-1).setStyle('backgroundColor',this.input.get('value'));this.box.setContent('').append(this.image).append(this.preview).append(this.current);if(typeof previewconf==='object'&&previewconf!==null)Y.one('#'+id+'_preview').on('click',function(e){if(Y.Lang.isString(previewconf.selector)){Y.all(previewconf.selector).setStyle(previewconf.style,this.input.get('value'))}else for(var i in previewconf.selector)Y.all(previewconf.selector[i]).setStyle(previewconf.style,this.input.get('value'))},this);this.eventClick=this.image.on('click',this.pickColour,this);this.eventMouseEnter=Y.on('mouseenter',this.startFollow,this.image,this)},startFollow:function(e){this.eventMouseEnter.detach();this.eventMouseLeave=Y.on('mouseleave',this.endFollow,this.image,this);this.eventMouseMove=this.image.on('mousemove',function(e){this.preview.setStyle('backgroundColor',this.determineColour(e))},this)},endFollow:function(e){this.eventMouseMove.detach();this.eventMouseLeave.detach();this.eventMouseEnter=Y.on('mouseenter',this.startFollow,this.image,this)},pickColour:function(e){var colour=this.determineColour(e);this.input.set('value',colour);this.current.setStyle('backgroundColor',colour)},determineColour:function(e){var eventx=Math.floor(e.pageX-e.target.getX()),eventy=Math.floor(e.pageY-e.target.getY()),imagewidth=this.width,imageheight=this.height,factor=this.factor,colour=[255,0,0],matrices=[[0,1,0],[-1,0,0],[0,0,1],[0,-1,0],[1,0,0],[0,0,-1]],matrixcount=matrices.length,limit=Math.round(imagewidth/matrixcount),heightbreak=Math.round(imageheight/2);for(var x=0;xheightbreak){pixel[0]=Math.floor((imageheight-eventy)*(pixel[0]/heightbreak));pixel[1]=Math.floor((imageheight-eventy)*(pixel[1]/heightbreak));pixel[2]=Math.floor((imageheight-eventy)*(pixel[2]/heightbreak))};return this.convert_rgb_to_hex(pixel)},convert_rgb_to_hex:function(rgb){var hex='#',hexchars="0123456789ABCDEF";for(var i=0;i<3;i++){var number=Math.abs(rgb[i]);if(number==0||isNaN(number)){hex+='00'}else hex+=hexchars.charAt((number-number%16)/16)+hexchars.charAt(number%16)};return hex}};colourpicker.init()})};M.util.init_block_hider=function(Y,config){Y.use('base','node',function(Y){M.util.block_hider=M.util.block_hider||(function(){var blockhider=function(){blockhider.superclass.constructor.apply(this,arguments)};blockhider.prototype={initializer:function(config){this.set('block','#'+this.get('id'));var b=this.get('block'),t=b.one('.title'),a=null;if(t&&(a=t.one('.block_action'))){var hide=Y.Node.create(''+config.tooltipVisible+'');hide.setAttribute('src',this.get('iconVisible')).on('click',this.updateState,this,true);hide.on('keypress',this.updateStateKey,this,true);var show=Y.Node.create(''+config.tooltipHidden+'');show.setAttribute('src',this.get('iconHidden')).on('click',this.updateState,this,false);show.on('keypress',this.updateStateKey,this,false);a.insert(show,0).insert(hide,0)}},updateState:function(e,hide){M.util.set_user_preference(this.get('preference'),hide);if(hide){this.get('block').addClass('hidden')}else this.get('block').removeClass('hidden')},updateStateKey:function(e,hide){if(e.keyCode==13)this.updateState(this,hide)}};Y.extend(blockhider,Y.Base,blockhider.prototype,{NAME:'blockhider',ATTRS:{id:{},preference:{},iconVisible:{value:M.util.image_url('t/switch_minus','moodle')},iconHidden:{value:M.util.image_url('t/switch_plus','moodle')},block:{setter:function(node){return Y.one(node)}}}});return blockhider})();new M.util.block_hider(config)})};M.util.pending_js=[];M.util.complete_js=[];M.util.js_pending=function(uniqid){if(uniqid!==false)M.util.pending_js.push(uniqid);return M.util.pending_js.length};M.util.js_watch_io=function(){YUI.add('moodle-core-io',function(Y){Y.on('io:start',function(id){M.util.js_pending('io:'+id)});Y.on('io:end',function(id){M.util.js_complete('io:'+id)})});YUI.applyConfig({modules:{'moodle-core-io':{after:['io-base']},'io-base':{requires:['moodle-core-io']}}})};M.util.js_pending('init');M.util.js_watch_io();M.util.js_complete=function(uniqid){var index=Y.Array.indexOf(M.util.pending_js,uniqid);if(index>=0)M.util.complete_js.push(M.util.pending_js.splice(index,1));return M.util.pending_js.length};M.util.get_string=function(identifier,component,a){var stringvalue;if(M.cfg.developerdebug){if(typeof M.util.get_string_yui_instance==='undefined')M.util.get_string_yui_instance=new YUI({debug:true});var Y=M.util.get_string_yui_instance};if(!M.str.hasOwnProperty(component)||!M.str[component].hasOwnProperty(identifier)){stringvalue='[['+identifier+','+component+']]';if(M.cfg.developerdebug)Y.log('undefined string '+stringvalue,'warn','M.util.get_string');return stringvalue};stringvalue=M.str[component][identifier];if(typeof a=='undefined')return stringvalue;if(typeof a=='number'||typeof a=='string'){stringvalue=stringvalue.replace(/\{\$a\}/g,a);return stringvalue};if(typeof a=='object'){for(var key in a){if(typeof a[key]!='number'&&typeof a[key]!='string'){if(M.cfg.developerdebug)Y.log('invalid value type for $a->'+key,'warn','M.util.get_string');continue};var search='{$a->'+key+'}';search=search.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,'\\$&');search=new RegExp(search,'g');stringvalue=stringvalue.replace(search,a[key])};return stringvalue};if(M.cfg.developerdebug)Y.log('incorrect placeholder type','warn','M.util.get_string');return stringvalue};M.util.focus_login_form=function(Y){var username=Y.one('#username'),password=Y.one('#password');if(username==null||password==null)return;var curElement=document.activeElement;if(curElement=='undefined');else if(curElement.tagName=='INPUT')return;if(username.get('value')==''){username.focus()}else password.focus()};M.util.focus_login_error=function(Y){var errorlog=Y.one('#loginerrormessage');if(errorlog)errorlog.focus()};M.util.add_lightbox=function(Y,node){var WAITICON={pix:"i/loading_small",component:'moodle'};if(node.one('.lightbox'))return node.one('.lightbox');node.setStyle('position','relative');var waiticon=Y.Node.create('').setAttrs({src:M.util.image_url(WAITICON.pix,WAITICON.component)}).setStyles({position:'relative',top:'50%'}),lightbox=Y.Node.create('
').setStyles({opacity:'.75',position:'absolute',width:'100%',height:'100%',top:0,left:0,backgroundColor:'white',textAlign:'center'}).setAttribute('class','lightbox').hide();lightbox.appendChild(waiticon);node.append(lightbox);return lightbox};M.util.add_spinner=function(Y,node){var WAITICON={pix:"i/loading_small",component:'moodle'};if(node.one('.spinner'))return node.one('.spinner');var spinner=Y.Node.create('').setAttribute('src',M.util.image_url(WAITICON.pix,WAITICON.component)).addClass('spinner').addClass('iconsmall').hide();node.append(spinner);return spinner} function checkall(){var inputs=document.getElementsByTagName('input');for(var i=0;i=9){if(chb.checked){pw.type="text"}else pw.type="password"}else{try{if(chb.checked){var newpw=document.createElement('')}else var newpw=document.createElement('');newpw.attributes['class'].nodeValue=pw.attributes['class'].nodeValue}catch(e){var newpw=document.createElement('input');newpw.setAttribute('autocomplete','off');newpw.setAttribute('name',pw.name);if(chb.checked){newpw.setAttribute('type','text')}else newpw.setAttribute('type','password');newpw.setAttribute('class',pw.getAttribute('class'))};newpw.id=pw.id;newpw.size=pw.size;newpw.onblur=pw.onblur;newpw.onchange=pw.onchange;newpw.value=pw.value;pw.parentNode.replaceChild(newpw,pw)}} function filterByParent(elCollection,parentFinder){var filteredCollection=[];for(var i=0;i0&&(windowobj.innerHeight<10||windowobj.innerWidth<10)){hackcount-=1;setTimeout(get_size_exactly_right,10)}};setTimeout(get_size_exactly_right,0)};windowobj.focus();return false} function close_window(e){if(e.preventDefault){e.preventDefault()}else e.returnValue=false;window.close()} function show_item(itemid){var item=document.getElementById(itemid);if(item)item.style.display=""} function destroy_item(itemid){var item=document.getElementById(itemid);if(item)item.parentNode.removeChild(item)} function focuscontrol(controlid){var control=document.getElementById(controlid);if(control)control.focus()} function old_onload_focus(formid,controlname){if(document.forms[formid]&&document.forms[formid].elements&&document.forms[formid].elements[controlname])document.forms[formid].elements[controlname].focus()} function build_querystring(obj){return convert_object_to_string(obj,'&')} function build_windowoptionsstring(obj){return convert_object_to_string(obj,',')} function convert_object_to_string(obj,separator){if(typeof obj!=='object')return null;var list=[];for(var k in obj){k=encodeURIComponent(k);var value=obj[k];if(obj[k]instanceof Array){for(var i in value)list.push(k+'[]='+encodeURIComponent(value[i]))}else list.push(k+'='+encodeURIComponent(value))};return list.join(separator)} function stripHTML(str){var re=/<\S[^><]*>/g,ret=str.replace(re,"");return ret};Number.prototype.fixed=function(n){with(Math)return round(Number(this)*pow(10,n))/pow(10,n)} function update_progress_bar(id,width,pt,msg,es){var percent=pt,status=document.getElementById("status_"+id),percent_indicator=document.getElementById("pt_"+id),progress_bar=document.getElementById("progress_"+id),time_es=document.getElementById("time_"+id);status.innerHTML=msg;percent_indicator.innerHTML=percent.fixed(2)+'%';if(percent==100){progress_bar.style.background="green";time_es.style.display="none"}else{progress_bar.style.background="#FFCC66";if(es=='?'){time_es.innerHTML=""}else{time_es.innerHTML=es.fixed(2)+" sec";time_es.style.display="block"}};progress_bar.style.width=width+"px"} function hide_item(itemid){var item=document.getElementById(itemid);if(item)item.style.display="none"};M.util.help_popups={setup:function(Y){Y.one('body').delegate('click',this.open_popup,'a.helplinkpopup',this)},open_popup:function(e){e.preventDefault();var anchor=e.target.ancestor('a',true),args={name:'popup',url:anchor.getAttribute('href'),options:''},options=['height=600','width=800','top=0','left=0','menubar=0','location=0','scrollbars','resizable','toolbar','status','directories=0','fullscreen=0','dependent'];args.options=options.join(',');openpopup(e,args)}};M.util.help_icon={initialised:false,setup:function(Y,properties){this.add(Y,properties)},add:function(Y){if(M.cfg.developerdebug)Y.log("You are using a deprecated function call (M.util.help_icon.add). Please look at rewriting your call to support lib/yui/popuphelp/popuphelp.js");if(!this.initialised)YUI().use('moodle-core-popuphelp',function(){M.core.init_popuphelp([])});this.initialised=true}};M.core_custom_menu={init:function(Y,nodeid){var node=Y.one('#'+nodeid);if(node)Y.use('node-menunav',function(Y){node.removeClass('javascript-disabled');node.plug(Y.Plugin.NodeMenuNav)})}};M.form=M.form||{};M.form.init_smartselect=function(Y,id,options){if(!id.match(/^id_/))id='id_'+id;var select=Y.one('select#'+id);if(!select)return false;Y.use('event-delegate',function(){var smartselect={id:id,structure:[],options:[],submenucount:0,currentvalue:null,currenttext:null,shownevent:null,cfg:{selectablecategories:true,mode:null},nodes:{select:null,loading:null,menu:null},init:function(Y,id,args,nodes){if(typeof args=='object')for(var i in this.cfg)if(args[i]||args[i]===false)this.cfg[i]=args[i];this.nodes.select=nodes.select;this.currentvalue=this.nodes.select.get('selectedIndex');this.currenttext=this.nodes.select.all('option').item(this.currentvalue).get('innerHTML');var options=Array();options['']={text:this.currenttext,value:'',depth:0,children:[]};this.nodes.select.all('option').each(function(option,index){var rawtext=option.get('innerHTML'),text=rawtext.replace(/^( )*/,'');if(rawtext===text){text=rawtext.replace(/^(\s)*/,'');var depth=(rawtext.length-text.length)+1}else var depth=((rawtext.length-text.length)/12)+1;option.set('innerHTML',text);options['i'+index]={text:text,depth:depth,index:index,children:[]}},this);this.structure=[];var structcount=0;for(var i in options){var o=options[i];if(o.depth==0){this.structure.push(o);structcount++}else{var d=o.depth,current=this.structure[structcount-1];for(var j=0;j';content+=this.generate_submenu_content(this.structure[0],true);content+='';return content},generate_submenu_content:function(item,rootelement){this.submenucount++;var content='';if(item.children.length>0){if(rootelement){content+='
 
';content+='
';content+='
'}else{content+='
  • ';var categoryclass=(this.cfg.selectablecategories)?'selectable':'notselectable';content+=''+item.text+'';content+='
    ';content+='
    '};content+='
      ';for(var i in item.children)content+=this.generate_submenu_content(item.children[i],false);content+='
    ';content+='
    ';content+='
    ';if(rootelement);else content+='
  • '}else{content+='
  • ';content+=''+item.text+'';content+='
  • '};return content},select:function(e){var t=e.target;e.halt();this.currenttext=t.get('innerHTML');this.currentvalue=t.getAttribute('value');this.nodes.select.set('selectedIndex',this.currentvalue);this.hide_menu()},handle_click:function(e){var target=e.target;if(target.hasClass('smartselect_mask')){this.show_menu(e)}else if(target.hasClass('selectable')||target.hasClass('smartselect_menuitem')){this.select(e)}else if(target.hasClass('smartselect_menuitem_label')||target.hasClass('smartselect_submenuitem'))this.show_sub_menu(e)},show_menu:function(e){e.halt();var menu=e.target.ancestor().one('.smartselect_menu');menu.addClass('visible');this.shownevent=Y.one(document.body).on('click',this.hide_menu,this)},show_sub_menu:function(e){e.halt();var target=e.target;if(!target.hasClass('smartselect_submenuitem'))target=target.ancestor('.smartselect_submenuitem');if(this.cfg.mode=='compact'&&target.one('.smartselect_submenu').hasClass('visible')){target.ancestor('ul').all('.smartselect_submenu.visible').removeClass('visible');return};target.ancestor('ul').all('.smartselect_submenu.visible').removeClass('visible');target.one('.smartselect_submenu').addClass('visible')},hide_menu:function(){this.nodes.menu.all('.visible').removeClass('visible');if(this.shownevent)this.shownevent.detach()}};smartselect.init(Y,id,options,{select:select})})};M.util.video_players=[];M.util.audio_players=[];M.util.add_video_player=function(id,fileurl,width,height,autosize){M.util.video_players.push({id:id,fileurl:fileurl,width:width,height:height,autosize:autosize,resized:false})};M.util.add_audio_player=function(id,fileurl,small){M.util.audio_players.push({id:id,fileurl:fileurl,small:small})};M.util.load_flowplayer=function(){if(M.util.video_players.length==0&&M.util.audio_players.length==0)return;if(typeof flowplayer=='undefined'){var loaded=false,embed_function=function(){if(loaded||typeof flowplayer=='undefined')return;loaded=true;var controls={autoHide:true};for(var i=0;i0&&video.height>0){var src={src:M.cfg.wwwroot+'/lib/flowplayer/flowplayer-3.2.18.swf',width:video.width,height:video.height}}else var src=M.cfg.wwwroot+'/lib/flowplayer/flowplayer-3.2.18.swf';flowplayer(video.id,src,{plugins:{controls:controls},clip:{url:video.fileurl,autoPlay:false,autoBuffering:true,scaling:'fit',mvideo:video,onMetaData:function(clip){if(clip.mvideo.autosize&&!clip.mvideo.resized){clip.mvideo.resized=true;if(typeof(clip.metaData.width)=='undefined'||typeof(clip.metaData.height)=='undefined'){var width=clip.width,height=clip.height}else{var width=clip.metaData.width,height=clip.metaData.height};var minwidth=300;if(width