var url="ajax.php";var tmpTag=new Array();var tmpStore=new Array();function makeEditable(id){tmpTag[id]=$(id).innerHTML?1:0;$(id).innerHTML=$(id).innerHTML?($(id).innerHTML):"Click here to edit!";Event.observe(id,"click",function(){edit($(id));},false);Event.observe(id,"mouseover",function(){showAsEditable($(id));},false);Event.observe(id,"mouseout",function(){showAsEditable($(id),true);},false);}function edit(_2){Element.hide(_2);tmpStore[_2.id]=_2.innerHTML;var _3="<div id=\""+_2.id+"_editor\"><textarea id=\""+_2.id+"_edit\" name=\""+_2.id+"\" rows=\"2\" cols=\"30\">"+(tmpTag[_2.id]==0?"":trim(_2.innerHTML))+"</textarea>";var _4="<div style=\"align:center;\"><input id=\""+_2.id+"_save\" type=\"button\" class=button value=\"SAVE\" /> OR <input id=\""+_2.id+"_cancel\" type=\"button\" class=button value=\"CANCEL\" /></div></div>";new Insertion.After(_2,_3+_4);Event.observe(_2.id+"_save","click",function(){saveChanges(_2);},false);Event.observe(_2.id+"_cancel","click",function(){cleanUp(_2);},false);}function showAsEditable(_5,_6){if(!_6){Element.removeClassName(_5,"editable");}else{Element.addClassName(_5,"editable");}}function saveChanges(_7){var _8=escape($F(_7.id+"_edit"));_7.innerHTML="Saving...";cleanUp(_7,true);var _9=function(t){editComplete(t,_7);};var _b=function(t){editFailed(t,_7);};var _d="id="+_7.id+"&mode=split&content="+_8;var _e=new Ajax.Request(url,{method:"post",postBody:_d,onSuccess:_9,onFailure:_b});}function cleanUp(_f,_10){Element.remove(_f.id+"_editor");Element.show(_f);if(!_10){showAsEditable(_f,true);}}function editComplete(t,obj){obj.innerHTML=t.responseText;tmpTag[obj.id]=obj.innerHTML?1:0;obj.innerHTML=obj.innerHTML?obj.innerHTML:"Click here to edit!";showAsEditable(obj,true);}function editFailed(t,obj){alert("Sorry, the update failed.");obj.innerHTML=tmpStore[obj.id];cleanUp(obj,0);}function trim(_15){if(typeof _15!="string"){return _15;}var _16=_15;var ch=_16.substring(0,1);while(ch==" "){_16=_16.substring(1,_16.length);ch=_16.substring(0,1);}ch=_16.substring(_16.length-1,_16.length);while(ch==" "){_16=_16.substring(0,_16.length-1);ch=_16.substring(_16.length-1,_16.length);}while(_16.indexOf("  ")!=-1){_16=_16.substring(0,_16.indexOf("  "))+_16.substring(_16.indexOf("  ")+1,_16.length);}return _16;}function populateValue(act,id,_1a,_1b){$(_1a).id.value=id;$(_1a).act.value=act;if(act+"_"+id){$(_1a).edits.value=_1b==0?"":unhtmlspecialchars($(act+"_"+id).innerHTML);}return overlay($(act+"_"+id),_1a+"_div");}function clickEditValue(act,id,_1e){var _1f=$(act+"_"+id).innerHTML!="";if($(act+"_"+id).innerHTML==""){$(act+"_"+id).innerHTML="Click here to edit!";}Event.observe(act+"_"+id,"click",function(){return populateValue(act,id,_1e,_1f);},false);}function clickEditValues(){for(var i=2;i<arguments.length;i++){clickEditValue(arguments[i],arguments[0],arguments[1]);}}function submitComplete(res,_22){var act=$(_22).act.value;var id=$(_22).id.value;$(act+"_"+id).innerHTML=res.responseText==""?"Click here to edit!":res.responseText;overlayclose("clickeditform_div");return false;}function submitFailed(res,obj){alert("Sorry, the update failed.");}