/* http://code.google.com/p/ifaddons/ */SKIFS.quickEdit={config:{button:'Quick Edit ',postCellCount:3,editHistoryEnabled:true,addQuickEditButton:true,hideEditButtons:false,enableDoubleClick:false},originalPostHtml:{},postIcons:{},authKey:'',construct:function(useCustomStyles){if(!SKIFS.util.getAjax()||!document.getElementById||!document.body.innerHTML)return;if(!useCustomStyles){document.write('')}var links=document.links;for(var i=0;i'+this.config.button+'';links[i].parentNode.insertBefore(editButton,links[i].nextSibling)}if(this.config.hideEditButtons)links[i].style.display='none';if(this.config.enableDoubleClick){var postE=this.getPostElement(pid);postE.fid=fid;postE.tid=tid;postE.pid=pid;postE.ondblclick=function(){SKIFS.quickEdit.edit(this.fid,this.tid,this.pid)}}}}},getPostElement:function(pid){var postAreaE=null;var anchors=document.anchors;for(var i=0;i'+'
'+'
'+' '+'
'+'
'+'
';var req=SKIFS.util.getAjax();req.open('GET',SKIFS.util.getBaseUrl()+'index.php?act=Post&CODE=08&f='+fid+'&t='+tid+'&p='+pid+'&s='+SKIFS.util.getSessionId(),true);req.onreadystatechange=function(){if(req.readyState==4)SKIFS.quickEdit.update(fid,tid,pid,req.responseText)};req.send(null)},update:function(fid,tid,pid,response){var editorE=document.getElementById('qe-editor-'+pid);var formE=document.getElementById('qe-form-'+pid);this.authKey=response.match(/auth_key' value='(.{32})'/)[1];var content=response.match(/';this.postIcons[pid]=response.match(/name=('|")iconid('|") value=('|")([0-9]+)('|") checked/)[4];with(formE){Post.focus();save.disabled=false;cancel.disabled=false;full.disabled=false;action=window.location.href.replace(/index\..*$/,'')+'index.php?act=Post&CODE=08&f='+fid+'&t='+tid+'&p='+pid+'&editupload=keep&add_edit='+(this.config.editHistoryEnabled?'1':'0')+'&iconid='+this.postIcons[pid]+'&enableemo=yes&enablesig=yes&preview=1'}},discard:function(pid){var postE=document.getElementById('post-area-'+pid);postE.innerHTML=this.originalPostHtml[pid];this.originalPostHtml[pid]=null;this.postIcons[pid]=null},save:function(fid,tid,pid){var formE=document.getElementById('qe-form-'+pid);if(formE.Post.value==''){alert('You must enter a message to post!');return}formE.Post.disabled=true;formE.cancel.disabled=true;formE.save.value="Saving... please wait";var st=window.location.href.match(/st=([0-9]+)/);st=st?st[1]:0;var req=SKIFS.util.getAjax();req.open('POST',SKIFS.util.getBaseUrl()+'index.php?act=Post&CODE=09&f='+fid+'&t='+tid+'&p='+pid+'&st='+st+'&auth_key='+this.authKey+'&s='+SKIFS.util.getSessionId(),true);req.setRequestHeader('Content-Type','application/x-www-form-urlencoded');req.onreadystatechange=function(){if(req.readyState==4)SKIFS.quickEdit.finish(pid,req.responseText)};req.send('editupload=keep&add_edit='+(this.config.editHistoryEnabled?'1':'0')+'&iconid='+this.postIcons[pid]+'&enableemo=yes&enablesig=yes&Post='+SKIFS.util.utf8Decode(formE.Post.value))},finish:function(pid,response){var formE=document.getElementById('qe-form-'+pid);var newPost=new RegExp('((.|\n)*?)');newPost=newPost.exec(response);if(!newPost){alert("An error has occurred while saving your post.");formE.save.value="Save";return}newPost=newPost[1];var postE=document.getElementById('post-area-'+pid);postE.innerHTML=newPost;this.originalPostHtml[pid]=null;this.postIcons[pid]=null}}