/* This compressed file is part of Xinha. For uncompressed sources, forum, and bug reports, go to xinha.org */
/* This file is part of version 0.96beta2 released Fri, 20 Mar 2009 11:01:14 +0100 */
var current_action=null;var actions=["crop","scale","rotate","measure","save"];var orginal_width=null,orginal_height=null;function toggle(g){if(current_action!=g){for(var d in actions){if(actions[d]!=g){var j=document.getElementById("tools_"+actions[d]);j.style.display="none";var f=document.getElementById("icon_"+actions[d]);f.className=""}}current_action=g;var j=document.getElementById("tools_"+g);j.style.display="block";var f=document.getElementById("icon_"+g);f.className="iconActive";var c=document.getElementById("indicator_image");c.src="img/"+g+".gif";editor.setMode(current_action);if(g=="scale"){var a=editor.window.document.getElementById("theImage");orginal_width=a.width;orginal_height=a.height;var b=document.getElementById("sw");b.value=orginal_width;var e=document.getElementById("sh");e.value=orginal_height}}}function toggleMarker(){var a=document.getElementById("markerImg");if(a!=null&&a.src!=null){if(a.src.indexOf("t_black.gif")>=0){a.src="img/t_white.gif"}else{a.src="img/t_black.gif"}editor.toggleMarker()}}function toggleConstraints(){var a=document.getElementById("scaleConstImg");var b=document.getElementById("constProp");if(a!=null&&a.src!=null){if(a.src.indexOf("unlocked2.gif")>=0){a.src="img/islocked2.gif";b.checked=true;checkConstrains("width")}else{a.src="img/unlocked2.gif";b.checked=false}}}function checkConstrains(f){var e=document.getElementById("constProp");if(e.checked){var b=document.getElementById("sw");var d=b.value;var c=document.getElementById("sh");var a=c.value;if(orginal_width>0&&orginal_height>0){if(f=="width"&&d>0){c.value=parseInt((d/orginal_width)*orginal_height)}else{if(f=="height"&&a>0){b.value=parseInt((a/orginal_height)*orginal_width)}}}}updateMarker("scale")}function updateMarker(f){if(f=="crop"){var e=document.getElementById("cx");var d=document.getElementById("cy");var g=document.getElementById("cw");var b=document.getElementById("ch");editor.setMarker(parseInt(e.value),parseInt(d.value),parseInt(g.value),parseInt(b.value))}else{if(f=="scale"){var a=document.getElementById("sw");var c=document.getElementById("sh");editor.setMarker(0,0,parseInt(a.value),parseInt(c.value))}}}function rotatePreset(a){var b=a.options[a.selectedIndex].value;if(b.length>0&&parseInt(b)!=0){var c=document.getElementById("ra");c.value=parseInt(b)}}function updateFormat(c){var b=c.options[c.selectedIndex].value;var a=b.split(",");if(a.length>1){updateSlider(parseInt(a[1]))}}function addEvent(d,c,a){if(d.addEventListener){d.addEventListener(c,a,true);return true}else{if(d.attachEvent){var b=d.attachEvent("on"+c,a);return b}else{return false}}}init=function(){var a=document.getElementById("bottom");if(window.opener){__dlg_init(a);__dlg_translate("ImageManager")}};addEvent(window,"load",init);