text: (function(){function e(e){return document.getElementById(e)}function t(e){var i,n,r,s;if(null==e||"object"!=typeof e)return e;if("length"in e){for(r=[],i=0,n=e.length;n>i;++i)r[i]=t(e[i]);return r}r={};for(s in e)e.hasOwnProperty(s)&&(r[s]=t(e[s]));return r}function i(t){var i=e(t);return"SELECT"==i.nodeName?i.options[i.selectedIndex].value:"checkbox"==i.type?i.checked:i.value}function n(t,i,n){if(i!==void 0&&null!=i){var r=e(t);"SELECT"==r.nodeName?selectByValue(document.forms[0],t,i):"checkbox"==r.type?("string"==typeof i&&(i=i.toLowerCase(),i=!n&&"true"===i||n&&i===n.toLowerCase()),r.checked=!!i):r.value=i}}var r;(r=tinyMCEPopup.getParam("media_external_list_url"))&&document.write('<script language="javascript" type="text/javascript" src="'+tinyMCEPopup.editor.documentBaseURI.toAbsolute(r)+'"></script>'),window.Media={init:function(){var i,n,r=this;r.editor=n=tinyMCEPopup.editor,e("filebrowsercontainer").innerHTML=getBrowserHTML("filebrowser","src","media","media"),e("qtsrcfilebrowsercontainer").innerHTML=getBrowserHTML("qtsrcfilebrowser","quicktime_qtsrc","media","media"),e("bgcolor_pickcontainer").innerHTML=getColorPickerHTML("bgcolor_pick","bgcolor"),e("video_altsource1_filebrowser").innerHTML=getBrowserHTML("video_filebrowser_altsource1","video_altsource1","media","media"),e("video_altsource2_filebrowser").innerHTML=getBrowserHTML("video_filebrowser_altsource2","video_altsource2","media","media"),e("audio_altsource1_filebrowser").innerHTML=getBrowserHTML("audio_filebrowser_altsource1","audio_altsource1","media","media"),e("audio_altsource2_filebrowser").innerHTML=getBrowserHTML("audio_filebrowser_altsource2","audio_altsource2","media","media"),e("video_poster_filebrowser").innerHTML=getBrowserHTML("filebrowser_poster","video_poster","image","media"),i=r.getMediaListHTML("medialist","src","media","media"),""==i?e("linklistrow").style.display="none":e("linklistcontainer").innerHTML=i,isVisible("filebrowser")&&(e("src").style.width="230px"),isVisible("video_filebrowser_altsource1")&&(e("video_altsource1").style.width="220px"),isVisible("video_filebrowser_altsource2")&&(e("video_altsource2").style.width="220px"),isVisible("audio_filebrowser_altsource1")&&(e("audio_altsource1").style.width="220px"),isVisible("audio_filebrowser_altsource2")&&(e("audio_altsource2").style.width="220px"),isVisible("filebrowser_poster")&&(e("video_poster").style.width="220px"),n.dom.setOuterHTML(e("media_type"),r.getMediaTypeHTML(n)),r.setDefaultDialogSettings(n),r.data=t(tinyMCEPopup.getWindowArg("data")),r.dataToForm(),r.preview(),updateColor("bgcolor_pick","bgcolor")},insert:function(){var e=tinyMCEPopup.editor;this.formToData(),e.execCommand("mceRepaint"),tinyMCEPopup.restoreSelection(),e.selection.setNode(e.plugins.media.dataToImg(this.data)),tinyMCEPopup.close()},preview:function(){e("prev").innerHTML=this.editor.plugins.media.dataToHtml(this.data,!0)},moveStates:function(t,r){function s(e){var t={};return e&&tinymce.each(e.split("&"),function(e){var i=e.split("=");t[unescape(i[0])]=unescape(i[1])}),t}function o(e,r){var s,o,a,l,h;if(e==u.type||"global"==e)for(r=tinymce.explode(r),s=0;r.length>s;s++)o=r[s],a="global"==e?o:e+"_"+o,"global"==e?h=u:"video"==e||"audio"==e?(h=u.video.attrs,h||t||(u.video.attrs=h={})):h=u.params,h&&(t?n(a,h[o],"video"==e||"audio"==e?o:""):(delete h[o],l=i(a),"video"!=e&&"audio"!=e||l!==!0||(l=o),c[a]?l!==c[a]&&(l=""+l,h[o]=l):l&&(l=""+l,h[o]=l)))}var a,l,h,c,l,u=this.data,d=this.editor,p=d.plugins.media;c={quicktime_autoplay:!0,quicktime_controller:!0,flash_play:!0,flash_loop:!0,flash_menu:!0,windowsmedia_autostart:!0,windowsmedia_enablecontextmenu:!0,windowsmedia_invokeurls:!0,realmedia_autogotourl:!0,realmedia_imagestatus:!0},t||(u.type=e("media_type").options[e("media_type").selectedIndex].value,u.width=i("width"),u.height=i("height"),l=i("src"),"src"==r&&(a=l.replace(/^.*\.([^.]+)$/,"$1"),(h=p.getType(a))&&(u.type=h.name.toLowerCase()),n("media_type",u.type)),("video"==u.type||"audio"==u.type)&&(u.video.sources||(u.video.sources=[]),u.video.sources[0]={src:i("src")})),e("video_options").style.display="none",e("audio_options").style.display="none",e("flash_options").style.display="none",e("quicktime_options").style.display="none",e("shockwave_options").style.display="none",e("windowsmedia_options").style.display="none",e("realmedia_options").style.display="none",e("embeddedaudio_options").style.display="none",e(u.type+"_options")&&(e(u.type+"_options").style.display="block"),n("media_type",u.type),o("flash","play,loop,menu,swliveconnect,quality,scale,salign,wmode,base,flashvars"),o("quicktime","loop,autoplay,cache,controller,correction,enablejavascript,kioskmode,autohref,playeveryframe,targetcache,scale,starttime,endtime,target,qtsrcchokespeed,volume,qtsrc"),o("shockwave","sound,progress,autostart,swliveconnect,swvolume,swstretchstyle,swstretchhalign,swstretchvalign"),o("windowsmedia","autostart,enabled,enablecontextmenu,fullscreen,invokeurls,mute,stretchtofit,windowlessvideo,balance,baseurl,captioningid,currentmarker,currentposition,defaultframe,playcount,rate,uimode,volume"),o("realmedia","autostart,loop,autogotourl,center,imagestatus,maintainaspect,nojava,prefetch,shuffle,console,controls,numloop,scriptcallbacks"),o("video","poster,autoplay,loop,muted,preload,controls"),o("audio","autoplay,loop,preload,controls"),o("embeddedaudio","autoplay,loop,controls"),o("global","id,name,vspace,hspace,bgcolor,align,width,height"),t?"video"==u.type?(u.video.sources[0]&&n("src",u.video.sources[0].src),l=u.video.sources[1],l&&n("video_altsource1",l.src),l=u.video.sources[2],l&&n("video_altsource2",l.src)):"audio"==u.type?(u.video.sources[0]&&n("src",u.video.sources[0].src),l=u.video.sources[1],l&&n("audio_altsource1",l.src),l=u.video.sources[2],l&&n("audio_altsource2",l.src)):("flash"==u.type&&tinymce.each(d.getParam("flash_video_player_flashvars",{url:"$url",poster:"$poster"}),function(e,t){"$url"==e&&(u.params.src=s(u.params.flashvars)[t]||u.params.src||"")}),n("src",u.params.src)):(l=i("src"),l.match(/youtube\.com\/embed\/\w+/)?(u.width=425,u.height=350,u.params.frameborder="0",u.type="iframe",n("src",l),n("media_type",u.type)):(l.match(/youtu\.be\/[a-z1-9.-_]+/)&&(u.width=425,u.height=350,u.params.frameborder="0",u.type="iframe",l="http://www.youtube.com/embed/"+l.match(/youtu.be\/([a-z1-9.-_]+)/)[1],n("src",l),n("media_type",u.type)),l.match(/youtube\.com(.+)v=([^&]+)/)&&(u.width=425,u.height=350,u.params.frameborder="0",u.type="iframe",l="http://www.youtube.com/embed/"+l.match(/v=([^&]+)/)[1],n("src",l),n("media_type",u.type))),l.match(/video\.google\.com(.+)docid=([^&]+)/)&&(u.width=425,u.height=326,u.type="flash",l="http://video.google.com/googleplayer.swf?docId="+l.match(/docid=([^&]+)/)[1]+"&hl=en",n("src",l),n("media_type",u.type)),l.match(/vimeo\.com\/([0-9]+)/)&&(u.width=425,u.height=350,u.params.frameborder="0",u.type="iframe",l="http://player.vimeo.com/video/"+l.match(/vimeo.com\/([0-9]+)/)[1],n("src",l),n("media_type",u.type)),l.match(/stream\.cz\/((?!object).)*\/([0-9]+)/)&&(u.width=425,u.height=350,u.params.frameborder="0",u.type="iframe",l="http://www.stream.cz/object/"+l.match(/stream.cz\/[^/]+\/([0-9]+)/)[1],n("src",l),n("media_type",u.type)),l.match(/maps\.google\.([a-z]{2,3})\/maps\/(.+)msid=(.+)/)&&(u.width=425,u.height=350,u.params.frameborder="0",u.type="iframe",l="http://maps.google.com/maps/ms?msid="+l.match(/msid=(.+)/)[1]+"&output=embed",n("src",l),n("media_type",u.type)),"video"==u.type?(u.video.sources||(u.video.sources=[]),u.video.sources[0]={src:l},l=i("video_altsource1"),l&&(u.video.sources[1]={src:l}),l=i("video_altsource2"),l&&(u.video.sources[2]={src:l})):"audio"==u.type?(u.video.sources||(u.video.sources=[]),u.video.sources[0]={src:l},l=i("audio_altsource1"),l&&(u.video.sources[1]={src:l}),l=i("audio_altsource2"),l&&(u.video.sources[2]={src:l})):u.params.src=l,n("width",u.width||("audio"==u.type?300:320)),n("height",u.height||("audio"==u.type?32:240)))},dataToForm:function(){this.moveStates(!0)},formToData:function(e){("width"==e||"height"==e)&&this.changeSize(e),"source"==e?(this.moveStates(!1,e),n("source",this.editor.plugins.media.dataToHtml(this.data)),this.panel="source"):("source"==this.panel&&(this.data=t(this.editor.plugins.media.htmlToData(i("source"))),this.dataToForm(),this.panel=""),this.moveStates(!1,e),this.preview())},beforeResize:function(){this.width=parseInt(i("width")||("audio"==this.data.type?"300":"320"),10),this.height=parseInt(i("height")||("audio"==this.data.type?"32":"240"),10)},changeSize:function(t){var r,s;e("constrain").checked&&(r=parseInt(i("width")||("audio"==this.data.type?"300":"320"),10),s=parseInt(i("height")||("audio"==this.data.type?"32":"240"),10),"width"==t?(this.height=Math.round(r/this.width*s),n("height",this.height)):(this.width=Math.round(s/this.height*r),n("width",this.width)))},getMediaListHTML:function(){if("undefined"!=typeof tinyMCEMediaList&&tinyMCEMediaList.length>0){var e="";e+='<select id="linklist" name="linklist" style="width: 250px" onchange="this.form.src.value=this.options[this.selectedIndex].value;Media.formToData(\'src\');">',e+='<option value="">---</option>';for(var t=0;tinyMCEMediaList.length>t;t++)e+='<option value="'+tinyMCEMediaList[t][1]+'">'+tinyMCEMediaList[t][0]+"</option>";return e+="</select>"}return""},getMediaTypeHTML:function(e){function t(t,i){return e.schema.getElementRule(i||t)?'<option value="'+t+'">'+tinyMCEPopup.editor.translate("media_dlg."+t)+"</option>":""}var i="";return i+='<select id="media_type" name="media_type" onchange="Media.formToData(\'type\');">',i+=t("video"),i+=t("audio"),i+=t("flash","object"),i+=t("quicktime","object"),i+=t("shockwave","object"),i+=t("windowsmedia","object"),i+=t("realmedia","object"),i+=t("iframe"),e.getParam("media_embedded_audio",!1)&&(i+=t("embeddedaudio","object")),i+="</select>"},setDefaultDialogSettings:function(e){var t=e.getParam("media_dialog_defaults",{});tinymce.each(t,function(e,t){n(t,e)})}},tinyMCEPopup.requireLangPack(),tinyMCEPopup.onInit.add(function(){Media.init()})})();