/*tinyMCEPopup.requireLangPack();*/var YoutubeDialog={init:function(){var a=document.forms[0];a.youtubeURL.value=tinyMCEPopup.editor.selection.getContent({format:"text"});$(".share-embed-size-list li.share-embed-size").each(function(){$(this).click(function(){$("li.share-embed-size").removeClass("selected");$(this).addClass("selected")})})},insert:function(){var a=$("#youtubeURL").val();if(a===null){tinyMCEPopup.close();return}var b,c,d,e,f;c=a.match("[\\?&]v=([^&#]*)");b=$.trim(c===null?a:c[1]);if(b===""){tinyMCEPopup.close();return}d=$("li.selected label input").attr("data-width");e=$("li.selected label input").attr("data-height");if(d==-1&&e==-1){d=$("input.share-embed-size-custom-width").val();e=$("input.share-embed-size-custom-height").val()}if(d==""||d=="undefined"||e==""||e=="undefined"){alert("Error: No size selected");tinyMCEPopup.close();return}f=$("input[name='yType']:checked").val();if(f==""||f=="undefined"){alert("Error: No type selected");tinyMCEPopup.close();return}var g='<iframe width="'+d+'" height="'+e+'" src="http://www.youtube.com/embed/'+b+'?wmode=transparent" frameborder="0" allowfullscreen></iframe>';var h='\n        <object width="'+d+'" height="'+e+'">\n\n            <param name="movie" value="http://www.youtube.com/v/'+b+'?version=3&hl=en_US"></param>\n\n            <param name="allowFullScreen" value="true"></param>\n\n            <param name="allowscriptaccess" value="always"></param>\n\n            <param name="wmode" value="transparent"></param>\n\n            <embed src="http://www.youtube.com/v/'+b+'?version=3&hl=en_US" type="application/x-shockwave-flash" width="'+d+'" height="'+e+'" allowscriptaccess="always" allowfullscreen="true"></embed>\n\n        </object>';if(f=="iframe"){tinyMCEPopup.editor.execCommand("mceInsertContent",false,g)}else{tinyMCEPopup.editor.execCommand("mceInsertContent",false,h)}tinyMCEPopup.close()}};tinyMCEPopup.onInit.add(YoutubeDialog.init,YoutubeDialog)