InsertImage._pluginInfo={name:"InsertImage",origin:"Xinha Core",version:"$LastChangedRevision:992 $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),developer:"The Xinha Core Developer Team",developer_url:"$HeadURL:http://svn.xinha.webfactional.com/trunk/modules/InsertImage/insert_image.js $".replace(/^[^:]*:\s*(.*)\s*\$$/,"$1"),sponsor:"",sponsor_url:"",license:"htmlArea"};function InsertImage(A){}Xinha.prototype._insertImage=function(F){var E=this;var D;if(typeof F=="undefined"){F=this.getParentElement();if(F&&F.tagName.toLowerCase()!="img"){F=null}}var B;if(typeof E.config.baseHref!="undefined"&&E.config.baseHref!==null){B=E.config.baseHref}else{var A=window.location.toString().split("/");A.pop();B=A.join("/")}if(F){function C(I,H){var G=I.attributes;for(var J=0;J<G.length;J++){if(G[J].nodeName==H&&G[J].specified){return G[J].value}}return""}D={f_base:B,f_url:this.stripBaseURL(F.getAttribute("src",2)),f_alt:F.alt,f_border:F.border,f_align:F.align,f_vert:C(F,"vspace"),f_horiz:C(F,"hspace"),f_width:F.width,f_height:F.height}}else{D={f_base:B,f_url:""}}Dialog(E.config.URIs.insert_image,function(J){if(!J){return false}var I=F;if(!I){if(Xinha.is_ie){var H=E.getSelection();var G=E.createRange(H);E._doc.execCommand("insertimage",false,J.f_url);I=G.parentElement();if(I.tagName.toLowerCase()!="img"){I=I.previousSibling}}else{I=document.createElement("img");I.src=J.f_url;E.insertNodeAtSelection(I);if(!I.tagName){I=G.startContainer.firstChild}}}else{I.src=J.f_url}for(var L in J){var K=J[L];switch(L){case"f_alt":if(K){I.alt=K}else{I.removeAttribute("alt")}break;case"f_border":if(K){I.border=parseInt(K||"0")}else{I.removeAttribute("border")}break;case"f_align":if(K){I.align=K}else{I.removeAttribute("align")}break;case"f_vert":if(K!=""){I.vspace=parseInt(K||"0")}else{I.removeAttribute("vspace")}break;case"f_horiz":if(K!=""){I.hspace=parseInt(K||"0")}else{I.removeAttribute("hspace")}break;case"f_width":if(K){I.width=parseInt(K||"0")}else{I.removeAttribute("width")}break;case"f_height":if(K){I.height=parseInt(K||"0")}else{I.removeAttribute("height")}break}}},D)};