/* Copyright (C) 2007 - 2010 YOOtheme GmbH, YOOtheme License (http://www.yootheme.com/license) */

window.addEvent("domready",function(){var e=location.href.match(/^(.+)administrator\/index\.php.*/i)[1];$$("input.image-select").each(function(a,c){var d="image-select-"+c,b=(new Element("button",{type:"button"})).setText("Select Image").injectAfter(a),f=(new Element("span",{"class":"image-cancel"})).injectAfter(a),g=(new Element("div",{"class":"image-preview"})).injectAfter(b);a.setProperty("id",d);a.getProperty("value")&&(new Element("img",{src:e+a.getProperty("value")})).injectInside(g);f.addEvent("click",
function(){a.setProperty("value","");a.getParent().getElement("div.image-preview").empty()});b.addEvent("click",function(h){(new Event(h)).stop();SqueezeBox.fromElement(this,{handler:"iframe",url:"index.php?option=com_media&view=images&tmpl=component&e_name="+d,size:{x:600,y:415}})})});if($type(window.jInsertEditorText)=="function")window.insertTextOld=window.jInsertEditorText;window.jInsertEditorText=function(a,c){if(c.match(/^image-select-/)){var d=$(c),b=d.getParent().getElement("div.image-preview").setHTML(a).getElement("img");
d.setProperty("value",b.getProperty("src"));b.setProperty("src",e+b.getProperty("src"))}else $type(window.insertTextOld)=="function"&&window.insertTextOld(a,c)}}); 
