addLoadEvent(function(){theList=new listMan();}); function deleteSomething(what,id,message,obj){if(!obj)obj=theList;if(!message)message="";if(confirm(message))return obj.ajaxDelete(what,id);else return false;} function dimSomething(what,id,dimClass,obj){if(!obj)obj=theList;return obj.ajaxDimmer(what,id,dimClass);} function WPAjax(file, responseEl){//class WPAjax extends sack this.getResponseElement=function(r){var p=document.getElementById(r+'-p');if(!p){p=document.createElement('span');p.id=r+'-p';document.getElementById(r).appendChild(p);}this.myResponseElement=p; } this.parseAjaxResponse=function(){ if(isNaN(this.response)){this.myResponseElement.innerHTML='

'+this.response+'

';return false;} this.response=parseInt(this.response,10); if(-1==this.response){this.myResponseElement.innerHTML="

";return false;} else if(0==this.response){this.myResponseElement.innerHTML="

";return false;} return true; } this.parseAjaxResponseXML=function(){ if(this.responseXML&&typeof this.responseXML=='object')return true; if(isNaN(this.response)){this.myResponseElement.innerHTML='

'+this.response+'

';return false;} var r=parseInt(this.response,10); if(-1==r){this.myResponseElement.innerHTML="

";} else if(0==r){this.myResponseElement.innerHTML="

";} return false; } this.init(file,responseEl); } WPAjax.prototype=new sack; WPAjax.prototype.init=function(f,r){ this.encVar('cookie', document.cookie); this.requestFile=f;this.getResponseElement(r);this.method='POST'; this.onLoading=function(){this.myResponseElement.innerHTML="";}; this.onLoaded=function(){this.myResponseElement.innerHTML="";}; this.onInteractive=function(){this.myResponseElement.innerHTML="";}; } function listMan(theListId){ this.theList=null; this.ajaxRespEl=null; this.inputData='';this.clearInputs=new Array();this.showLink=1; this.topAdder=0;this.alt='alternate';this.recolorPos;this.reg_color='#FFFFFF';this.alt_color='#F1F1F1'; this.addComplete=null;this.delComplete=null;this.dimComplete=null; var listType;var listItems; self.aTrap=0; this.ajaxAdder=function(what,where,update){//for TR, server must wrap TR in TABLE TBODY. this.makeEl cleans it if(self.aTrap)return;self.aTrap=1;setTimeout('aTrap=0',300); this.ajaxAdd=new WPAjax('admin-ajax.php',this.ajaxRespEl?this.ajaxRespEl:'ajax-response'); if(this.ajaxAdd.failed)return true; this.grabInputs(where); var tempObj=this; this.ajaxAdd.onCompletion=function(){ if(!this.parseAjaxResponseXML())return; var newItems=this.responseXML.getElementsByTagName(what); if(tempObj.topAdder)tempObj.recolorPos=0; if(newItems){for (c=0;c

';} else this.myResponseElement.innerHTML=''; for(var i=0;i