var Prototype={Version:"1.5.0",BrowserFeatures:{XPath:!!document.evaluate},ScriptFragment:"(?:<script.*?>)((\n|\r|.)*?)(?:</script>)",emptyFunction:function(){
},K:function(x){
return x;
}};
var Class={create:function(){
return function(){
this.initialize.apply(this,arguments);
};
}};
var Abstract=new Object();
Object.extend=function(_2,_3){
for(var _4 in _3){
_2[_4]=_3[_4];
}
return _2;
};
Object.extend(Object,{inspect:function(_5){
try{
if(_5===undefined){
return "undefined";
}
if(_5===null){
return "null";
}
return _5.inspect?_5.inspect():_5.toString();
}
catch(e){
if(e instanceof RangeError){
return "...";
}
throw e;
}
},keys:function(_6){
var _7=[];
for(var _8 in _6){
_7.push(_8);
}
return _7;
},values:function(_9){
var _a=[];
for(var _b in _9){
_a.push(_9[_b]);
}
return _a;
},clone:function(_c){
return Object.extend({},_c);
}});
Function.prototype.bind=function(){
var _d=this,_e=$A(arguments),_f=_e.shift();
return function(){
return _d.apply(_f,_e.concat($A(arguments)));
};
};
Function.prototype.bindAsEventListener=function(_10){
var _11=this,_12=$A(arguments),_10=_12.shift();
return function(_13){
return _11.apply(_10,[(_13||window.event)].concat(_12).concat($A(arguments)));
};
};
Object.extend(Number.prototype,{toColorPart:function(){
var _14=this.toString(16);
if(this<16){
return "0"+_14;
}
return _14;
},succ:function(){
return this+1;
},times:function(_15){
$R(0,this,true).each(_15);
return this;
}});
var Try={these:function(){
var _16;
for(var i=0,_18=arguments.length;i<_18;i++){
var _19=arguments[i];
try{
_16=_19();
break;
}
catch(e){
}
}
return _16;
}};
var PeriodicalExecuter=Class.create();
PeriodicalExecuter.prototype={initialize:function(_1a,_1b){
this.callback=_1a;
this.frequency=_1b;
this.currentlyExecuting=false;
this.registerCallback();
},registerCallback:function(){
this.timer=setInterval(this.onTimerEvent.bind(this),this.frequency*1000);
},stop:function(){
if(!this.timer){
return;
}
clearInterval(this.timer);
this.timer=null;
},onTimerEvent:function(){
if(!this.currentlyExecuting){
try{
this.currentlyExecuting=true;
this.callback(this);
}
finally{
this.currentlyExecuting=false;
}
}
}};
String.interpret=function(_1c){
return _1c==null?"":String(_1c);
};
Object.extend(String.prototype,{gsub:function(_1d,_1e){
var _1f="",_20=this,_21;
_1e=arguments.callee.prepareReplacement(_1e);
while(_20.length>0){
if(_21=_20.match(_1d)){
_1f+=_20.slice(0,_21.index);
_1f+=String.interpret(_1e(_21));
_20=_20.slice(_21.index+_21[0].length);
}else{
_1f+=_20,_20="";
}
}
return _1f;
},sub:function(_22,_23,_24){
_23=this.gsub.prepareReplacement(_23);
_24=_24===undefined?1:_24;
return this.gsub(_22,function(_25){
if(--_24<0){
return _25[0];
}
return _23(_25);
});
},scan:function(_26,_27){
this.gsub(_26,_27);
return this;
},truncate:function(_28,_29){
_28=_28||30;
_29=_29===undefined?"...":_29;
return this.length>_28?this.slice(0,_28-_29.length)+_29:this;
},strip:function(){
return this.replace(/^\s+/,"").replace(/\s+$/,"");
},stripTags:function(){
return this.replace(/<\/?[^>]+>/gi,"");
},stripScripts:function(){
return this.replace(new RegExp(Prototype.ScriptFragment,"img"),"");
},extractScripts:function(){
var _2a=new RegExp(Prototype.ScriptFragment,"img");
var _2b=new RegExp(Prototype.ScriptFragment,"im");
return (this.match(_2a)||[]).map(function(_2c){
return (_2c.match(_2b)||["",""])[1];
});
},evalScripts:function(){
return this.extractScripts().map(function(_2d){
return eval(_2d);
});
},escapeHTML:function(){
var div=document.createElement("div");
var _2f=document.createTextNode(this);
div.appendChild(_2f);
return div.innerHTML;
},unescapeHTML:function(){
var div=document.createElement("div");
div.innerHTML=this.stripTags();
return div.childNodes[0]?(div.childNodes.length>1?$A(div.childNodes).inject("",function(_31,_32){
return _31+_32.nodeValue;
}):div.childNodes[0].nodeValue):"";
},toQueryParams:function(_33){
var _34=this.strip().match(/([^?#]*)(#.*)?$/);
if(!_34){
return {};
}
return _34[1].split(_33||"&").inject({},function(_35,_36){
if((_36=_36.split("="))[0]){
var _37=decodeURIComponent(_36[0]);
var _38=_36[1]?decodeURIComponent(_36[1]):undefined;
if(_35[_37]!==undefined){
if(_35[_37].constructor!=Array){
_35[_37]=[_35[_37]];
}
if(_38){
_35[_37].push(_38);
}
}else{
_35[_37]=_38;
}
}
return _35;
});
},toArray:function(){
return this.split("");
},succ:function(){
return this.slice(0,this.length-1)+String.fromCharCode(this.charCodeAt(this.length-1)+1);
},camelize:function(){
var _39=this.split("-"),len=_39.length;
if(len==1){
return _39[0];
}
var _3b=this.charAt(0)=="-"?_39[0].charAt(0).toUpperCase()+_39[0].substring(1):_39[0];
for(var i=1;i<len;i++){
_3b+=_39[i].charAt(0).toUpperCase()+_39[i].substring(1);
}
return _3b;
},capitalize:function(){
return this.charAt(0).toUpperCase()+this.substring(1).toLowerCase();
},underscore:function(){
return this.gsub(/::/,"/").gsub(/([A-Z]+)([A-Z][a-z])/,"#{1}_#{2}").gsub(/([a-z\d])([A-Z])/,"#{1}_#{2}").gsub(/-/,"_").toLowerCase();
},dasherize:function(){
return this.gsub(/_/,"-");
},inspect:function(_3d){
var _3e=this.replace(/\\/g,"\\\\");
if(_3d){
return "\""+_3e.replace(/"/g,"\\\"")+"\"";
}else{
return "'"+_3e.replace(/'/g,"\\'")+"'";
}
}});
String.prototype.gsub.prepareReplacement=function(_3f){
if(typeof _3f=="function"){
return _3f;
}
var _40=new Template(_3f);
return function(_41){
return _40.evaluate(_41);
};
};
String.prototype.parseQuery=String.prototype.toQueryParams;
var Template=Class.create();
Template.Pattern=/(^|.|\r|\n)(#\{(.*?)\})/;
Template.prototype={initialize:function(_42,_43){
this.template=_42.toString();
this.pattern=_43||Template.Pattern;
},evaluate:function(_44){
return this.template.gsub(this.pattern,function(_45){
var _46=_45[1];
if(_46=="\\"){
return _45[2];
}
return _46+String.interpret(_44[_45[3]]);
});
}};
var $break=new Object();
var $continue=new Object();
var Enumerable={each:function(_47){
var _48=0;
try{
this._each(function(_49){
try{
_47(_49,_48++);
}
catch(e){
if(e!=$continue){
throw e;
}
}
});
}
catch(e){
if(e!=$break){
throw e;
}
}
return this;
},eachSlice:function(_4a,_4b){
var _4c=-_4a,_4d=[],_4e=this.toArray();
while((_4c+=_4a)<_4e.length){
_4d.push(_4e.slice(_4c,_4c+_4a));
}
return _4d.map(_4b);
},all:function(_4f){
var _50=true;
this.each(function(_51,_52){
_50=_50&&!!(_4f||Prototype.K)(_51,_52);
if(!_50){
throw $break;
}
});
return _50;
},any:function(_53){
var _54=false;
this.each(function(_55,_56){
if(_54=!!(_53||Prototype.K)(_55,_56)){
throw $break;
}
});
return _54;
},collect:function(_57){
var _58=[];
this.each(function(_59,_5a){
_58.push((_57||Prototype.K)(_59,_5a));
});
return _58;
},detect:function(_5b){
var _5c;
this.each(function(_5d,_5e){
if(_5b(_5d,_5e)){
_5c=_5d;
throw $break;
}
});
return _5c;
},findAll:function(_5f){
var _60=[];
this.each(function(_61,_62){
if(_5f(_61,_62)){
_60.push(_61);
}
});
return _60;
},grep:function(_63,_64){
var _65=[];
this.each(function(_66,_67){
var _68=_66.toString();
if(_68.match(_63)){
_65.push((_64||Prototype.K)(_66,_67));
}
});
return _65;
},include:function(_69){
var _6a=false;
this.each(function(_6b){
if(_6b==_69){
_6a=true;
throw $break;
}
});
return _6a;
},inGroupsOf:function(_6c,_6d){
_6d=_6d===undefined?null:_6d;
return this.eachSlice(_6c,function(_6e){
while(_6e.length<_6c){
_6e.push(_6d);
}
return _6e;
});
},inject:function(_6f,_70){
this.each(function(_71,_72){
_6f=_70(_6f,_71,_72);
});
return _6f;
},invoke:function(_73){
var _74=$A(arguments).slice(1);
return this.map(function(_75){
return _75[_73].apply(_75,_74);
});
},max:function(_76){
var _77;
this.each(function(_78,_79){
_78=(_76||Prototype.K)(_78,_79);
if(_77==undefined||_78>=_77){
_77=_78;
}
});
return _77;
},min:function(_7a){
var _7b;
this.each(function(_7c,_7d){
_7c=(_7a||Prototype.K)(_7c,_7d);
if(_7b==undefined||_7c<_7b){
_7b=_7c;
}
});
return _7b;
},partition:function(_7e){
var _7f=[],_80=[];
this.each(function(_81,_82){
((_7e||Prototype.K)(_81,_82)?_7f:_80).push(_81);
});
return [_7f,_80];
},pluck:function(_83){
var _84=[];
this.each(function(_85,_86){
_84.push(_85[_83]);
});
return _84;
},reject:function(_87){
var _88=[];
this.each(function(_89,_8a){
if(!_87(_89,_8a)){
_88.push(_89);
}
});
return _88;
},sortBy:function(_8b){
return this.map(function(_8c,_8d){
return {value:_8c,criteria:_8b(_8c,_8d)};
}).sort(function(_8e,_8f){
var a=_8e.criteria,b=_8f.criteria;
return a<b?-1:a>b?1:0;
}).pluck("value");
},toArray:function(){
return this.map();
},zip:function(){
var _92=Prototype.K,_93=$A(arguments);
if(typeof _93.last()=="function"){
_92=_93.pop();
}
var _94=[this].concat(_93).map($A);
return this.map(function(_95,_96){
return _92(_94.pluck(_96));
});
},size:function(){
return this.toArray().length;
},inspect:function(){
return "#<Enumerable:"+this.toArray().inspect()+">";
}};
Object.extend(Enumerable,{map:Enumerable.collect,find:Enumerable.detect,select:Enumerable.findAll,member:Enumerable.include,entries:Enumerable.toArray});
var $A=Array.from=function(_97){
if(!_97){
return [];
}
if(_97.toArray){
return _97.toArray();
}else{
var _98=[];
for(var i=0,_9a=_97.length;i<_9a;i++){
_98.push(_97[i]);
}
return _98;
}
};
Object.extend(Array.prototype,Enumerable);
if(!Array.prototype._reverse){
Array.prototype._reverse=Array.prototype.reverse;
}
Object.extend(Array.prototype,{_each:function(_9b){
for(var i=0,_9d=this.length;i<_9d;i++){
_9b(this[i]);
}
},clear:function(){
this.length=0;
return this;
},first:function(){
return this[0];
},last:function(){
return this[this.length-1];
},compact:function(){
return this.select(function(_9e){
return _9e!=null;
});
},flatten:function(){
return this.inject([],function(_9f,_a0){
return _9f.concat(_a0&&_a0.constructor==Array?_a0.flatten():[_a0]);
});
},without:function(){
var _a1=$A(arguments);
return this.select(function(_a2){
return !_a1.include(_a2);
});
},indexOf:function(_a3){
for(var i=0,_a5=this.length;i<_a5;i++){
if(this[i]==_a3){
return i;
}
}
return -1;
},reverse:function(_a6){
return (_a6!==false?this:this.toArray())._reverse();
},reduce:function(){
return this.length>1?this:this[0];
},uniq:function(){
return this.inject([],function(_a7,_a8){
return _a7.include(_a8)?_a7:_a7.concat([_a8]);
});
},clone:function(){
return [].concat(this);
},size:function(){
return this.length;
},inspect:function(){
return "["+this.map(Object.inspect).join(", ")+"]";
}});
Array.prototype.toArray=Array.prototype.clone;
function $w(_a9){
_a9=_a9.strip();
return _a9?_a9.split(/\s+/):[];
};
if(window.opera){
Array.prototype.concat=function(){
var _aa=[];
for(var i=0,_ac=this.length;i<_ac;i++){
_aa.push(this[i]);
}
for(var i=0,_ac=arguments.length;i<_ac;i++){
if(arguments[i].constructor==Array){
for(var j=0,_ae=arguments[i].length;j<_ae;j++){
_aa.push(arguments[i][j]);
}
}else{
_aa.push(arguments[i]);
}
}
return _aa;
};
}
Prototype.Hash=function(obj){
Object.extend(this,obj||{});
};
Object.extend(Prototype.Hash,{toQueryString:function(obj){
var _b1=[];
this.prototype._each.call(obj,function(_b2){
if(!_b2.key){
return;
}
if(_b2.value&&_b2.value.constructor==Array){
var _b3=_b2.value.compact();
if(_b3.length<2){
_b2.value=_b3.reduce();
}else{
key=encodeURIComponent(_b2.key);
_b3.each(function(_b4){
_b4=_b4!=undefined?encodeURIComponent(_b4):"";
_b1.push(key+"="+encodeURIComponent(_b4));
});
return;
}
}
if(_b2.value==undefined){
_b2[1]="";
}
_b1.push(_b2.map(encodeURIComponent).join("="));
});
return _b1.join("&");
}});
Object.extend(Prototype.Hash.prototype,Enumerable);
Object.extend(Prototype.Hash.prototype,{_each:function(_b5){
for(var key in this){
var _b7=this[key];
if(_b7&&_b7==Prototype.Hash.prototype[key]){
continue;
}
var _b8=[key,_b7];
_b8.key=key;
_b8.value=_b7;
_b5(_b8);
}
},keys:function(){
return this.pluck("key");
},values:function(){
return this.pluck("value");
},merge:function(_b9){
return $H(_b9).inject(this,function(_ba,_bb){
_ba[_bb.key]=_bb.value;
return _ba;
});
},remove:function(){
var _bc;
for(var i=0,_be=arguments.length;i<_be;i++){
var _bf=this[arguments[i]];
if(_bf!==undefined){
if(_bc===undefined){
_bc=_bf;
}else{
if(_bc.constructor!=Array){
_bc=[_bc];
}
_bc.push(_bf);
}
}
delete this[arguments[i]];
}
return _bc;
},toQueryString:function(){
return Prototype.Hash.toQueryString(this);
},inspect:function(){
return "#<Prototype.Hash:{"+this.map(function(_c0){
return _c0.map(Object.inspect).join(": ");
}).join(", ")+"}>";
}});
function $H(_c1){
if(_c1&&_c1.constructor==Prototype.Hash){
return _c1;
}
return new Prototype.Hash(_c1);
};
ObjectRange=Class.create();
Object.extend(ObjectRange.prototype,Enumerable);
Object.extend(ObjectRange.prototype,{initialize:function(_c2,end,_c4){
this.start=_c2;
this.end=end;
this.exclusive=_c4;
},_each:function(_c5){
var _c6=this.start;
while(this.include(_c6)){
_c5(_c6);
_c6=_c6.succ();
}
},include:function(_c7){
if(_c7<this.start){
return false;
}
if(this.exclusive){
return _c7<this.end;
}
return _c7<=this.end;
}});
var $R=function(_c8,end,_ca){
return new ObjectRange(_c8,end,_ca);
};
var Ajax={getTransport:function(){
return Try.these(function(){
return new XMLHttpRequest();
},function(){
return new ActiveXObject("Msxml2.XMLHTTP");
},function(){
return new ActiveXObject("Microsoft.XMLHTTP");
})||false;
},activeRequestCount:0};
Ajax.Responders={responders:[],_each:function(_cb){
this.responders._each(_cb);
},register:function(_cc){
if(!this.include(_cc)){
this.responders.push(_cc);
}
},unregister:function(_cd){
this.responders=this.responders.without(_cd);
},dispatch:function(_ce,_cf,_d0,_d1){
this.each(function(_d2){
if(typeof _d2[_ce]=="function"){
try{
_d2[_ce].apply(_d2,[_cf,_d0,_d1]);
}
catch(e){
}
}
});
}};
Object.extend(Ajax.Responders,Enumerable);
Ajax.Responders.register({onCreate:function(){
Ajax.activeRequestCount++;
},onComplete:function(){
Ajax.activeRequestCount--;
}});
Ajax.Base=function(){
};
Ajax.Base.prototype={setOptions:function(_d3){
this.options={method:"post",asynchronous:true,contentType:"application/x-www-form-urlencoded",encoding:"UTF-8",parameters:""};
Object.extend(this.options,_d3||{});
this.options.method=this.options.method.toLowerCase();
if(typeof this.options.parameters=="string"){
this.options.parameters=this.options.parameters.toQueryParams();
}
}};
Ajax.Request=Class.create();
Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"];
Ajax.Request.prototype=Object.extend(new Ajax.Base(),{_complete:false,initialize:function(url,_d5){
this.transport=Ajax.getTransport();
this.setOptions(_d5);
this.request(url);
},request:function(url){
this.url=url;
this.method=this.options.method;
var _d7=this.options.parameters;
if(!["get","post"].include(this.method)){
_d7["_method"]=this.method;
this.method="post";
}
_d7=Prototype.Hash.toQueryString(_d7);
if(_d7&&/Konqueror|Safari|KHTML/.test(navigator.userAgent)){
_d7+="&_=";
}
if(this.method=="get"&&_d7){
this.url+=(this.url.indexOf("?")>-1?"&":"?")+_d7;
}
try{
Ajax.Responders.dispatch("onCreate",this,this.transport);
this.transport.open(this.method.toUpperCase(),this.url,this.options.asynchronous);
if(this.options.asynchronous){
setTimeout(function(){
this.respondToReadyState(1);
}.bind(this),10);
}
this.transport.onreadystatechange=this.onStateChange.bind(this);
this.setRequestHeaders();
var _d8=this.method=="post"?(this.options.postBody||_d7):null;
this.transport.send(_d8);
if(!this.options.asynchronous&&this.transport.overrideMimeType){
this.onStateChange();
}
}
catch(e){
this.dispatchException(e);
}
},onStateChange:function(){
var _d9=this.transport.readyState;
if(_d9>1&&!((_d9==4)&&this._complete)){
this.respondToReadyState(this.transport.readyState);
}
},setRequestHeaders:function(){
var _da={"X-Requested-With":"XMLHttpRequest","X-Prototype-Version":Prototype.Version,"Accept":"text/javascript, text/html, application/xml, text/xml, */*"};
if(this.method=="post"){
_da["Content-type"]=this.options.contentType+(this.options.encoding?"; charset="+this.options.encoding:"");
if(this.transport.overrideMimeType&&(navigator.userAgent.match(/Gecko\/(\d{4})/)||[0,2005])[1]<2005){
_da["Connection"]="close";
}
}
if(typeof this.options.requestHeaders=="object"){
var _db=this.options.requestHeaders;
if(typeof _db.push=="function"){
for(var i=0,_dd=_db.length;i<_dd;i+=2){
_da[_db[i]]=_db[i+1];
}
}else{
$H(_db).each(function(_de){
_da[_de.key]=_de.value;
});
}
}
for(var _df in _da){
this.transport.setRequestHeader(_df,_da[_df]);
}
},success:function(){
return !this.transport.status||(this.transport.status>=200&&this.transport.status<300);
},respondToReadyState:function(_e0){
var _e1=Ajax.Request.Events[_e0];
var _e2=this.transport,_e3=this.evalJSON();
if(_e1=="Complete"){
try{
this._complete=true;
(this.options["on"+this.transport.status]||this.options["on"+(this.success()?"Success":"Failure")]||Prototype.emptyFunction)(_e2,_e3);
}
catch(e){
this.dispatchException(e);
}
if((this.getHeader("Content-type")||"text/javascript").strip().match(/^(text|application)\/(x-)?(java|ecma)script(;.*)?$/i)){
this.evalResponse();
}
}
try{
(this.options["on"+_e1]||Prototype.emptyFunction)(_e2,_e3);
Ajax.Responders.dispatch("on"+_e1,this,_e2,_e3);
}
catch(e){
this.dispatchException(e);
}
if(_e1=="Complete"){
this.transport.onreadystatechange=Prototype.emptyFunction;
}
},getHeader:function(_e4){
try{
return this.transport.getResponseHeader(_e4);
}
catch(e){
return null;
}
},evalJSON:function(){
try{
var _e5=this.getHeader("X-JSON");
return _e5?eval("("+_e5+")"):null;
}
catch(e){
return null;
}
},evalResponse:function(){
try{
return eval(this.transport.responseText);
}
catch(e){
this.dispatchException(e);
}
},dispatchException:function(_e6){
(this.options.onException||Prototype.emptyFunction)(this,_e6);
Ajax.Responders.dispatch("onException",this,_e6);
}});
Ajax.Updater=Class.create();
Object.extend(Object.extend(Ajax.Updater.prototype,Ajax.Request.prototype),{initialize:function(_e7,url,_e9){
this.container={success:(_e7.success||_e7),failure:(_e7.failure||(_e7.success?null:_e7))};
this.transport=Ajax.getTransport();
this.setOptions(_e9);
var _ea=this.options.onComplete||Prototype.emptyFunction;
this.options.onComplete=(function(_eb,_ec){
this.updateContent();
_ea(_eb,_ec);
}).bind(this);
this.request(url);
},updateContent:function(){
var _ed=this.container[this.success()?"success":"failure"];
var _ee=this.transport.responseText;
if(!this.options.evalScripts){
_ee=_ee.stripScripts();
}
if(_ed=$(_ed)){
if(this.options.insertion){
new this.options.insertion(_ed,_ee);
}else{
_ed.update(_ee);
}
}
if(this.success()){
if(this.onComplete){
setTimeout(this.onComplete.bind(this),10);
}
}
}});
Ajax.PeriodicalUpdater=Class.create();
Ajax.PeriodicalUpdater.prototype=Object.extend(new Ajax.Base(),{initialize:function(_ef,url,_f1){
this.setOptions(_f1);
this.onComplete=this.options.onComplete;
this.frequency=(this.options.frequency||2);
this.decay=(this.options.decay||1);
this.updater={};
this.container=_ef;
this.url=url;
this.start();
},start:function(){
this.options.onComplete=this.updateComplete.bind(this);
this.onTimerEvent();
},stop:function(){
this.updater.options.onComplete=undefined;
clearTimeout(this.timer);
(this.onComplete||Prototype.emptyFunction).apply(this,arguments);
},updateComplete:function(_f2){
if(this.options.decay){
this.decay=(_f2.responseText==this.lastText?this.decay*this.options.decay:1);
this.lastText=_f2.responseText;
}
this.timer=setTimeout(this.onTimerEvent.bind(this),this.decay*this.frequency*1000);
},onTimerEvent:function(){
this.updater=new Ajax.Updater(this.container,this.url,this.options);
}});
function $(_f3){
if(arguments.length>1){
for(var i=0,_f5=[],_f6=arguments.length;i<_f6;i++){
_f5.push($(arguments[i]));
}
return _f5;
}
if(typeof _f3=="string"){
_f3=document.getElementById(_f3);
}
return Element.extend(_f3);
};
if(Prototype.BrowserFeatures.XPath){
document._getElementsByXPath=function(_f7,_f8){
var _f9=[];
var _fa=document.evaluate(_f7,$(_f8)||document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);
for(var i=0,_fc=_fa.snapshotLength;i<_fc;i++){
_f9.push(_fa.snapshotItem(i));
}
return _f9;
};
}
document.getElementsByClassName=function(_fd,_fe){
if(Prototype.BrowserFeatures.XPath){
var q=".//*[contains(concat(' ', @class, ' '), ' "+_fd+" ')]";
return document._getElementsByXPath(q,_fe);
}else{
var _100=($(_fe)||document.body).getElementsByTagName("*");
var _101=[],_102;
for(var i=0,_104=_100.length;i<_104;i++){
_102=_100[i];
if(Element.hasClassName(_102,_fd)){
_101.push(Element.extend(_102));
}
}
return _101;
}
};
if(!window.Element){
var Element=new Object();
}
Element.extend=function(_105){
if(!_105||_nativeExtensions||_105.nodeType==3){
return _105;
}
if(!_105._extended&&_105.tagName&&_105!=window){
var _106=Object.clone(Element.Methods),_107=Element.extend.cache;
if(_105.tagName=="FORM"){
Object.extend(_106,Form.Methods);
}
if(["INPUT","TEXTAREA","SELECT"].include(_105.tagName)){
Object.extend(_106,Form.Element.Methods);
}
Object.extend(_106,Element.Methods.Simulated);
for(var _108 in _106){
var _109=_106[_108];
if(typeof _109=="function"&&!(_108 in _105)){
_105[_108]=_107.findOrStore(_109);
}
}
}
_105._extended=true;
return _105;
};
Element.extend.cache={findOrStore:function(_10a){
return this[_10a]=this[_10a]||function(){
return _10a.apply(null,[this].concat($A(arguments)));
};
}};
Element.Methods={visible:function(_10b){
return $(_10b).style.display!="none";
},toggle:function(_10c){
_10c=$(_10c);
Element[Element.visible(_10c)?"hide":"show"](_10c);
return _10c;
},hide:function(_10d){
$(_10d).style.display="none";
return _10d;
},show:function(_10e){
$(_10e).style.display="";
return _10e;
},remove:function(_10f){
_10f=$(_10f);
_10f.parentNode.removeChild(_10f);
return _10f;
},update:function(_110,html){
html=typeof html=="undefined"?"":html.toString();
$(_110).innerHTML=html.stripScripts();
setTimeout(function(){
html.evalScripts();
},10);
return _110;
},replace:function(_112,html){
_112=$(_112);
html=typeof html=="undefined"?"":html.toString();
if(_112.outerHTML){
_112.outerHTML=html.stripScripts();
}else{
var _114=_112.ownerDocument.createRange();
_114.selectNodeContents(_112);
_112.parentNode.replaceChild(_114.createContextualFragment(html.stripScripts()),_112);
}
setTimeout(function(){
html.evalScripts();
},10);
return _112;
},inspect:function(_115){
_115=$(_115);
var _116="<"+_115.tagName.toLowerCase();
$H({"id":"id","className":"class"}).each(function(pair){
var _118=pair.first(),_119=pair.last();
var _11a=(_115[_118]||"").toString();
if(_11a){
_116+=" "+_119+"="+_11a.inspect(true);
}
});
return _116+">";
},recursivelyCollect:function(_11b,_11c){
_11b=$(_11b);
var _11d=[];
while(_11b=_11b[_11c]){
if(_11b.nodeType==1){
_11d.push(Element.extend(_11b));
}
}
return _11d;
},ancestors:function(_11e){
return $(_11e).recursivelyCollect("parentNode");
},descendants:function(_11f){
return $A($(_11f).getElementsByTagName("*"));
},immediateDescendants:function(_120){
if(!(_120=$(_120).firstChild)){
return [];
}
while(_120&&_120.nodeType!=1){
_120=_120.nextSibling;
}
if(_120){
return [_120].concat($(_120).nextSiblings());
}
return [];
},previousSiblings:function(_121){
return $(_121).recursivelyCollect("previousSibling");
},nextSiblings:function(_122){
return $(_122).recursivelyCollect("nextSibling");
},siblings:function(_123){
_123=$(_123);
return _123.previousSiblings().reverse().concat(_123.nextSiblings());
},match:function(_124,_125){
if(typeof _125=="string"){
_125=new Selector(_125);
}
return _125.match($(_124));
},up:function(_126,_127,_128){
return Selector.findElement($(_126).ancestors(),_127,_128);
},down:function(_129,_12a,_12b){
return Selector.findElement($(_129).descendants(),_12a,_12b);
},previous:function(_12c,_12d,_12e){
return Selector.findElement($(_12c).previousSiblings(),_12d,_12e);
},next:function(_12f,_130,_131){
return Selector.findElement($(_12f).nextSiblings(),_130,_131);
},getElementsBySelector:function(){
var args=$A(arguments),_133=$(args.shift());
return Selector.findChildElements(_133,args);
},getElementsByClassName:function(_134,_135){
return document.getElementsByClassName(_135,_134);
},readAttribute:function(_136,name){
_136=$(_136);
if(document.all&&!window.opera){
var t=Element._attributeTranslations;
if(t.values[name]){
return t.values[name](_136,name);
}
if(t.names[name]){
name=t.names[name];
}
var _139=_136.attributes[name];
if(_139){
return _139.nodeValue;
}
}
return _136.getAttribute(name);
},getHeight:function(_13a){
try{
return $(_13a).getDimensions().height;
}
catch(e){
return 1;
}
},getWidth:function(_13b){
return $(_13b).getDimensions().width;
},classNames:function(_13c){
return new Element.ClassNames(_13c);
},hasClassName:function(_13d,_13e){
if(!(_13d=$(_13d))){
return;
}
var _13f=_13d.className;
if(_13f.length==0){
return false;
}
if(_13f==_13e||_13f.match(new RegExp("(^|\\s)"+_13e+"(\\s|$)"))){
return true;
}
return false;
},addClassName:function(_140,_141){
if(!(_140=$(_140))){
return;
}
Element.classNames(_140).add(_141);
return _140;
},removeClassName:function(_142,_143){
if(!(_142=$(_142))){
return;
}
Element.classNames(_142).remove(_143);
return _142;
},toggleClassName:function(_144,_145){
if(!(_144=$(_144))){
return;
}
Element.classNames(_144)[_144.hasClassName(_145)?"remove":"add"](_145);
return _144;
},observe:function(){
Event.observe.apply(Event,arguments);
return $A(arguments).first();
},stopObserving:function(){
Event.stopObserving.apply(Event,arguments);
return $A(arguments).first();
},cleanWhitespace:function(_146){
_146=$(_146);
var node=_146.firstChild;
while(node){
var _148=node.nextSibling;
if(node.nodeType==3&&!/\S/.test(node.nodeValue)){
_146.removeChild(node);
}
node=_148;
}
return _146;
},empty:function(_149){
return $(_149).innerHTML.match(/^\s*$/);
},descendantOf:function(_14a,_14b){
_14a=$(_14a),_14b=$(_14b);
while(_14a=_14a.parentNode){
if(_14a==_14b){
return true;
}
}
return false;
},scrollTo:function(_14c){
_14c=$(_14c);
var pos=Position.cumulativeOffset(_14c);
window.scrollTo(pos[0],pos[1]);
return _14c;
},getStyle:function(_14e,_14f){
_14e=$(_14e);
if(["float","cssFloat"].include(_14f)){
_14f=(typeof _14e.style.styleFloat!="undefined"?"styleFloat":"cssFloat");
}
_14f=_14f.camelize();
var _150=_14e.style[_14f];
if(!_150){
if(document.defaultView&&document.defaultView.getComputedStyle){
var css=document.defaultView.getComputedStyle(_14e,null);
_150=css?css[_14f]:null;
}else{
if(_14e.currentStyle){
_150=_14e.currentStyle[_14f];
}
}
}
if((_150=="auto")&&["width","height"].include(_14f)&&(_14e.getStyle("display")!="none")){
_150=_14e["offset"+_14f.capitalize()]+"px";
}
if(window.opera&&["left","top","right","bottom"].include(_14f)){
if(Element.getStyle(_14e,"position")=="static"){
_150="auto";
}
}
if(_14f=="opacity"){
if(_150){
return parseFloat(_150);
}
if(_150=(_14e.getStyle("filter")||"").match(/alpha\(opacity=(.*)\)/)){
if(_150[1]){
return parseFloat(_150[1])/100;
}
}
return 1;
}
return _150=="auto"?null:_150;
},setStyle:function(_152,_153){
_152=$(_152);
for(var name in _153){
var _155=_153[name];
if(name=="opacity"){
if(_155==1){
_155=(/Gecko/.test(navigator.userAgent)&&!/Konqueror|Safari|KHTML/.test(navigator.userAgent))?0.999999:1;
if(/MSIE/.test(navigator.userAgent)&&!window.opera){
_152.style.filter=_152.getStyle("filter").replace(/alpha\([^\)]*\)/gi,"");
}
}else{
if(_155==""){
if(/MSIE/.test(navigator.userAgent)&&!window.opera){
_152.style.filter=_152.getStyle("filter").replace(/alpha\([^\)]*\)/gi,"");
}
}else{
if(_155<0.00001){
_155=0;
}
if(/MSIE/.test(navigator.userAgent)&&!window.opera){
_152.style.filter=_152.getStyle("filter").replace(/alpha\([^\)]*\)/gi,"")+"alpha(opacity="+_155*100+")";
}
}
}
}else{
if(["float","cssFloat"].include(name)){
name=(typeof _152.style.styleFloat!="undefined")?"styleFloat":"cssFloat";
}
}
_152.style[name.camelize()]=_155;
}
return _152;
},getDimensions:function(_156){
_156=$(_156);
var _157=$(_156).getStyle("display");
if(_157!="none"&&_157!=null){
return {width:_156.offsetWidth,height:_156.offsetHeight};
}
var els=_156.style;
var _159=els.visibility;
var _15a=els.position;
var _15b=els.display;
els.visibility="hidden";
els.position="absolute";
els.display="block";
var _15c=_156.clientWidth;
var _15d=_156.clientHeight;
els.display=_15b;
els.position=_15a;
els.visibility=_159;
return {width:_15c,height:_15d};
},makePositioned:function(_15e){
_15e=$(_15e);
var pos=Element.getStyle(_15e,"position");
if(pos=="static"||!pos){
_15e._madePositioned=true;
_15e.style.position="relative";
if(window.opera){
_15e.style.top=0;
_15e.style.left=0;
}
}
return _15e;
},undoPositioned:function(_160){
_160=$(_160);
if(_160._madePositioned){
_160._madePositioned=undefined;
_160.style.position=_160.style.top=_160.style.left=_160.style.bottom=_160.style.right="";
}
return _160;
},makeClipping:function(_161){
_161=$(_161);
if(_161._overflow){
return _161;
}
_161._overflow=_161.style.overflow||"auto";
if((Element.getStyle(_161,"overflow")||"visible")!="hidden"){
_161.style.overflow="hidden";
}
return _161;
},undoClipping:function(_162){
_162=$(_162);
if(!_162._overflow){
return _162;
}
_162.style.overflow=_162._overflow=="auto"?"":_162._overflow;
_162._overflow=null;
return _162;
}};
Object.extend(Element.Methods,{childOf:Element.Methods.descendantOf});
Element._attributeTranslations={};
Element._attributeTranslations.names={colspan:"colSpan",rowspan:"rowSpan",valign:"vAlign",datetime:"dateTime",accesskey:"accessKey",tabindex:"tabIndex",enctype:"encType",maxlength:"maxLength",readonly:"readOnly",longdesc:"longDesc"};
Element._attributeTranslations.values={_getAttr:function(_163,_164){
return _163.getAttribute(_164,2);
},_flag:function(_165,_166){
return $(_165).hasAttribute(_166)?_166:null;
},style:function(_167){
return _167.style.cssText.toLowerCase();
},title:function(_168){
var node=_168.getAttributeNode("title");
return node.specified?node.nodeValue:null;
}};
Object.extend(Element._attributeTranslations.values,{href:Element._attributeTranslations.values._getAttr,src:Element._attributeTranslations.values._getAttr,disabled:Element._attributeTranslations.values._flag,checked:Element._attributeTranslations.values._flag,readonly:Element._attributeTranslations.values._flag,multiple:Element._attributeTranslations.values._flag});
Element.Methods.Simulated={hasAttribute:function(_16a,_16b){
var t=Element._attributeTranslations;
_16b=t.names[_16b]||_16b;
return $(_16a).getAttributeNode(_16b).specified;
}};
if(document.all&&!window.opera){
Element.Methods.update=function(_16d,html){
_16d=$(_16d);
html=typeof html=="undefined"?"":html.toString();
var _16f=_16d.tagName.toUpperCase();
if(["THEAD","TBODY","TR","TD"].include(_16f)){
var div=document.createElement("div");
switch(_16f){
case "THEAD":
case "TBODY":
div.innerHTML="<table><tbody>"+html.stripScripts()+"</tbody></table>";
depth=2;
break;
case "TR":
div.innerHTML="<table><tbody><tr>"+html.stripScripts()+"</tr></tbody></table>";
depth=3;
break;
case "TD":
div.innerHTML="<table><tbody><tr><td>"+html.stripScripts()+"</td></tr></tbody></table>";
depth=4;
}
$A(_16d.childNodes).each(function(node){
_16d.removeChild(node);
});
depth.times(function(){
div=div.firstChild;
});
$A(div.childNodes).each(function(node){
_16d.appendChild(node);
});
}else{
_16d.innerHTML=html.stripScripts();
}
setTimeout(function(){
html.evalScripts();
},10);
return _16d;
};
}
Object.extend(Element,Element.Methods);
var _nativeExtensions=false;
if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){
["","Form","Input","TextArea","Select"].each(function(tag){
var _174="HTML"+tag+"Element";
if(window[_174]){
return;
}
var _175=window[_174]={};
_175.prototype=document.createElement(tag?tag.toLowerCase():"div").__proto__;
});
}
Element.addMethods=function(_176){
Object.extend(Element.Methods,_176||{});
function copy(_177,_178,_179){
_179=_179||false;
var _17a=Element.extend.cache;
for(var _17b in _177){
var _17c=_177[_17b];
if(!_179||!(_17b in _178)){
_178[_17b]=_17a.findOrStore(_17c);
}
}
};
if(typeof HTMLElement!="undefined"){
copy(Element.Methods,HTMLElement.prototype);
copy(Element.Methods.Simulated,HTMLElement.prototype,true);
copy(Form.Methods,HTMLFormElement.prototype);
[HTMLInputElement,HTMLTextAreaElement,HTMLSelectElement].each(function(_17d){
copy(Form.Element.Methods,_17d.prototype);
});
_nativeExtensions=true;
}
};
var Toggle=new Object();
Toggle.display=Element.toggle;
Abstract.Insertion=function(_17e){
this.adjacency=_17e;
};
Abstract.Insertion.prototype={initialize:function(_17f,_180){
this.element=$(_17f);
this.content=_180.stripScripts();
if(this.adjacency&&this.element.insertAdjacentHTML){
try{
this.element.insertAdjacentHTML(this.adjacency,this.content);
}
catch(e){
var _181=this.element.tagName.toUpperCase();
if(["TBODY","TR"].include(_181)){
this.insertContent(this.contentFromAnonymousTable());
}else{
throw e;
}
}
}else{
this.range=this.element.ownerDocument.createRange();
if(this.initializeRange){
this.initializeRange();
}
this.insertContent([this.range.createContextualFragment(this.content)]);
}
setTimeout(function(){
_180.evalScripts();
},10);
},contentFromAnonymousTable:function(){
var div=document.createElement("div");
div.innerHTML="<table><tbody>"+this.content+"</tbody></table>";
return $A(div.childNodes[0].childNodes[0].childNodes);
}};
var Insertion=new Object();
Insertion.Before=Class.create();
Insertion.Before.prototype=Object.extend(new Abstract.Insertion("beforeBegin"),{initializeRange:function(){
this.range.setStartBefore(this.element);
},insertContent:function(_183){
_183.each((function(_184){
this.element.parentNode.insertBefore(_184,this.element);
}).bind(this));
}});
Insertion.Top=Class.create();
Insertion.Top.prototype=Object.extend(new Abstract.Insertion("afterBegin"),{initializeRange:function(){
this.range.selectNodeContents(this.element);
this.range.collapse(true);
},insertContent:function(_185){
_185.reverse(false).each((function(_186){
this.element.insertBefore(_186,this.element.firstChild);
}).bind(this));
}});
Insertion.Bottom=Class.create();
Insertion.Bottom.prototype=Object.extend(new Abstract.Insertion("beforeEnd"),{initializeRange:function(){
this.range.selectNodeContents(this.element);
this.range.collapse(this.element);
},insertContent:function(_187){
_187.each((function(_188){
this.element.appendChild(_188);
}).bind(this));
}});
Insertion.After=Class.create();
Insertion.After.prototype=Object.extend(new Abstract.Insertion("afterEnd"),{initializeRange:function(){
this.range.setStartAfter(this.element);
},insertContent:function(_189){
_189.each((function(_18a){
this.element.parentNode.insertBefore(_18a,this.element.nextSibling);
}).bind(this));
}});
Element.ClassNames=Class.create();
Element.ClassNames.prototype={initialize:function(_18b){
this.element=$(_18b);
},_each:function(_18c){
this.element.className.split(/\s+/).select(function(name){
return name.length>0;
})._each(_18c);
},set:function(_18e){
this.element.className=_18e;
},add:function(_18f){
if(this.include(_18f)){
return;
}
this.set($A(this).concat(_18f).join(" "));
},remove:function(_190){
if(!this.include(_190)){
return;
}
this.set($A(this).without(_190).join(" "));
},toString:function(){
return $A(this).join(" ");
}};
Object.extend(Element.ClassNames.prototype,Enumerable);
var Selector=Class.create();
Selector.prototype={initialize:function(_191){
this.params={classNames:[]};
this.expression=_191.toString().strip();
this.parseExpression();
this.compileMatcher();
},parseExpression:function(){
function abort(_192){
throw "Parse error in selector: "+_192;
};
if(this.expression==""){
abort("empty expression");
}
var _193=this.params,expr=this.expression,_195,_196,_197,rest;
while(_195=expr.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i)){
_193.attributes=_193.attributes||[];
_193.attributes.push({name:_195[2],operator:_195[3],value:_195[4]||_195[5]||""});
expr=_195[1];
}
if(expr=="*"){
return this.params.wildcard=true;
}
while(_195=expr.match(/^([^a-z0-9_-])?([a-z0-9_-]+)(.*)/i)){
_196=_195[1],_197=_195[2],rest=_195[3];
switch(_196){
case "#":
_193.id=_197;
break;
case ".":
_193.classNames.push(_197);
break;
case "":
case undefined:
_193.tagName=_197.toUpperCase();
break;
default:
abort(expr.inspect());
}
expr=rest;
}
if(expr.length>0){
abort(expr.inspect());
}
},buildMatchExpression:function(){
var _199=this.params,_19a=[],_19b;
if(_199.wildcard){
_19a.push("true");
}
if(_19b=_199.id){
_19a.push("element.readAttribute(\"id\") == "+_19b.inspect());
}
if(_19b=_199.tagName){
_19a.push("element.tagName.toUpperCase() == "+_19b.inspect());
}
if((_19b=_199.classNames).length>0){
for(var i=0,_19d=_19b.length;i<_19d;i++){
_19a.push("element.hasClassName("+_19b[i].inspect()+")");
}
}
if(_19b=_199.attributes){
_19b.each(function(_19e){
var _19f="element.readAttribute("+_19e.name.inspect()+")";
var _1a0=function(_1a1){
return _19f+" && "+_19f+".split("+_1a1.inspect()+")";
};
switch(_19e.operator){
case "=":
_19a.push(_19f+" == "+_19e.value.inspect());
break;
case "~=":
_19a.push(_1a0(" ")+".include("+_19e.value.inspect()+")");
break;
case "|=":
_19a.push(_1a0("-")+".first().toUpperCase() == "+_19e.value.toUpperCase().inspect());
break;
case "!=":
_19a.push(_19f+" != "+_19e.value.inspect());
break;
case "":
case undefined:
_19a.push("element.hasAttribute("+_19e.name.inspect()+")");
break;
default:
throw "Unknown operator "+_19e.operator+" in selector";
}
});
}
return _19a.join(" && ");
},compileMatcher:function(){
this.match=new Function("element","if (!element.tagName) return false;       element = $(element);       return "+this.buildMatchExpression());
},findElements:function(_1a2){
var _1a3;
if(_1a3=$(this.params.id)){
if(this.match(_1a3)){
if(!_1a2||Element.childOf(_1a3,_1a2)){
return [_1a3];
}
}
}
_1a2=(_1a2||document).getElementsByTagName(this.params.tagName||"*");
var _1a4=[];
for(var i=0,_1a6=_1a2.length;i<_1a6;i++){
if(this.match(_1a3=_1a2[i])){
_1a4.push(Element.extend(_1a3));
}
}
return _1a4;
},toString:function(){
return this.expression;
}};
Object.extend(Selector,{matchElements:function(_1a7,_1a8){
var _1a9=new Selector(_1a8);
return _1a7.select(_1a9.match.bind(_1a9)).map(Element.extend);
},findElement:function(_1aa,_1ab,_1ac){
if(typeof _1ab=="number"){
_1ac=_1ab,_1ab=false;
}
return Selector.matchElements(_1aa,_1ab||"*")[_1ac||0];
},findChildElements:function(_1ad,_1ae){
return _1ae.map(function(_1af){
return _1af.match(/[^\s"]+(?:"[^"]*"[^\s"]+)*/g).inject([null],function(_1b0,expr){
var _1b2=new Selector(expr);
return _1b0.inject([],function(_1b3,_1b4){
return _1b3.concat(_1b2.findElements(_1b4||_1ad));
});
});
}).flatten();
}});
function $$(){
return Selector.findChildElements(document,$A(arguments));
};
var Form={reset:function(form){
$(form).reset();
return form;
},serializeElements:function(_1b6,_1b7){
var data=_1b6.inject({},function(_1b9,_1ba){
if(!_1ba.disabled&&_1ba.name){
var key=_1ba.name,_1bc=$(_1ba).getValue();
if(_1bc!=undefined){
if(_1b9[key]){
if(_1b9[key].constructor!=Array){
_1b9[key]=[_1b9[key]];
}
_1b9[key].push(_1bc);
}else{
_1b9[key]=_1bc;
}
}
}
return _1b9;
});
return _1b7?data:Prototype.Hash.toQueryString(data);
},unserializeElements:function(_1bd,hash){
for(i in hash){
Form.Element.setValue(i,hash[i].toString());
}
}};
Form.Methods={serialize:function(form,_1c0){
return Form.serializeElements(Form.getElements(form),_1c0);
},unserialize:function(form,hash){
return Form.unserializeElements(Form.getElements(form),hash);
},getElements:function(form){
return $A($(form).getElementsByTagName("*")).inject([],function(_1c4,_1c5){
if(Form.Element.Serializers[_1c5.tagName.toLowerCase()]){
_1c4.push(Element.extend(_1c5));
}
return _1c4;
});
},getInputs:function(form,_1c7,name){
form=$(form);
var _1c9=form.getElementsByTagName("input");
if(!_1c7&&!name){
return $A(_1c9).map(Element.extend);
}
for(var i=0,_1cb=[],_1cc=_1c9.length;i<_1cc;i++){
var _1cd=_1c9[i];
if((_1c7&&_1cd.type!=_1c7)||(name&&_1cd.name!=name)){
continue;
}
_1cb.push(Element.extend(_1cd));
}
return _1cb;
},disable:function(form){
form=$(form);
form.getElements().each(function(_1cf){
_1cf.blur();
_1cf.disabled="true";
});
return form;
},enable:function(form){
form=$(form);
form.getElements().each(function(_1d1){
_1d1.disabled="";
});
return form;
},findFirstElement:function(form){
return $(form).getElements().find(function(_1d3){
return _1d3.type!="hidden"&&!_1d3.disabled&&["input","select","textarea"].include(_1d3.tagName.toLowerCase());
});
},focusFirstElement:function(form){
form=$(form);
form.findFirstElement().activate();
return form;
}};
Object.extend(Form,Form.Methods);
Form.Element={focus:function(_1d5){
$(_1d5).focus();
return _1d5;
},select:function(_1d6){
$(_1d6).select();
return _1d6;
}};
Form.Element.Methods={serialize:function(_1d7){
_1d7=$(_1d7);
if(!_1d7.disabled&&_1d7.name){
var _1d8=_1d7.getValue();
if(_1d8!=undefined){
var pair={};
pair[_1d7.name]=_1d8;
return Prototype.Hash.toQueryString(pair);
}
}
return "";
},getValue:function(_1da){
_1da=$(_1da);
var _1db=_1da.tagName.toLowerCase();
return Form.Element.Serializers[_1db](_1da);
},clear:function(_1dc){
$(_1dc).value="";
return _1dc;
},present:function(_1dd){
return $(_1dd).value!="";
},activate:function(_1de){
_1de=$(_1de);
_1de.focus();
if(_1de.select&&(_1de.tagName.toLowerCase()!="input"||!["button","reset","submit"].include(_1de.type))){
_1de.select();
}
return _1de;
},disable:function(_1df){
_1df=$(_1df);
_1df.disabled=true;
return _1df;
},enable:function(_1e0){
_1e0=$(_1e0);
_1e0.blur();
_1e0.disabled=false;
return _1e0;
}};
Object.extend(Form.Element,Form.Element.Methods);
var Field=Form.Element;
var $F=Form.Element.getValue;
Form.Element.Serializers={input:function(_1e1){
switch(_1e1.type.toLowerCase()){
case "checkbox":
return _1e1.checked?_1e1.value:0;
case "radio":
return Form.Element.Serializers.inputSelector(_1e1);
default:
return Form.Element.Serializers.textarea(_1e1);
}
},inputSelector:function(_1e2){
return _1e2.checked?_1e2.value:null;
},textarea:function(_1e3){
return _1e3.value;
},select:function(_1e4){
return this[_1e4.type=="select-one"?"selectOne":"selectMany"](_1e4);
},selectOne:function(_1e5){
var _1e6=_1e5.selectedIndex;
return _1e6>=0?this.optionValue(_1e5.options[_1e6]):null;
},selectMany:function(_1e7){
var _1e8,_1e9=_1e7.length;
if(!_1e9){
return null;
}
for(var i=0,_1e8=[];i<_1e9;i++){
var opt=_1e7.options[i];
if(opt.selected){
_1e8.push(this.optionValue(opt));
}
}
return _1e8;
},optionValue:function(opt){
try{
ret=Element.extend(opt).hasAttribute("value")?opt.value:opt.text;
}
catch(e){
alert("caught:"+opt.value+" : "+e);
ret=opt.value;
}
return ret;
}};
Abstract.TimedObserver=function(){
};
Abstract.TimedObserver.prototype={initialize:function(_1ed,_1ee,_1ef){
this.frequency=_1ee;
this.element=$(_1ed);
this.callback=_1ef;
this.lastValue=this.getValue();
this.registerCallback();
},registerCallback:function(){
setInterval(this.onTimerEvent.bind(this),this.frequency*1000);
},onTimerEvent:function(){
var _1f0=this.getValue();
var _1f1=("string"==typeof this.lastValue&&"string"==typeof _1f0?this.lastValue!=_1f0:String(this.lastValue)!=String(_1f0));
if(_1f1){
this.callback(this.element,_1f0);
this.lastValue=_1f0;
}
}};
Form.Element.Observer=Class.create();
Form.Element.Observer.prototype=Object.extend(new Abstract.TimedObserver(),{getValue:function(){
return Form.Element.getValue(this.element);
}});
Form.Observer=Class.create();
Form.Observer.prototype=Object.extend(new Abstract.TimedObserver(),{getValue:function(){
return Form.serialize(this.element);
}});
Abstract.EventObserver=function(){
};
Abstract.EventObserver.prototype={initialize:function(_1f2,_1f3){
this.element=$(_1f2);
this.callback=_1f3;
this.lastValue=this.getValue();
if(this.element.tagName.toLowerCase()=="form"){
this.registerFormCallbacks();
}else{
this.registerCallback(this.element);
}
},onElementEvent:function(){
var _1f4=this.getValue();
if(this.lastValue!=_1f4){
this.callback(this.element,_1f4);
this.lastValue=_1f4;
}
},registerFormCallbacks:function(){
Form.getElements(this.element).each(this.registerCallback.bind(this));
},registerCallback:function(_1f5){
if(_1f5.type){
switch(_1f5.type.toLowerCase()){
case "checkbox":
case "radio":
Event.observe(_1f5,"click",this.onElementEvent.bind(this));
break;
default:
Event.observe(_1f5,"change",this.onElementEvent.bind(this));
break;
}
}
}};
Form.Element.EventObserver=Class.create();
Form.Element.EventObserver.prototype=Object.extend(new Abstract.EventObserver(),{getValue:function(){
return Form.Element.getValue(this.element);
}});
Form.EventObserver=Class.create();
Form.EventObserver.prototype=Object.extend(new Abstract.EventObserver(),{getValue:function(){
return Form.serialize(this.element);
}});
if(!window.Event){
var Event=new Object();
}
Object.extend(Event,{KEY_BACKSPACE:8,KEY_TAB:9,KEY_RETURN:13,KEY_ESC:27,KEY_LEFT:37,KEY_UP:38,KEY_RIGHT:39,KEY_DOWN:40,KEY_DELETE:46,KEY_HOME:36,KEY_END:35,KEY_PAGEUP:33,KEY_PAGEDOWN:34,element:function(_1f6){
return _1f6.target||_1f6.srcElement;
},isLeftClick:function(_1f7){
return (((_1f7.which)&&(_1f7.which==1))||((_1f7.button)&&(_1f7.button==1)));
},pointerX:function(_1f8){
return _1f8.pageX||(_1f8.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft));
},pointerY:function(_1f9){
return _1f9.pageY||(_1f9.clientY+(document.documentElement.scrollTop||document.body.scrollTop));
},stop:function(_1fa){
if(_1fa.preventDefault){
_1fa.preventDefault();
_1fa.stopPropagation();
}else{
_1fa.returnValue=false;
_1fa.cancelBubble=true;
}
},findElement:function(_1fb,_1fc){
var _1fd=Event.element(_1fb);
while(_1fd.parentNode&&(!_1fd.tagName||(_1fd.tagName.toUpperCase()!=_1fc.toUpperCase()))){
_1fd=_1fd.parentNode;
}
return _1fd;
},observers:false,_observeAndCache:function(_1fe,name,_200,_201){
if(!this.observers){
this.observers=[];
}
if(_1fe.addEventListener){
this.observers.push([_1fe,name,_200,_201]);
_1fe.addEventListener(name,_200,_201);
}else{
if(_1fe.attachEvent){
this.observers.push([_1fe,name,_200,_201]);
_1fe.attachEvent("on"+name,_200);
}
}
},unloadCache:function(){
if(!Event.observers){
return;
}
for(var i=0,_203=Event.observers.length;i<_203;i++){
Event.stopObserving.apply(this,Event.observers[i]);
Event.observers[i][0]=null;
}
Event.observers=false;
},observe:function(_204,name,_206,_207){
_204=$(_204);
_207=_207||false;
if(name=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||_204.attachEvent)){
name="keydown";
}
Event._observeAndCache(_204,name,_206,_207);
},stopObserving:function(_208,name,_20a,_20b){
_208=$(_208);
_20b=_20b||false;
if(name=="keypress"&&(navigator.appVersion.match(/Konqueror|Safari|KHTML/)||_208.detachEvent)){
name="keydown";
}
if(_208.removeEventListener){
_208.removeEventListener(name,_20a,_20b);
}else{
if(_208.detachEvent){
try{
_208.detachEvent("on"+name,_20a);
}
catch(e){
}
}
}
}});
if(navigator.appVersion.match(/\bMSIE\b/)){
Event.observe(window,"unload",Event.unloadCache,false);
}
var Position={includeScrollOffsets:false,prepare:function(){
this.deltaX=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0;
this.deltaY=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;
},realOffset:function(_20c){
var _20d=0,_20e=0;
do{
_20d+=_20c.scrollTop||0;
_20e+=_20c.scrollLeft||0;
_20c=_20c.parentNode;
}while(_20c);
return [_20e,_20d];
},cumulativeOffset:function(_20f){
var _210=0,_211=0;
do{
_210+=_20f.offsetTop||0;
_211+=_20f.offsetLeft||0;
_20f=_20f.offsetParent;
}while(_20f);
return [_211,_210];
},positionedOffset:function(_212){
var _213=0,_214=0;
do{
_213+=_212.offsetTop||0;
_214+=_212.offsetLeft||0;
_212=_212.offsetParent;
if(_212){
if(_212.tagName=="BODY"){
break;
}
var p=Element.getStyle(_212,"position");
if(p=="relative"||p=="absolute"){
break;
}
}
}while(_212);
return [_214,_213];
},offsetParent:function(_216){
if(_216.offsetParent){
return _216.offsetParent;
}
if(_216==document.body){
return _216;
}
while((_216=_216.parentNode)&&_216!=document.body){
if(Element.getStyle(_216,"position")!="static"){
return _216;
}
}
return document.body;
},within:function(_217,x,y){
if(this.includeScrollOffsets){
return this.withinIncludingScrolloffsets(_217,x,y);
}
this.xcomp=x;
this.ycomp=y;
this.offset=this.cumulativeOffset(_217);
return (y>=this.offset[1]&&y<this.offset[1]+_217.offsetHeight&&x>=this.offset[0]&&x<this.offset[0]+_217.offsetWidth);
},withinIncludingScrolloffsets:function(_21a,x,y){
var _21d=this.realOffset(_21a);
this.xcomp=x+_21d[0]-this.deltaX;
this.ycomp=y+_21d[1]-this.deltaY;
this.offset=this.cumulativeOffset(_21a);
return (this.ycomp>=this.offset[1]&&this.ycomp<this.offset[1]+_21a.offsetHeight&&this.xcomp>=this.offset[0]&&this.xcomp<this.offset[0]+_21a.offsetWidth);
},overlap:function(mode,_21f){
if(!mode){
return 0;
}
if(mode=="vertical"){
return ((this.offset[1]+_21f.offsetHeight)-this.ycomp)/_21f.offsetHeight;
}
if(mode=="horizontal"){
return ((this.offset[0]+_21f.offsetWidth)-this.xcomp)/_21f.offsetWidth;
}
},page:function(_220){
var _221=0,_222=0;
var _223=_220;
do{
_221+=_223.offsetTop||0;
_222+=_223.offsetLeft||0;
if(_223.offsetParent==document.body){
if(Element.getStyle(_223,"position")=="absolute"){
break;
}
}
}while(_223=_223.offsetParent);
_223=_220;
do{
if(!window.opera||_223.tagName=="BODY"){
_221-=_223.scrollTop||0;
_222-=_223.scrollLeft||0;
}
}while(_223=_223.parentNode);
return [_222,_221];
},clone:function(_224,_225){
var _226=Object.extend({setLeft:true,setTop:true,setWidth:true,setHeight:true,offsetTop:0,offsetLeft:0},arguments[2]||{});
_224=$(_224);
var p=Position.page(_224);
_225=$(_225);
var _228=[0,0];
var _229=null;
if(Element.getStyle(_225,"position")=="absolute"){
_229=Position.offsetParent(_225);
_228=Position.page(_229);
}
if(_229==document.body){
_228[0]-=document.body.offsetLeft;
_228[1]-=document.body.offsetTop;
}
if(_226.setLeft){
_225.style.left=(p[0]-_228[0]+_226.offsetLeft)+"px";
}
if(_226.setTop){
_225.style.top=(p[1]-_228[1]+_226.offsetTop)+"px";
}
if(_226.setWidth){
_225.style.width=_224.offsetWidth+"px";
}
if(_226.setHeight){
_225.style.height=_224.offsetHeight+"px";
}
},absolutize:function(_22a){
_22a=$(_22a);
if(_22a.style.position=="absolute"){
return;
}
Position.prepare();
var _22b=Position.positionedOffset(_22a);
var top=_22b[1];
var left=_22b[0];
var _22e=_22a.clientWidth;
var _22f=_22a.clientHeight;
_22a._originalLeft=left-parseFloat(_22a.style.left||0);
_22a._originalTop=top-parseFloat(_22a.style.top||0);
_22a._originalWidth=_22a.style.width;
_22a._originalHeight=_22a.style.height;
_22a.style.position="absolute";
_22a.style.top=top+"px";
_22a.style.left=left+"px";
_22a.style.width=_22e+"px";
_22a.style.height=_22f+"px";
},relativize:function(_230){
_230=$(_230);
if(_230.style.position=="relative"){
return;
}
Position.prepare();
_230.style.position="relative";
var top=parseFloat(_230.style.top||0)-(_230._originalTop||0);
var left=parseFloat(_230.style.left||0)-(_230._originalLeft||0);
_230.style.top=top+"px";
_230.style.left=left+"px";
_230.style.height=_230._originalHeight;
_230.style.width=_230._originalWidth;
}};
if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)){
Position.cumulativeOffset=function(_233){
var _234=0,_235=0;
do{
_234+=_233.offsetTop||0;
_235+=_233.offsetLeft||0;
if(_233.offsetParent==document.body){
if(Element.getStyle(_233,"position")=="absolute"){
break;
}
}
_233=_233.offsetParent;
}while(_233);
return [_235,_234];
};
}
Element.addMethods();
JSONstring={compactOutput:false,includeProtos:false,includeFunctions:false,detectCirculars:false,restoreCirculars:true,make:function(arg,_237){
this.restore=_237;
this.mem=[];
this.pathMem=[];
return this.toJsonStringArray(arg).join("");
},toObject:function(x){
eval("this.myObj="+x);
if(!this.restoreCirculars||!alert){
return this.myObj;
}
this.restoreCode=[];
this.make(this.myObj,true);
var r=this.restoreCode.join(";")+";";
eval("r=r.replace(/\\W([0-9]{1,})(\\W)/g,\"[$1]$2\").replace(/\\.\\;/g,\";\")");
eval(r);
return this.myObj;
},toJsonStringArray:function(arg,out){
if(!out){
this.path=[];
}
out=out||[];
var u;
switch(typeof arg){
case "object":
this.lastObj=arg;
if(this.detectCirculars){
var m=this.mem;
var n=this.pathMem;
for(var i=0;i<m.length;i++){
if(arg===m[i]){
out.push("\"JSONcircRef:"+n[i]+"\"");
return out;
}
}
m.push(arg);
n.push(this.path.join("."));
}
if(arg){
if(arg.constructor==Array){
out.push("[");
for(var i=0;i<arg.length;++i){
this.path.push(i);
if(i>0){
out.push(",\n");
}
this.toJsonStringArray(arg[i],out);
this.path.pop();
}
out.push("]");
return out;
}else{
if(typeof arg.toString!="undefined"){
out.push("{");
var _240=true;
for(var i in arg){
if(!this.includeProtos&&arg[i]===arg.constructor.prototype[i]){
continue;
}
this.path.push(i);
var curr=out.length;
if(!_240){
out.push(this.compactOutput?",":",\n");
}
this.toJsonStringArray(i,out);
out.push(":");
this.toJsonStringArray(arg[i],out);
if(out[out.length-1]==u){
out.splice(curr,out.length-curr);
}else{
_240=false;
}
this.path.pop();
}
out.push("}");
return out;
}
}
return out;
}
out.push("null");
return out;
case "unknown":
case "undefined":
case "function":
out.push(this.includeFunctions?arg:u);
return out;
case "string":
if(this.restore&&arg.indexOf("JSONcircRef:")==0){
this.restoreCode.push("this.myObj."+this.path.join(".")+"="+arg.split("JSONcircRef:").join("this.myObj."));
}
out.push("\"");
var a=["\\","\\\\","\n","\\n","\r","\\r","\"","\\\""];
arg+="";
for(var i=0;i<8;i+=2){
arg=arg.split(a[i]).join(a[i+1]);
}
out.push(arg);
out.push("\"");
return out;
default:
out.push(String(arg));
return out;
}
}};
Dragger=function(o,a){
this.handleStart=this.start.bind(this);
this.handleStop=this.stop.bind(this);
this.handleUpdate=this._updateMouse.bind(this);
o.style.position="absolute";
this.object=o;
this.d={x:0,y:0};
this.f=[];
if(a){
Event.observe(o,"mousedown",this.handleStart,false);
o.onmousedown=function(){
if(browser=="Safari"){
return true;
}
return false;
};
Event.observe(document,"mouseup",this.handleStop,false);
}
if(!Dragger.updatingMouse){
Event.observe(document,"mousemove",this.handleUpdate,false);
Dragger.updatingMouse=true;
}
};
with({p:Dragger.prototype,c:Dragger}){
p._updateMouse=function(e){
var w=window,b=document.body;
p.mouse={x:e.clientX+(w.scrollX||b.scrollLeft||b.parentNode.scrollLeft||0),y:e.clientY+(w.scrollY||b.scrollTop||b.parentNode.scrollTop||0)};
};
p.mouse={x:0,y:0};
p.dragging=false;
p.setonbeforestart=function(_248){
this["onbeforestart"]=_248;
this.object.onmousedown=function(e){
if(this.callEvent("onbeforestart",e)){
if(browser=="Safari"){
return true;
}
return false;
}
}.bind(this);
};
p.start=function(e,_24b){
if(this["onbeforestart"] instanceof Function&&!this.callEvent("onbeforestart",e)){
}else{
var r,$=this,m=$.mouse,o=$.object;
for(var r={l:o.offsetLeft,t:o.offsetTop,w:o.offsetWidth,h:o.offsetHeight};o=o.offsetParent;r.l+=o.offsetLeft,r.t+=o.offsetTop){
}
!$.dragging&&($.dragging=true,o=$.object,$.d=_24b&&(m.x<r.l||m.x>r.l+r.w||m.y<r.t||m.y>r.t+r.h)?{x:r.w/2,y:r.h/2}:{x:m.x-o.offsetLeft,y:m.y-o.offsetTop},this.dragListener=this.drag.bindAsEventListener(this),Event.observe(document,"mousemove",this.dragListener,false),this.callEvent("onstart"));
}
};
p.drag=function(e){
if(browser=="IE"){
var minY=document.body.parentNode.scrollTop;
var maxY=minY+document.body.parentNode.clientHeight;
var _253=event.clientY+minY;
}else{
var minY=window.scrollY;
var maxY=window.scrollY+window.innerHeight;
var _253=e.pageY;
}
if(_253>(maxY-10)){
window.scrollBy(0,6);
}else{
if(_253>(maxY-25)){
window.scrollBy(0,4);
}else{
if(_253>(maxY-50)){
window.scrollBy(0,2);
}else{
if(_253<(minY+10)){
window.scrollBy(0,-6);
}else{
if(_253<(minY+25)){
window.scrollBy(0,-4);
}else{
if(_253<(minY+50)){
window.scrollBy(0,-2);
}
}
}
}
}
}
var i,p,$=this,o=$.object,m=($._updateMouse(e),(m=$.mouse).x-=$.d.x,m.y-=$.d.y,m);
for(i=$.f.length;i;$.f[--i]&&$.f[i][0].apply(m,$.f[i][1])){
}
if(o.style.posLeft){
o.style.posLeft=m.x,o.style.posTop=m.y;
}else{
o.style.left=m.x+"px",o.style.top=m.y+"px";
}
return !!this.callEvent("ondrag",e);
};
p.stop=function(){
this.dragging=false;
this.dragListener&&(Event.stopObserving(document,"mousemove",this.dragListener,false));
this.callEvent("onstop");
};
p.addFilter=function(f,arg0,arg1,arg2,argN){
this.f[this.f.length]=[f,[].slice.call(arguments,1)];
};
p.callEvent=function(e){
return this[e] instanceof Function?this[e].apply(this,[].slice.call(arguments,1)):undefined;
};
}
Dragger.prototype.disable=function(o){
Event.stopObserving(o,"mousedown",this.handleStart,false);
Event.stopObserving(document,"mouseup",this.handleStop,false);
Event.stopObserving(document,"mousemove",this.handleUpdate,false);
if(this.dragListener){
Event.stopObserving(document,"mousemove",this.dragListener,false);
}
};
Dragger.prototype.enable=function(o){
Event.observe(o,"mousedown",this.handleStart,false);
Event.observe(document,"mouseup",this.handleStop,false);
Event.observe(document,"mousemove",this.handleUpdate,false);
};
Dragger.filters=new function(){
function lineLength(x,y,x0,y0){
return Math.sqrt((x-=x0)*x+(y-=y0)*y);
};
function dotLineLength(x,y,x0,y0,x1,y1,o){
if(o&&!(o=function(x,y,x0,y0,x1,y1){
if(!(x1-x0)){
return {x:x0,y:y};
}else{
if(!(y1-y0)){
return {x:x,y:y0};
}
}
var left,tg=-1/((y1-y0)/(x1-x0));
return {x:left=(x1*(x*tg-y+y0)+x0*(x*-tg+y-y1))/(tg*(x1-x0)+y0-y1),y:tg*left-tg*x+y};
}(x,y,x0,y0,x1,y1),o.x>=Math.min(x0,x1)&&o.x<=Math.max(x0,x1)&&o.y>=Math.min(y0,y1)&&o.y<=Math.max(y0,y1))){
var l1=lineLength(x,y,x0,y0),l2=lineLength(x,y,x1,y1);
return l1>l2?l2:l1;
}else{
var a=y0-y1,b=x1-x0,c=x0*y1-y0*x1;
return Math.abs(a*x+b*y+c)/Math.sqrt(a*a+b*b);
}
};
this.SQUARE=function(x,y,w,h){
this.x=this.x<x?x:this.x>x+w?x+w:this.x,this.y=this.y<y?y:this.y>y+h?y+h:this.y;
};
this.CIRCLE=function(x,y,ray){
var tg;
lineLength(this.x,this.y,x+=ray,y+=ray)>ray&&(this.x=Math.cos(tg=Math.atan2(this.y-y,this.x-x))*ray+x,this.y=Math.sin(tg)*ray+y);
};
this.LINE=function(x,y,_283){
if(!(_283%90)){
return this.x=x;
}
var tg=Math.tan(-_283*Math.PI/180);
Math.sin(45*Math.PI/180)>=Math.sin(_283*Math.PI/180)?this.y=(this.x-x)*tg+y:this.x=(this.y-y)/tg+x;
};
this.POLY=function(x0,y0,x1,y1,etc,etc,etc){
for(var a=[].slice.call(arguments,0),_28b=[];a.length>3;_28b[_28b.length]={y1:a.pop(),x1:a.pop(),y0:a.pop(),x0:a.pop()}){
}
if(!_28b.length){
return;
}
for(var l,i=_28b.length-1,o=_28b[i],_28f={i:i,l:dotLineLength(this.x,this.y,o.x0,o.y0,o.x1,o.y1,1)};i--;_28f.l>(l=dotLineLength(this.x,this.y,(o=_28b[i]).x0,o.y0,o.x1,o.y1,1))&&(_28f={i:i,l:l})){
}
this.y<Math.min((o=_28b[_28f.i]).y0,o.y1)?this.y=Math.min(o.y0,o.y1):this.y>Math.max(o.y0,o.y1)&&(this.y=Math.max(o.y0,o.y1));
this.x<Math.min(o.x0,o.x1)?this.x=Math.min(o.x0,o.x1):this.x>Math.max(o.x0,o.x1)&&(this.x=Math.max(o.x0,o.x1));
Math.abs(o.x0-o.x1)<Math.abs(o.y0-o.y1)?this.x=(this.y*(o.x0-o.x1)-o.x0*o.y1+o.y0*o.x1)/(o.y0-o.y1):this.y=(this.x*(o.y0-o.y1)-o.y0*o.x1+o.x0*o.y1)/(o.x0-o.x1);
};
};
Form.Element.setValue=function(_290,_291){
element_id=_290;
_290=$(_290);
if(!_290){
_290=document.getElementsByName(element_id)[0];
}
if(!_290){
return false;
}
var _292=_290.tagName.toLowerCase();
var _293=Form.Element.SetSerializers[_292](_290,_291);
};
Form.Element.SetSerializers={input:function(_294,_295){
switch(_294.type.toLowerCase()){
case "submit":
case "hidden":
case "password":
case "text":
return Form.Element.SetSerializers.textarea(_294,_295);
case "checkbox":
return Form.Element.SetSerializers.checkbox(_294,_295);
case "radio":
return Form.Element.SetSerializers.inputSelector(_294,_295);
}
return false;
},checkbox:function(_296,_297){
if(_297==0||_297==null||_297==""){
_296.checked=false;
}else{
_296.checked=true;
}
},inputSelector:function(_298,_299){
fields=document.getElementsByName(_298.name);
for(var i=0;i<fields.length;i++){
if(fields[i].value==_299){
fields[i].checked=true;
}
}
},textarea:function(_29b,_29c){
_29b.value=_29c;
},select:function(_29d,_29e){
var _29f="",opt,_2a1=_29d.selectedIndex;
for(var i=0;i<_29d.options.length;i++){
if(_29d.options[i].value==_29e){
_29d.selectedIndex=i;
return true;
}
}
}};
var fx=new Object();
fx.Base=function(){
};
fx.Base.prototype={setOptions:function(_2a3){
this.options={duration:500,onComplete:"",transition:fx.sinoidal};
Object.extend(this.options,_2a3||{});
},step:function(){
var time=(new Date).getTime();
if(time>=this.options.duration+this.startTime){
this.now=this.to;
clearInterval(this.timer);
this.timer=null;
if(this.options.onComplete){
setTimeout(this.options.onComplete.bind(this),10);
}
}else{
var Tpos=(time-this.startTime)/(this.options.duration);
this.now=this.options.transition(Tpos)*(this.to-this.from)+this.from;
}
this.increase();
},custom:function(from,to){
if(this.timer!=null){
return;
}
this.from=from;
this.to=to;
this.startTime=(new Date).getTime();
this.timer=setInterval(this.step.bind(this),13);
},hide:function(){
this.now=0;
this.increase();
},clearTimer:function(){
clearInterval(this.timer);
this.timer=null;
}};
fx.Layout=Class.create();
fx.Layout.prototype=Object.extend(new fx.Base(),{initialize:function(el,_2a9){
this.el=$(el);
this.el.style.overflow="hidden";
this.iniWidth=this.el.offsetWidth;
this.iniHeight=this.el.offsetHeight;
this.setOptions(_2a9);
}});
fx.Height=Class.create();
Object.extend(Object.extend(fx.Height.prototype,fx.Layout.prototype),{increase:function(){
this.el.style.height=this.now+"px";
},toggle:function(){
if(this.el.offsetHeight>0){
this.custom(this.el.offsetHeight,0);
}else{
this.custom(0,this.el.scrollHeight);
}
}});
fx.Width=Class.create();
Object.extend(Object.extend(fx.Width.prototype,fx.Layout.prototype),{increase:function(){
this.el.style.width=this.now+"px";
},toggle:function(){
if(this.el.offsetWidth>0){
this.custom(this.el.offsetWidth,0);
}else{
this.custom(0,this.iniWidth);
}
}});
fx.Opacity=Class.create();
fx.Opacity.prototype=Object.extend(new fx.Base(),{initialize:function(el,_2ab){
this.el=$(el);
this.now=1;
this.increase();
this.setOptions(_2ab);
},increase:function(){
if(this.now==1&&(/Firefox/.test(navigator.userAgent))){
this.now=0.9999;
}
this.setOpacity(this.now);
},setOpacity:function(_2ac){
if(_2ac==0&&this.el.style.visibility!="hidden"){
this.el.style.visibility="hidden";
}else{
if(this.el.style.visibility!="visible"){
this.el.style.visibility="visible";
}
}
if(window.ActiveXObject){
this.el.style.filter="alpha(opacity="+_2ac*100+")";
}
this.el.style.opacity=_2ac;
},toggle:function(){
if(this.now>0){
this.custom(1,0);
}else{
this.custom(0,1);
}
}});
fx.sinoidal=function(pos){
return ((-Math.cos(pos*Math.PI)/2)+0.5);
};
fx.linear=function(pos){
return pos;
};
fx.cubic=function(pos){
return Math.pow(pos,3);
};
fx.circ=function(pos){
return Math.sqrt(pos);
};
fx.Scroll=Class.create();
fx.Scroll.prototype=Object.extend(new fx.Base(),{initialize:function(_2b1){
this.setOptions(_2b1);
},scrollTo:function(el){
var dest=Position.cumulativeOffset($(el))[1]-20;
var _2b4=window.innerHeight||document.documentElement.clientHeight;
var full=document.documentElement.scrollHeight;
var top=window.pageYOffset||document.body.scrollTop||document.documentElement.scrollTop;
if(dest+_2b4>full){
this.custom(top,dest-_2b4+(full-dest));
}else{
this.custom(top,dest);
}
},increase:function(){
window.scrollTo(0,this.now);
}});
fx.Text=Class.create();
fx.Text.prototype=Object.extend(new fx.Base(),{initialize:function(el,_2b8){
this.el=$(el);
this.setOptions(_2b8);
if(!this.options.unit){
this.options.unit="em";
}
},increase:function(){
this.el.style.fontSize=this.now+this.options.unit;
}});
fx.Combo=Class.create();
fx.Combo.prototype={setOptions:function(_2b9){
this.options={opacity:true,height:true,width:false};
Object.extend(this.options,_2b9||{});
},initialize:function(el,_2bb){
this.el=$(el);
this.setOptions(_2bb);
if(this.options.opacity){
this.o=new fx.Opacity(el,_2bb);
_2bb.onComplete=null;
}
if(this.options.height){
this.h=new fx.Height(el,_2bb);
_2bb.onComplete=null;
}
if(this.options.width){
this.w=new fx.Width(el,_2bb);
}
},toggle:function(){
this.checkExec("toggle");
},hide:function(){
this.checkExec("hide");
},clearTimer:function(){
this.checkExec("clearTimer");
},checkExec:function(func){
if(this.o){
this.o[func]();
}
if(this.h){
this.h[func]();
}
if(this.w){
this.w[func]();
}
},resizeTo:function(hto,wto){
if(this.h&&this.w){
this.h.custom(this.el.offsetHeight,this.el.offsetHeight+hto);
this.w.custom(this.el.offsetWidth,this.el.offsetWidth+wto);
}
},customSize:function(hto,wto){
if(this.h&&this.w){
this.h.custom(this.el.offsetHeight,hto);
this.w.custom(this.el.offsetWidth,wto);
}
}};
fx.Accordion=Class.create();
fx.Accordion.prototype={setOptions:function(_2c1){
this.options={delay:100,opacity:false};
Object.extend(this.options,_2c1||{});
},initialize:function(_2c2,_2c3,_2c4){
this.elements=_2c3;
this.setOptions(_2c4);
var _2c4=_2c4||"";
_2c3.each(function(el,i){
_2c4.onComplete=function(){
if(el.offsetHeight>0){
el.style.height="1%";
}
};
el.fx=new fx.Combo(el,_2c4);
el.fx.hide();
});
_2c2.each(function(tog,i){
tog.onclick=function(){
this.showThisHideOpen(_2c3[i]);
}.bind(this);
}.bind(this));
},showThisHideOpen:function(_2c9){
this.elements.each(function(el,i){
if(el.offsetHeight>0&&el!=_2c9){
this.clearAndToggle(el);
}
}.bind(this));
if(_2c9.offsetHeight==0){
setTimeout(function(){
this.clearAndToggle(_2c9);
}.bind(this),this.options.delay);
}
},clearAndToggle:function(el){
el.fx.clearTimer();
el.fx.toggle();
}};
var Remember=new Object();
Remember=function(){
};
Remember.prototype={initialize:function(el,_2ce){
this.el=$(el);
this.days=365;
this.options=_2ce;
this.effect();
var _2cf=this.readCookie();
if(_2cf){
this.fx.now=_2cf;
this.fx.increase();
}
},setCookie:function(_2d0){
var date=new Date();
date.setTime(date.getTime()+(this.days*24*60*60*1000));
var _2d2="; expires="+date.toGMTString();
document.cookie=this.el+this.el.id+this.prefix+"="+_2d0+_2d2+"; path=/";
},readCookie:function(){
var _2d3=this.el+this.el.id+this.prefix+"=";
var ca=document.cookie.split(";");
for(var i=0;c=ca[i];i++){
while(c.charAt(0)==" "){
c=c.substring(1,c.length);
}
if(c.indexOf(_2d3)==0){
return c.substring(_2d3.length,c.length);
}
}
return false;
},custom:function(from,to){
if(this.fx.now!=to){
this.setCookie(to);
this.fx.custom(from,to);
}
}};
fx.RememberHeight=Class.create();
fx.RememberHeight.prototype=Object.extend(new Remember(),{effect:function(){
this.fx=new fx.Height(this.el,this.options);
this.prefix="height";
},toggle:function(){
if(this.el.offsetHeight==0){
this.setCookie(this.el.scrollHeight);
}else{
this.setCookie(0);
}
this.fx.toggle();
},resize:function(to){
this.setCookie(this.el.offsetHeight+to);
this.fx.custom(this.el.offsetHeight,this.el.offsetHeight+to);
},hide:function(){
if(!this.readCookie()){
this.fx.hide();
}
}});
fx.RememberText=Class.create();
fx.RememberText.prototype=Object.extend(new Remember(),{effect:function(){
this.fx=new fx.Text(this.el,this.options);
this.prefix="text";
}});
fx.expoIn=function(pos){
return Math.pow(2,10*(pos-1));
};
fx.expoOut=function(pos){
return (-Math.pow(2,-10*pos)+1);
};
fx.quadIn=function(pos){
return Math.pow(pos,2);
};
fx.quadOut=function(pos){
return -(pos)*(pos-2);
};
fx.circOut=function(pos){
return Math.sqrt(1-Math.pow(pos-1,2));
};
fx.circIn=function(pos){
return -(Math.sqrt(1-Math.pow(pos,2))-1);
};
fx.backIn=function(pos){
return (pos)*pos*((2.7)*pos-1.7);
};
fx.backOut=function(pos){
return ((pos-1)*(pos-1)*((2.7)*(pos-1)+1.7)+1);
};
fx.sineOut=function(pos){
return Math.sin(pos*(Math.PI/2));
};
fx.sineIn=function(pos){
return -Math.cos(pos*(Math.PI/2))+1;
};
fx.sineInOut=function(pos){
return -(Math.cos(Math.PI*pos)-1)/2;
};
fx.Position=Class.create();
fx.Position.prototype=Object.extend(new fx.Base(),{initialize:function(el,_2e5){
this.el=$(el);
this.setOptions(_2e5);
this.now=[0,0];
},step:function(){
var time=(new Date).getTime();
if(time>=this.options.duration+this.startTime){
this.now=this.to;
clearInterval(this.timer);
this.timer=null;
if(this.options.onComplete){
setTimeout(this.options.onComplete.bind(this),10);
}
}else{
var Tpos=(time-this.startTime)/(this.options.duration);
var tmp=[];
tmp[0]=(this.options.transition(Tpos)*(this.to[0]-this.from[0])+this.from[0]);
tmp[1]=(this.options.transition(Tpos)*(this.to[1]-this.from[1])+this.from[1]);
this.now=tmp;
}
this.increase();
},increase:function(){
this.el.style["left"]=this.now[0]+"px";
this.el.style["top"]=this.now[1]+"px";
},move:function(from,to){
to=to?to:this.now;
this.custom(from,to);
}});
fx.Color=Class.create();
fx.Color.prototype=Object.extend(new fx.Base(),{initialize:function(el,_2ec){
this.el=$(el);
this.setOptions(_2ec);
this.now=0;
this.regex=new RegExp("#?(..?)(..?)(..?)");
if(!this.options.fromColor){
this.options.fromColor="#FFFFFF";
}
if(!this.options.toColor){
this.options.toColor="#FFFFFF";
}
if(!this.options.property){
this.props=new Array("backgroundColor");
}else{
this.props=this.options.property.split(",");
}
},increase:function(){
var hex="rgb("+(Math.round(this.cs[0]+(this.ce[0]-this.cs[0])*this.now))+","+(Math.round(this.cs[1]+(this.ce[1]-this.cs[1])*this.now))+","+(Math.round(this.cs[2]+(this.ce[2]-this.cs[2])*this.now))+")";
for(i=0;i<this.props.length;i++){
if(this.props[i]=="backgroundColor"){
this.el.style.backgroundColor=hex;
}else{
if(this.props[i]=="color"){
this.el.style.color=hex;
}else{
if(this.props[i]=="borderColor"){
this.el.style.borderColor=hex;
}
}
}
}
},toggle:function(){
this.cs=this.regex.exec(this.options.fromColor);
this.ce=this.regex.exec(this.options.toColor);
for(i=1;i<this.cs.length;i++){
this.cs[i-1]=parseInt(this.cs[i],16);
this.ce[i-1]=parseInt(this.ce[i],16);
}
if(this.now>0){
this.custom(1,0);
}else{
this.custom(0,1);
}
},cycle:function(){
this.toggle();
setTimeout(this.toggle.bind(this),this.options.duration+10);
},customColor:function(from,to){
this.cs=this.regex.exec(from);
this.ce=this.regex.exec(to);
for(i=1;i<this.cs.length;i++){
if(this.cs[i].length==1){
this.cs[i]+=this.cs[i];
}
if(this.ce[i].length==1){
this.ce[i]+=this.ce[i];
}
this.cs[i-1]=parseInt(this.cs[i],16);
this.ce[i-1]=parseInt(this.ce[i],16);
}
this.custom(0,1);
},customColorRGB:function(from,to){
this.rgb_regex=new RegExp("^rgb.([^,]*),s?([^,]*),s?([^)]*)");
this.cs=this.rgb_regex.exec(from);
this.ce=this.rgb_regex.exec(to);
if(!this.cs){
this.customColor(from,to);
return;
}
for(i=1;i<this.cs.length;i++){
this.cs[i-1]=parseInt(this.cs[i]);
this.ce[i-1]=parseInt(this.ce[i]);
}
this.custom(0,1);
}});
var detect=navigator.userAgent.toLowerCase();
var OS,browser,version,total,thestring;
if(checkIt("konqueror")){
browser="Konqueror";
OS="Linux";
}else{
if(checkIt("safari")){
browser="Safari";
}else{
if(checkIt("opera")){
browser="Opera";
}else{
if(checkIt("msie")){
browser="IE";
}else{
if(!checkIt("compatible")){
browser="Netscape Navigator";
version=detect.charAt(8);
}else{
browser="An unknown browser";
}
}
}
}
}
if(!version){
version=detect.charAt(place+thestring.length);
}
if(!OS){
if(checkIt("linux")){
OS="Linux";
}else{
if(checkIt("x11")){
OS="Unix";
}else{
if(checkIt("mac")){
OS="Mac";
}else{
if(checkIt("win")){
OS="Windows";
}else{
OS="an unknown operating system";
}
}
}
}
}
var insideHubEditor=false;
function checkIt(_2f2){
place=detect.indexOf(_2f2)+1;
thestring=_2f2;
return place;
};
function ssToId(id){
var s=new SoftScroll(id);
return false;
};
function ssTo(_2f5){
var s=new SoftScroll("mod_"+_2f5);
return false;
};
function ssOnload(){
var _2f7=location.hash.slice(1);
if(_2f7=="comments"){
ssToId("comFirst");
}else{
if(_2f7.substr(0,8)=="comment-"){
ssToId("comment"+_2f7.substr(8));
}else{
if(_2f7!=null&&_2f7){
ssToId(_2f7);
}
}
}
};
var SoftScroll=Class.create();
SoftScroll.prototype={initialize:function(ele,_2f9,_2fa){
this.ele=$(ele);
this.durat=_2f9||1000;
this.delay=_2fa||0;
if(this.delay){
setTimeout(this.toggle.bind(this),this.delay);
}else{
this.toggle();
}
},toggle:function(){
this.scroll=new fx.Scroll({duration:this.durat});
this.scroll.scrollTo(this.ele);
}};
function insertVideo(type,key,css,_2fe,_2ff,_300){
var _301="<div class=\"video\">";
var mode="opaque";
if(_2ff){
mode="transparent";
}
if(_300=="bad"){
_301="<div class=\"video\" style=\"background-color: #f7e1e1; border-bottom:3px solid #ed9693; color: #440000; padding: 5px;\">"+"<p style=\"margin:0;\">&nbsp;The specified URL is not working</p></div>";
}
if(type=="Google"){
_301+="<embed style=\""+_2fe+"\" class=\""+css+"\" "+"type=\"application/x-shockwave-flash\" id=\"VideoPlayback\" "+"src=\"http://video.google.com/googleplayer.swf?docId="+key+"&hl=en\""+" flashvars=\"\" wmode=\""+mode+"\">"+"</embed>";
}else{
if(type=="YouTube"){
_301+="<embed style=\""+_2fe+"\" class=\""+css+"\" "+"type=\"application/x-shockwave-flash\" "+"src=\"http://www.youtube.com/v/"+key+"\" scale=\"exactFit\" "+"wmode=\""+mode+"\">"+"</embed>";
}else{
if(type=="Revver"){
_301+="<embed style=\""+_2fe+"\" class=\""+css+"\" "+"type=\"application/x-shockwave-flash\" "+"src=\"http://flash.revver.com/player/1.0/player.swf?mediaId="+key+"\" scale=\"exactFit\" "+"wmode=\""+mode+"\" allowfullscreen=\"true\" allowScriptAccess=\"always\" flashvars=\"allowFullScreen=true\">"+"</embed>";
}else{
if(type=="Metacafe"){
_301+="<embed style=\""+_2fe+"\" class=\""+css+"\" "+"type=\"application/x-shockwave-flash\" "+"src=\"http://www.metacafe.com/fplayer/"+key+".swf\" scale=\"exactFit\" "+"wmode=\""+mode+"\">"+"</embed>";
}else{
if(type=="Yahoo"){
var vid=key.substr(0,key.indexOf("/"));
var id=key.substr(key.indexOf("/")+1);
_301+="<embed class=\""+css+"\" flashvars=\"callback_function=YAHOO.yv.Player.SWFInterface&amp;id="+id+"&amp;vid="+vid+"&amp;autoPlay=0"+"&amp;site=video.yahoo.com&amp;lang=en-US&amp;intl=us&amp;"+"thumbUrl=http%3A//us.i1.yimg.com/us.yimg.com/i/us/sch/cn/video08/"+vid+"_rnde180d393_19.jpg\""+" allowfullscreen=\"true\" allowscriptaccess=\"never\" quality=\"high\" bgcolor=\"#000\" scale=\"exactFit\" "+" src=\"http://d.yimg.com/static.video.yahoo.com/yep/YV_YEP.swf\""+" type=\"application/x-shockwave-flash\" wmode=\""+mode+"\" />";
}else{
if(type=="Vimeo"){
_301+="<embed style=\""+_2fe+"\" class=\""+css+"\" "+"type=\"application/x-shockwave-flash\" "+"src=\"http://vimeo.com/moogaloop.swf?clip_id="+key+"&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;"+"show_portrait=0&amp;color=&amp;fullscreen=1\" scale=\"exactFit\" allowFullscreen=\"true\" allowScriptAccess=\"never\" "+"wmode=\""+mode+"\">"+"</embed>";
}else{
if(type=="BlipTV"){
_301+="<embed style=\""+_2fe+"\" class=\""+css+"\" "+"type=\"application/x-shockwave-flash\" "+"src=\"http://blip.tv/play/"+key+"\" scale=\"exactFit\" allowFullscreen=\"true\" allowScriptAccess=\"always\" "+"wmode=\""+mode+"\">"+"</embed>";
}else{
if(type=="Unknown"){
_301+="<p style=\"margin-left:1em\">The specified URL was not recognized</p>";
}else{
_301+="<p style=\"margin-left:1em\">Video Not Available</p>";
}
}
}
}
}
}
}
}
_301+="</div>";
if(_2ff){
Element.update(_2ff,_301);
}else{
if(type!="New"){
document.write(_301);
}
}
};
function tagFan(id,_306){
var _307="tagFan_"+id;
var uri=$H({k:id,action:_306}).toQueryString();
var ajax=new Ajax.Updater({success:_307},"/xml/tagFan.php",{parameters:uri,onFailure:reportError});
return false;
};
function recArt(id,val){
var _30c="rec_"+id;
var uri=$H({a:id,v:val}).toQueryString();
var ajax=new Ajax.Updater({success:_30c},"/xml/feedback.php",{parameters:uri,onFailure:reportError});
return false;
};
function requestStatus(id,_310,_311){
var uri=$H({a:id,v:_311}).toQueryString();
var ajax=new Ajax.Updater({success:_310},"/xml/request.php",{parameters:uri,onFailure:reportError});
return false;
};
function categoryFanSignupNewUser(){
if(categoryFanCountChecked()==0){
$("warning").show();
}else{
categoryFanBulkJoin("category_fan_new_user",true);
}
};
function categoryFanSearchNewUser(){
$("nextStep").show();
categoryFanSearch("category_fan_new_user","category_fan_search_text",12);
};
function categoryFanMy(){
categoryFanBulkJoin("my_category_fans",false,true);
$("category_fan_search").innerHTML="";
$("category_fan_search_text").value="";
return false;
};
function categoryFanCountChecked(){
var _314=document.getElementsByClassName("jc");
var _315=0;
for(var j=0;j<_314.length;j++){
if(_314[j].checked){
_315++;
}
}
return _315;
};
function categoryFanBulkJoin(id,_318,_319){
var _31a=document.getElementsByClassName("jc");
var cids=Array();
var _31c=Array();
var i=0;
var k=0;
for(var j=0;j<_31a.length;j++){
if(_31a[j].checked){
cids[i++]=Number(_31a[j].name.substr(3));
}else{
_31c[k++]=Number(_31a[j].name.substr(3));
}
}
checked_ids=cids.join(",");
unchecked_ids=_31c.join(",");
var ajax=new Ajax.Updater({success:id},"/xml/categoryFanBulkJoin.php",{parameters:$H({checked_ids:checked_ids,unchecked_ids:unchecked_ids,html_target:id}).toQueryString(),onSuccess:function(){
if(_318){
window.location.replace("/contacts/newuser.php");
}else{
if(_319){
setTimeout(categoryFanHighlight,500);
}
}
}});
return false;
};
function categoryFanHighlight(){
var elts=$$(".highlighted");
elts.each(function(elt){
var _323=new fx.Color(elt,{duration:700,fromColor:"#feffd7",toColor:"#ffffff"});
_323.toggle();
});
};
function categoryFanSearch(_324,_325,_326,cols){
if(!_326){
var _326=8;
}
if(!cols){
var cols=2;
}
var ajax=new Ajax.Updater({success:_324},"/xml/categoryFanSearch.php",{parameters:$H({search:$F(_325),limit:_326,cols:cols})});
return false;
};
function toggleActivityPrefs(){
var _329=$("edit_button");
var _32a=$("filter").value;
var _32b="edit";
if(_329.innerHTML=="save changes"){
_32b="save";
}
if(_32b=="save"){
var _32c=0;
var _32d=document.getElementsByClassName("ht_box");
for(var j=0;j<_32d.length;j++){
if(_32d[j].checked){
_32c+=Number(_32d[j].name.substr(3));
}
}
var _32f=$("current_prefs");
if(_32c!=_32f.value){
var _330=function(){
Element.update(_329,"saved");
_329.style.background="#ebb";
var text=new fx.Text(_329,{duration:400,onComplete:function(){
this.custom(1.3,1);
this.options.onComplete=function(){
Element.update($("edit_button"),"edit preferences");
$("edit_button").style.background="#999";
};
}});
text.custom(1,1.3);
};
var ajax=new Ajax.Updater({success:"content"},"/xml/activityPref.php",{parameters:$H({prefs:_32c,filter:_32a}).toQueryString(),onComplete:_330});
_32f.value=_32c;
}else{
Element.update(_329,"no changes");
_329.style.background="#ebb";
_329.style.text_decoration="none";
var text=new fx.Text(_329,{duration:400,onComplete:function(){
this.custom(1.3,1);
this.options.onComplete=function(){
Element.update($("edit_button"),"edit preferences");
$("edit_button").style.background="#999";
};
}});
text.custom(1,1.3);
}
}
var curs=document.getElementsByClassName("ht_cur");
var _335="";
for(var i=0;i<curs.length;i++){
_335=curs[i].className;
}
var eles=document.getElementsByClassName("ht_pref");
for(var i=0;i<eles.length;i++){
if(_32b=="edit"){
if(_335=="ht_all ht_cur"){
eles[i].style.display="block";
}else{
if(eles[i].parentNode.className==_335){
eles[i].style.display="block";
}
}
}else{
eles[i].style.display="none";
}
}
if(_32b=="edit"){
_329.innerHTML="save changes";
}
return false;
};
function toggleShareIt(id,flg){
if(flg){
var uri=$H({art_id:id}).toQueryString();
var ajax=new Ajax.Updater({success:"share_tgt"},"/xml/shareit.php",{parameters:uri,onFailure:reportError});
}else{
$("share_tgt").innerHTML="";
}
return false;
};
function expandComments(id,mm,flg){
if(flg){
var _33f=$H({mdc_id:id,modMode:mm}).toQueryString();
var ajax=new Ajax.Updater({success:"comment_tgt"},"/xml/comments.php",{parameters:_33f,onFailure:reportError});
}else{
$("comment_tgt").innerHTML="";
}
return false;
};
function changeTags(_341,_342,_343){
var ajax=new Ajax.Updater({success:"tagmap"},"/xml/tagmap.php",{parameters:$H({user_id:_341,randomize:_342,display:_343}).toQueryString(),onFailure:reportError});
return false;
};
function toggleStats(e,id){
var tar=Event.element(e);
var pane=$("authorcenter_pane");
if(tar.showing_stats){
Element.hide(pane);
Element.update(tar,tar.showing_stats);
tar.showing_stats=false;
}else{
var _349=function(req){
Element.show(pane);
tar.showing_stats=tar.innerHTML;
Element.update(tar,"&nbsp;HIDE STATS&nbsp;");
};
var ajax=new Ajax.Updater({success:"authorcenter_pane"},"/xml/articlestats.php",{onComplete:_349,parameters:$H({art_id:id}).toQueryString(),onFailure:reportError});
}
return false;
};
function toggleUserStats(e,id){
var tar=Event.element(e);
var pane=$("usercenter_pane");
if(tar.showing_stats){
Element.hide(pane);
Element.update(tar,tar.showing_stats);
tar.showing_stats=false;
}else{
var _350=function(req){
Element.show(pane);
tar.showing_stats=tar.innerHTML;
Element.update(tar,"&nbsp;HIDE STATS&nbsp;");
};
var ajax=new Ajax.Updater({success:"usercenter_pane"},"/xml/userstats.php",{onComplete:_350,parameters:$H({user_id:id}).toQueryString(),onFailure:reportError});
}
return false;
};
function toggleRequestStats(e,id){
var tar=Event.element(e);
var pane=$("requestcenter_pane");
if(tar.showing_stats){
Element.hide(pane);
Element.update(tar,tar.showing_stats);
tar.showing_stats=false;
}else{
var _357=function(req){
Element.show(pane);
tar.showing_stats=tar.innerHTML;
Element.update(tar,"&nbsp;HIDE STATS&nbsp;");
};
var ajax=new Ajax.Updater({success:"requestcenter_pane"},"/xml/requeststats.php",{onComplete:_357,parameters:$H({request_id:id}).toQueryString(),onFailure:reportError});
}
return false;
};
function toggleCategoryStats(e,id){
var tar=Event.element(e);
var pane=$("categorycenter_pane");
if(tar.showing_stats){
Element.hide(pane);
Element.update(tar,tar.showing_stats);
tar.showing_stats=false;
}else{
var _35e=function(req){
Element.show(pane);
tar.showing_stats=tar.innerHTML;
Element.update(tar,"&nbsp;HIDE STATS&nbsp;");
};
var ajax=new Ajax.Updater({success:"categorycenter_pane"},"/xml/categorystats.php",{onComplete:_35e,parameters:$H({category_id:id}).toQueryString(),onFailure:reportError});
}
return false;
};
function toggleMyAccountHelp(){
var _361=$("show_myhelp");
var _362=$("myhelp");
if(_361.innerHTML=="help"){
Element.show(_362);
Element.update(_361,"hide");
}else{
Element.hide(_362);
Element.update(_361,"help");
}
return false;
};
function showDupeHistory(){
var hist=$("toggle_history");
var pane=$("dupe_history");
if(hist.innerHTML=="hide history"){
Element.hide(pane);
Element.update(hist,"show history");
}else{
Element.show(pane);
Element.update(hist,"hide history");
}
return false;
};
function updateDupes(e,_366){
var tar=Event.element(e);
var pane=$("dupe_history");
var hist=$("toggle_history");
Element.update(tar,"processing");
var _36a=function(req){
Element.show(pane);
Element.update(tar,"check");
Element.update(hist,"hide history");
};
var ajax=new Ajax.Updater({success:"dupe_history"},"/xml/dupecheck.php",{onComplete:_36a,parameters:$H({articleId:_366}).toQueryString(),onFailure:reportError});
return false;
};
function activity_why(id,_36e,_36f,_370){
var ajax=new Ajax.Updater({success:id},"/xml/activity_why.php",{parameters:$H({actionTypeId:_36e,actionTargetId:_36f,createDate:_370}).toQueryString(),onFailure:reportError});
return false;
};
function request_reviewed(id){
var ajax=new Ajax.Updater({success:"request_reviewed"},"/xml/request_reviewed.php",{parameters:$H({req_id:id}).toQueryString(),onFailure:reportError});
};
function article_reviewed(id){
var ajax=new Ajax.Updater({success:"article_reviewed"},"/xml/article_reviewed.php",{parameters:$H({art_id:id}).toQueryString(),onFailure:reportError});
};
function article_flag(id,flag){
var ajax=new Ajax.Updater({success:"flaglink_"+id+"_"+flag},"/xml/flaghub.php",{parameters:$H({aID:id,reason:flag}).toQueryString(),onFailure:reportError});
};
function article_learn(_379,_37a,key){
var ajax=new Ajax.Updater({success:"learn"},"/xml/authorcenter_learn.php",{parameters:$H({artId:_379,flagId:_37a,key:key}).toQueryString(),onFailure:reportError});
$("learn").style.display="block";
};
function ellipse(str,_37e){
if(str.length>_37e&&_37e!=0){
str=str.substr(0,_37e-3);
var pos=str.lastIndexOf(" ");
if(pos===-1){
str=str.substr(0,_37e-3)+"...";
}else{
str=str.substr(0,pos)+"...";
}
}
return str;
};
function loadRandomArt(_380,_381){
var ajax=new Ajax.Request("/xml/random.php",{method:"post",parameters:"score="+_381,onFailure:reportError,onComplete:function(req){
_380.location.href=req.responseText;
}});
};
function toggleCommentEdit(_384,_385){
if(_385){
$("cedit_"+_384).style.display="none";
$("cbox_"+_384).style.display="";
$("ctext_"+_384).style.display="none";
}else{
$("cedit_"+_384).style.display="";
$("cbox_"+_384).style.display="none";
$("ctext_"+_384).style.display="";
}
};
function reportError(req){
alert("Something went wrong.  Please try again. And when you get a chance, report this issue using the 'feedback' link.");
var _387=req.getAllResponseHeaders();
var ajax=new Ajax.Request("/xml/reporterror.php",{parameters:_387+"&error=1"});
};
function addTagEntries(){
var _389=4;
var _38a=document.createElement("div");
_38a.id="moreEntryDiv";
var li=null;
var _38c=4+1;
var _38d=_38c+_389;
for(var i=_38c;i<_38d;i++){
li=document.createElement("li");
_38a.appendChild(li);
var _38f=document.createElement("input");
_38f.className="tagEntry";
_38f.name="tag_"+i;
_38f.type="text";
_38f.size=40;
li.appendChild(_38f);
}
$("tagEntries").appendChild(_38a);
return true;
};
function hubtool_add_tag(_390){
var _391=(_390)?$(_390):$("add_tag_input");
if(!_391){
return;
}
var tag;
if(Field.present(_391)&&_391.type){
tag=$F(_391);
Field.clear(_391);
}else{
if(_391.innerHTML){
tag=_391.innerHTML;
Element.remove(Element.findElement(_391,"li"));
}
}
if(!tag){
return;
}
var _393=0;
var _394=/^tag_(\d+)$/i;
var _395=document.getElementsByClassName("tagEntry");
_395.each(function(ele){
if(ele.id){
var ms=_394.exec(ele.id);
if(ms&&ms.length>0){
var id=parseInt(ms[1],10);
if($F(ele).length&&id>_393){
_393=id;
}
}
}
});
_393++;
var _399="tag_"+_393;
var _39a=$("add_tag_input").parentNode;
var _39b="<input class=\"tagEntry\" id=\""+_399+"\" name=\""+_399+"\" value=\""+tag+"\" size=\"30\" onFocus=\"_helpOn('help__tags')\" onBlur=\"_helpOff('help__tags')\" />";
if($(_399)){
var _39c=$(_399).tabIndex;
Element.update($(_399).parentNode,_39b);
$(_399).tabIndex=_39c;
}else{
var _39d=$("tag_1").tabIndex-1;
var _39c=_39d+_393;
var pole=new Insertion.Before(_39a,"<li>"+_39b+"</li>");
$(_399).tabIndex=_39c;
_39c=$("add_tag_input").tabIndex;
_39c++;
$("add_tag_input").tabIndex=_39c;
}
return false;
};
function add_calculated_tag(_39f,tag,_3a1){
var _3a2=tag.replace(/'/g,"\\'");
var _3a3=tag.replace(/ /g,"+");
var _3a4="tagd_"+tag.replace(/ /g,"_");
_3a4=_3a4.toLowerCase();
if($(_3a4)){
$(_3a4).style.fontWeight="bolder";
Field.clear("add_tag_input");
}else{
if(!tag.match(/^[a-zA-Z0-9 \-\'\&\.]{2,100}$/)){
alert("Invalid tag \""+tag+"\".\n\nTags should be from 2-100 characters, and contain only numbers, letters, spaces, dashes, periods, and ampersands.");
}else{
var _3a5=$("nav_tags_edit");
var _3a6="<a href=\"javascript:void delete_tag('"+_39f+"','"+_3a2+"');\"><img src=\"http://x.hubpages.com/x/hubtool_discard_tag.gif\" width=\"14\" height=\"14\"/></a>";
_3a6+="<a id=\""+_3a4+"\" href=\"/tag/"+_3a3+"\">"+tag+"</a>";
var item=document.createElement("li");
item.innerHTML=_3a6;
_3a5.appendChild(item);
save_tag(_39f,tag,false);
}
}
var _3a8=$(_3a1);
Element.remove(Element.findElement(_3a8,"li"));
return false;
};
function update_suggested_tags(_3a9){
var _3aa=$H({id:_3a9});
var ajax=new Ajax.Updater({success:"suggested_tags"},"/xml/suggestedtags.php",{parameters:_3aa,onFailure:reportError,onComplete:function(){
}});
};
function add_tag(_3ac){
if(!$("add_tag_input")||!$F("add_tag_input")){
return;
}
var tag=$F("add_tag_input");
var _3ae=tag.replace(/'/g,"\\'");
var _3af=tag.replace(/ /g,"+");
var _3b0="tagd_"+tag.replace(/ /g,"_");
_3b0=_3b0.toLowerCase();
if($(_3b0)){
$(_3b0).style.fontWeight="bolder";
Field.clear("add_tag_input");
}else{
if(!tag.match(/^[a-zA-Z0-9 \-\'\&\.]{2,100}$/)){
alert("Invalid tag \""+tag+"\".\n\nTags should be from 2-100 characters, and contain only numbers, letters, spaces, dashes, periods, and ampersands.");
}else{
var _3b1=$("nav_tags_edit");
var _3b2="<a href=\"javascript:void delete_tag('"+_3ac+"','"+_3ae+"');\"><img src=\"http://x.hubpages.com/x/hubtool_discard_tag.gif\" width=\"14\" height=\"14\"/></a>";
_3b2+="<a id=\""+_3b0+"\" href=\"/tag/"+_3af+"\">"+tag+"</a>";
var item=document.createElement("li");
item.innerHTML=_3b2;
_3b1.appendChild(item);
save_tag(_3ac,tag,false);
Field.clear("add_tag_input");
}
}
return false;
};
function delete_tag(_3b4,tag){
if(!_3b4||!tag){
return;
}
var _3b6="tagd_"+tag.replace(/ /g,"_");
var _3b7=$(_3b6);
if(!_3b7){
return;
}
var li=_3b7.parentNode;
Element.remove(li);
save_tag(_3b4,tag,true);
return false;
};
function save_tag(_3b9,tag,del){
var _3bc=(del)?1:0;
var req={a:_3b9,v:tag,d:_3bc};
var _3be=$H(req).toQueryString();
var ajax=new Ajax.Request("/xml/tagadd.php",{parameters:_3be,onFailure:reportError,onComplete:function(){
}});
};
function fireOnReturn(_3c0,func){
Event.observe(_3c0,"keyup",function(_3c2){
_3c2=_3c2||window.event;
if(_3c2.which){
if(_3c2.which==Event.KEY_RETURN){
_3c2.preventDefault();
func();
}
}else{
if(_3c2.keyCode){
if(_3c2.keyCode==Event.KEY_RETURN){
Event.stop(_3c2);
func();
}
}
}
},false);
};
function moderate_comment(_3c3,_3c4,_3c5){
if(!_3c3||!_3c4||!_3c5){
return;
}
ccId="cc_"+_3c3+"_"+_3c4;
var req={mod_id:_3c3,comment_id:_3c4,action:_3c5};
var _3c7=$H(req).toQueryString();
var ajax=new Ajax.Updater({success:ccId},"/xml/modcom.php",{parameters:_3c7,onFailure:reportError});
return false;
};
function moderate_fanmail(_3c9,_3ca,_3cb){
if(!_3c9||!_3ca){
return;
}
ccId="fanmail__"+_3c9+"__"+_3ca;
var _3cc=$(ccId);
if(!_3cc){
return;
}
var req={fan_id:_3c9,comment_id:_3ca,action:_3cb};
var _3ce=$H(req).toQueryString();
var ajax=new Ajax.Updater({success:ccId},"/xml/modfanmail.php",{parameters:_3ce,onFailure:reportError});
return false;
};
function save_aff(aff,val){
if(!aff){
return;
}
var req={aff:aff,v:val};
var _3d3=$H(req).toQueryString();
var ajax=new Ajax.Request("/xml/userprofile.php",{parameters:_3d3,onFailure:reportError,onComplete:function(_3d5){
var _3d6=$(aff+"_code_status");
Element.update(_3d6,"Saved");
var _3d7=_3d5.responseText;
if(_3d7!="Set"&&_3d7!="Not Set"){
_3d7="Error";
}
var text=new fx.Text(_3d6,{duration:500,onComplete:function(){
this.custom(1.6,1);
this.options.onComplete=function(){
Element.update(_3d6,_3d7);
};
}});
text.custom(1,1.6);
}.bind(aff)});
return false;
};
function InlineEdit(){
};
InlineEdit._registered=[];
InlineEdit._onedit=[];
InlineEdit._ondone=[];
InlineEdit._editting=[];
InlineEdit._setonclick=false;
InlineEdit.register=function(ele,_3da){
var obj=$(ele);
obj.title="Click to edit";
obj.style.backgroundColor="#ffe";
obj.empty_text="";
InlineEdit._registered[obj.id]=_3da;
obj.highlight=function(){
if(this.hide_timer){
clearTimeout(this.hide_timer);
}
this.style.backgroundColor="#ffffd3";
if(this.empty_text&&(this.innerHTML=="&nbsp;"||this.innerHTML==" "||this.innerHTML.charCodeAt(0)==160)){
this.innerHTML=this.empty_text;
}
};
obj.onmouseover=obj.highlight;
obj.onmouseout=function(){
if(this.hide_timer){
clearTimeout(this.hide_timer);
}
this.hide_timer=setTimeout("var el=$('"+this.id+"');if (el) {el.unhighlight();}",1000);
};
obj.unhighlight=function(){
this.style.backgroundColor="#ffe";
if(this.empty_text&&this.innerHTML==this.empty_text){
this.innerHTML="&nbsp;";
}
};
if(!InlineEdit._setonclick){
document.onclick=InlineEdit._handleDocClick;
InlineEdit._setonclick=true;
}
};
InlineEdit.unregister=function(ele){
var obj=$(ele);
obj.title="";
if(obj.hide_timer){
clearTimeout(obj.hide_timer);
}
obj.onmouseover=function(){
};
obj.onmouseout=function(){
};
obj.style.backgroundColor="";
delete InlineEdit._registered[obj.id];
};
InlineEdit.registerCallbacks=function(ele,_3df,_3e0){
var obj=$(ele);
InlineEdit._onedit[obj.id]=_3df;
InlineEdit._ondone[obj.id]=_3e0;
};
InlineEdit._handleDocClick=function(e){
if(!document.getElementById||!document.createElement){
return;
}
var obj;
if(!e){
obj=window.event.srcElement;
}else{
obj=e.target;
}
while(obj.nodeType!=1){
obj=obj.parentNode;
}
if(obj.tagName=="TEXTAREA"||obj.tagName=="A"){
return;
}
while(!InlineEdit._registered[obj.id]&&obj.nodeName!="HTML"){
obj=obj.parentNode;
}
if(obj.nodeName=="HTML"){
return;
}
InlineEdit.edit(obj);
};
InlineEdit.edit=function(ele){
ele=$(ele);
if(!InlineEdit._registered[ele.id]){
return false;
}
if(InlineEdit._onedit[ele.id]){
var _3e5=InlineEdit._onedit[ele.id];
_3e5(ele);
}
var text=ele.innerHTML;
if(ele.empty_text&&ele.empty_text==text){
text=" ";
}
var _3e7=document.createElement("INPUT");
_3e7.type="text";
Element.cloneStyles(ele,_3e7);
ele.parentNode.insertBefore(_3e7,ele);
InlineEdit._insertEditSpanBefore(ele);
_3e7.id=ele.id+"_edit_inplace";
InlineEdit._editting[_3e7.id]=ele;
Element.remove(ele);
_3e7.value=text;
_3e7.focus();
_3e7.select();
return false;
};
InlineEdit._onButtonClick=function(_3e8){
_3e8=_3e8||window.event;
var _3e9=_3e8.target||_3e8.srcElement;
var _3ea=(_3e9.innerHTML.search(/CANCEL/)==-1)?true:false;
var _3eb=_3e9.parentNode;
var _3ec=_3eb;
while(_3ec&&!InlineEdit._editting[_3ec.id]){
_3ec=_3ec.previousSibling;
}
var _3ed=InlineEdit._editting[_3ec.id];
_3ec.hasFocus=false;
var z=_3ec.parentNode;
z.insertBefore(_3ed,_3ec);
z.removeChild(_3ec);
z.removeChild(document.getElementsByClassName("buttonSpan",z)[0]);
delete InlineEdit._editting[_3ec.id];
if(InlineEdit._ondone[_3ed.id]){
var _3ef=InlineEdit._ondone[_3ed.id];
_3ef(_3ed);
}
if(_3ea){
_3ed.innerHTML=(_3ec.value.length>0)?_3ec.value:"&nbsp;";
var _3f0=InlineEdit._registered[_3ed.id];
_3f0(_3ec.value);
}
};
InlineEdit._insertEditSpanBefore=function(obj){
if(document.getElementById&&document.createElement){
var _3f2=document.createElement("span");
_3f2.className="buttonSpan";
var butt=document.createElement("button");
var _3f4=document.createTextNode("OK");
butt.appendChild(_3f4);
_3f2.appendChild(butt);
var _3f5=document.createElement("button");
var _3f6=document.createTextNode("CANCEL");
_3f5.appendChild(_3f6);
_3f2.appendChild(_3f5);
obj.parentNode.insertBefore(_3f2,obj);
butt.onclick=InlineEdit._onButtonClick;
_3f5.onclick=InlineEdit._onButtonClick;
}
};
var SampleDuration=Class.create();
SampleDuration.prototype={initialize:function(_3f7){
this.art_id=_3f7;
this.t=new Timer();
this.onleaveListener=this.onleave.bindAsEventListener(this);
Event.observe(window,"beforeunload",this.onleaveListener,false);
},onleave:function(e){
e=e||window.event;
this.t.stop();
var _3f9=$H({art_id:this.art_id,dur:this.t.length});
var ajax=new Ajax.Request("/xml/duration",{parameters:_3f9.toQueryString()});
}};
var myGlobalHandlers={onCreate:function(){
this.flag(true);
},onComplete:function(){
if(Ajax.activeRequestCount==0){
this.flag(false);
this.shouldShowIcon=false;
}
},onScroll:function(){
var div=insideHubEditor?$("ajaxing_big"):$("ajaxing");
if(div){
var _3fc=insideHubEditor?200:0;
div.style.top=(Position.getViewportScrollY()+_3fc)+"px";
}
},flagUp:function(){
this.flag(true);
},flagDown:function(){
this.flag(false);
},flag:function(up){
if(up){
this.shouldShowIcon=true;
setTimeout(this.showIcon.bind(this),2000);
}else{
if(!this.iconVisible){
return;
}
var _3fe=insideHubEditor?$("ajaxing_big"):$("ajaxing");
if(_3fe){
this.shouldShowIcon=false;
_3fe.style.display="none";
Event.stopObserving(window,"scroll",this.scrollListener,false);
this.scrollListener=null;
this.iconVisible=false;
}
}
},showIcon:function(id){
if(this.shouldShowIcon&&!this.iconVisible&&Ajax.activeRequestCount>0){
this.iconVisible=true;
var _400=insideHubEditor?$("ajaxing_big"):$("ajaxing");
_400.style.display="inline";
this.onScroll();
this.scrollListener=this.onScroll.bindAsEventListener(this);
Event.observe(window,"scroll",this.scrollListener,false);
}
}};
Ajax.Responders.register(myGlobalHandlers);
Element.setOpacity=function(ele,_402){
ele=$(ele);
if(window.ActiveXObject){
ele.style.filter="alpha(opacity="+Math.round(_402*100)+")";
}
ele.style.opacity=_402;
};
Element.getCurrentStyle=function(ele){
ele=$(ele);
var _404;
if(document.defaultView){
_404=document.defaultView.getComputedStyle(ele,"");
}else{
_404=ele.currentStyle;
}
return _404;
};
Element.cloneStyles=function(ele,_406,_407){
ele=$(ele);
_406=$(_406);
var _408=Element.getCurrentStyle(ele);
for(var name in _408){
if(browser=="Opera"){
if(name=="height"||name=="pixelHeight"||name=="pixelWidth"||name=="posHeight"||name=="posWidth"||name=="width"||name=="font"||name=="fontSize"){
continue;
}
}
var _40a=_408[name];
if(_40a!==""&&!(_40a instanceof Object)&&name!="length"&&name!="parentRule"){
if(_407&&name.indexOf(_407)!==0){
continue;
}
_406.style[name]=_40a;
}
}
return _406;
};
Element.findElement=function(_40b,_40c){
_40b=$(_40b);
while(_40b.parentNode&&(!_40b.tagName||(_40b.tagName.toUpperCase()!=_40c.toUpperCase()))){
_40b=_40b.parentNode;
}
return _40b;
};
String.prototype.trim=function(){
var res=this;
while(res.substring(0,1)==" "){
res=res.substring(1,res.length);
}
while(res.substring(res.length-1,res.length)==" "){
res=res.substring(0,res.length-1);
}
return res;
};
String.prototype.startsWith=function(_40e){
var res=this;
return res.substring(0,_40e.length)==_40e;
};
Element.getWidth=function(ele){
ele=$(ele);
return ele.offsetWidth;
};
Element.ellipsis=function(ele,len){
len=len||(100);
var p=$(ele);
if(p&&p.innerHTML){
var _414=p.innerHTML;
if(_414.length>len){
_414=_414.substring(0,len);
_414=_414.replace(/\w+$/,"");
_414+="...";
p.innerHTML=_414;
}
}
};
Position.getViewportHeight=function(){
if(window.innerHeight!=window.undefined){
return window.innerHeight;
}
if(document.compatMode=="CSS1Compat"){
return document.documentElement.clientHeight;
}
if(document.body){
return document.body.clientHeight;
}
return window.undefined;
};
Position.getViewportWidth=function(){
if(window.innerWidth!=window.undefined){
return window.innerWidth;
}
if(document.compatMode=="CSS1Compat"){
return document.documentElement.clientWidth;
}
if(document.body){
return document.body.clientWidth;
}
return window.undefined;
};
Position.getDocumentHeight=function(){
return document.documentElement.scrollHeight;
};
Position.getDocumentWidth=function(){
return document.documentElement.scrollWidth;
};
Position.getViewportScrollX=function(){
var _415=0;
if(document.documentElement&&document.documentElement.scrollLeft){
_415=document.documentElement.scrollLeft;
}else{
if(document.body&&document.body.scrollLeft){
_415=document.body.scrollLeft;
}else{
if(window.pageXOffset){
_415=window.pageXOffset;
}else{
if(window.scrollX){
_415=window.scrollX;
}
}
}
}
return _415;
};
Position.getViewportScrollY=function(){
var _416=0;
if(document.documentElement&&document.documentElement.scrollTop){
_416=document.documentElement.scrollTop;
}else{
if(document.body&&document.body.scrollTop){
_416=document.body.scrollTop;
}else{
if(window.pageYOffset){
_416=window.pageYOffset;
}else{
if(window.scrollY){
_416=window.scrollY;
}
}
}
}
return _416;
};
Position.withinViewport=function(ele){
var off=Position.cumulativeOffset($(ele));
var _419=[0+Position.getViewportScrollX(),Position.getViewportScrollY()];
var _41a=[_419[0]+Position.getViewportWidth(),_419[1]+Position.getViewportHeight()];
return (_419[0]<off[0]&&off[0]<_41a[0]&&_419[1]<off[1]&&off[1]<_41a[1]);
};
Position.set=function(ele,_41c){
if(ele&&_41c){
ele.style.left=_41c[0]+"px";
ele.style.top=_41c[1]+"px";
}
};
function updateAdLevelOptions(){
isCommercial=document.getElementById("isCommercial");
adLevelSelect=document.getElementById("adLevelSelect");
if(isCommercial.checked){
for(i=adLevelSelect.length-2;i>=0;i--){
adLevelSelect.options[i].disabled=true;
adLevelSelect.selectedIndex=adLevelSelect.length-1;
}
}else{
for(i=adLevelSelect.length-1;i>=0;i--){
adLevelSelect.options[i].disabled=false;
}
}
};
function select_all(name,_41e,end){
for(var i=_41e;i<=end;i++){
var ele=$(name+"_"+i);
if(ele){
ele.checked=true;
}
}
var disp=$(name+"_selected");
if(disp){
disp.innerHTML=(end-_41e)+1;
}
update_plural(name);
};
function unselect_all(name,_424,end){
for(var i=_424;i<=end;i++){
var ele=$(name+"_"+i);
if(ele){
ele.checked=false;
}
}
var disp=$(name+"_selected");
if(disp){
disp.innerHTML=0;
}
update_plural(name);
};
function checkbox_onchange(name,num){
var disp=$(name+"_selected");
if(disp){
var ele=$(name+"_"+num);
if(ele.checked){
disp.innerHTML=parseInt(disp.innerHTML,10)+1;
update_plural(name);
}else{
disp.innerHTML=parseInt(disp.innerHTML,10)-1;
update_plural(name);
}
}
};
function update_plural(name){
var ele=document.getElementById(name+"_selected");
if(ele){
var disp=document.getElementById(name+"_plural");
if(disp){
if(parseInt(ele.innerHTML,10)==1){
disp.innerHTML=" is";
}else{
disp.innerHTML="s are";
}
}
}
};
function import_now(_430,name,_432,end){
var _434=self.opener.document.getElementById(_430);
if(_434){
for(var i=_432;i<=end;i++){
var ele=$(name+"_"+i);
if(ele&&ele.checked){
var _437=$(name+"_email_"+i);
if(_434.value.length<2||_434.value.charAt(_434.value.length)==","||_434.value.charAt(_434.value.length-1)==","){
_434.value=_434.value+_437.innerHTML;
}else{
_434.value=_434.value+", "+_437.innerHTML;
}
}
}
}else{
alert("cannot locate parent (opener) window!");
}
};
function charCounter(_438,_439,max){
var _43b=document.getElementById(_438);
var _43c=document.getElementById(_439);
if(!_43b){
alert("charCounter bad source: "+_438);
}
if(!_43c){
alert("charCounter bad source: "+_439);
}
if(_43b.value.length>max){
_43b.value=_43b.value.substring(0,max);
}
_43c.value=max-_43b.value.length;
};
function hideAnswers(){
$("hiddenAnswers").hide();
$("hideAnswers").hide();
$("showAnswers").show();
return false;
};
function showAnswers(){
$("hiddenAnswers").show();
$("hideAnswers").show();
$("showAnswers").hide();
return false;
};
function answerVote(id,v){
new Ajax.Updater("voting_"+id,"/xml/answervote.php",{parameters:{id:id,vote:v}});
return false;
};
function answerVoteDown(id){
return answerVote(id,-1);
};
function answerVoteUp(id){
return answerVote(id,1);
};
function getEvent(evt){
return window.event||evt;
};
function getKeyProperties(evt){
var e=getEvent(evt);
var k=e.keyCode?e.keyCode:e.charCode?e.charCode:e.which;
var t=e.target?e.target:e.srcElement?e.srcElement:e.which;
return {evt:e,keyCode:k,target:t};
};
function checkTabKeyAlone(evt){
var p=getKeyProperties(evt);
return (p.keyCode==9&&!p.evt.shiftKey&&!p.evt.ctrlKey&&!p.evt.altKey);
};
function checkShiftTabKey(evt){
var p=getKeyProperties(evt);
return (p.keyCode==9&&p.evt.shiftKey&&!p.evt.ctrlKey&&!p.evt.altKey);
};
function getSelectionProperties(evt){
var p=getKeyProperties(evt);
var tr=(p.target.setSelectionRange)?null:document.selection.createRange();
var tab=String.fromCharCode(9);
if(tr){
var br=document.body.createTextRange();
br.moveToElementText(p.target);
br.setEndPoint("StartToStart",tr);
var ss=p.target.value.length-br.text.length;
var se=ss+tr.text.length;
}else{
var ss=p.target.selectionStart;
var se=p.target.selectionEnd;
}
return {setSelection:function(ss,se){
if(tr){
var adj=ss-tab.length*(p.target.value.substring(0,ss).split("\n").length-1);
var adj2=se+tab.length*(p.target.value.substring(se,p.target.value.length).split("\n").length-1);
var nr=document.body.createTextRange();
nr.moveToElementText(p.target);
nr.moveStart("character",adj);
nr.moveEnd("character",-(p.target.value.length-adj2));
nr.select();
}else{
p.target.selectionStart=ss;
p.target.selectionEnd=se;
}
},isMultiline:function(){
return (se>(ss+2)&&p.target.value.slice(ss,se-2).indexOf("\n")!=-1);
},removeTab:function(){
if(this.isMultiline()){
var sel=p.target.value.slice(ss,se);
var a=sel.split("\n");
for(var i=0;i<a.length;i++){
if(a[i].slice(0,1)==tab||a[i].slice(0,1)==" "){
a[i]=a[i].slice(1,a[i].length);
}
}
sel=a.join("\n");
var pre=p.target.value.slice(0,ss);
var post=p.target.value.slice(se,p.target.value.length);
p.target.value=pre.concat(sel,post);
this.setSelection(ss,pre.length+sel.length);
}else{
var brt=p.target.value.slice(0,ss);
var ch=brt.slice(brt.length-1,brt.length);
if(ch==tab||ch==" "){
p.target.value=brt.slice(0,brt.length-1).concat(p.target.value.slice(ss,p.target.value.length));
this.setSelection(ss-1,se-1);
}
}
},addTab:function(){
if(this.isMultiline()){
if(ss>0){
ss=p.target.value.slice(0,ss).lastIndexOf("\n")+1;
}
var pre=p.target.value.slice(0,ss);
var sel=p.target.value.slice(ss,se);
var post=p.target.value.slice(se,p.target.value.length);
sel=sel.replace(/\n/g,"\n"+tab);
pre=pre.concat(tab);
p.target.value=pre.concat(sel,post);
this.setSelection(ss,se+(tab.length*sel.split("\n").length));
}else{
var pre=p.target.value.substring(0,ss);
var sel=p.target.value.substring(ss,se);
var post=p.target.value.substring(se,p.target.value.length);
pre=pre.concat(tab);
p.target.value=pre.concat(sel,post);
this.setSelection(ss+tab.length,se+tab.length);
}
}};
};
function getTextAreaSelection(evt){
var p=getKeyProperties(evt);
if(p.target.setSelectionRange){
var ss=p.target.selectionStart;
var se=p.target.selectionEnd;
return (ss!=se)?p.target.value.slice(ss,se):null;
}else{
var r=document.selection.createRange();
return (r.text.length!=0)?r.text:null;
}
};
function updateNumCharCount(_465,_466,_467){
if($(_466).value.length>_465){
$(_466).value=$(_466).value.substring(0,_465);
}
$(_467).update(_465-$(_466).value.length);
};
function checkCharCount(_468,_469,_46a){
updateNumCharCount(_468,_469,_46a);
Event.observe(_469,"click",function(){
updateNumCharCount(_468,_469,_46a);
});
Event.observe(_469,"keypress",function(evt){
updateNumCharCount(_468,_469,_46a);
if(evt.keyCode!=Event.KEY_BACKSPACE&&evt.keyCode!=Event.KEY_LEFT&&evt.keyCode!=Event.KEY_RIGHT&&evt.keyCode!=Event.KEY_UP&&evt.keyCode!=Event.KEY_DOWN&&(browser=="Opera"||evt.keyCode!=Event.KEY_DELETE)){
if($(_469).value.length>=_468){
Event.stop(evt);
return false;
}
}
return true;
});
Event.observe(_469,"keyup",function(){
updateNumCharCount(_468,_469,_46a);
});
Event.observe(_469,"keydown",function(){
updateNumCharCount(_468,_469,_46a);
});
};
function _drawPointerInd(_46c,_46d,_46e){
if(typeof _46e=="undefined"){
_46e="ind";
}
var _46f="<div id=\""+_46e+"\"><div>"+_46d+"</div></div>";
var pole=new Insertion.Bottom(_46c,_46f);
if(!window.ActiveXObject){
$(_46e).style.position="fixed";
}
setTimeout(function(){
if($(_46e)){
Element.remove(_46e);
}
},3500);
};
function getElementDimensions(elem){
var top=0,left=0,_474=elem.getWidth(),_475=elem.getHeight();
do{
top+=elem.offsetTop;
left+=elem.offsetLeft;
elem=elem.offsetParent;
}while(elem!=null);
return {top:top,left:left,right:left+_474,bottom:top+_475};
};
function getElementTop(elem){
var top=0;
do{
top+=elem.offsetTop;
elem=elem.offsetParent;
}while(elem!=null);
return top;
};
function getElementLeft(elem){
var left=0;
do{
left+=elem.offsetLeft;
elem=elem.offsetParent;
}while(elem!=null);
return left;
};
function getElementRight(elem){
return getElementLeft(elem)+elem.getWidth();
};
function getElementBottom(elem){
return getElementTop(elem)+elem.getHeight();
};
function removePXFromSize(size){
if(size.length>2&&size.substring(size.length-2).toLowerCase()=="px"){
return size.substring(0,size.length-2);
}else{
return size;
}
};
function StringBuffer(){
this.buffer=[];
};
StringBuffer.prototype.append=function(_47d){
this.buffer.push(_47d);
return this;
};
StringBuffer.prototype.toString=function toString(){
return this.buffer.join("");
};
function dump_divs(){
var _47e="DIV REPORT:<br/>";
var divs=$A(document.getElementsByTagName("div"));
divs.each(function(div){
if(div.id){
_47e+="#"+div.id+", ";
}
_47e+="."+div.className+", "+div.offsetWidth+" x "+div.offsetHeight+"<br/>";
});
if(!$("debug_div")){
out("create");
}
$("debug_div").innerHTML=_47e;
};
function out(_481){
if(window.console){
console.log(_481);
}else{
var pole;
var _483="<div id=\"debug_div\"></div>";
if(!$("debug_div")){
if($("footer")){
pole=new Insertion.Bottom("footer",_483);
}else{
if($("sidebar")){
pole=new Insertion.Bottom("sidebar",_483);
}
}
}
if($("debug_div")){
pole=new Insertion.Bottom("debug_div",_481+"<br/>");
}
}
};
function search_escape(str){
newstr=encodeURI(str);
newstr=newstr.replace(/\%20/g,"+");
return newstr;
};
var Timer=Class.create();
Timer.prototype={initialize:function(){
this.start();
},start:function(){
this.startTime=new Date();
},stop:function(){
this.stopTime=new Date();
this.length=(this.stopTime-this.startTime);
},inspect:function(){
if(!this.stopTime){
this.stop();
}
return "duration: "+this.length+"ms";
}};
function update_user_is_connected(){
var _485=document.getElementById("connect");
_485.innerHTML="<span>"+"<fb:profile-pic uid=loggedinuser facebook-logo=true size=square></fb:profile-pic>"+"&nbsp;&nbsp;&nbsp;<div class='account_logout'>Welcome, <fb:name uid=loggedinuser useyou=false></fb:name>"+" ( <a href='#' onclick='FB.Connect.logout(function() { window.location.reload(); })'> Disconnect from Facebook</a> )</div>"+"</span>";
document.getElementById("connect_code").style.display="block";
FB.XFBML.Host.parseDomTree();
};
function facebook_onload(_486){
FB.ensureInit(function(){
FB.Facebook.get_sessionState().waitUntilReady(function(_487){
var _488=_487?true:false;
if(_488==_486){
return;
}
window.location=$_SERVER["SERVER_URI"];
});
});
};
function facebook_publish_feed_story(_489,_48a){
FB.ensureInit(function(){
FB.Connect.showFeedDialog(_489,_48a);
});
};
function hpFormHandler(_48b){
this.submitMode=false;
this.submitUri="/";
this.nextUri="/";
this.lit=false;
this.form=$(_48b);
this.errors=$H({});
this.method="post";
this.errorHeader="<strong>Please fix these errors before continuing:</strong><br/>";
this.setValidators();
};
hpFormHandler.prototype.handleSubmitServerError=function(req){
};
hpFormHandler.prototype.validateLengthMax=function(ele,max,msg){
var val=$F(ele);
this.testForError(($F(ele).trim().length>max),ele,msg);
};
hpFormHandler.prototype.validateLengthMin=function(ele,min,msg){
var val=$F(ele);
this.testForError((val.length!=0&&val.length<min),ele,msg);
};
hpFormHandler.prototype.validateLengthExactly=function(ele,len,msg){
var val=$F(ele);
this.testForError((val.length!=0&&val.length!=len),ele,msg);
};
hpFormHandler.prototype.validateMandatory=function(ele,msg){
var val=false;
if($F(ele)){
val=$F(ele).trim();
}
this.testForError((!val||val.length==0),ele,msg);
};
hpFormHandler.prototype.validateRegex=function(ele,_49d,msg){
var val=$F(ele);
this.testForError((val.length!=0&&val.search(_49d)==-1),ele,msg);
};
hpFormHandler.prototype.validateNoRegex=function(ele,_4a1,msg){
var val=$F(ele);
this.testForError((val.search(_4a1)!=-1),ele,msg);
};
hpFormHandler.prototype.validateNoSpaces=function(ele,msg){
var val=$F(ele);
this.testForError(val.search(/ /)!=-1,ele,msg);
};
hpFormHandler.prototype.validateNot=function(ele,not,msg){
this.testForError(($F(ele).trim()==not),ele,msg);
};
hpFormHandler.prototype.validateSameAs=function(ele,ele2,msg){
this.testForError(($F(ele)!=$F(ele2)),ele,msg);
};
hpFormHandler.prototype.validateServerCheck=function(ele,url,msg){
var val=$F(ele);
if(val.length==0){
return;
}
if(ele.lastGoodValue&&ele.lastGoodValue==val){
return;
}
val=encodeURIComponent(val);
var _4b1=new Ajax.Request(url,{method:"post",parameters:ele.id+"="+val,onComplete:function(req){
eval(req.responseText);
this.testForError(!valid,ele,msg);
if(valid){
ele.lastGoodValue=val;
}
this._showErrors();
}.bind(this),onException:function(){
alert("Something went very wrong.  Please try submitting again.");
},onFailure:reportError});
};
hpFormHandler.prototype.validateEmailList=function(ele){
var _4b4=800;
var _4b5=6;
this.validateLengthMin(ele,_4b5,"The address you entered is too short. Please use an address at least "+_4b5+" characters in length.");
this.validateNoRegex(ele,/\$/,"Dollar signs are not valid in an email address.");
this.validateNoRegex(ele,/\\/,"Backslashes are not valid in an email address.");
this.validateRegex(ele,/\@/,"A valid email address must contain an @ symbol.");
};
hpFormHandler.prototype.validateEmail=function(ele){
this.validateEmailList(ele);
var _4b7=200;
this.validateLengthMax(ele,_4b7,"Your email address is too long. Please use a shorter address.");
this.validateNoSpaces(ele,"Spaces are not valid characters in an email address.  Please recheck your address.");
};
hpFormHandler.prototype.validateEmailName=function(ele){
var _4b9=2;
var _4ba=200;
this.validateLengthMin(ele,_4b9,"Your name is too short.  Please enter at least 2 characters.");
this.validateLengthMax(ele,_4ba,"Your name is too long. Please use a shorter name.");
};
hpFormHandler.prototype.validatePhone=function(ele){
var val=$F(ele);
var us=/^(?:\([2-9]\d{2}\)\ ?|[2-9]\d{2}(?:\-?|\ ?))[2-9]\d{2}[- ]?\d{4}$/;
this.testForError(!us.test(val)&&val.length>0,ele,"Please enter a valid phone number");
};
hpFormHandler.prototype.validatePostal=function(ele){
var val=$F(ele).trim();
var _4c0=false;
var us=/^\d{5}(-\d{4})?$/;
var ca=/[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJKLMNPRSTVWXYZ] \d[ABCEGHJKLMNPRSTVWXYZ]\d/i;
var gb=/^[A-Za-z]{1,2}[\d]{1,2}([A-Za-z])?\s?[\d][A-Za-z]{2}$/i;
if(val.length==0||(us.test(val)||ca.test(val)||gb.test(val))){
_4c0=true;
}
this.testForError(!_4c0,ele,"Please enter a valid postal code");
};
hpFormHandler.prototype.validateNewPassword=function(ele1,ele2){
ele1=$(ele1);
ele2=$(ele2);
var _4c6=40;
var _4c7=5;
this.validateMandatory(ele1,"Please protect your hubpages account with a password.");
this.validateLengthMin(ele1,_4c7,"Your password is too short.  Protect your account by choosing a password that is at least  "+_4c7+" characters long.  Safety first!");
this.validateLengthMax(ele1,_4c6,"Your password is too long; it will be difficult to type.  Please use a shorter password.");
this.validateMandatory(ele2,"Please confirm your password.");
this.validateSameAs(ele1,ele2,"Your passwords do not match.  Please retype them.");
};
hpFormHandler.prototype.validateTag=function(ele){
ele=$(ele);
var _4c9=60;
var _4ca=3;
this.validateRegex(ele,/^[\w\s\$\-\'\%\&]*$/,"Please use only alphanumeric and $, ', % or & characters in your tag.");
this.validateLengthMin(ele,3,"A tag should be at least three characters long.");
this.validateLengthMax(ele,_4c9,"A tag should not be longer than 60 characters.");
};
hpFormHandler.prototype.validateGroupName=function(ele,_4cc){
this.validateMandatory(ele,"Please specify a group name.");
this.validateLengthMax(ele,50,"Group names may be no longer than 50 characters.");
this.validateRegex(ele,/^[\w\s\$\-\'\%\&\!\?]*$/,"Please use only alphanumeric and $, ', -, %, !, ? or & characters in your group name.");
existingName=_4cc.detect(function(name){
return ($F(ele)==name);
});
this.testForError(existingName,ele,"You already have a group with this name.  Please select it from the list, or enter a new name.");
};
hpFormHandler.prototype.observe=function(){
new Form.EventObserver(this.form,this._elemsChanged.bind(this));
};
hpFormHandler.prototype.focusFirst=function(){
Form.focusFirstElement(this.form);
};
hpFormHandler.prototype.tabOnEnter=function(){
hpFormHandler.tabOnEnter(this.form);
};
hpFormHandler.tabOnEnter=function(form){
if(!$(form)){
return;
}
var _4cf=$A($(form).getElementsByTagName("input"));
_4cf.each(function(node){
Event.observe(node,"keydown",_handleInputKeypress,false);
});
};
hpFormHandler.prototype.ghostField=function(_4d1,_4d2,_4d3){
if($(_4d1)&&$(_4d2)){
var gw=new GhostWatcher(_4d1,_4d2,_4d3);
}
};
hpFormHandler.prototype.setValidators=function(_4d5,_4d6){
this.toValidate=$H(_4d5);
this.toValidateOnsubmit=$H(_4d6);
};
hpFormHandler.prototype.hasErrors=function(){
return (this.errors&&this.errors.keys()&&this.errors.keys().length>0);
};
hpFormHandler.prototype.cancel=function(){
this.reset();
};
hpFormHandler.prototype.reset=function(){
Form.reset(this.form);
if(this.cancelUri){
location.href=this.cancelUri;
}
};
hpFormHandler.prototype.valid=function(){
this._runValidators(true);
if(this.hasErrors()){
return false;
}
return true;
};
hpFormHandler.prototype.save=function(){
this._runValidators(true);
if(this.hasErrors()){
return false;
}
if(window.tinyMCE&&tinyMCE.triggerSave){
try{
tinyMCE.triggerSave(false,true);
}
catch(e){
}
}
if(!this.submitMode){
this.params="ajax=1&"+Form.serialize(this.form);
var _4d7=new Ajax.Request(this.submitUri,{method:this.method,parameters:this.params,onComplete:this.handleResponse.bind(this),onFailure:reportError});
}
return (this.submitMode);
};
hpFormHandler.prototype.handleResponse=function(req){
eval(req.responseText);
if(valid==1){
if(this.saveCallback){
this.saveCallback();
}
if(this.nextUri){
location.href=this.nextUri;
}
return true;
}else{
this.handleSubmitServerError(req);
return false;
}
};
hpFormHandler.prototype.testForError=function(_4d9,ele,msg){
if(_4d9){
var tmp=new Object();
tmp[ele.id]=msg;
this.errors=this.errors.merge(tmp);
}else{
if(this.errors[ele.id]&&this.errors[ele.id]==msg){
delete this.errors[ele.id];
}
}
};
hpFormHandler.prototype._elemsChanged=function(ele){
this._runValidators(false);
};
hpFormHandler.prototype._runValidators=function(_4de){
var _4df=Form.getElements(this.form);
var _4e0=$A(_4df);
_4e0.each(function(node){
if(_4de){
var _4e2=this.toValidateOnsubmit[node.id];
if(!_4e2){
_4e2=this.toValidateOnsubmit[node.className];
}
if(_4e2){
_4e2(node);
}
}
var _4e2=this.toValidate[node.id];
if(!_4e2){
_4e2=this.toValidate[node.className];
}
if(_4e2){
_4e2(node);
}
}.bind(this));
this._showErrors();
return !this.hasErrors();
};
hpFormHandler.prototype._showErrors=function(){
if(!this.errorDiv&&!$("formErrors")){
new Insertion.Top(this.form,"<div id=\"formErrors\"></div>");
}
if(!this.errorDiv){
this.errorDiv=$("formErrors");
}
if(!this.errFade){
this.errFade=new fx.Opacity(this.errorDiv,{duration:500});
this.errFade.now=0;
}
if(!this.hasErrors()){
if(this.lit){
this.errFade.toggle();
var eles=document.getElementsByClassName("alertBorder",this.form);
eles.each(function(ele){
hpFormHandler.lightEle(ele,false);
});
if($("nextB")){
$("nextB").src="http://x.hubpages.com/i/next.gif";
}
this.lit=false;
}
return;
}
var _4e5=this.errorHeader;
_4e5+="<ul>";
this.errors.each(function(err){
_4e5+="<li>"+err.value+"</li>";
var ele=$(err.key);
hpFormHandler.lightEle(ele,true);
});
_4e5+="</ul>";
this.errorDiv.className="alert";
if(!this.lit){
Element.setOpacity(this.errorDiv,0);
this.errFade.toggle();
}
this.errorDiv.innerHTML=_4e5;
this.lit=true;
};
function _handleInputKeypress(_4e8){
_4e8=_4e8||window.event;
if(_4e8.which){
if(_4e8.which==Event.KEY_RETURN){
var _4e9=document.createEvent("KeyboardEvent");
_4e9.initKeyEvent("keydown",true,true,document.defaultView,_4e8.ctrlKey,_4e8.altKey,_4e8.shiftKey,_4e8.metaKey,Event.KEY_TAB,0);
_4e8.preventDefault();
_4e8.target.dispatchEvent(_4e9);
}
}else{
if(_4e8.keyCode){
if(_4e8.keyCode==Event.KEY_RETURN){
_4e8.keyCode=Event.KEY_TAB;
}
}
}
return true;
};
hpFormHandler.lightEle=function(ele,on){
ele=$(ele);
if(!ele){
return;
}
if(on){
Element.addClassName(ele,"alertBorder");
}else{
Element.removeClassName(ele,"alertBorder");
}
};
var GhostWatcher=Class.create();
GhostWatcher.prototype={initialize:function(_4ec,_4ed,_4ee){
this.fromEle=$(_4ec);
this.toEle=$(_4ed);
this.copyFunction=(_4ee!=null)?_4ee:this.copyValue;
if(this.fromEle&&this.toEle){
Event.observe(this.fromEle,"keyup",this.copyFunction.bind(this),false);
}
Event.observe(window,"focus",this.copyFunction.bind(this),false);
Event.observe(window,"load",this.copyFunction.bind(this),false);
},copyValue:function(evt){
var text=$F(this.fromEle);
this.toEle.innerHTML=text.stripTags();
},recopy:function(){
this.copyFunction();
}};
function ModuleEdit(id){
this.data={id:id,mod_data_id:null,div_id:null,art_id:null,type:null,links_json:"",images_json:"",quiz_json:"",links_added:0,position:0};
this.state={video_type:null,video_current_css:null,quiz_type:0,select_id:null,images_removed:[],links:null,tiny_mce_editor:null,origtext_width:0,origtext_height:0,last_hide:null,last_position:-1,delete_confirm_text:"Are you sure you want to delete this capsule?",inserting:false,answers_added:0,questions_added:0,results_added:0,questions_removed:[],truncated_question_length:60,quiz_score_ranges:new Array(30,60,80,90,100),select_result_id:null,content_id:"modcont_"+id,rss_results_id:id+"_rss_results",rss_edit_id:id+"_rss",amazon_numbered_id:id+"_numbered",amazon_numbered_div_id:id+"_numberedDiv",amazon_searchindex_id:id+"_searchIndex",amazon_searchtype_id:id+"_searchType",amazon_results_id:id+"_amazon_results",amazon_asin_input_id:id+"_asin",amazon_asin_div_id:id+"_asinDiv",amazon_asin_search_div_id:id+"_asinSearchDiv",amazon_keyword_search_div_id:id+"_keywordSearchDiv",amazon_max_display_div_id:id+"_maxDisplayDiv",amazon_description_id:id+"_description",amazon_description_div_id:id+"_descriptionDiv",amazon_description_link_id:id+"_descriptionLink",amazon_searchtype_div_id:id+"_searchTypeDiv",poll_question_id:id+"_question",poll_answers_id:id+"_answers",poll_answer_id:id+"_answer_",poll_answer_li_id:id+"_answer_li_",poll_answer_class:id+"_answer",poll_results_id:id+"_poll_results",poll_status_id:id+"_status_",comment_edit_id:id+"_comment",comment_moderated_id:id+"_moderated",comment_emailme_id:id+"_emailme",comment_noanonymous_id:id+"_anonymous",comment_max_id:id+"_max",comment_reversed_id:id+"_reversed",text_div_id:"txtd_"+id,code_div_id:"code_d_"+id,code_textarea_id:"code_txt_area_"+id,code_type_id:id+"_code_type",code_include_line_numbers_id:id+"_code_lines",code_display_size_id:id+"_code_display_size",code_max_size_id:id+"_code_max_size",code_size_left_id:"codesize_numcharsvalue_"+id,link_search_id:id+"_link_search",link_search_type:"del",link_results_id:id+"_link_search_results",link_edit_id:id+"_link",link_display_id:id+"_link_results",links_list:id+"_linkitem",link_url_id:id+"_url",link_search_term_id:id+"_search_term",link_title_id:id+"_link_title",link_desc_id:id+"_desc",link_desc_len_id:id+"_len",link_submit_button:id+"_submit_button",link_edit_box:id+"_link_edit_box",link_status_id:"test_status_"+id,link_status_button_id:"test_status_button_"+id,link_findbox_id:"link_findbox_"+id,link_show_add_field:"link_show_add_field_"+id,link_show_search_field:"link_show_search_field_"+id,link_add_field:"link_add_field_"+id,link_search_field:"link_search_field_"+id,quiz_rendered_id:"rendered_quiz_"+id,quiz_results_id:"results_"+id,quiz_question_drag_area_id:"question_drag_"+id,quiz_edit_id:"edit_quiz_"+id,quiz_json_id:"quiz_json_"+id,quiz_result_add_input_id:"question_add_result_"+id,quiz_question_add_input_id:"question_add_input_"+id,quiz_type_name_id:"quiz_type_"+id,quiz_type_form_id:"quiz_type_form"+id,quiz_result_sentence_id:"quiz_result_sentence_"+id,quiz_form_id:"quiz_form_"+id,quiz_edit_question_id:id+"_edit_question_",quiz_done_question_id:id+"_done_question_",quiz_edit_result_id:id+"_edit_result_",quiz_done_result_id:id+"_done_result_",quiz_question_span_id:id+"_question_span_",quiz_value_id:id+"_value_",quiz_value_label_id:id+"_value_label_",quiz_question_id:id+"_question_",quiz_answer_id:id+"_answer_",quiz_answer_list_id:id+"_answer_list_",quiz_answer_li_id:id+"_answer_item_",quiz_answer_area_id:id+"_answer_area_",quiz_result_id:id+"_result_",quiz_result_values_id:id+"_result_values_",quiz_result_area_id:id+"_result_area_",quiz_result_description_id:id+"_result_description_",quiz_result_span_id:id+"_result_span_",quiz_result_name_id:id+"_result_name_",quiz_question_input_id:id+"_question_input_",feed_id:id+"_feed",keywords_id:id+"_keywords",max_id:id+"_max",max_max_id:id+"_max_max",mode_id:id+"_mode",colorbar_id:"colorbar_"+id,hidebar_id:"hidebar_"+id,titlebar_id:"titlebar_"+id,title_id:id+"_title",title_input_id:id+"_titleinput",modal_id:id+"_modal",hide_id:id+"_hide",hide_text_id:id+"_hidetext",empty_notification_id:"modempty_"+id};
this.editting=false;
this.autoSavePeriodicalExecuter=null;
this.checkNetworkPeriodicalExecuter=null;
this.cleanUpRules=null;
this.layout={topleft:[15,150],bottomright:[15+450,150+600],width:450,height:600};
this.resources={edit_button_id:"edit_"+id,edit_link_id:"editlink_"+id,discard_button_id:"discard_"+id,up_button_id:"up_"+id,down_button_id:"down_"+id,position_id:id+"_position",amazon_edit_id:id+"_amazon",poll_edit_id:id+"_poll",quiz_edit_id:id+"_quiz",draft_notice_id:"draft_notice",draft_revert_id:"draft_revert",json_links_id:"json_links_"+id,max_results_id:"max_"+id,inserter_cancel_id:"capsule_inserter_cancel_"+id,inserter_id:"capsule_inserter_"+id,chooser_id:"capsule_chooser_"+id,link_edit_url:id+"_url_edit",link_edit_title:id+"_link_title",link_edit_desc:id+"_desc",link_edit_desc_len:id+"_len",link_drag_section:"link_drag_"+id,link_drag_title:"link_drag_txt_"+id,image_edit_id:"image_"+id,image_caption_input:"descinput_"+id,image_size_input:"sizeinput_"+id,image_display_style_id:"dispstyle_"+id,image_popup_id:"fullsize_"+id,image_upload_gif_id:"upload_gif_"+id,image_upload_status_id:"upload_status_"+id,image_upload_target_id:"upload_target_"+id,image_load_form_id:"add_image_form_"+id,image_import_id:"url_"+id,image_upload_id:"file_"+id,image_import_section_id:"image_import_"+id,image_upload_section_id:"image_upload_"+id,image_queue_id:"url_import_list_"+id,image_drag_section:"image_drag_"+id,image_drag_title:"image_drag_txt_"+id,image_selection_id:"image_selected_"+id,image_load_id:"image_load_"+id,image_web_radio_id:"image_web_radio_"+id,image_computer_radio_id:"image_computer_radio_"+id,image_viewer_display:"slide_display_"+id,image_viewer_caption:"slide_desc_"+id,video_edit_id:"video_"+id,video_url_input_id:"video_url_"+id,video_key_id:"video_key_"+id,video_type_id:"video_type_"+id,video_results_id:"video_results_"+id,text_edit_id:"txte_"+id,code_edit_id:"code_e_"+id,table_view_id:"div_table_view_"+id,table_edit_id:"div_table_edit_"+id,table_edit_content_id:"table_edit_"+id,table_view_content_id:"table_view_"+id,table_view_thead_id:"thead_view_"+id,table_view_tbody_id:"tbody_view_"+id,table_edit_thead_id:"thead_edit_"+id,table_edit_tbody_id:"tbody_edit_"+id,table_edit_form_id:"form_table_"+id,table_file_id:"file_"+id,table_url_id:"url_"+id,table_loading_id:"div_loading_"+id,table_action1_id:"table_action1_"+id,table_action2_id:"table_action2_"+id,table_action3_id:"table_action3_"+id,table_style_id:"table_style_"+id,table_loading_status_id:"div_loading_status_"+id,table_radio_current_id:"radio_current_"+id,table_radio_url_id:"radio_url_"+id,table_radio_pc_id:"radio_pc_"+id,table_div_current_id:"div_radio_current_"+id,table_div_url_id:"div_radio_url_"+id,table_div_pc_id:"div_radio_pc_"+id,table_previous_element:null,table_max_rows_id:"max_rows_"+id,table_max_cols_id:"max_cols_"+id,table_checkbox_sortable_id:"checkbox_sortable_"+id,table_caption_id:"table_caption_"+id,ebay_edit_id:id+"_ebay",ebay_results_id:id+"_ebay_results",ebay_preview_id:"preview_"+id,ebay_keywords_id:"keywords_"+id,ebay_seller_id:"seller_"+id};
};
ModuleEdit.Manager=null;
ModuleEdit.options={capsule_edit_reposition_duration:600,upload_status_hide_timeout:8*1000,drag_enabled:true,drag_reorder_enabled:true};
ModuleEdit.prototype.addNewAbove=function(type){
$(this.resources.chooser_id).hide();
$(this.resources.inserter_cancel_id).hide();
this.state.inserting=false;
ModuleEdit.Manager.addNew(type,this.data.position);
};
ModuleEdit.prototype.capsuleInsert=function(){
$(this.resources.chooser_id).show();
$(this.resources.inserter_cancel_id).show();
$(this.resources.inserter_id).hide();
this.state.inserting=true;
};
ModuleEdit.prototype.cancelCapsuleInsert=function(){
$(this.resources.chooser_id).hide();
$(this.resources.inserter_cancel_id).hide();
this.state.inserting=false;
};
ModuleEdit.prototype.toggleInserter=function(show){
if(this.state.inserting||ModuleEdit.Manager.editting){
return;
}
if(show){
$(this.resources.inserter_id).show();
}else{
$(this.resources.inserter_id).hide();
}
};
ModuleEdit.prototype.cleanUp=function(){
ModuleEdit.Manager=null;
this.editting=null;
this.data=null;
this.state=null;
};
ModuleEdit.make=function(type,_4f5,_4f6,_4f7){
var ajax=new Ajax.Request("/xml/modules.php",{method:"post",parameters:"new=1&art_id="+_4f5+"&type="+type+"&position="+_4f6,onFailure:reportError,onComplete:_4f7});
};
ModuleEdit.toggleIcon=function(ele,_4fa){
ele=$(ele);
if(!ele){
return;
}
if(_4fa){
ModuleEdit.disableIcon(ele);
}else{
ModuleEdit.reenableIcon(ele);
}
};
ModuleEdit.disableIcon=function(ele){
ele=$(ele);
if(!ele){
return;
}
ele.className="disabledicon";
var _4fc=ele.firstChild;
if(!_4fc.disabled){
var _4fd=function(){
return false;
};
if(_4fc.href&&_4fc.href!="#"){
_4fc.bhref=_4fc.href;
}
if(_4fc.onclick){
_4fc.bonclick=_4fc.onclick;
}
if(_4fc.alt){
_4fc.balt=_4fc.alt;
}
if(_4fc.title){
_4fc.btitle=_4fc.title;
}
_4fc.alt="";
_4fc.title="";
_4fc.href="#";
_4fc.onclick=_4fd;
_4fc.disabled=true;
}
};
ModuleEdit.reenableIcon=function(ele){
ele=$(ele);
if(!ele){
return;
}
ele.className="icon";
var _4ff=ele.firstChild;
if(_4ff.disabled){
if(_4ff.bhref){
_4ff.href=_4ff.bhref;
}
if(_4ff.bonclick){
_4ff.onclick=_4ff.bonclick;
}
if(_4ff.balt){
_4ff.alt=_4ff.balt;
}
if(_4ff.btitle){
_4ff.title=_4ff.btitle;
}
_4ff.disabled=false;
}
};
ModuleEdit.getFromJSON=function(json){
var _501=new ModuleEdit(json.data.mod_id);
Object.extend(_501.data,json.data);
Object.extend(_501.state,json.state);
return _501;
};
ModuleEdit.toggleCurtain=function(){
var _502=$("modalarea");
if(!_502){
var pole=new Insertion.Bottom(document.body,"<iframe class=\"modalarea\" style=\"display:none\" frameborder=\"0\" id=\"addcaps_modalarea\" src=\"about:blank\"></iframe>");
}
if(_502&&_502.style.display!="block"){
_502.style.display="block";
_502.style.left="0px";
_502.style.top="0px";
ModuleEdit.stretchCurtain();
this.stretchListener=ModuleEdit.stretchCurtain.bindAsEventListener(this);
Event.observe(window,"resize",this.stretchListener,false);
}else{
_502.style.display="none";
Event.stopObserving(window,"resize",this.stretchListener,false);
this.stretchListener=null;
}
};
ModuleEdit.stretchCurtain=function(){
var _504=$("modalarea");
var _505=20;
var _506=Element.getHeight("container")+Element.getHeight("header_wrap")+Element.getHeight("browse_wrap");
var _507=Element.getHeight("sidebar")+Position.cumulativeOffset($("sidebar"))[1];
_504.style.width=(Element.getWidth("container")+_505)+"px";
_504.style.height=((_506>_507)?_506:_507)+"px";
};
ModuleEdit.prototype.toggle=function(){
if(!this.edditing&&this.data.type=="Table"){
$(this.resources.table_view_id).hide();
}
if(!this.editting&&this.data.type=="Poll"){
var _508=$(this.data.mod_data_id+"_pollVotes");
if(null!=_508){
var _509=_508.value;
if(_509>0){
var _50a;
if(_509==1){
_50a="1 vote that has been counted will be deleted.";
}else{
_50a=_509+" votes that have been counted will be deleted.";
}
var _50b=confirm("Are you sure that you want to edit this poll? \n\nIf you make changes to the question or answer choices in this capsule, then the "+_50a);
if(!_50b){
return false;
}
}
}
}
this.editting=!this.editting;
if(this.editting){
this.state.original_html=$(this.data.div_id).innerHTML;
this.state.original_form=(this.data.type=="Text")?"":Form.serialize($(this.data.div_id),true);
this.data.hide=$(this.state.hide_id).checked;
this.state.original_hide=this.data.hide;
}
this._toggleTitle();
this._toggleBorder();
this._toggleEditButton();
this._toggleDiscardButton();
this._toggleDeleteButton();
this._toggleZIndex();
this._toggleSize();
this._toggleDrag();
this._toggleEmptyNotification();
switch(this.data.type){
case "Text":
this.toggleText();
break;
case "Ebay":
this.toggleEbay();
break;
case "Amazon":
this.toggleAmazon();
break;
case "Rss":
this.toggleRss();
break;
case "News":
this.toggleNews();
break;
case "Link":
this.toggleLink();
break;
case "Image":
this.toggleImage();
break;
case "Video":
this.toggleVideo();
break;
case "Comment":
this.toggleComment();
break;
case "Poll":
this.togglePoll();
break;
case "Code":
this.toggleCode();
break;
case "Table":
this.toggleTable();
break;
case "Quiz":
this.toggleQuiz();
break;
}
if(this.editting){
this.setDirty();
}else{
this.save();
}
this.render();
return true;
};
ModuleEdit.prototype._toggleZIndex=function(){
var _50c=this.state.div_ele;
if(this.editting){
_50c.style.zIndex="10";
}else{
_50c.style.zIndex="1";
}
};
ModuleEdit.prototype._toggleSize=function(){
var _50d=$(this.data.div_id);
if(this.editting){
var _50e=5;
var _50f=102;
var _510=0.15;
var _511=ModuleEdit.options.capsule_edit_reposition_duration;
var mods=$("modules");
var _513=Position.positionedOffset(_50d);
var _514=620+(_50e*2);
var _515=ModuleEdit.Manager.layout;
var _516=_515.viewportScroll[1]+(_515.viewportSize[1]*_510);
_50d.style.width=_514+"px";
var _517=new fx.Position(_50d,{duration:_511});
_50d.style.position="absolute";
Position.set(_50d,_513);
_517.move(_513,[_50f,_516]);
this.computeState();
}else{
_50d.style.display="inline";
_50d.style.position="static";
_50d.style.width="auto";
_50d.style.top=_50d.style.left="0px";
}
};
ModuleEdit.prototype._toggleDrag=function(){
var _518=$(this.data.div_id);
var _519=$("dragbar_"+this.data.id);
if(ModuleEdit.options.drag_enabled&&this.editting){
var d=new Dragger(_518,false);
_519.style.cursor="move";
Event.observe(_519,"mousedown",(function(){
d.start();
return false;
}).bind(d),false);
Event.observe(document,"mouseup",d.stop.bind(d),false);
}else{
_519.style.cursor="default";
}
};
ModuleEdit.prototype._toggleEmptyNotification=function(){
if(this.editting&&this.data.div_id){
Element.hide(this.state.empty_notification_id);
}
};
ModuleEdit.prototype._toggleTitle=function(){
var _51b=$(this.state.title_id);
if(!_51b){
return;
}
if(this.editting){
$(this.state.title_input_id).value=$(this.state.title_id).innerHTML;
}else{
this.data.title=$F(this.state.title_input_id).replace(/<[^>]+(>|$)/g,"");
if(this.data.title!==null){
Element.update(this.state.title_id,this.data.title);
if(this.data.title==""){
$(this.state.title_id).style.display="none";
}else{
$(this.state.title_id).style.display="";
}
}
}
this.toggleDisplay(this.state.colorbar_id);
this.toggleDisplay(this.state.hidebar_id);
this.toggleDisplay(this.state.titlebar_id);
this.toggleDisplay(_51b,!this.editting);
};
ModuleEdit.prototype.toggleQuiz=function(){
if(this.editting){
$(this.state.content_id).hide();
this.state.questions_removed=[];
this.state.quiz=JSONstring.toObject($(this.state.quiz_json_id).innerHTML);
this.quizBuildInterface();
if($(this.state.quiz_question_drag_area_id)&&!this.state.reorder){
this.quizCreateContentReorder();
}
var _51c=$H(this.state.quiz.questions).values();
var _51d=new Array();
_51c.each(function(q){
_51d[q.position]=q;
});
_51d.each(function(q){
if(!q.id){
return;
}
this.quizBuildQuestion(q.question,q.id);
var _520=$H(q.answers).values();
_520.each(function(a,_522){
if(!a.id){
return;
}
this.quizBuildAnswerChoice(q.id,a.id,_522>2,a.value,a.answer,a.resultValues);
}.bind(this));
}.bind(this));
}else{
$(this.state.content_id).show();
if(this.data.dirty&&this.state.quiz.quizTypeId>0){
if(this.state.select_id){
this.toggleAnswersForQuizQuestion(null,this.state.select_id,0);
}
if(this.state.select_result_id){
this.toggleQuizResult(null,this.state.select_result_id,0);
}
var _523=this.state.reorder.getitemstate();
_523.each(function(pair){
this.state.quiz.questions[pair.id].position=pair.position;
}.bind(this));
this.state.questions_removed.each(function(_525){
this.state.quiz.questions[_525].position=-1;
}.bind(this));
var _526=this.state.quiz.quizTypeId;
if(_526==1||_526==2){
this.state.quiz.resultSentence=$F(this.state.quiz_result_sentence_id);
var _527=$A();
var _528=$A();
var _51c=$H(this.state.quiz.questions).values();
_51c.each(function(q){
if(!q.id||q.position==-1){
return;
}
var _52a=$H(q.answers).values();
minQuestionScore=9999;
_52a.each(function(an){
if(an.id&&!an.isDeleted){
minQuestionScore=Math.min(minQuestionScore,an.value);
}
});
maxQuestionScore=-9999;
_52a.each(function(an){
if(an.id&&!an.isDeleted){
maxQuestionScore=Math.max(maxQuestionScore,an.value);
}
});
_527.push(minQuestionScore);
_528.push(maxQuestionScore);
});
var _52d=_527.inject(0,function(acc,n){
return acc+(+n);
});
var _530=_528.inject(0,function(acc,n){
return acc+(+n);
});
this.state.quiz.minimumScore=_52d;
this.state.quiz.maximumScore=_530;
var _533=_530-_52d;
var _534=$H(this.state.quiz.results).values();
i=0;
var _535=_52d;
_534.each(function(r){
if(!r.id){
return;
}
var _537=this.state.quiz_score_ranges[i];
var _538;
if(_537==100){
_538=_530;
}else{
_538=Math.floor(_537*_533/100+_52d);
}
this.state.quiz.results[r.id]={id:r.id,minimumValue:_535,maximumValue:_538,description:$F(this.state.quiz_result_description_id+r.id),result:"",isDeleted:r.isDeleted};
_535=_538;
i++;
}.bind(this));
}
this.data.quiz_json=JSONstring.make(this.state.quiz);
$(this.state.quiz_json_id).innerHTML=this.data.quiz_json;
}
$(this.state.quiz_edit_id).innerHTML="";
delete this.state.reorder;
}
this.toggleDisplay(this.resources.quiz_edit_id);
};
ModuleEdit.prototype._renderQuiz=function(){
if(!$(this.state.quiz_json_id)){
return;
}
this.state.quiz=JSONstring.toObject($(this.state.quiz_json_id).innerHTML);
var _539=$(this.state.quiz_rendered_id);
_539.innerHTML="";
if(this.state.quiz.quizTypeId==0){
return;
}
if(this.state.quiz.error){
_539.innerHTML="<p class=\"error\">"+this.state.quiz.error+" No one will be able to take your quiz until you fix the problem.</p>";
return;
}
var _53a=0;
var _53b=$H(this.state.quiz.questions).values();
if(this.state.floatright){
_53b.each(function(q){
if(!q.id){
return;
}
var _53d=Math.ceil(q.question.length/22)+2;
var _53e=$H(q.answers).values();
_53e.each(function(a){
if(!a.id){
return;
}
_53d+=1+Math.ceil(a.answer.length/25);
});
if(_53d>_53a){
_53a=_53d;
}
});
var _540=9+_53a;
if(this.state.quiz.quizTypeId==1){
_540+=3;
}
}else{
_53b.each(function(q){
if(!q.id){
return;
}
var _542=Math.ceil(q.question.length/75)+2;
var _543=$H(q.answers).values();
_543.each(function(a){
if(!a.id){
return;
}
_542+=1+Math.ceil(a.answer.length/75);
});
if(_542>_53a){
_53a=_542;
}
});
var _540=9+_53a;
if(this.state.quiz.quizTypeId==1){
_540+=2;
}
}
var _545=0;
var _546=$H(this.state.quiz.results).values();
if(this.state.floatright){
_546.each(function(r){
if(!r.id){
return;
}
var _548=Math.ceil(r.description.length/32);
if(_548>_545){
_545=_548;
}
});
var _549=Math.ceil(this.state.quiz.resultSentence.length/17*1.6);
var _54a=_545+_549+13;
if(this.state.quiz.quizTypeId==1){
_54a+=3;
}
}else{
_546.each(function(r){
if(!r.id){
return;
}
var _54c=Math.ceil(r.description.length/75);
if(_54c>_545){
_545=_54c;
}
});
var _549=Math.ceil(this.state.quiz.resultSentence.length/56*1.6);
var _54a=_545+_549+13;
if(this.state.quiz.quizTypeId==1){
_54a+=2;
}
}
var _54d=Math.max(_540,_54a);
_54d=Math.max(18,_54d);
height=14*_54d;
var _54e=this.state.floatright?240:520;
var _54f="color0";
if(this.state.floatright){
var _550=$w($(this.state.content_id).className);
_550.each(function(_551){
if(_551.indexOf("color")!=-1){
_54f=_551;
throw $break;
}
});
}
_539.innerHTML="<embed src=\"/quizwidget/Widget.swf\" width=\""+_54e+"\" height=\""+height+"\" align=\"middle\" name=\"Widget"+this.data.id+"\" wmode=\"opaque\" play=\"true\" loop=\"false\" quality=\"high\" flashvars=\"id="+this.data.mod_data_id+"&cssClass="+_54f+"\" allowScriptAccess=\"always\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.adobe.com/go/getflashplayer\"></embed>";
};
ModuleEdit.prototype.quizUpdateType=function(){
var _552=Form.getInputs(this.state.quiz_type_form_id,"radio",this.state.quiz_type_name_id).find(function(_553){
return _553.checked;
}).value;
this.state.quiz.quizTypeId=_552;
this.quizBuildInterface();
};
ModuleEdit.prototype.quizBuildInterface=function(){
var _554=new Array();
_554[1]="Add some questions and answer choices to your quiz. Mark the correct answer to each question by checking the radio button next to the right answer. Click on the edit quiz results link to change the messages that are displayed to people when they are done taking your quiz.";
_554[2]="Add some questions and answer choices to your quiz. For each answer choice, decide how many points that answer choice is worth (between -5 and +5) and select that number from the menu. Click on the edit quiz results link to change the messages that are displayed to people when they are done taking your quiz.";
_554[3]="Add a result for each possible outcome of your quiz. For example, if your quiz tells someone whether they are type A or type B, add one result called \"type A\" and another result called \"type B.\" Then add some questions and answer choices. For each answer choice, decide how many points are contributed to each result possibility when someone chooses that answer. At the end of the quiz, the result with the largest number of points will be the one that is displayed to the quiz taker.";
var _555=$(this.state.quiz_edit_id);
_555.innerHTML="";
var _556=this.state.quiz.quizTypeId;
if(_556==0){
var _557=new Array();
_557[1]="<strong>Option 1.</strong> Every question has exactly one correct answer. <div class=\"quizTypeDescription\">* Good for fact-based quizzes such as a movie trivia quiz.</div>";
_557[2]="<strong>Option 2.</strong> Every answer choice is worth a different numbers of points. <div class=\"quizTypeDescription\">* Good for quizzes that measure where someone falls between two extremes, such as: How liberal are you?</div>";
_557[3]="<strong>Option 3.</strong> A quiz with multiple possible results. <div class=\"quizTypeDescription\">* Good for quizzes that tell someone what type they are, such as what political party they identify most with.</div>";
var _558=$(document.createElement("form"));
_558.name=this.state.quiz_type_form_id;
_558.id=this.state.quiz_type_form_id;
var ul=$(document.createElement("ul"));
ul.addClassName("quizTypeList");
for(var i=1;i<=3;i++){
var li=$(document.createElement("li"));
var name=this.state.quiz_type_name_id;
var _55d="<input type=\"radio\" name=\""+name+"\" value=\""+i+"\"/>";
var div=$(document.createElement("div"));
div.className="quizType";
div.innerHTML=_557[i];
li.innerHTML=_55d;
li.appendChild(document.createTextNode(" "));
li.appendChild(div);
ul.appendChild(li);
}
var _55f=$(document.createElement("input"));
_55f.type="button";
_55f.value="Next step &raquo;".unescapeHTML();
_55f.observe("click",this.quizUpdateType.bind(this));
_558.appendChild(ul);
_558.appendChild(_55f);
var h2=$(document.createElement("h2"));
h2.appendChild($(document.createTextNode("What type of quiz do you want to make?")));
_555.appendChild(h2);
_555.appendChild(_558);
return;
}else{
var _561=$(document.createElement("p"));
_561.appendChild($(document.createTextNode(_554[_556])));
var _562=$(document.createElement("h3"));
_562.appendChild($(document.createTextNode("Instructions")));
_555.appendChild(_562);
_555.appendChild(_561);
}
var _563=$(document.createElement("div"));
_563.id=this.state.quiz_results_id;
_563.addClassName("resultArea");
_555.appendChild(_563);
if(_556==1||_556==2){
this.quizBuildResultBar(0,"Quiz Results",0);
this.quizBuildResultsByPercentageScore(0);
}else{
if(_556==3){
var _564=$H(this.state.quiz.results).values();
_564.each(function(r){
if(!r.id){
return;
}
this.quizBuildResult(r.id,r.result,r.description);
}.bind(this));
var _566=$(document.createElement("form"));
var _567=$(document.createElement("label"));
_567.htmlFor=this.state.quiz_result_add_input_id;
_567.appendChild($(document.createTextNode("Name of Result: ")));
var _568=$(document.createElement("input"));
_568.type="text";
_568.id=this.state.quiz_result_add_input_id;
_568.addClassName("quizResultInput");
_568.maxLength=120;
var _569=$(document.createElement("input"));
_569.type="button";
_569.value="Add Result";
_569.observe("click",this.quizAddResult.bind(this));
_566.observe("submit",function(e){
Event.stop(e);
this.quizAddResult();
return false;
}.bindAsEventListener(this));
_566.appendChild(_567);
_566.appendChild(_568);
_566.appendChild(_569);
_555.appendChild(_566);
}
}
var _56b=$(document.createElement("form"));
var _56c=$(document.createElement("label"));
_56c.htmlFor=this.state.quiz_question_add_input_id;
_56c.appendChild($(document.createTextNode("Question: ")));
var _56d=$(document.createElement("input"));
_56d.type="text";
_56d.id=this.state.quiz_question_add_input_id;
_56d.addClassName("quizQuestionInput");
_56d.maxLength=120;
var _55f=$(document.createElement("input"));
_55f.type="button";
_55f.value="Add Question";
var _56e=$(document.createElement("div"));
_56e.addClassName("questionDragArea");
_56e.id=this.state.quiz_question_drag_area_id;
var _56f=$(document.createElement("small"));
_56f.appendChild($(document.createTextNode("*Drag and drop questions to reorder them.")));
_555.appendChild(_56e);
_56b.appendChild(_56c);
_56b.appendChild(_56d);
_56b.appendChild(_55f);
_555.appendChild(_56b);
_555.appendChild(_56f);
_55f.observe("click",this.quizAddQuestion.bind(this));
_56b.observe("submit",function(e){
Event.stop(e);
this.quizAddQuestion();
}.bind(this));
this.quizCreateContentReorder();
};
ModuleEdit.prototype.quizBuildResultsByPercentageScore=function(id){
var _572=$(document.createElement("div"));
_572.id=this.state.quiz_result_area_id+id;
_572.addClassName("editResultArea");
var _573=$(document.createElement("p"));
_573.appendChild($(document.createTextNode("Choose the message that will be displayed when someone is done taking your quiz. Any occurrence of the characters #% will be replaced with the person's percentage score. For example, \"You scored #% on the intelligence test!\" might become \"You scored 87% on the intelligence test!\"")));
var _574=$(document.createElement("label"));
_574.appendChild($(document.createTextNode("Message: ")));
var _575=$(document.createElement("input"));
_575.type="text";
_575.value=this.state.quiz.resultSentence.unescapeHTML();
_575.id=this.state.quiz_result_sentence_id;
_575.addClassName("quizResultSentence");
_575.maxLength=120;
var _576=$(document.createElement("p"));
_576.appendChild($(document.createTextNode("You can display a custom message depending on how someone scores on your quiz. Type your custom messages in the boxes below.")));
_572.appendChild(_573);
_572.appendChild(_574);
_572.appendChild(_575);
_572.appendChild(_576);
var _577=this.state.quiz_score_ranges;
var _578=0;
var i=0;
var list=$(document.createElement("ol"));
list.addClassName("messageByPercent");
var _57b=$H(this.state.quiz.results).values();
_57b.each(function(r){
if(!r.id){
return;
}
var item=$(document.createElement("li"));
var _57e=_577[i];
var _57f=$(document.createElement("label"));
_57f.htmlFor=this.state.quiz_result_description_id+r.id;
_57f.appendChild(document.createTextNode("For a score between "+_578+"% and "+_57e+"%: "));
item.appendChild(_57f);
var _580=$(document.createElement("textarea"));
_580.appendChild($(document.createTextNode(r.description.unescapeHTML())));
_580.id=this.state.quiz_result_description_id+r.id;
item.appendChild(_580);
list.appendChild(item);
_578=_57e;
i++;
}.bind(this));
for(;i<_577.length;i++){
var item=$(document.createElement("li"));
var _582="new"+i;
score=_577[i];
var _574=$(document.createElement("label"));
_574.htmlFor=this.state.quiz_result_description_id+_582;
_574.appendChild(document.createTextNode("For a score between "+_578+"% and "+score+"%:"));
item.appendChild(_574);
var _583=$(document.createElement("textarea"));
_583.id=this.state.quiz_result_description_id+_582;
item.appendChild(_583);
list.appendChild(item);
_578=score;
this.state.quiz.results[_582]={id:_582,description:"",result:"",minimumValue:0,maximumValue:0,isDeleted:0};
}
_572.appendChild(list);
_572.hide();
$(this.state.quiz_results_id).appendChild(_572);
};
ModuleEdit.prototype.quizBuildResult=function(id,_585,_586,_587){
_585=_585.unescapeHTML();
_586=_586.unescapeHTML();
this.quizBuildResultBar(id,_585,_587);
var _588=$(document.createElement("div"));
_588.id=this.state.quiz_result_area_id+id;
_588.addClassName("editResultArea");
var _589=$(document.createElement("label"));
_589.appendChild($(document.createTextNode("Result Name: ")));
_589.htmlFor=this.state.quiz_result_name_id+id;
var _58a=$(document.createElement("input"));
_58a.type="text";
_58a.value=_585;
_58a.addClassName("quizResultInput");
_58a.id=this.state.quiz_result_name_id+id;
_58a.observe("keyup",function(id){
$(this.state.quiz_result_span_id+id).innerHTML=$F(this.state.quiz_result_name_id+id);
}.bind(this,id));
var _58c=$(document.createElement("label"));
_58c.appendChild($(document.createTextNode("Explain the meaning of this result: ")));
_58c.htmlFor=this.state.quiz_result_description_id+id;
var _58d=$(document.createElement("textarea"));
_58d.appendChild($(document.createTextNode(_586)));
_58d.id=this.state.quiz_result_description_id+id;
var _58e=$(document.createElement("p"));
var _58f=$(document.createElement("small"));
_58f.appendChild($(document.createTextNode("This will be the payoff for taking your quiz, so make it good!")));
_58e.appendChild(_58f);
_588.appendChild(_589);
_588.appendChild(_58a);
_588.appendChild(_58c);
_588.appendChild(_58d);
_588.appendChild(_58e);
_588.hide();
$(this.state.quiz_results_id).appendChild(_588);
this.state.quiz.results[id]={id:id,result:_585,description:_586,minimumValue:0,maximumValue:0,isDeleted:0};
};
ModuleEdit.prototype.quizAddResult=function(){
if(this.state.select_id){
this.toggleAnswersForQuizQuestion(null,this.state.select_id,0);
}
var _590="new"+this.state.results_added;
this.state.results_added++;
var _591=$F(this.state.quiz_result_add_input_id);
$(this.state.quiz_result_add_input_id).value="";
this.quizBuildResult(_590,_591,"",1);
this.quizUpdateResultSelectors();
this.toggleQuizResult(null,_590,1);
};
ModuleEdit.prototype.quizUpdateResultSelectors=function(){
var _592=$H(this.state.quiz.questions).values();
var _593=$H(this.state.quiz.results).values();
_592.each(function(q){
if(!q.id||q.position==-1){
return;
}
var _595=$H(q.answers).values();
_595.each(function(a){
if(!a.id||a.isDeleted){
return;
}
_593.each(function(r){
if(!r.id){
return;
}
var _598=$(this.state.quiz_value_id+a.id+"_"+r.id);
if(r.isDeleted&&_598){
$(this.state.quiz_value_label_id+a.id+"_"+r.id).remove();
Element.remove(_598);
return;
}
if(!r.isDeleted&&!_598){
var _599=$(this.state.quiz_result_values_id+a.id);
var _598=$(document.createElement("select"));
_598.id=this.state.quiz_value_id+a.id+"_"+r.id;
var _59a=$(document.createElement("label"));
_59a.htmlFor=_598.id;
_59a.appendChild(document.createTextNode(r.result+": "));
_59a.id=this.state.quiz_value_label_id+a.id+"_"+r.id;
for(var i=5;i>=-5;i--){
var _59c=$(document.createElement("option"));
_59c.value=i;
_59c.appendChild($(document.createTextNode(i>0?"+"+i:i)));
_598.appendChild(_59c);
if(0==i){
_59c.selected="selected";
}
}
_599.appendChild(_59a);
_599.appendChild(_598);
_599.appendChild($(document.createTextNode(" ")));
this.state.quiz.questions[q.id].answers[a.id].resultValues["rv"+r.id]=0;
}
}.bind(this));
}.bind(this));
}.bind(this));
};
ModuleEdit.prototype.toggleQuizResult=function(e,id,show){
if(show){
$(this.state.quiz_result_area_id+id).show();
$(this.state.quiz_edit_result_id+id).hide();
$(this.state.quiz_done_result_id+id).show();
if(this.state.select_result_id){
this.toggleQuizResult(null,this.state.select_result_id,0);
}
this.state.select_result_id=id;
}else{
$(this.state.quiz_result_area_id+id).hide();
$(this.state.quiz_edit_result_id+id).show();
$(this.state.quiz_done_result_id+id).hide();
if(this.state.select_result_id&&this.state.select_result_id==id){
this.state.select_result_id=null;
}
if(this.state.quiz.quizTypeId==3){
this.state.quiz.results[id].description=$F(this.state.quiz_result_description_id+id);
this.state.quiz.results[id].result=$F(this.state.quiz_result_name_id+id);
}
}
if(e){
Event.stop(e);
}
};
ModuleEdit.prototype.quizBuildResultBar=function(id,_5a1,_5a2){
var _5a3=$(this.state.quiz_results_id);
var _5a4=$(document.createElement("div"));
_5a4.addClassName("resultBar");
_5a4.id=this.state.quiz_result_id+id;
var _5a5=$(document.createElement("span"));
_5a5.appendChild($(document.createTextNode(_5a1)));
_5a5.id=this.state.quiz_result_span_id+id;
var _5a6=$(document.createElement("ul"));
_5a6.addClassName("quizButtons");
var _5a7=$(document.createElement("li"));
var _5a8=$(document.createElement("a"));
var _5a9=$(document.createElement("img"));
_5a9.src="/x/hubtool_discard_tag.gif";
_5a9.alt="delete";
_5a8.title="delete";
_5a8.href="#";
_5a8.appendChild(_5a9);
Event.observe(_5a8,"click",this.quizDeleteResult.bindAsEventListener(this,id));
_5a7.appendChild(_5a8);
_5a6.appendChild(_5a7);
var _5aa=$(document.createElement("li"));
_5aa.id=this.state.quiz_edit_result_id+id;
var _5ab=$(document.createElement("a"));
_5ab.appendChild($(document.createTextNode("edit")));
_5ab.href="#";
Event.observe(_5ab,"click",this.toggleQuizResult.bindAsEventListener(this,id,1));
_5aa.appendChild(_5ab);
_5a6.appendChild(_5aa);
var _5ac=$(document.createElement("li"));
_5ac.id=this.state.quiz_done_result_id+id;
var _5ad=$(document.createElement("a"));
_5ad.href="#";
_5ad.appendChild($(document.createTextNode("done")));
Event.observe(_5ad,"click",this.toggleQuizResult.bindAsEventListener(this,id,0));
_5ac.hide();
_5ac.appendChild(_5ad);
_5a6.appendChild(_5ac);
_5a4.appendChild(_5a6);
_5a4.appendChild(_5a5);
_5a3.appendChild(_5a4);
};
ModuleEdit.prototype.quizCreateContentReorder=function(){
this.state.reorder=new ModuleContentReorder(this.state.quiz_question_drag_area_id,1,550,20);
};
ModuleEdit.prototype.quizBuildAnswerChoice=function(_5ae,_5af,_5b0,_5b1,_5b2,_5b3){
_5b2=_5b2.unescapeHTML();
var item=$(document.createElement("li"));
item.id=this.state.quiz_answer_li_id+_5af;
item.addClassName("quizAdded");
var _5b5=this.state.quiz.quizTypeId;
if(_5b5==1){
var name=this.state.quiz_value_id+_5ae;
var id=this.state.quiz_value_id+_5af;
var _5b8=(_5b1>0)?"checked=\"checked\"":"";
var _5b9="<input type=\"radio\" name=\""+name+"\" id=\""+id+"\" class=\"correctAnswerRadio\" "+_5b8+"/>";
}else{
if(_5b5==2){
var _5ba=$(document.createElement("select"));
_5ba.id=this.state.quiz_value_id+_5af;
for(var i=5;i>=-5;i--){
var _5bc=$(document.createElement("option"));
_5bc.value=i;
_5bc.appendChild($(document.createTextNode((i>0?"+":"")+i)));
if(_5b1==i){
_5bc.selected="selected";
}
_5ba.appendChild(_5bc);
}
}else{
if(_5b5==3){
var _5bd=$H(this.state.quiz.results).values();
var _5be=$(document.createElement("div"));
_5be.id=this.state.quiz_result_values_id+_5af;
_5bd.each(function(r){
if(!r.id){
return;
}
var _5c0=$(document.createElement("select"));
_5c0.id=this.state.quiz_value_id+_5af+"_"+r.id;
var _5c1=$(document.createElement("label"));
_5c1.htmlFor=_5c0.id;
_5c1.appendChild(document.createTextNode(r.result+": "));
_5c1.id=this.state.quiz_value_label_id+_5af+"_"+r.id;
for(var i=5;i>=-5;i--){
var _5c3=$(document.createElement("option"));
_5c3.value=i;
_5c3.appendChild($(document.createTextNode(i>0?"+"+i:i)));
_5c0.appendChild(_5c3);
if(_5b3&&_5b3["rv"+r.id]==i){
_5c3.selected="selected";
}
}
_5be.appendChild(_5c1);
_5be.appendChild(_5c0);
_5be.appendChild($(document.createTextNode(" ")));
}.bind(this));
}
}
}
var _5c4=$(document.createElement("input"));
_5c4.type="text";
_5c4.id=this.state.quiz_answer_id+_5af;
_5c4.value=_5b2;
_5c4.addClassName("quizAnswerInput");
_5c4.maxLength=120;
if(_5b5==1){
item.innerHTML=_5b9;
}
item.appendChild(_5c4);
if(_5b5==2){
item.appendChild(_5ba);
}
if(_5b0){
var _5c5=$(document.createElement("a"));
var _5c6=$(document.createElement("img"));
_5c5.href="#";
_5c5.title="delete";
_5c5.addClassName("quizDeleteAnswer");
_5c6.src="/x/hubtool_discard_tag.gif";
_5c6.alt="delete";
_5c5.appendChild(_5c6);
item.appendChild(_5c5);
Event.observe(_5c5,"click",this.quizDeleteAnswer.bindAsEventListener(this,_5ae,_5af));
}
if(_5b5==3){
item.appendChild(_5be);
}
$(this.state.quiz_answer_list_id+_5ae).appendChild(item);
if(!_5b2){
_5b2="";
}
if(!_5b3){
_5b3={};
}
this.state.quiz.questions[_5ae].answers[_5af]={id:_5af,answer:_5b2,value:_5b1,resultId:0,isDeleted:0,resultValues:_5b3};
};
ModuleEdit.prototype.quizAddAnswerChoice=function(_5c7,_5c8,_5c9){
var _5ca="new"+this.state.answers_added;
this.state.answers_added++;
if(this.state.quiz.quizTypeId==3){
var _5cb=$H(this.state.quiz.results).values();
var _5cc={};
_5cb.each(function(r){
if(!r.id||r.isDeleted){
return;
}
_5cc["rv"+r.id]=0;
});
}
this.quizBuildAnswerChoice(_5c7,_5ca,_5c8,_5c9,"",_5cc);
};
ModuleEdit.prototype.quizDeleteAnswer=function(e,_5cf,_5d0){
if(this.state.quiz.quizTypeId==1&&$(this.state.quiz_value_id+_5d0).checked){
var _5d1=$H(this.state.quiz.questions[_5cf].answers).values();
_5d1.each(function(an){
if(!an.id||an.isDeleted){
return;
}
$(this.state.quiz_value_id+an.id).checked="checked";
throw $break;
}.bind(this));
}
$(this.state.quiz_answer_li_id+_5d0).remove();
this.state.quiz.questions[_5cf].answers[_5d0].isDeleted=1;
if(e){
Event.stop(e);
}
};
ModuleEdit.prototype.quizDeleteResult=function(e,_5d4){
if(this.state.select_result_id==_5d4){
this.state.select_result_id=null;
}
$(this.state.quiz_result_id+_5d4).remove();
$(this.state.quiz_result_area_id+_5d4).remove();
this.state.quiz.results[_5d4].isDeleted=1;
this.quizUpdateResultSelectors();
if(e){
Event.stop(e);
}
};
ModuleEdit.prototype.quizDeleteQuestion=function(e,_5d6){
if(this.state.select_id==_5d6){
this.state.select_id=null;
}
this.state.reorder.remove(_5d6);
this.state.questions_removed.push(_5d6);
$(this.state.quiz_answer_area_id+_5d6).remove();
if(e){
Event.stop(e);
}
};
ModuleEdit.prototype.quizBuildQuestion=function(_5d7,_5d8){
_5d7=_5d7.unescapeHTML();
var _5d9=$(document.createElement("div"));
_5d9.addClassName("draggableQuestionBar");
_5d9.id=this.state.quiz_question_id+_5d8;
_5d9.onclick=function(){
};
var _5da=$(document.createElement("div"));
_5da.addClassName("editAnswerArea");
_5da.hide();
_5da.id=this.state.quiz_answer_area_id+_5d8;
var _5db=$(document.createElement("ul"));
_5db.addClassName("quizButtons");
var _5dc=$(document.createElement("li"));
var _5dd=$(document.createElement("a"));
var _5de=$(document.createElement("img"));
_5de.src="/x/hubtool_discard_tag.gif";
_5de.alt="delete";
_5dd.title="delete";
_5dd.href="#";
_5dd.appendChild(_5de);
Event.observe(_5dd,"click",this.quizDeleteQuestion.bindAsEventListener(this,_5d8));
_5dc.appendChild(_5dd);
_5db.appendChild(_5dc);
var _5df=$(document.createElement("li"));
_5df.id=this.state.quiz_edit_question_id+_5d8;
var _5e0=$(document.createElement("a"));
_5e0.appendChild($(document.createTextNode("edit")));
_5e0.href="#";
Event.observe(_5e0,"click",this.toggleAnswersForQuizQuestion.bindAsEventListener(this,_5d8,1));
_5df.appendChild(_5e0);
_5db.appendChild(_5df);
var _5e1=$(document.createElement("li"));
_5e1.id=this.state.quiz_done_question_id+_5d8;
var _5e2=$(document.createElement("a"));
_5e2.href="#";
_5e2.appendChild($(document.createTextNode("done")));
Event.observe(_5e2,"click",this.toggleAnswersForQuizQuestion.bindAsEventListener(this,_5d8,0,1));
_5e1.hide();
_5e1.appendChild(_5e2);
_5db.appendChild(_5e1);
var _5e3=$(document.createElement("span"));
_5e3.appendChild($(document.createTextNode(_5d7.truncate(this.state.truncated_question_length))));
_5e3.id=this.state.quiz_question_span_id+_5d8;
var _5e4=$(document.createElement("label"));
_5e4.appendChild(document.createTextNode("Question: "));
var _5e5=$(document.createElement("input"));
_5e5.type="text";
_5e5.id=this.state.quiz_question_input_id+_5d8;
_5e5.hide();
_5e5.value=_5d7;
_5e5.maxLength=120;
_5e5.addClassName("quizQuestionInput");
_5d9.appendChild(_5db);
_5d9.appendChild(_5e3);
var _5e6=$(document.createElement("ol"));
_5e6.id=this.state.quiz_answer_list_id+_5d8;
_5e6.addClassName("quizAnswerList");
var _5e7=$(document.createElement("input"));
_5e7.type="button";
_5e7.value="add new answer choice";
_5da.appendChild(_5e4);
_5da.appendChild(_5e5);
_5da.appendChild(_5e6);
_5da.appendChild(_5e7);
_5e7.observe("click",function(_5e8){
this.quizAddAnswerChoice(_5e8,1,0);
this.quizRearrangeItems(_5e8);
}.bind(this,_5d8));
_5e5.observe("keyup",function(_5e9){
$(this.state.quiz_question_span_id+_5e9).innerHTML=$F(this.state.quiz_question_input_id+_5e9).truncate(this.state.truncated_question_length);
}.bind(this,_5d8));
var _5ea=$(this.state.quiz_question_drag_area_id);
_5ea.appendChild(_5d9);
_5ea.appendChild(_5da);
var _5eb=new ModuleContentReorderItem(this.state.quiz_question_id+_5d8,_5d8,this.state.reorder);
this.state.reorder.add(_5eb);
this.state.reorder.relayout();
this.state.quiz.questions[_5d8]={id:_5d8,question:_5d7,answers:{}};
};
ModuleEdit.prototype.quizAddQuestion=function(){
var _5ec="new"+this.state.questions_added;
this.state.questions_added++;
var _5ed=$F(this.state.quiz_question_add_input_id);
$(this.state.quiz_question_add_input_id).value="";
this.quizBuildQuestion(_5ed,_5ec);
for(var i=0;i<2;i++){
this.quizAddAnswerChoice(_5ec,0,i==0&&this.state.quiz.quizTypeId==1?1:0);
}
this.toggleAnswersForQuizQuestion(null,_5ec,1);
};
ModuleEdit.prototype.updateQuizStateForQuestion=function(_5ef){
var _5f0=this.state.quiz.questions[_5ef];
_5f0.question=$F(this.state.quiz_question_input_id+_5ef);
var _5f1=$H(_5f0.answers).values();
_5f1.each(function(_5f2,a){
if(!a.id||a.isDeleted){
return;
}
this.state.quiz.questions[_5f2].answers[a.id].answer=$F(this.state.quiz_answer_id+a.id);
var _5f4=this.state.quiz.quizTypeId;
if(_5f4==1){
this.state.quiz.questions[_5f2].answers[a.id].value=$(this.state.quiz_value_id+a.id).checked?1:0;
}else{
if(_5f4==2){
this.state.quiz.questions[_5f2].answers[a.id].value=$(this.state.quiz_value_id+a.id).value;
}else{
if(_5f4==3){
var _5f5=$H(this.state.quiz.results).values();
resultValues={};
var i=0;
_5f5.each(function(r){
if(!r.id||r.isDeleted){
return;
}
var val=$F(this.state.quiz_value_id+a.id+"_"+r.id);
resultValues["rv"+r.id]=val;
}.bind(this));
this.state.quiz.questions[_5f2].answers[a.id].resultValues=resultValues;
}
}
}
}.bind(this,_5ef));
};
ModuleEdit.prototype.quizRearrangeItems=function(_5f9){
var _5fa=_5f9;
var _5fb=this.state.reorder.items;
var _5fc=this.state.reorder.options;
var _5fd=this.state.reorder.canvas;
var i=0;
var item=_5fb[0];
while(item.item_id!=_5fa){
item=_5fb[++i];
}
var _600=$(this.state.quiz_answer_area_id+_5fa);
var rows=Math.ceil(_5fb.length/_5fc.num_cols);
var _602=(rows*(_5fc.ele_space_per_v))+_600.getHeight()+_5fc.ele_buffer_v;
if(_602!=parseInt(_5fd.style.height,10)){
_5fd.style.height=_602+"px";
}
var top=(Math.floor((i+1)/_5fc.num_cols))*_5fc.ele_space_per_v;
_600.setStyle({position:"absolute",top:top+"px"});
offset=_600.getHeight()+_5fc.ele_buffer_v+_5fc.offset_v;
for(i++;i<_5fb.length;i++){
item=_5fb[i];
var _604=Math.floor(i/_5fc.num_cols);
var top=(_604*_5fc.ele_space_per_v)+offset;
$(this.state.quiz_question_id+item.item_id).setStyle({top:top+"px"});
}
};
ModuleEdit.prototype.toggleAnswersForQuizQuestion=function(e,_606,show,_608){
if(show){
if(this.state.select_id){
this.toggleAnswersForQuizQuestion(null,this.state.select_id,0,0);
}
this.quizRearrangeItems(_606);
$(this.state.quiz_answer_area_id+_606).show();
$(this.state.quiz_question_input_id+_606).show();
$(this.state.quiz_edit_question_id+_606).hide();
$(this.state.quiz_done_question_id+_606).show();
this.state.select_id=_606;
this.state.reorder.disable();
}else{
this.state.reorder.relayout();
$(this.state.quiz_answer_area_id+_606).hide();
$(this.state.quiz_question_input_id+_606).hide();
$(this.state.quiz_edit_question_id+_606).show();
$(this.state.quiz_done_question_id+_606).hide();
this.updateQuizStateForQuestion(_606);
this.state.select_id=null;
if(_608){
this.state.reorder.enable();
}
}
if(e){
Event.stop(e);
}
return false;
};
function implode(elts,glue){
var str="";
elts.each(function(elt){
str+=elt.value+glue;
});
if(str!=""){
str=str.substring(0,str.length-glue.length);
}
return str;
};
ModuleEdit.prototype.togglePoll=function(){
this.toggleDisplay(this.resources.poll_edit_id);
if(!this.state.next_poll_question_id&&this.editting){
this.state.next_poll_question_id=$$("."+this.state.poll_answer_class).size();
}
if(this.editting){
$(this.state.poll_results_id).hide();
}else{
$(this.state.poll_results_id).show();
this.data.question=$F(this.state.poll_question_id);
this.keepPollChanges();
var _60d=$$("."+this.state.poll_answer_class);
this.data.answers=implode(_60d,"%*%");
if(!this.data.discard){
this.onclickPollPreview();
}else{
this.data.discard=false;
}
}
};
ModuleEdit.prototype.keepPollChanges=function(){
elts=$$(".answerLi");
elts.each(function(elt){
var _60f=$(elt.id.replace("answer_li","status"));
switch(_60f.value){
case "1":
_60f.value=0;
break;
case "2":
elt.remove();
break;
}
});
};
ModuleEdit.prototype.discardPollChanges=function(){
this.data.discard=true;
elts=$$(".answerLi");
elts.each(function(elt){
var _611=$(elt.id.replace("answer_li","status"));
switch(_611.value){
case "1":
elt.remove();
break;
case "2":
elt.show();
_611.value=0;
break;
}
});
};
ModuleEdit.prototype.onclickPollPreview=function(){
eval("pm_"+this.data.mod_data_id+" = new PollManager("+this.data.id+","+this.data.mod_data_id+");");
var _612=$H({question:this.data.question,answers:this.data.answers,modId:this.data.id,modDataId:this.data.mod_data_id}).toQueryString();
var ajax=new Ajax.Updater({success:this.state.poll_results_id},"/xml/pollresults.php",{parameters:_612,onFailure:reportError,onComplete:function(){
}});
};
function pollHandler(e){
var data=$A(arguments);
data.shift();
this.deletePollChoice(data[0]);
Event.stop(e);
};
ModuleEdit.prototype.newPollChoice=function(){
var _616=document.createElement("li");
var link=document.createElement("a");
link.href="#";
link.title="delete this choice";
var _618=document.createElement("img");
_618.src="http://x.hubpages.com/x/hubtool_discard_tag.gif";
_618.alt="delete choice";
$(_618).addClassName("delete");
link.appendChild(_618);
var _619=document.createElement("input");
_619.type="text";
$(_619).addClassName("textInput");
$(_619).addClassName(this.data.id+"_answer");
_619.tabIndex=this.state.next_poll_question_id+2;
_619.id=this.state.poll_answer_id+this.state.next_poll_question_id;
_619.name=this.state.poll_answer_id+this.state.next_poll_question_id;
var _61a=document.createElement("input");
_61a.type="hidden";
_61a.value=1;
_61a.id=this.state.poll_status_id+this.state.next_poll_question_id;
_61a.name=_61a.id;
$(_616).addClassName("answerLi");
_616.appendChild(_619);
_616.appendChild(_61a);
_616.appendChild(link);
_616.id=this.state.poll_answer_li_id+this.state.next_poll_question_id;
$(this.state.poll_answers_id).appendChild(_616);
$(link).observe("click",pollHandler.bindAsEventListener(this,this.state.next_poll_question_id));
this.state.next_poll_question_id+=1;
};
ModuleEdit.prototype.deletePollChoice=function(i){
var _61c=$(this.state.poll_status_id+i);
var _61d=$(this.state.poll_answer_li_id+i);
if(_61c.value==1){
_61d.remove();
}else{
_61d.hide();
_61c.value=2;
}
};
ModuleEdit.prototype.toggleAmazon=function(){
this.toggleDisplay(this.resources.amazon_edit_id);
if(this.editting){
this.displayCorrectAmazonType();
this.changeNumDisplayedAmazon();
}
if(!this.editting){
if($(this.state.amazon_searchindex_id)){
this.data.searchtype=$F(this.state.amazon_searchtype_id);
this.data.searchindex=$F(this.state.amazon_searchindex_id);
this.data.maxitems=$F(this.state.max_id);
this.data.keywords=$F(this.state.keywords_id);
this.data.asins=this.implodeAsins();
this.data.descriptions=this.implodeDescriptions();
this.data.numbered=($F(this.state.amazon_numbered_id)=="on")?1:0;
}
this.onclickAmazonPreview();
}
};
ModuleEdit.prototype.toggleComment=function(){
this.toggleDisplay(this.state.comment_edit_id);
if(!this.editting){
if($(this.state.comment_moderated_id)){
this.data.moderated=$(this.state.comment_moderated_id).checked;
this.data.emailme=$(this.state.comment_emailme_id).checked;
this.data.anonymous=$(this.state.comment_noanonymous_id).checked;
this.data.reversed=$(this.state.comment_reversed_id).checked;
this.data.max=$F(this.state.comment_max_id);
}
}
};
ModuleEdit.prototype.buildCsv=function(_61e,_61f){
var csv=new StringBuffer();
var _621=_61e.rows.length;
var _622=_61e.rows[0].cells.length;
if(!_61e.rows[0].cells[0].hasClassName){
Element.extend(_61e.rows[0].cells[0]);
}
var _623=(_61e.rows[0].cells[0].hasClassName("extraCell"))?1:0;
this.resources.table_previous_element=null;
for(var row=_623;row<_621;row++){
if(!_61e.rows[row].cells[0].hasClassName){
Element.extend(_61e.rows[row].cells[0]);
}
if(!_61e.rows[row].cells[0].hasClassName("extraCell")){
for(var col=0;col<_622;col++){
if(!_61e.rows[row].cells[col].hasClassName){
Element.extend(_61e.rows[row].cells[col]);
}
if(!_61e.rows[row].cells[col].hasClassName("extraCell")){
if(col>0){
csv.append(",");
}
var cell=_61e.rows[row].cells[col];
var _627="";
for(var i=0;i<cell.childNodes.length;i++){
var _629=cell.childNodes[i];
if(_629.tagName&&_629.tagName.toLowerCase()=="div"){
_627=_629.innerHTML;
break;
}else{
if(_629.tagName&&_629.tagName.toLowerCase()=="input"){
_627=_629.value.escapeHTML();
var div=document.createElement("div");
div.innerHTML=_627;
_629.parentNode.removeClassName("selectedCell");
if(!_629.parentNode.hasClassName("tableCell")){
_629.parentNode.addClassName("tableCell");
}
_629.parentNode.replaceChild(div,_629);
break;
}
}
}
if(!cell.hasClassName){
Element.extend(cell);
}
var bold=(cell.hasClassName("boldCell"))?"b":"n";
var _62c="c";
if(!cell.hasClassName("centerCell")){
_62c=(cell.hasClassName("leftCell"))?"l":"r";
}
var _62d=cell.parentNode.parentNode.tagName.toLowerCase();
_627=_627.replace(/(,|")/g,function(_62e,part){
if(part==","){
return "^COMMA^";
}else{
if(part=="\""){
return "^QUOTE^";
}else{
return part;
}
}
});
csv.append("[").append(bold.substring(0,1)).append(_62c.substring(0,1)).append(_62d.substring(1,2)).append("]\"").append(_627).append("\"");
}
}
csv.append("\n");
}
}
return csv.toString();
};
ModuleEdit.prototype.insertExtraCell=function(row){
var cell=(row.parentNode.tagName.toLowerCase()=="thead")?document.createElement("th"):document.createElement("td");
row.appendChild(cell);
cell.className="extraCell centerCell";
if(cell.tagName.toLowerCase()=="th"){
cell.className+=" boldCell";
}
cell.innerHTML="<div></div>";
};
ModuleEdit.prototype.isExtraCell=function(cell){
if(!cell.hasClassName){
Element.extend(cell);
}
return cell.hasClassName("extraCell");
};
ModuleEdit.prototype.getTableNumCols=function(_633){
return (_633.rows.length==0)?0:_633.rows[0].cells.length;
};
ModuleEdit.prototype.updateEditTable=function(_634,_635){
var _636=$(this.resources.table_edit_thead_id);
var _637=$(this.resources.table_edit_tbody_id);
if(!_636.update){
Element.extend(_636);
}
if(!_637.update){
Element.extend(_637);
}
_636.update();
_637.update();
var tr=_636.insertRow(0);
var _639=this.getTableNumCols(_634.parentNode);
var _63a=$(_635).rows.length;
var _63b=$(this.resources.table_max_rows_id).value;
var _63c=$(this.resources.table_max_cols_id).value;
if(_634.rows.length>0){
for(var col=0;col<_639;col++){
var cell=document.createElement("th");
tr.appendChild(cell);
if(!cell.update){
Element.extend(cell);
}
cell.update(_634.rows[0].cells[col].innerHTML);
cell.className=_634.rows[0].cells[col].className;
cell.noWrap=true;
}
if(_639<_63c){
this.insertExtraCell(tr);
}
}else{
if(_635.rows.length>0){
for(col=0;col<_639;col++){
this.insertExtraCell(tr);
}
if(_639<_63c){
this.insertExtraCell(tr);
}
}else{
this.insertExtraCell(tr);
}
}
if(_63a>0&&$(_635).rows[0].cells.length>0){
for(var row=0;row<_63a;row++){
tr=_637.insertRow(row);
tr.className=_635.rows[row].className;
for(col=0;col<_639;col++){
cell=tr.insertCell(col);
if(!cell.update){
Element.extend(cell);
}
cell.update(_635.rows[row].cells[col].innerHTML);
cell.className=_635.rows[row].cells[col].className;
cell.noWrap=true;
}
if(_639<_63c){
this.insertExtraCell(tr);
}
}
}
if(_63a<_63b-1){
tr=$(_637).insertRow($(_637).rows.length);
for(col=0;col<_639;col++){
this.insertExtraCell(tr);
}
if(_639<_63c){
this.insertExtraCell(tr);
}
}
$(this.resources.table_edit_content_id).observe("click",function(evt){
var elm=Event.element(evt);
if(elm.tagName.toLowerCase()=="td"||elm.tagName.toLowerCase()=="th"){
var divs=elm.getElementsByTagName("div");
if(divs.length>0){
this.selectCell(divs[0]);
}
}else{
if(elm.tagName.toLowerCase()=="div"&&elm.parentNode!=null&&elm.parentNode.tagName!=null){
if(elm.parentNode.tagName.toLowerCase()=="td"||elm.parentNode.tagName.toLowerCase()=="th"){
this.selectCell(elm);
}
}
}
}.bind(this));
};
ModuleEdit.prototype.updateViewTable=function(_643,_644){
var _645=$(this.resources.table_view_thead_id);
var _646=$(this.resources.table_view_tbody_id);
if(!_645.update){
Element.extend(_645);
}
if(!_646.update){
Element.extend(_646);
}
_645.update();
_646.update();
var _647=this.getTableNumCols(_643.parentNode);
if(this.hasTableHeader(_643.parentNode)){
var tr=_645.insertRow(0);
for(var col=0;col<_647;col++){
if(!_643.rows[0].cells[col].hasClassName){
Element.extend(_643.rows[0].cells[col]);
}
if(!_643.rows[0].cells[col].hasClassName("extraCell")){
var cell=document.createElement("th");
tr.appendChild(cell);
if(!cell.update){
Element.extend(cell);
}
cell.update(_643.rows[0].cells[col].innerHTML);
if(cell.innerHTML.trim().toLowerCase()=="<div></div>"){
cell.update("<div>&nbsp;</div>");
}
cell.className=_643.rows[0].cells[col].className;
if(col==0){
cell.addClassName("firstCell");
}else{
cell.removeClassName("firstCell");
}
cell.removeClassName("lastCell");
}
}
if(cell.addClassName){
cell.addClassName("lastCell");
}
}
if(_644.rows.length>1){
for(var row=0;row<_644.rows.length;row++){
if(!_644.rows[row].cells[0].hasClassName){
Element.extend(_644.rows[row].cells[0]);
}
if(!_644.rows[row].cells[0].hasClassName("extraCell")){
tr=_646.insertRow(row);
tr.className=_644.rows[row].className;
for(col=0;col<_644.rows[row].cells.length;col++){
if(!_644.rows[row].cells[col].hasClassName){
Element.extend(_644.rows[row].cells[col]);
}
if(!_644.rows[row].cells[col].hasClassName("extraCell")){
cell=document.createElement("td");
tr.appendChild(cell);
if(!cell.update){
Element.extend(cell);
}
cell.update(_644.rows[row].cells[col].innerHTML);
if(cell.innerHTML.trim().toLowerCase()=="<div></div>"){
cell.update("<div>&nbsp;</div>");
}
cell.className=_644.rows[row].cells[col].className;
if(col==0&&!cell.hasClassName("firstCell")){
cell.addClassName("firstCell");
}else{
if(cell.hasClassName("firstCell")){
cell.removeClassName("firstCell");
}
}
if(cell.hasClassName("lastCell")){
cell.removeClassName("lastCell");
}
}
}
}
if(cell.addClassName){
cell.addClassName("lastCell");
}
}
}
};
ModuleEdit.prototype.showTableView=function(evt){
$(this.resources.table_loading_status_id).hide();
if(evt){
var elm=Event.element(evt);
if(elm.id!=this.resources.table_radio_current_id){
$(this.resources.table_radio_current_id).checked=false;
}
}
if(!$(this.resources.table_radio_current_id).checked){
$(this.resources.table_div_current_id).hide();
}else{
$(this.resources.table_div_current_id).show();
}
if(!$(this.resources.table_radio_url_id).checked){
$(this.resources.table_div_url_id).hide();
$(this.resources.table_url_id).value="";
}else{
$(this.resources.table_div_url_id).show();
}
if(!$(this.resources.table_radio_pc_id).checked){
$(this.resources.table_div_pc_id).hide();
$(this.resources.table_file_id).value="";
}else{
$(this.resources.table_div_pc_id).show();
}
};
ModuleEdit.prototype.showTableStatusMessage=function(_64e){
$(this.resources.table_loading_status_id).update(_64e);
$(this.resources.table_loading_status_id).show();
};
ModuleEdit.prototype.hideTableStatusMessage=function(){
$(this.resources.table_loading_status_id).hide();
};
ModuleEdit.prototype.handleSelectionsForTable=function(evt){
var elm=Event.element(evt);
if(elm.id!=this.resources.table_action1_id){
$(this.resources.table_action1_id).value=0;
}
if(elm.id!=this.resources.table_action2_id){
$(this.resources.table_action2_id).value=0;
}
if(elm.id!=this.resources.table_action3_id){
$(this.resources.table_action3_id).value=0;
}
};
ModuleEdit.prototype.hasTableHeader=function(_651){
if(_651.rows.length==0||_651.rows[0].cells.length==0){
return false;
}
var test=_651.rows[0].cells[0];
if(!test.hasClassName){
Element.extend(test);
}
return (!test.hasClassName("extraCell"));
};
ModuleEdit.prototype.updateTableRowClasses=function(_653){
for(var row=0;row<_653.rows.length;row++){
var tr=_653.rows[row];
if(!tr.hasClassName){
Element.extend(tr);
}
tr.className=(row%2==0)?"oddRow":"evenRow;";
}
};
ModuleEdit.prototype.handleTableActions=function(){
if(this.resources.table_previous_element==null||this.resources.table_previous_element.parentNode==null){
alert("You need to select a column or row before hitting the 'update' button.");
return;
}
var _656=$(this.resources.table_max_rows_id).value;
var _657=$(this.resources.table_max_cols_id).value;
var cell=this.resources.table_previous_element.parentNode;
var col=$(cell).cellIndex;
var row=$(cell).parentNode.rowIndex;
var _65b=$(this.resources.table_edit_content_id);
var _65c=$(this.resources.table_edit_thead_id);
var _65d=$(this.resources.table_edit_tbody_id);
var _65e=_65b.rows.length;
var _65f=this.getTableNumCols(_65b);
var _660=parseInt($(this.resources.table_action1_id).value)+parseInt($(this.resources.table_action2_id).value)+parseInt($(this.resources.table_action3_id).value);
switch(_660){
case 1:
if(row!=0&&row<_65e-1||row==_65e-1&&_65e==_656){
var _661=(_65e==_656&&!this.isExtraCell(_65b.rows[_65e-1].cells[0]));
_65b.deleteRow(row);
if(_661){
var tr=_65b.insertRow(_65e-1);
for(col=0;col<_65f;col++){
this.insertExtraCell(tr);
}
}
this.updateTableRowClasses(_65d);
}else{
if(row==0){
alert("You are not able to delete the header row");
}else{
alert("You are not able to delete the extra row");
}
}
break;
case 2:
if(_65f>2&&col<_65f-1||col==_65f-1&&_65f==_657){
var _661=(_65f==_657&&!this.isExtraCell(_65b.rows[0].cells[_65f-1]));
for(row=0;row<_65e;row++){
_65b.rows[row].deleteCell(col);
if(_661){
this.insertExtraCell(_65b.rows[row]);
}
}
}else{
if(_65f==2&&col==0){
alert("You must have at least one column.");
}else{
alert("You are not able to delete the extra column");
}
}
break;
case 4:
if(row<_65e-1){
row++;
}
case 3:
if(row==0){
alert("Rows above the header row are not alloweed");
}else{
if(_65e==_656){
alert("You have reached the maximum number of rows");
}else{
_65b.insertRow(row);
for(var i=0;i<_65f;i++){
cell=(_65b.rows[row].parentNode==_65c)?document.createElement("th"):document.createElement("td");
_65b.rows[row].appendChild(cell);
cell.className=(i==_65f-1)?"extraCell":"tableCell";
cell.style.width="200px";
cell.innerHTML="<div></div>";
}
this.updateTableRowClasses(_65d);
this.selectCell(_65b.rows[row].cells[col]);
}
}
break;
case 6:
if(col<_65f-1){
col++;
}
case 5:
if(_65f==_657){
alert("You have reached the maximum number of columns");
}else{
for(i=0;i<_65e;i++){
var _664=(i==_65e-1)?"extraCell":"tableCell";
if(i!=0||!this.hasTableHeader(_65b)){
cell=document.createElement("td");
}else{
cell=document.createElement("th");
}
_65b.rows[i].insertBefore(cell,_65b.rows[i].cells[col]);
cell.className=_664;
cell.innerHTML="<div></div>";
}
this.selectCell(_65b.rows[row].cells[col]);
}
break;
case 16:
case 14:
for(i=0;i<_65f;i++){
cell=_65b.rows[row].cells[i];
var _665=(_660==14)?"boldCell":"unboldCell";
var _666=(_660==14)?"unboldCell":"boldCell";
if(!cell.hasClassName){
Element.extend(cell);
}
if(!cell.hasClassName(_665)){
cell.removeClassName(_666);
cell.addClassName(_665);
}
}
break;
case 15:
case 13:
for(i=0;i<_65e;i++){
if(i!=0||!this.hasTableHeader(_65b)){
cell=_65b.rows[i].cells[col];
_665=(_660==13)?"boldCell":"unboldCell";
_666=(_660==13)?"unboldCell":"boldCell";
if(!cell.hasClassName(_665)){
cell.removeClassName(_666);
cell.addClassName(_665);
}
}
}
break;
case 7:
case 8:
case 9:
var _667,not1,not2;
if(_660==7){
_667="centerCell";
not1="leftCell";
not2="rightCell";
}else{
if(_660==8){
_667="rightCell";
not1="leftCell";
not2="centerCell";
}else{
if(_660==9){
_667="leftCell";
not1="rightCell";
not2="centerCell";
}
}
}
for(i=0;i<_65e;i++){
if(i!=0||!this.hasTableHeader(_65b)){
cell=_65b.rows[i].cells[col];
if(!cell.hasClassName){
Element.extend(cell);
}
if(!cell.hasClassName(_667)){
cell.addClassName(_667);
cell.removeClassName(not1);
cell.removeClassName(not2);
}
}
}
break;
case 10:
case 11:
case 12:
if(_660==10){
_667="centerCell";
not1="leftCell";
not2="rightCell";
}else{
if(_660==11){
_667="rightCell";
not1="leftCell";
not2="centerCell";
}else{
if(_660==12){
_667="leftCell";
not1="rightCell";
not2="centerCell";
}
}
}
for(i=0;i<_65f;i++){
cell=_65b.rows[row].cells[i];
if(!cell.hasClassName){
Element.extend(cell);
}
if(!cell.hasClassName(_667)){
cell.addClassName(_667);
cell.removeClassName(not1);
cell.removeClassName(not2);
}
}
break;
case 17:
this.resources.table_previous_element.value="";
break;
case 18:
for(i=0;i<_65d.rows.length;i++){
if(i==row&&cell.tagName.toLowerCase()!="th"){
this.resources.table_previous_element.value="";
}else{
var curr=_65d.rows[i].cells[col];
if(!curr.hasClassName){
Element.extend(curr);
}
if(!curr.hasClassName("extraCell")){
curr.update("<div></div>");
}
}
}
break;
case 19:
for(i=0;i<_65f;i++){
if(i==col){
this.resources.table_previous_element.value="";
}else{
curr=_65b.rows[row].cells[i];
if(!curr.update){
Element.extend(curr);
}
if(!curr.hasClassName("extraCell")){
curr.update("<div></div>");
}
}
}
break;
case 20:
case 21:
case 22:
if(_660==20){
_667="centerCell";
not1="rightCell";
not2="leftCell";
}else{
if(_660==21){
_667="rightCell";
not1="centerCell";
not2="leftCell";
}else{
if(_660==22){
_667="leftCell";
not1="rightCell";
not2="centerCell";
}
}
}
if(!cell.hasClassName){
Element.extend(cell);
}
if(!cell.hasClassName(_667)){
cell.removeClassName(not1);
cell.removeClassName(not2);
cell.addClassName(_667);
}
break;
case 23:
case 24:
_667=(_660==23)?"boldCell":"unboldCell";
not1=(_660==23)?"unboldCell":"boldCell";
if(!cell.hasClassName){
Element.extend(cell);
}
if(!cell.hasClassName(_667)){
cell.removeClassName(not1);
cell.addClassName(_667);
}
break;
}
};
ModuleEdit.prototype.tableHandleTabsAndArrows=function(evt){
var elm=Event.element(evt);
if(!elm.tagName||elm.tagName.toLowerCase()!="input"||elm.parentNode.tagName.toLowerCase()!="td"&&elm.parentNode.tagName.toLowerCase()!="th"){
return true;
}
if(!checkTabKeyAlone(evt)&&!checkShiftTabKey(evt)&&evt.keyCode!=Event.KEY_UP&&evt.keyCode!=Event.KEY_DOWN){
return true;
}
var cell=elm.parentNode;
var col=cell.cellIndex;
var row=cell.parentNode.rowIndex;
var _670=$(this.resources.table_edit_content_id);
var _671=_670.rows.length;
var _672=(_671==0)?0:_670.rows[0].cells.length;
if(checkTabKeyAlone(evt)){
if(col<_672-1||row<_671-1){
if(col==_672-1){
this.selectCell(_670.rows[row+1].cells[0]);
}else{
this.selectCell(_670.rows[row].cells[col+1]);
}
}
Event.stop(evt);
return false;
}else{
if(checkShiftTabKey(evt)){
if(col!=0||row!=0){
if(col==0){
this.selectCell(_670.rows[row-1].cells[_672-1]);
}else{
this.selectCell(_670.rows[row].cells[col-1]);
}
}
Event.stop(evt);
return false;
}else{
if(evt.keyCode==Event.KEY_UP){
if(row>0){
this.selectCell(_670.rows[row-1].cells[col]);
Event.stop(evt);
return false;
}
}else{
if(evt.keyCode==Event.KEY_DOWN){
if(row<_671-1){
this.selectCell(_670.rows[row+1].cells[col]);
Event.stop(evt);
return false;
}
}
}
}
}
return true;
};
ModuleEdit.prototype.selectCell=function(elm){
var _674=this.resources.table_previous_element;
if(!elm||!elm.parentNode||!elm.tagName||_674==elm||_674!=null&&_674.parentNode==elm){
return;
}
if(_674!=null&&_674.parentNode!=null){
var _675=_674.value.escapeHTML();
_674=_674.parentNode;
_674.innerHTML="<div>"+_675+"</div>";
if(!_674.removeClassName){
Element.extend(_674);
}
_674.removeClassName("selectedCell");
}
if(elm.tagName.toLowerCase()!="div"){
list=elm.getElementsByTagName("div");
if(list.length==0){
return;
}
elm=list[0];
}
var _676=$(this.resources.table_max_rows_id).value;
var _677=$(this.resources.table_max_cols_id).value;
_675=elm.innerHTML;
elm=elm.parentNode;
var _678=elm.offsetWidth;
if(!elm.update){
Element.extend(elm);
}
elm.update();
elm.addClassName("selectedCell");
var _679=document.createElement("input");
_679.type="text";
_679.value=_675.unescapeHTML().strip();
_679=elm.appendChild(_679);
var _67a=elm.offsetWidth;
var _67b=_679.offsetWidth;
if(_67a<_678){
_679.style.width=(_678-_67a+_67b)+"px";
}
_679.focus();
setTimeout(function(){
_679.focus();
},10);
this.resources.table_previous_element=_679;
if(!_679.observe){
Element.extend(_679);
}
_679.onkeydown=function(evt){
evt=getEvent(evt);
return this.tableHandleTabsAndArrows(evt);
}.bind(this);
_679.onkeypress=function(evt){
evt=getEvent(evt);
if(checkTabKeyAlone(evt)||checkShiftTabKey(evt)){
Event.stop(evt);
return false;
}else{
if(evt.keyCode!=Event.KEY_BACKSPACE&&evt.keyCode!=Event.KEY_LEFT&&evt.keyCode!=Event.KEY_RIGHT&&evt.keyCode!=Event.KEY_UP&&evt.keyCode!=Event.KEY_DOWN){
var _67e=Event.element(evt);
var cell=_67e.parentNode;
var col=cell.cellIndex;
var tr=cell.parentNode;
var row=tr.rowIndex;
var _683=$(this.resources.table_edit_content_id);
var _684=_683.rows.length;
var _685=_683.rows[0].cells.length;
if(row==0&&cell.hasClassName("extraCell")){
for(var i=0;i<_685;i++){
cell=tr.cells[i];
if(!cell.hasClassName){
Element.extend(cell);
}
if(i<_685-1||_685==_677){
cell.removeClassName("extraCell");
cell.addClassName("tableCell");
cell.addClassName("boldCell");
cell.addClassName("centerCell");
}
}
}
if(col==_685-1){
for(i=0;i<_684;i++){
var _687=_683.rows[i];
if(i<_684-1||i==_684-1&&_684>=_676-1){
cell=_687.cells[_685-1];
if(!cell.removeClassName){
Element.extend(cell);
}
cell.removeClassName("extraCell");
cell.addClassName("tableCell");
var divs=cell.getElementsByTagName("div");
if(divs!=null&&divs.length>0){
var div=divs[0];
div.style.minWidth="200px";
div.style.width="200px";
}
if(i==0){
cell.addClassName("boldCell");
}
}
if(_685<_677){
this.insertExtraCell(_687);
}
}
_685++;
}
if(row==_684-1){
var tr2;
if(_684<_676){
tr2=_683.insertRow(row+1);
}
for(i=0;i<_685;i++){
if(_684<_676){
this.insertExtraCell(tr2);
}
if(i<_685-1||_685==_677){
if(!tr.cells[i].removeClassName){
Element.extend(tr.cells[i]);
}
tr.cells[i].removeClassName("extraCell");
tr.cells[i].addClassName("tableCell");
}
}
tr.className=(_684%2==0)?"oddRow":"evenRow";
}
}
}
return true;
}.bind(this);
};
ModuleEdit.prototype.toggleTable=function(){
this.toggleDisplay(this.resources.table_edit_id);
if(this.editting){
this.showTableView();
var _68b=$(this.resources.table_view_thead_id);
var _68c=$(this.resources.table_view_tbody_id);
this.updateEditTable(_68b,_68c);
}else{
if(this.data.dirty){
var csv=this.buildCsv($(this.resources.table_edit_content_id));
this.data.content=csv;
this.data.tableStyle=$(this.resources.table_style_id).value;
this.data.sortable=$(this.resources.table_checkbox_sortable_id).checked?1:0;
this.data.caption=$(this.resources.table_caption_id).value;
_68b=$(this.resources.table_edit_thead_id);
_68c=$(this.resources.table_edit_tbody_id);
this.updateViewTable(_68b,_68c);
$(this.resources.table_view_content_id).className=this.data.tableStyle;
this.data.numRows=$(this.resources.table_view_tbody_id).rows.length+1;
this.data.numCols=$(this.resources.table_view_thead_id).rows[0].cells.length;
$(this.resources.table_view_id).show();
}else{
$(this.resources.table_view_id).show();
}
}
};
ModuleEdit.prototype.toggleCode=function(){
this.toggleDisplay(this.resources.code_edit_id);
var _68e=-2;
var _68f=-20;
var _690=150;
var _691=10;
var _692=0.5*((window.innerHeight||document.documentElement.clientHeight)-_691);
var _693=$(this.state.code_div_id);
if(this.editting){
_693=$(this.state.code_div_id);
var text=$(_693.id).innerHTML;
$(_693.id).innerHTML="<textarea id=\""+this.state.code_textarea_id+"\" class=\"moduleCodeEdit\" rows=\"10\">"+text+"</textarea>";
var _695=text.length;
var _696=this.state.code_textarea_id;
checkCharCount($F(this.state.code_max_size_id),this.state.code_textarea_id,this.state.code_size_left_id);
$(this.state.code_textarea_id).onkeypress=function(evt){
if(browser=="Opera"){
if(checkTabKeyAlone(evt)||checkShiftTabKey(evt)){
Event.stop(evt);
return false;
}
}
return true;
};
Event.observe(this.state.code_textarea_id,"keydown",function(evt){
evt=getEvent(evt);
var s;
if(checkTabKeyAlone(evt)){
s=getSelectionProperties(evt);
s.addTab();
Event.stop(evt);
return false;
}else{
if(checkShiftTabKey(evt)){
s=getSelectionProperties(evt);
s.removeTab();
Event.stop(evt);
return false;
}
}
return true;
});
this.state.origtext_width=parseFloat(Element.getWidth(this.data.div_id))+_68e+(this.state.floatright&&!_693.parentNode.hasClassName("color0")?_68f:0);
this.state.origtext_height=parseFloat(Element.getHeight(_693));
var _69a=(this.state.origtext_height<_690)?_690:this.state.origtext_height;
if(_692>_690&&_69a>_692){
_69a=_692;
}
_69a+=_691;
_693.style.height=_69a+"px";
_693.style.width=this.state.origtext_width+"px";
_693.style.padding="13px";
$(_693.id).show();
}else{
_693=$(this.state.code_div_id);
this.data.content=$(this.state.code_textarea_id).value;
this.data.codeTypeId=$(this.state.code_type_id).value;
this.data.includeLineNumbers=$(this.state.code_include_line_numbers_id).checked?1:0;
this.data.codeDisplaySize=$(this.state.code_display_size_id).value;
var _69b=document.createTextNode(this.data.content);
$(_693).update();
$(_693).appendChild(_69b);
_693.style.display="";
_693.style.width="auto";
_693.style.height="auto";
delete this.state.origtext_width;
delete this.state.origtext_height;
}
};
ModuleEdit.prototype.toggleEbay=function(){
this.toggleDisplay(this.resources.ebay_edit_id);
if(this.editting){
fireOnReturn($(this.resources.ebay_keywords_id),this.onclickEbayPreview.bind(this));
fireOnReturn($(this.resources.ebay_seller_id),this.onclickEbayPreview.bind(this));
Event.observe($(this.resources.max_results_id),"change",this.onclickEbayPreview.bindAsEventListener(this),false);
Event.observe($(this.resources.ebay_preview_id),"click",this.onclickEbayPreview.bindAsEventListener(this),false);
}else{
this.data.keywords=$F(this.resources.ebay_keywords_id);
this.data.seller=$F(this.resources.ebay_seller_id);
this.data.maxitems=$F(this.resources.max_results_id);
this.onclickEbayPreview();
}
};
ModuleEdit.prototype.toggleLink=function(){
this.toggleDisplay(this.state.link_edit_id);
if(this.editting){
this.state.select_id=null;
Element.hide(this.state.link_display_id);
if(!this.state.links){
this.loadLinkState();
}
this.state.reorder=new ModuleContentReorder(this.resources.link_drag_section,1,150,24);
$H(this.state.links.links).values().each(function(link){
if(!link.id){
return;
}
this.addLinkDragElement(link.id,link.name,false);
}.bind(this));
this.state.reorder.relayout();
if($(this.state.link_show_search_field).checked){
this.linkDisplay("link_search_field");
}else{
this.linkDisplay("link_add_field");
}
}else{
Element.show(this.state.link_display_id);
$(this.state.links_list).innerHTML="";
this.state.reorder.items.each(function(item){
var link=this.state.linkIndex[item.item_id];
var url=link.url;
var desc=link.description;
var _6a1=link.name;
var _6a2=document.createElement("li");
_6a2.id="linkitem_"+item.item_id;
_6a2.innerHTML="<a class=\"link_hub\" target=\"new\" href="+url+">"+_6a1+"</a><p>"+desc+"</p>";
$(this.state.links_list).appendChild(_6a2);
}.bind(this));
var _6a3=this.state.reorder.getitemstateRec();
for(pos in this.state.links.links){
var link=this.state.links.links[pos];
if(!link.id||!_6a3[link.id]){
continue;
}
var _6a5=_6a3[link.id].position;
if(_6a5!=pos||link.isnew){
link.move=true;
link.newpos=_6a5;
link.dirty=true;
}
}
this.data.links_json=JSONstring.make(this.state.links);
this.linkDisplay("link_add_field");
$(this.resources.link_drag_title).hide();
this.stretched=false;
$(this.resources.link_drag_section).innerHTML="";
delete this.state.reorder;
}
};
ModuleEdit.prototype.loadLinkState=function(){
if($(this.resources.json_links_id)){
this.state.links=JSONstring.toObject($(this.resources.json_links_id).innerHTML);
this.state.linkIndex=Object();
var _6a6=$H(this.state.links.links).values();
_6a6.each(function(link){
if(!link.id){
return;
}
this.state.linkIndex[link.id]=link;
}.bind(this));
}
};
ModuleEdit.prototype.toggleImage=function(){
this.toggleDisplay(this.resources.image_edit_id);
if(!this.editting){
if(this.data.dirty){
this.updateImageData();
var _6a8=this.state.reorder.getitemstate();
_6a8.each(function(_6a9){
_6a9.caption=this.state.photoData[_6a9.id].caption;
_6a9.maxSize=this.state.photoData[_6a9.id].maxSize;
}.bind(this));
this.state.images_removed.each(function(id){
_6a8.push({id:id,caption:"",position:-1});
});
this.data.images_json=JSONstring.make(_6a8);
if($(this.resources.image_display_style_id)){
this.data.dispTypeId=$F(this.resources.image_display_style_id);
var elem=$(this.resources.image_display_style_id);
this.state.image_ctrl.displayStatus=elem.options[elem.selectedIndex].text;
}
if($(this.resources.image_popup_id)){
this.data.showFullSize=($F(this.resources.image_popup_id)=="on")?1:0;
}
this.state.image_ctrl.clear();
this.state.reorder.items.each(function(item){
this.state.image_ctrl.addPhoto(this.state.photoData[item.item_id]);
}.bind(this));
this.updateImageControlHeight();
this.state.image_ctrl.render();
}
this.state.image_ctrl.toggleViewer();
Element.show(this.state.content_id);
Element.hide(this.resources.image_selection_id);
$(this.resources.image_selection_id).innerHTML="";
$(this.resources.image_drag_section).innerHTML="";
delete this.state.reorder;
delete this.state.photoData;
}else{
$(this.resources.image_computer_radio_id).checked=false;
$(this.resources.image_web_radio_id).checked=false;
$(this.resources.image_import_section_id).hide();
$(this.resources.image_upload_section_id).hide();
$(this.resources.image_load_id).hide();
$(this.resources.image_upload_target_id).style.height="0px";
Element.hide(this.state.content_id);
Element.show(this.resources.image_selection_id);
if(!this.state.image_ctrl){
eval("this.state.image_ctrl = imgCtrl_"+this.data.id);
}
this.state.image_ctrl.stopTimer();
this.state.reorder=new ModuleContentReorder(this.resources.image_drag_section,1,300,85);
this.state.photoData=new Object();
this.state.image_ctrl.photoOrder.each(function(_6ad){
var rec=this.state.image_ctrl.photoData[_6ad];
this.state.photoData[_6ad]={};
for(key in rec){
this.state.photoData[_6ad][key]=rec[key];
}
this.addImageDragElement(_6ad,rec.urlThumb,rec.caption);
}.bind(this));
this.state.reorder.relayout();
}
};
ModuleEdit.prototype.updateImageControlHeight=function(){
$newHeight=this.state.image_ctrl.getMaxDisplayHeight();
$(this.resources.image_viewer_display).style.height=$newHeight+"px";
this.state.image_ctrl.setMaxHeight($newHeight);
};
ModuleEdit.prototype.toggleVideo=function(){
this.toggleDisplay(this.resources.video_edit_id);
if(this.editting){
this.onclickVideoPreview();
}else{
var size=(this.state.floatnone)?"Big":"Small";
this.onclickVideoPreview(size);
if($(this.resources.video_url_input_id)){
this.data.url=$F(this.resources.video_url_input_id);
}
}
};
ModuleEdit.prototype.toggleRss=function(){
this.toggleDisplay(this.state.rss_edit_id);
if(!this.editting){
if($(this.state.feed_id)){
this.data.feed=$F(this.state.feed_id);
this.data.maxitems=$F(this.state.max_id);
this.data.mode=$F(this.state.mode_id);
}
this.onclickRssPreview("rss");
}
};
ModuleEdit.prototype.toggleNews=function(){
this.toggleDisplay(this.state.rss_edit_id);
if(!this.editting){
if($(this.state.keywords_id)){
this.data.keywords=$F(this.state.keywords_id);
this.data.maxitems=$F(this.state.max_id);
}
this.onclickRssPreview("news");
}
};
ModuleEdit.prototype.getContent=function(_6b0){
if(_6b0.getContent){
return _6b0.getContent();
}else{
return _6b0.activeEditor.getContent();
}
};
ModuleEdit.prototype.toggleText=function(){
var _6b1=-2;
var _6b2=-20;
var _6b3=150;
var _6b4=75;
var _6b5=0.5*((window.innerHeight||document.documentElement.clientHeight)-_6b4);
var _6b6=$(this.state.text_div_id);
var inst;
if(this.editting){
_6b6=$(this.state.text_div_id);
this.state.origtext_width=parseFloat(Element.getWidth(this.data.div_id))+_6b1+(this.state.floatright&&!_6b6.parentNode.hasClassName("color0")?_6b2:0);
this.state.origtext_height=parseFloat(Element.getHeight(_6b6));
var _6b8=(this.state.origtext_height<_6b3)?_6b3:this.state.origtext_height;
if(_6b5>_6b3&&_6b8>_6b5){
_6b8=_6b5;
}
_6b8+=_6b4;
_6b6.style.height=_6b8+"px";
_6b6.style.width=this.state.origtext_width+"px";
if(browser=="Konqueror"){
Element.update(_6b6.id,"<textarea id=\"txta_konqueror\" rows=\"10\" cols=\"80\">"+_6b6.innerHTML+"</textarea>");
}else{
tinyMCE.execCommand("mceAddControl",false,_6b6.id);
inst=tinyMCE.getInstanceById(_6b6.id);
if(inst){
if(inst.getWin&&inst.getWin()){
this.state.mce_ele_id=inst.getWin().id;
}else{
this.state.mce_ele_id=inst.id;
tinyMCE.execInstanceCommand(inst.id,"FormatBlock",false,"p");
}
}
}
}else{
if(browser=="Konqueror"){
this.data.content=$("txta_konqueror").value;
Element.update(this.state.text_div_id,this.data.content);
}else{
inst=tinyMCE.getInstanceById(this.state.text_div_id);
if(inst){
if($(this.state.mce_ele_id)){
if(inst.contentDocument){
inst.contentWindow=$(this.state.mce_ele_id).contentWindow;
inst.contentWindow.document.body.innerHTML=inst.contentDocument.body.innerHTML;
}else{
inst.contentWindow=$(this.state.mce_ele_id).contentWindow;
inst.getWin().document.body.innerHTML=inst.getDoc().body.innerHTML;
}
}
tinyMCE.triggerSave(false,true);
if(tinyMCE.activeEditor){
this.needsHtmlCleanUp=true;
this.data.content=this._cleanUpHtml(this.tiny_mce_editor,this.getContent(tinyMCE),false);
}else{
this.data.content=this.getContent(tinyMCE);
}
if(this.data.content==""){
var _6b9=new Date();
while(true){
var _6ba=new Date();
if(_6ba.getTime()>_6b9.getTime()){
break;
}
}
this.data.content=this.getContent(tinyMCE);
}
if(tinyMCE.activeEditor){
try{
tinyMCE.execCommand("mceCloseHubHtmlEditor",false,null);
}
catch(e){
}
try{
tinyMCE.execCommand("mceCloseHubLink",false,null);
}
catch(e){
}
try{
tinyMCE.execCommand("mceCloseHubDraft",false,null);
}
catch(e){
}
}
tinyMCE.execCommand("mceRemoveControl",false,this.state.text_div_id);
}
_6b6=$(this.state.text_div_id);
if(_6b6.nodeName.toLowerCase()=="input"){
_6b6.parentNode.removeChild(_6b6);
}
}
_6b6=$(this.state.text_div_id);
Element.update(_6b6,this.data.content);
_6b6.style.display="";
_6b6.style.width="auto";
_6b6.style.height="auto";
delete this.state.origtext_width;
delete this.state.origtext_height;
}
};
ModuleEdit.prototype.discard=function(){
this.setClean();
if(this.data.type=="Poll"){
this.discardPollChanges();
}else{
if(this.data.type=="Image"){
this.clearImageUploadForm();
}
}
if(this.data.type!="Text"&&this.data.type!="Code"){
Form.unserialize($(this.data.div_id),this.state.original_form);
this.data.hide=this.state.original_hide;
ModuleEdit.Manager.toggle(this.data.id);
}else{
this.data.hide=this.state.original_hide;
ModuleEdit.Manager.toggle(this.data.id);
$(this.data.div_id).innerHTML=this.state.original_html.replace(/(<[^<>]+)\s+_extended="true"/ig,"$1");
}
this.state.original_html=null;
this.state.original_form=null;
delete this.state.original_html;
delete this.state.original_form;
if(this.data.type=="Link"){
this.loadLinkState();
this.onclickCapsuleRenderFromDB(this.state.link_display_id);
}
};
ModuleEdit.prototype.computeState=function(){
var _6bb=this.getHoriz();
this.state.floatleft=(_6bb<2)?true:false;
this.state.floatright=(_6bb>2)?true:false;
this.state.floatnone=(_6bb==2)?true:false;
var _6bc=this.state.div_ele=$(this.data.div_id);
if(this.editting){
var l=this.layout;
l.topleft=Position.cumulativeOffset(_6bc);
l.height=Element.getHeight(_6bc);
l.width=Element.getWidth(_6bc);
l.bottomright=[l.topleft[0]+l.width,l.topleft[1]+l.height];
}
};
ModuleEdit.prototype.toggleDisplay=function(item,_6bf){
item=$(item);
var show;
if(_6bf!=null){
show=_6bf;
}else{
show=this.editting;
}
if(item){
var _6c1=item.style.display;
if(show&&_6c1=="none"){
item.style.display="";
}else{
if(!show&&_6c1!="none"){
item.style.display="none";
}
}
}
};
ModuleEdit.prototype.setDirty=function(){
this.data.dirty=true;
};
ModuleEdit.prototype.setClean=function(_6c2,json){
this.data.dirty=false;
if(this.data.type=="Link"){
if(json){
$(this.resources.json_links_id).innerHTML=JSONstring.make(json);
this.loadLinkState();
}
}else{
if(this.data.type=="Text"){
if(_6c2&&_6c2.responseText){
this.needsHtmlCleanUp=false;
var resp=JSONstring.toObject(_6c2.responseText);
if(resp.cleanedText){
this.data.content=resp.cleanedText;
var _6c5=$(this.state.text_div_id);
}
}
}
}
};
ModuleEdit.prototype.getHoriz=function(){
return (this.isLast())?2:this.data.horiz_id;
};
ModuleEdit.prototype.setHoriz=function(_6c6){
this.data.horiz_id=_6c6;
};
ModuleEdit.prototype.isLast=function(){
return this.state.is_last;
};
ModuleEdit.prototype.isFloated=function(){
return (this.getHoriz()!=2);
};
ModuleEdit.prototype.renderExhaustive=function(){
if(this.data.type=="Image"){
this.adjustImageWidth();
}
this.computeState();
this._renderFloat();
this.render();
};
ModuleEdit.prototype.setColorbar=function(pos){
if(this.data.type=="Image"||this.data.type=="Video"||this.data.type=="Comment"){
return;
}
if(pos==3){
$("nocolor_"+this.data.id).style.display="none";
$("yescolor_"+this.data.id).style.display="";
}else{
$("nocolor_"+this.data.id).style.display="";
$("yescolor_"+this.data.id).style.display="none";
}
};
ModuleEdit.prototype.adjustImageWidth=function(){
if(this.data.type!="Image"){
return;
}
if(!this.state.image_ctrl){
eval("this.state.image_ctrl = imgCtrl_"+this.data.id);
}
if(this.data.horiz_id>2&&!this.isLast()){
if(this.state.image_ctrl.floatStatus=="none"){
this.state.image_ctrl.floatStatus="right";
this.updateImageControlHeight();
$(this.resources.image_viewer_caption).className="caption_half";
}
}else{
if(this.state.image_ctrl.floatStatus=="right"){
this.state.image_ctrl.floatStatus="none";
this.updateImageControlHeight();
$(this.resources.image_viewer_caption).className="caption_full";
}
}
var _6c8=this.state.image_ctrl.displayStatus;
if(_6c8=="No Border"||_6c8=="With Border"){
this.state.image_ctrl.renderInlineImages();
}else{
this.state.image_ctrl.loadSlide(this.state.image_ctrl.viewer_id);
}
};
ModuleEdit.prototype._cleanUpHtml=function(ed,_6ca,tidy){
var t=this;
_6ca=_6ca.replace(/<\s*a\s+([^>]+\s+)?href\s*=\s*('[^']*'|"[^"]*")(\\s[^>]*)>/ig,function(_6cd,_6ce,href,_6d0){
_6ce=(!_6ce)?" ":" "+_6ce.strip()+" ";
_6d0=(!_6d0)?"":" "+_6d0.strip();
return "<a"+_6ce+"href="+href+_6d0+">";
}.bind(this));
_6ca=_6ca.replace(/<\s*span\s*[^>]*style=([^>]*)>([^<]*)<\s*\/span\s*>/ig,function(_6d1,_6d2,_6d3){
var _6d4="",_6d5="";
if(_6d2.match(/font-weight:\s*bold(\s+|;|'|")/ig)){
_6d4+="<strong>";
_6d5="</strong>"+_6d5;
}
if(_6d2.match(/font-style:\s*italic(\s+|;|'|")/ig)){
_6d4+="<em>";
_6d5="</em>"+_6d5;
}
if(_6d2.match(/text-decoration:\s*underline(\s+|;|'|")/ig)){
_6d4+="<u>";
_6d5="</u>"+_6d5;
}
return _6d4+_6d3+_6d5;
});
_6ca=_6ca.replace(/<\s*pre\s*>([\s\S]*)<\s*\/pre\s*>/ig,function(_6d6,_6d7){
return "<pre>"+_6d7.replace(/(<\s*br\s*>|<\s*br\s*\/\s*>)/ig,"\n")+"</pre>";
});
if(tidy){
_6ca=_6ca.replace(/(<\s*pre\s*>([\s\S]*)<\s*\/\s*pre\s*>\s*)+/ig,function(_6d8){
return "<pre>"+_6d8.replace(/<\s*\/\s*pre\s*><\s*pre\s*>/ig,"\n").replace(/<\s*\/?\s*pre\s*>/ig,"")+"</pre>";
});
}
_6ca=_6ca.replace(/<\s*p\s*>\s+<\s*\/\s*p\s*/g,"<p><br/></p>");
_6ca=_6ca.replace(/<\s*p\s*><\s*\/\s*p\s*>/ig,"");
if(this.cleanUpRules){
if(this.cleanUpRules.emptyReg){
_6ca=_6ca.replace(this.cleanUpRules.emptyReg,function(_6d9,tag){
var _6db=this.cleanUpRules.value["$"+tag.toLowerCase()];
return (_6db=="-")?"":(_6db=="+")?"<"+tag+">&nbsp;</"+tag+">":"<"+tag+"/>";
}.bind(this));
}
if(this.cleanUpRules.synReg){
_6ca=_6ca.replace(this.cleanUpRules.synReg,function(_6dc,_6dd,tag,_6df){
if(_6df==undefined||_6df==null){
_6df="";
}
return "<"+_6dd+this.cleanUpRules.value[tag.toLowerCase()]+" "+_6df+">";
}.bind(this));
}
}
if(!this.needsHtmlCleanUp){
return _6ca;
}
var _6e0=$H({content:_6ca,tidy:tidy});
var ajax=new Ajax.Request("/xml/verifyhtml.php",{parameters:_6e0.toQueryString(),asynchronous:false,onFailure:function(_6e2){
},onSuccess:function(_6e3){
if(_6e3.responseText){
var resp=JSONstring.toObject(_6e3.responseText);
_6ca=resp.cleanedText;
_6ca=_6ca.replace(/<\s*p\s*><\s*\/\s*p\s*>/ig,"");
this.needsHtmlCleanUp=false;
}
}.bind(this)});
return _6ca;
};
ModuleEdit.prototype._handleAutoSave=function(){
if(!this.editting||!this.tiny_mce_editor||!this.tiny_mce_editor.getDoc()){
if(this.autoSavePeriodicalExecuter!=null){
this.autoSavePeriodicalExecuter.stop();
this.autoSavePeriodicalExecuter=null;
}
return null;
}
var _6e5=this;
if(this.tiny_mce_editor.isDirty()){
var msg=tinymce.DOM.get("editor_status_"+this.data.id);
tinymce.DOM.setHTML(msg,"Saving draft...");
var _6e7=$H({id:this.data.id,save:1,art_id:this.data.art_id,content:this.getContent(tinyMCE)});
var ajax=new Ajax.Request("/xml/textdraft.php",{parameters:_6e7.toQueryString(),onFailure:function(_6e9){
$("editor_status_"+_6e7.id).update("Autosave failed: will try again later.");
},onSuccess:function(_6ea){
if(!_6ea.responseText){
$("editor_status_"+_6e7.id).update("Autosave failed: will try again later.");
}else{
var resp=JSONstring.toObject(_6ea.responseText);
if(resp&&resp.result=="success"){
var t=new Date();
var ampm="AM";
var h=t.getHours();
var m=(t.getMinutes()<10)?("0"+t.getMinutes()):t.getMinutes();
var d=t.getDate();
var y=t.getFullYear();
var mon=["Jan","Feb","Mar","Apr","May","Jun","July","Aug","Sept","Oct","Nov","Dec"][t.getMonth()];
var ampm=(t.getHours()>=12)?"PM":"AM";
var h=(t.getHours()%12==0)?12:(t.getHours()%12);
$("editor_status_"+_6e7.id).update("Draft saved at "+h+":"+m+" "+ampm+" on "+mon+" "+d+", "+y+"!");
if(_6e5&&_6e5.tiny_mce_editor){
_6e5.tiny_mce_editor.isNotDirty=1;
}
_6e5._activateRecoverButton();
}else{
$("editor_status_"+_6e7.id).update("Autosave failed: will try again later.");
}
}
}});
}
};
ModuleEdit.prototype._checkNetworkConnection=function(_6f3,_6f4){
if(!this.editting||!this.tiny_mce_editor||!this.tiny_mce_editor.getDoc()){
if(this.checkNetworkPeriodicalExecutor!=null){
this.checkNetworkPeriodicalExecuter.stop();
this.checkNetworkPeriodicalExecuter=null;
}
return null;
}
var _6f5=this.tiny_mce_editor.id+"_network_indicator";
if(this.tiny_mce_editor.isDirty()){
var _6f6=$H({check:"ping"});
var ajax=new Ajax.Request("/xml/verifynetwork.php",{parameters:_6f6.toQueryString(),onFailure:function(_6f8){
$(_6f5).src=_6f4.src;
$(_6f5).title=_6f4.title;
},onSuccess:function(_6f9){
if(!_6f9.responseText){
$(_6f5).src=_6f4.src;
$(_6f5).title=_6f4.title;
}else{
var resp=JSONstring.toObject(_6f9.responseText);
if(resp&&resp.result=="success"){
$(_6f5).src=_6f3.src;
$(_6f5).title=_6f3.title;
}else{
$(_6f5).src=_6f4.src;
$(_6f5).title=_6f4.title;
}
}
}});
}
};
ModuleEdit.prototype._activateRecoverButton=function(){
$(this.tiny_mce_editor.id+"_recover_button").show();
};
ModuleEdit.prototype._initializeTinyMCE=function(){
this.tiny_mce_editor=tinyMCE.activeEditor;
var _6fb=this;
var _6fc=new Image();
var _6fd=new Image();
_6fc.src="http://x.hubpages.com/x/icon_internet_on.gif";
_6fd.src="http://x.hubpages.com/x/icon_internet_off.gif";
_6fc.title="The network connection is good.";
_6fd.title="The network connection is bad.";
this.needsHtmlCleanUp=false;
this.tiny_mce_editor.onChange.add(function(ed,l,um){
if(this.needsHtmlCleanUp){
ed.setContent(this._cleanUpHtml(ed,ed.getContent(),false));
}
}.bind(this));
this.tiny_mce_editor.addCommand("hp_html_cleanup",function(ui,_702){
this.needsHtmlCleanUp=true;
return this._cleanUpHtml(this.tiny_mce_editor,_702,false);
}.bind(this));
this.tiny_mce_editor.addCommand("hp_html_tidy",function(ui,_704){
this.needsHtmlCleanUp=true;
return this._cleanUpHtml(this.tiny_mce_editor,_704,true);
}.bind(this));
var _705="";
this.tiny_mce_editor.addCommand("mceHubHtmlEditorContent",function(_706,_707){
if(_707!=null){
_705=_707;
return _705;
}else{
if(_705==""){
return null;
}else{
return _705;
}
}
}.bind(this));
if(!tinymce.DOM.get(this.tiny_mce_editor.id+"_network_indicator")){
var p=tinymce.DOM.get(this.tiny_mce_editor.id+"_path_row");
tinymce.DOM.add(p,"img",{id:this.tiny_mce_editor.id+"_network_indicator",src:_6fc.src,title:_6fc.title});
tinymce.DOM.add(p,"span",{},"&nbsp;");
var a=tinymce.DOM.add(p,"a",{id:this.tiny_mce_editor.id+"_recover_button",style:{"display":"none","margin-left":"10px","padding":"1px","font-size":"12px","font-weight":"bold","color":"#297ccf","cursor":"pointer"},title:"Press this button to recover using an autosaved draft",href:"#"},"recover draft");
tinymce.dom.Event.add(a,"click",function(e){
tinyMCE.execCommand("mceHubDraft",false,this.data.id);
this.tiny_mce_editor.selection.collapse();
tinymce.dom.Event.stop(e);
return false;
}.bind(this));
var _70b=$H({id:_6fb.data.id,check:1});
var ajax=new Ajax.Request("/xml/checkifdrafts.php",{parameters:_70b.toQueryString(),onFailure:function(_70d){
},onSuccess:function(_70e){
if(_70e&&_70e.responseText){
var resp=JSONstring.toObject(_70e.responseText);
if(resp&&resp.result=="success"){
_6fb._activateRecoverButton();
}
}
}});
tinymce.DOM.add(p,"span",{style:"padding-left:1em;",id:"editor_status_"+this.data.id},"&nbsp;");
}
var _710=this.tiny_mce_editor.getParam("tiny_mce_autosave_period",0);
var _711=this.tiny_mce_editor.getParam("tiny_mce_check_network_period",0);
if(_710>0&&this.autoSavePeriodicalExecuter==null){
this.autoSavePeriodicalExecuter=new PeriodicalExecuter(function(pe){
this._handleAutoSave(this);
}.bind(this),_710);
}
if(_711>0&&this.checkNetworkPeriodicalExecuter==null){
this.checkNetworkPeriodicalExecuter=new PeriodicalExecuter(function(pe){
this._checkNetworkConnection(_6fc,_6fd,this);
}.bind(this),_711);
}
if(this.cleanUpRules==null){
this.cleanUpRules={value:{},syn:null,empty:null,synReg:null,emptyReg:null};
function concat_with_separator(_714,str,_716){
if(str){
return str+_714+_716;
}
return _716;
};
this.tiny_mce_editor.settings.valid_elements.split(",").each(function(s){
var t=s.split("/");
var key1=t[0].replace(/^[\-#]/,"");
var _71a=null;
if(t.length>1){
var key2=t[1].replace(/^[\-#]/,"");
_6fb.cleanUpRules.value[key2.toLowerCase()]=key1;
_6fb.cleanUpRules.syn=concat_with_separator("|",_6fb.cleanUpRules.syn,key2);
_71a=(t[1].charAt(0)=="#")?"+":(t[1].charAt(0)=="-")?"-":null;
if(_71a){
_6fb.cleanUpRules.empty=concat_with_separator("|",_6fb.cleanUpRules.empty,key2);
_6fb.cleanUpRules.value["$"+key2.toLowerCase()]=_71a;
}
}
_71a=(t[0].charAt(0)=="#")?"+":(t[0].charAt(0)=="-")?"-":null;
if(_71a){
_6fb.cleanUpRules.empty=concat_with_separator("|",_6fb.cleanUpRules.empty,key1);
_6fb.cleanUpRules.value["$"+key1.toLowerCase()]=_71a;
}
});
if(this.cleanUpRules.syn){
this.cleanUpRules.synReg=new RegExp("<\\s*(/?)\\s*("+this.cleanUpRules.syn+")(\\s[^>]*)?>","ig");
}
if(this.cleanUpRules.empty){
this.cleanUpRules.emptyReg=new RegExp("<\\s*("+this.cleanUpRules.empty+")\\s*/\\s*>","ig");
}
}
};
ModuleEdit.prototype._cleanupTinyMCE=function(){
if(this.checkNetworkPeriodicalExecuter){
this.checkNetworkPeriodicalExecuter.stop();
}
if(this.autoSavePeriodicalExecuter){
this.autoSavePeriodicalExecuter.stop();
}
this.cleanUpRules=null;
this.needsHtmlCleanUp=false;
this.autoSavePeriodicalExecuter=null;
this.checkNetworkPeriodicalExecuter=null;
};
ModuleEdit.prototype.render=function(){
this.computeState();
this._renderSize();
this._renderHide();
this._renderBackground();
this._renderTypeSpecific();
this._renderMoveButtons();
this._renderFloatButtons();
if(this.data.type=="Text"){
if(this.editting&&tinyMCE.activeEditor){
this._initializeTinyMCE();
}else{
if(this.tiny_mce_editor){
this._cleanupTinyMCE();
}
}
}
};
ModuleEdit.prototype._renderSize=function(){
var _71c=this.state.div_ele;
_71c.style.height="auto";
};
ModuleEdit.prototype._renderFloat=function(){
var _71d=this.state.div_ele;
if(!this.editting){
if(!this.state.floatnone){
_71d.style.display="inline-block";
}else{
_71d.style.display="block";
}
}
};
ModuleEdit.prototype._renderTypeSpecific=function(){
switch(this.data.type){
case "Video":
this._renderVideo();
break;
case "Quiz":
this._renderQuiz();
break;
}
};
ModuleEdit.prototype._renderHide=function(){
var cont=$(this.state.content_id);
if(!cont){
return;
}
if(null==this.data.hide){
return;
}
$(this.state.hide_text_id).style.textDecoration=(this.data.hide?"line-through":"none");
};
ModuleEdit.prototype._toggleBorder=function(){
var ele=$(this.data.div_id);
if(!ele){
return;
}
var _720=(this.editting)?"solid 1px #ccc":"none";
ele.style.borderRight=_720;
ele.style.borderLeft=_720;
ele.style.borderBottom=_720;
};
ModuleEdit.prototype._renderBackground=function(){
var ele=$(this.state.content_id);
if(!ele){
return;
}
var _722=-1;
if(this.data.color!=null){
_722=ModuleEdit._getBackgroundColor("color"+this.data.color);
}
if(!this.state.current_color){
this.state.current_color=Element.getCurrentStyle(ele).backgroundColor;
}
if(this.state.current_color&&_722!=-1&&_722!=this.state.current_color){
var _723=$(this.state.text_div_id+"_tbl");
if(_723){
var _724=-20;
if(this.data.color=="0"){
var _725=Element.getWidth(_723)-_724;
_723.style.width=_725+"px";
}else{
if(Element.hasClassName(ele,"color0")){
var _725=Element.getWidth(_723)+_724;
_723.style.width=_725+"px";
}
}
}
Element.removeClassName(ele,"color0");
Element.removeClassName(ele,"color1");
Element.removeClassName(ele,"color2");
Element.addClassName(ele,"color"+this.data.color);
this.state.current_color=_722;
}
};
ModuleEdit._getBackgroundColor=function(_726){
var eles=document.getElementsByClassName(_726);
if(eles.length>0){
var _728=Element.getCurrentStyle(eles.first());
return _728.backgroundColor;
}else{
return null;
}
};
ModuleEdit.prototype._renderMoveButtons=function(){
ModuleEdit.toggleIcon(this.resources.up_button_id,(this.editting||this.data.position==0));
ModuleEdit.toggleIcon(this.resources.down_button_id,(this.editting||this.isLast()));
};
ModuleEdit.prototype._renderFloatButtons=function(){
if(this.data.type=="Comment"){
ModuleEdit.toggleIcon("cent_"+this.data.id,true);
ModuleEdit.toggleIcon("rt_"+this.data.id,true);
return;
}
var _729=(this.editting||this.state.floatnone);
ModuleEdit.toggleIcon("cent_"+this.data.id,_729);
_729=(this.editting||this.state.floatright||this.isLast());
ModuleEdit.toggleIcon("rt_"+this.data.id,_729);
};
ModuleEdit.prototype._toggleDeleteButton=function(){
ModuleEdit.toggleIcon(this.data.id+"_delete",(this.editting));
};
ModuleEdit.prototype._toggleDiscardButton=function(){
this.toggleDisplay(this.resources.discard_button_id);
};
ModuleEdit.prototype._toggleEditButton=function(){
$(this.resources.edit_button_id).className=(this.editting)?"savebtn":"editbtn";
$(this.resources.edit_button_id).innerHTML=(this.editting)?"save&nbsp;":"edit&nbsp;";
$(this.resources.edit_link_id).title=(this.editting)?"Save this Capsule":"Edit this Capsule";
};
ModuleEdit.prototype._renderPosition=function(){
alert("renderPosition deprecated?");
var _72a=this.data.position+1;
if(this.state.last_position!=_72a){
Element.update(this.resources.position_id,String(_72a));
this.state.last_position=_72a;
}
};
ModuleEdit.prototype._renderVideo=function(){
var size=(this.state.floatnone)?"Big":"Small";
var css="video"+this.state.video_type+size;
if(this.state.video_css_class!=css){
var _72d=$(this.resources.video_results_id);
if(_72d){
var _72e=_72d.getElementsByTagName("embed")[0];
}
if(_72e){
if(_72e.className!=css){
_72e.className=css;
}
this.state.video_css_class=css;
}
}
};
ModuleEdit.prototype.unselectDragElements=function(){
this.state.reorder.items.each(function(item){
item.ele.style.backgroundColor="";
});
};
ModuleEdit.prototype.wireLinkCtrlHandlers=function(){
var eles=document.getElementsByClassName("link_add_button",this.data.div_id);
eles.each(function(ele){
ele.onclick=this.onclickLinkFindAdd.bindAsEventListener(this);
}.bind(this));
};
ModuleEdit.prototype.onclickLinkFindAdd=function(_732){
_732=_732||window.event;
var elem=Event.findElement(_732,"div");
var _734=document.getElementsByClassName("link_hub",elem)[0];
$(this.state.link_status_id).update("");
this.addLink(_734.href,_734.innerHTML,_734.title);
Element.remove(elem);
return false;
};
ModuleEdit.prototype.onclickLinkAddInfo=function(){
var url=$F(this.state.link_url_id).trim().toString();
var _736=$F(this.state.link_title_id).trim().toString();
var desc=$F(this.state.link_desc_id).trim().toString();
regex=/^(ftp|https?):\/\/.+/;
if(!regex.test(url.toLowerCase())){
url="http://"+url;
}
this.addLink(url,_736,desc);
};
ModuleEdit.prototype.addLink=function(url,_739,desc){
if(url.trim().length===0){
return;
}
if(_739.length===0){
_739=url;
}
var l_id="";
this.data.links_added++;
l_id="n"+(this.data.links_added-1);
_739=_739.replace(/(\s|&nbsp;|\xA0)+/g," ");
desc=desc.replace(/(\s|&nbsp;|\xA0)+/g," ");
this.state.links.links[l_id]={id:l_id,dirty:true,isnew:true,url:url.stripScripts().stripTags(),name:_739.escapeHTML(),description:desc.escapeHTML()};
this.state.linkIndex[l_id]=this.state.links.links[l_id];
this.addLinkDragElement(l_id,_739.toString(),true);
this.state.reorder.relayout();
Field.clear(this.state.link_url_id);
Field.clear(this.state.link_title_id);
Field.clear(this.state.link_desc_id);
Field.clear(this.state.link_desc_len_id);
if(this.state.reorder.items.length>1){
Element.show(this.resources.link_drag_title);
}else{
Element.hide(this.resources.link_drag_title);
}
this.openEditBox(l_id);
};
ModuleEdit.prototype.onclickLinkUrlUpdate=function(){
this.linkHide(this.state.link_status_id);
};
ModuleEdit.prototype.onclickLinkUpdate=function(){
var url=$F(this.resources.link_edit_url).trim().stripScripts().stripTags();
var _73d=$F(this.resources.link_edit_title).trim().escapeHTML();
var desc=$F(this.resources.link_edit_desc).trim().escapeHTML();
if(url.length===0){
return;
}
if(_73d.length===0){
_73d=url;
}
var l_id=this.state.select_id;
var html=$("link_name_"+l_id);
var rec=this.state.linkIndex[l_id];
rec.dirty=true;
rec.url=url.toString();
rec.name=_73d.toString();
rec.description=desc.toString();
var _742=rec.name.replace(/\<[^>]*\>/gi,"");
$("link_name_"+l_id).update(ellipse(_742,60));
};
ModuleEdit.prototype.onclickLinkSelect=function(_743){
if(this.state.select_id!=_743){
this.state.select_id=_743;
this.unselectDragElements();
$("linkdrg_"+_743).style.backgroundColor="#ffc";
var link=this.state.linkIndex[_743];
this.populateLinkEdit(link.url,link.name,link.description);
}
if(_743){
this.linkDisplay("link_edit_box");
}
};
ModuleEdit.prototype.populateLinkEdit=function(href,text,desc){
if(href==text){
text="";
}
desc=desc.unescapeHTML().substring(0,250);
$(this.resources.link_edit_url).value=href;
$(this.resources.link_edit_title).value=text.unescapeHTML();
$(this.resources.link_edit_desc).value=desc.unescapeHTML();
$(this.resources.link_edit_desc_len).value=250-desc.length;
};
ModuleEdit.prototype.onclickLinkRemove=function(id){
var _749=id;
this.state.linkIndex[_749].deleted=true;
this.state.linkIndex[_749].dirty=true;
this.state.reorder.remove(_749);
Field.clear(this.resources.link_edit_url);
Field.clear(this.resources.link_edit_title);
Field.clear(this.resources.link_edit_desc);
if(this.state.reorder.items.length>0){
Element.show(this.resources.link_drag_title);
}else{
Element.hide(this.resources.link_drag_title);
}
this.state.reorder.relayout(true);
if(this.state.select_id!=id&&this.state.select_id!=null){
this.openEditBox(this.state.select_id);
}else{
this.state.select_id=null;
}
};
ModuleEdit.prototype.onclickLinkFind=function(){
this.state.link_search_id=this.state.link_search_term_id;
this.state.link_search_type="hub";
if(!$(this.state.link_search_id)){
return;
}
$(this.state.link_results_id).innerHTML="Searching...";
this.linkDisplay("link_find_box");
var _74a=$F(this.state.link_search_id);
var _74b=this.state.link_search_type;
var _74c=_74a+"_"+_74b;
var _74d=$H({search:_74a,maxitems:10,type:this.state.link_search_type}).toQueryString();
var ajax=new Ajax.Updater({success:this.state.link_results_id},"/xml/linkresults.php",{method:"post",parameters:_74d,onFailure:reportError,onComplete:function(){
if($(this.state.link_results_id).innerHTML==""){
$(this.state.link_results_id).innerHTML="No results found.";
}
this.wireLinkCtrlHandlers();
}.bind(this)});
};
ModuleEdit.prototype.onclickLinkTab=function(_74f){
if(!_74f){
return;
}
var eles=document.getElementsByClassName("findtaba");
if($(_74f+"_findtab")){
var tab=$(_74f+"_findtab");
eles.each(function(ele){
ele.className="findtab";
});
tab.className="findtaba";
this.state.link_search_type=_74f;
}
if($F(this.state.link_search_id)){
this.onclickLinkFind();
}
};
ModuleEdit.prototype.onclickLinkAdd=function(_753,url,_755){
if(!_755&&this.state.select_id){
this.closeEditBox(this.state.select_id);
}
if(!_753){
_753=this.renderLinkAdd.bind(this);
}
if(!url){
url=$F(this.state.link_url_id);
}
if(!url||url.trim().length==0){
return false;
}
var _756="url="+url;
var ajax=new Ajax.Request("/xml/checklink.php",{method:"get",parameters:_756,onFailure:reportError,onComplete:_753});
};
ModuleEdit.prototype.onclickLinkTest=function(){
this.onclickLinkAdd(this.renderLinkTest.bind(this),$F(this.resources.link_edit_url),1);
};
ModuleEdit.prototype.renderLinkAdd=function(req){
$(this.state.link_title_id).value="";
$(this.state.link_desc_id).value="";
try{
var j=JSONstring.toObject(req.responseText);
}
catch(e){
}
if(j){
if(j.valid){
(j.title&&j.title.length>0)&&($(this.state.link_title_id).value=j.title.unescapeHTML());
(j.desc&&j.desc.length>0)&&($(this.state.link_desc_id).value=j.desc.unescapeHTML());
$(this.state.link_desc_len_id).value=250-j.desc.length;
}
}
return this.onclickLinkAddInfo();
};
ModuleEdit.prototype.renderLinkTest=function(req){
try{
var j=JSONstring.toObject(req.responseText);
}
catch(e){
}
if(j){
if(j.status&&j.status.length>0){
$(this.state.link_status_id).update(j.status);
this.linkShow(this.state.link_status_id);
}
}
};
ModuleEdit.prototype.linkHide=function(_75c){
switch(_75c){
case this.state.link_add_field:
$(this.state.link_add_field).hide();
break;
case this.state.link_search_field:
$(this.state.link_findbox_id).hide();
$(this.state.link_search_field).hide();
break;
case this.state.link_edit_box:
$(this.state.link_edit_box).hide();
this.closeEditBox(this.state.select_id);
break;
case this.state.link_status_id:
$(this.state.link_status_id).hide();
$(this.state.link_status_button_id).show();
break;
}
};
ModuleEdit.prototype.linkShow=function(_75d){
switch(_75d){
case this.state.link_add_field:
$(this.state.link_add_field).show();
break;
case this.state.link_search_field:
$(this.state.link_search_field).show();
break;
case this.state.link_edit_box:
$(this.state.link_edit_box).show();
break;
case this.state.link_findbox_id:
$(this.state.link_findbox_id).show();
break;
case this.state.link_status_id:
$(this.state.link_status_id).show();
$(this.state.link_status_button_id).hide();
break;
}
};
ModuleEdit.prototype.linkDisplay=function(type){
if(type=="link_add_field"){
this.linkHide(this.state.link_search_field);
}
if(type=="link_search_field"){
this.linkHide(this.state.link_add_field);
}
if(type!="link_edit_box"){
this.linkHide(this.state.link_edit_box);
}
switch(type){
case "link_add_field":
this.linkShow(this.state.link_add_field);
break;
case "link_search_field":
this.linkShow(this.state.link_search_field);
break;
case "link_edit_box":
this.linkShow(this.state.link_edit_box);
break;
case "link_find_box":
this.linkShow(this.state.link_findbox_id);
break;
}
};
ModuleEdit.prototype.getElementPosition=function(id){
var _760=0;
var _761=0;
var _762=document.getElementById(id);
while(_762){
_760+=_762.offsetLeft;
_761+=_762.offsetTop;
_762=_762.offsetParent;
}
return {left:_760,top:_761};
};
ModuleEdit.prototype.closeEditBox=function(id){
if(id){
this.displayLinkDragElement(id,"edit link");
this.state.select_id=id;
this.onclickLinkUpdate();
}
$(this.state.link_edit_box).hide();
this.state.reorder.enable();
this.state.reorder.relayout(true);
this.state.select_id=null;
return false;
};
ModuleEdit.prototype.displayLinkDragElement=function(id,text,_766,item){
if(_766){
bgColor="#ffc";
}else{
bgColor="#e5e5e5";
}
$("linkedit_"+id+"_span").update(text);
$("linkdrg_"+id).style.backgroundColor=bgColor;
if(item){
var ele=$(item.ele);
ele.style.top=item.startY+"px";
}
};
ModuleEdit.prototype.openEditBox=function(id){
var _76a=this.state.reorder.items;
var _76b=this.state.reorder.options;
var _76c=this.state.reorder.canvas;
var i,item=_76a[0];
if(item.id!=id){
for(i=0;item.item_id!=id&&i<_76a.length;i++,item=_76a[i]){
this.displayLinkDragElement(item.item_id,"edit link");
}
}
if(item.item_id==id){
this.displayLinkDragElement(item.item_id,"done",true);
var rows=Math.ceil(_76a.length/_76b.num_cols);
var _770=(rows*(_76b.ele_space_per_v))+$(this.state.link_edit_box).getHeight()+_76b.ele_buffer_v;
if(_770!=parseInt(_76c.style.height,10)){
_76c.style.height=_770+"px";
}
this.state.select_id=item.item_id;
this.linkHide(this.state.link_status_id);
var link=this.state.linkIndex[item.item_id];
this.populateLinkEdit(link.url,link.name,link.description);
var top=(Math.floor((i+1)/_76b.num_cols))*_76b.ele_space_per_v-1;
$(this.state.link_edit_box).style.top=top+"px";
$(this.state.link_edit_box).show();
var _773=$(this.state.link_edit_box).getHeight()+_76b.ele_buffer_v;
var _774=new fx.Height(this.state.link_edit_box,{duration:250});
var _775=$(this.state.link_edit_box).getHeight()-_76b.ele_buffer_v;
_774.hide();
_774.custom(0,_775);
}
if(i<_76a.length){
for(i++,item=_76a[i];i<_76a.length;i++,item=_76a[i]){
var _776=Math.floor(i/_76b.num_cols);
item.startY=(_776*_76b.ele_space_per_v)+_773;
this.displayLinkDragElement(item.item_id,"edit link",false,item);
}
}
this.state.reorder.disable();
this.linkDisplay("link_edit_box");
return false;
};
ModuleEdit.prototype.addLinkDragElement=function(id,name,top){
if(!this.state.reorder){
return;
}
name=ellipse(name,60);
name=name.replace(/\<[^>]*\>/gi,"");
var _77a=document.createElement("div");
_77a.id="linkdrg_"+id;
_77a.className="reorderableLinkWrapper";
_77a.style.zIndex=1;
_77a.style.overflow="hidden";
_77a.onclick=function(){
return false;
}.bind(this);
_77a.onselectstart=function(){
return false;
};
var _77b="linkedit_"+id;
var _77c="linkremove_"+id;
this.edit="<li><a id=\""+_77b+"\" href=\"#\"><span id=\""+_77b+"_span\" class=\"editbtn\">edit link</span></a></li>";
this.remove="<li style=\"padding-left:18px\"><a title=\"delete\" id=\""+_77c+"\" href=\"#\"><img alt=\"delete\" src=\"/x/hubtool_discard_tag.gif\"></a></li>";
_77a.innerHTML="<span class=\"linkname\" id=\"link_name_"+id+"\" style=\"float: left;\">"+name+"</span>"+" <ul class=\"linkButtons\">"+this.remove+this.edit+"</ul>";
if(top){
$(this.resources.link_drag_section).insertBefore(_77a,$(this.resources.link_drag_section).firstChild);
}else{
$(this.resources.link_drag_section).appendChild(_77a);
}
$(_77c).onclick=function(){
$(this.state.link_edit_box).hide();
this.onclickLinkRemove(id);
return false;
}.bind(this);
$(_77b).onclick=function(){
this.state.reorder.relayout(true);
if($("linkedit_"+id+"_span").innerHTML=="done"){
this.closeEditBox(id);
}else{
this.openEditBox(id);
}
return false;
}.bind(this);
this.state.reorder.add(new ModuleContentReorderItem("linkdrg_"+id,id,this.state.reorder),top);
$(this.resources.link_drag_title).show();
};
ModuleEdit.prototype.onclickImageAddUpload=function(){
var _77d=document.createElement("input");
_77d.type="file";
_77d.className="upload";
_77d.name=this.resources.image_upload_id+(new Date()).getTime().toString().substr(3);
var _77e=$(this.resources.image_upload_section_id).getElementsByTagName("div")[0];
_77e.appendChild(_77d);
};
ModuleEdit.prototype.onclickImageAddImport=function(){
var div=document.createElement("div");
div.className="import";
var _780=document.createElement("label");
var url=document.createTextNode("Url: ");
_780.appendChild(url);
var _782=document.createElement("input");
_782.type="text";
_782.name=this.resources.image_import_id+(new Date()).getTime().toString().substr(3);
div.appendChild(_780);
div.appendChild(_782);
var _783=$(this.resources.image_import_section_id).getElementsByTagName("div")[0];
_783.appendChild(div);
};
ModuleEdit.prototype.onclickCsvLoad=function(){
if($F(this.resources.table_file_id).strip()!=""||$F(this.resources.table_url_id).strip()!=""){
Element.show(this.resources.table_loading_id);
$(this.resources.table_edit_form_id).submit();
}
};
ModuleEdit.prototype.onclickImageLoad=function(){
Element.show(this.resources.image_upload_gif_id);
$(this.resources.image_upload_target_id).style.height="0px";
if($(this.resources.image_upload_target_id)){
$(this.resources.image_load_form_id).submit();
}
};
ModuleEdit.prototype.imageLoadComplete=function(){
this.clearImageUploadForm();
Element.hide(this.resources.image_upload_gif_id);
$(this.resources.image_upload_target_id).style.height="60px";
if(this.state.reorder.items.length>1){
Element.show(this.resources.image_drag_title);
}else{
Element.hide(this.resources.image_drag_title);
}
};
ModuleEdit.prototype.clearImageUploadForm=function(){
var _784=function(elt){
elt.remove();
};
var _786=$$("#"+this.resources.image_import_section_id+" input");
_786.each(_784);
var _787=$$("#"+this.resources.image_import_section_id+" label");
_787.each(_784);
this.onclickImageAddImport();
var _788=$$("#"+this.resources.image_upload_section_id+" input");
_788.each(_784);
this.onclickImageAddUpload();
};
ModuleEdit.prototype.addImageDragElement=function(_789,_78a,cap){
var _78c=$(document.createElement("img"));
_78c.id="image_tn_"+_789;
_78c.src=_78a;
_78c.alt=cap;
_78c.title=cap;
Event.observe(_78c,"selectstart",function(){
return false;
});
var _78d=document.createElement("div");
_78d.id="image_tn_wrapper_"+_789;
_78d.className="reorderableImageWrapper";
Event.observe(_78d,"click",function(_78e){
if(null!=_78e&&(Event.element(_78e).tagName=="A"||Event.element(_78e).tagName=="SELECT"||Event.element(_78e).tagName=="TEXTAREA")){
return;
}else{
$("image_caption_"+_789).focus();
}
}.bind(this));
_78d.onclick=function(){
};
var _78f=$(document.createElement("a"));
Event.observe(_78f,"click",function(_790){
this.onclickImageRemove(_789);
}.bind(this));
_78f.appendChild(document.createTextNode("Delete"));
_78f.setStyle({cursor:"pointer"});
var _791=$(document.createElement("div"));
_791.appendChild(_78c);
_791.appendChild(document.createElement("br"));
_791.appendChild(_78f);
_78d.appendChild(_791);
var _792=$(document.createElement("label"));
_792.appendChild(document.createTextNode("Caption: "));
var _793=$(document.createElement("textarea"));
_793.name="image_caption_"+_789;
_793.id="image_caption_"+_789;
_793.setAttribute("wrap","virtual");
if(undefined!=this.state.photoData&&undefined!=this.state.photoData[_789]){
_793.value=this.state.photoData[_789].caption;
}
captionDiv=$(document.createElement("div"));
captionDiv.appendChild(_792);
captionDiv.appendChild(document.createElement("br"));
captionDiv.appendChild(_793);
_78d.appendChild(captionDiv);
var _794=$(document.createElement("label"));
_794.appendChild(document.createTextNode("Image size: "));
var size=$(document.createElement("select"));
size.id="image_size_"+_789;
Event.observe(size,"focus",function(){
this.state.reorder.disable();
}.bind(this));
Event.observe(size,"blur",function(){
this.state.reorder.enable();
}.bind(this));
var _796=new Array("Full Width","Half Width","Quarter Width");
["Full Width","Half Width","Quarter Width"].each(function(_797){
var _798=document.createElement("option");
_798.appendChild(document.createTextNode(_797));
size.appendChild(_798);
});
size.setStyle({verticalAlign:"middle"});
if(undefined!=this.state.photoData&&undefined!=this.state.photoData[_789]){
size.selectedIndex=this.state.photoData[_789].maxSize;
}
var _799=document.createElement("div");
_799.appendChild(_794);
_799.appendChild(document.createElement("br"));
_799.appendChild(size);
_78d.appendChild(_799);
$(this.resources.image_drag_section).appendChild(_78d);
var _79a=new ModuleContentReorderItem("image_tn_wrapper_"+_789,_789,this.state.reorder);
_79a.setBeforeStartCallback(imageDraggableBeforeStartCallback);
this.state.reorder.add(_79a);
};
function imageDraggableBeforeStartCallback(e){
if(null!=e&&Event.element(e).tagName=="TEXTAREA"){
return false;
}else{
return true;
}
};
ModuleEdit.prototype.unselectImageThumbnails=function(){
var _79c=$(this.resources.image_drag_section).getElementsByTagName("img");
$A(_79c).each(function(ele){
ele.style.backgroundColor="";
});
};
ModuleEdit.prototype.updateImageData=function(){
var _79e=$(this.resources.image_drag_section).getElementsByTagName("img");
var _79f=this.state.photoData;
$A(_79e).each(function(im){
var num=im.id.substring(9);
var _7a2=$("image_caption_"+num).value.replace(/<[^>]+(>|$)/g,"");
_7a2=_7a2.replace(/\n+/g," ");
_79f[num].caption=_7a2;
if($("image_size_"+num).selectedIndex!=_79f[num].maxSize){
_79f[num].maxSize=$("image_size_"+num).selectedIndex;
}
});
};
ModuleEdit.prototype.onclickImageRemove=function(_7a3){
this.state.images_removed.push(_7a3);
delete this.state.photoData[_7a3];
var _7a4=$("image_tn_wrapper_"+_7a3);
var _7a5=_7a4.nextSibling?_7a4.nextSibling:_7a4.previousSibling;
var _7a6=-1;
if(null!=_7a5&&_7a5.id){
_7a6=_7a5.id.match(/[0-9]+/g)[0];
}
this.state.reorder.remove(_7a3);
this.state.reorder.relayout();
if(this.state.reorder.items.length>1){
Element.show(this.resources.image_drag_title);
}else{
Element.hide(this.resources.image_drag_title);
}
};
ModuleEdit.prototype.onclickEbayPreview=function(){
var _7a7=$H({search:$F(this.resources.ebay_keywords_id),seller:$F(this.resources.ebay_seller_id),maxitems:$F(this.resources.max_results_id)}).toQueryString();
var ajax=new Ajax.Updater({success:this.resources.ebay_results_id},"/xml/ebayresults.php",{parameters:_7a7,onFailure:reportError,onComplete:function(){
}});
};
ModuleEdit.prototype.clearAmazonAsin=function(i){
$(this.state.amazon_asin_input_id+i).value="";
$(this.state.amazon_description_id+i).value="";
$(this.state.amazon_description_link_id+i).style.display="inline";
Element.hide($(this.state.amazon_description_div_id+i));
};
ModuleEdit.prototype.changeNumDisplayedAmazon=function(){
if($F(this.state.amazon_searchtype_id)=="Keyword"){
return;
}
var max=$F(this.state.max_max_id);
var num=$F(this.state.max_id);
var i;
var _7ad;
for(i=1;i<=max;i+=1){
if(i<=num){
Element.show($(this.state.amazon_asin_div_id+i));
}else{
Element.hide($(this.state.amazon_asin_div_id+i));
this.clearAmazonAsin(i);
}
}
};
ModuleEdit.prototype.displayAmazonKeywordUI=function(){
Element.hide($(this.state.amazon_searchtype_div_id));
Element.hide($(this.state.amazon_asin_search_div_id));
Element.show($(this.state.amazon_keyword_search_div_id));
Element.show($(this.state.amazon_max_display_div_id));
Element.hide($(this.state.amazon_numbered_div_id));
};
ModuleEdit.prototype.displayAmazonAsinUI=function(){
Element.hide($(this.state.amazon_searchtype_div_id));
Element.show($(this.state.amazon_asin_search_div_id));
Element.hide($(this.state.amazon_keyword_search_div_id));
Element.show($(this.state.amazon_max_display_div_id));
Element.show($(this.state.amazon_numbered_div_id));
};
ModuleEdit.prototype.displayAmazonUndecidedUI=function(){
Element.show($(this.state.amazon_searchtype_div_id));
Element.hide($(this.state.amazon_asin_search_div_id));
Element.hide($(this.state.amazon_keyword_search_div_id));
Element.hide($(this.state.amazon_max_display_div_id));
Element.hide($(this.state.amazon_numbered_div_id));
};
ModuleEdit.prototype.displayCorrectAmazonType=function(){
var type=this.data.searchtype;
if(type=="Keyword"&&this.data.keywords==""){
type="Undecided";
}
if(type=="Asin"&&this.data.asins==""){
type="Undecided";
}
switch(type){
case "Keyword":
this.displayAmazonKeywordUI();
break;
case "Asin":
this.displayAmazonAsinUI();
break;
case "Undecided":
this.displayAmazonUndecidedUI();
}
};
ModuleEdit.prototype.setAmazonSearchType=function(type){
$(this.state.amazon_searchtype_id).value=type;
switch(type){
case "Keyword":
this.displayAmazonKeywordUI();
break;
case "Asin":
this.displayAmazonAsinUI();
break;
}
};
ModuleEdit.prototype.amazonStartOver=function(){
var max=$F(this.state.max_max_id);
var i;
for(i=1;i<=max;i+=1){
this.clearAmazonAsin(i);
}
$(this.state.max_id).value=4;
$(this.state.amazon_numbered_id).checked=false;
this.changeNumDisplayedAmazon();
$(this.state.keywords_id).value="";
$(this.state.amazon_searchindex_id).value="All";
$(this.state.amazon_results_id).innerHTML="";
this.displayAmazonUndecidedUI();
};
ModuleEdit.prototype.addAmazonDescription=function(_7b2){
Element.hide($(this.state.amazon_description_link_id+_7b2));
Element.show($(this.state.amazon_description_div_id+_7b2));
};
ModuleEdit.prototype.getSafeAsin=function(i){
var asin=$F(this.state.amazon_asin_input_id+i);
asin=asin.replace(/\s+/g,"");
return asin;
};
ModuleEdit.prototype.getSafeDescription=function(i){
var des=$F(this.state.amazon_description_id+i);
des=des.replace(/%\*%/g,"");
return des;
};
ModuleEdit.prototype.implodeAsins=function(){
var max=$F(this.state.max_max_id);
var _7b8=/amazon/i;
var _7b9="";
var i;
for(i=1;i<=max;i+=1){
var _7bb=this.getSafeAsin(i);
var _7bc=(_7b8.test(_7bb))?/\/[A-Z0-9]{10}/:/[A-Z0-9]{10}/;
var asin=(_7bc.test(_7bb))?_7bb.match(_7bc)[0].replace(/\//g,""):_7bb;
if(asin!=""){
$(this.state.amazon_asin_input_id+i).value=asin;
_7b9+=asin+"\n";
}
}
return _7b9;
};
ModuleEdit.prototype.implodeDescriptions=function(){
if($F(this.state.amazon_searchtype_id)=="Keyword"){
return "";
}
var num=$F(this.state.max_id);
var _7bf=/amazon/i;
var _7c0="";
var i;
for(i=1;i<=num;i+=1){
var asin=this.getSafeAsin(i);
_7c0+=asin+":"+this.getSafeDescription(i);
if(i!=num){
_7c0+="%*%";
}
}
return _7c0;
};
ModuleEdit.prototype.onclickAmazonPreview=function(){
var _7c3=this.implodeAsins();
var _7c4=this.implodeDescriptions();
var _7c5=($F(this.state.amazon_numbered_id)=="on")?1:0;
var _7c6=$H({search:$F(this.state.keywords_id),maxitems:$F(this.state.max_id),searchIndex:$F(this.state.amazon_searchindex_id),searchType:$F(this.state.amazon_searchtype_id),asins:_7c3,descriptions:_7c4,numbered:_7c5}).toQueryString();
var ajax=new Ajax.Updater({success:this.state.amazon_results_id},"/xml/amazonresults.php",{parameters:_7c6,onFailure:reportError,onComplete:function(){
}});
};
ModuleEdit.prototype.onclickRssPreview=function(type){
var _7c9=$H({maxitems:$F(this.state.max_id)}).toQueryString();
if($(this.state.mode_id)){
_7c9+="&mode="+$F(this.state.mode_id);
}
if($(this.state.feed_id)){
_7c9+="&feed="+encodeURIComponent($F(this.state.feed_id));
}else{
if($(this.state.keywords_id)){
_7c9+="&keywords="+$F(this.state.keywords_id);
}
}
if(type){
_7c9+="&type="+type;
}
var ajax=new Ajax.Updater({success:this.state.rss_results_id},"/xml/rssresults.php",{parameters:_7c9,onFailure:reportError,onComplete:function(){
}});
};
ModuleEdit.prototype.onclickCapsuleRenderFromDB=function(_7cb){
var _7cc=$H({art_id:this.data.art_id,id:this.data.id}).toQueryString();
var ajax=new Ajax.Updater({success:_7cb},"/xml/capsule_render.php",{parameters:_7cc,onFailure:reportError,onComplete:function(){
}});
};
ModuleEdit.prototype.onclickVideoPreview=function(size){
if(!size){
size="Big";
}
var _7cf=$H({url:$F(this.resources.video_url_input_id),size:size}).toQueryString();
var ajax=new Ajax.Updater({success:this.resources.video_results_id},"/xml/videoresults.php",{parameters:_7cf,onFailure:reportError,onComplete:function(_7d1,json){
if(json){
var _7d3=(json.key=="Unrecognized URL");
hpFormHandler.lightEle(this.resources.video_key_id,_7d3);
hpFormHandler.lightEle(this.resources.video_type_id,_7d3);
Element.update(this.resources.video_key_id,json.key);
Element.update(this.resources.video_type_id,json.type);
this.state.video_type=json.type;
if(json.showPreview){
insertVideo(json.type,json.key,json.cssClass,"",this.resources.video_results_id);
}
}
}.bind(this)});
};
ModuleEdit.prototype.setHide=function(){
if($(this.state.hide_id)){
this.data.hide=$(this.state.hide_id).checked;
}
this.render();
};
ModuleEdit.prototype.setColor=function(_7d4){
this.data.color=String(_7d4);
var eles=document.getElementsByClassName("selected","colorbar_"+this.data.id);
Element.removeClassName(eles.first(),"selected");
Element.addClassName(eles.first(),"unselected");
var _7d6=$(this.data.id+"_color"+_7d4);
Element.addClassName(_7d6,"selected");
Element.removeClassName(_7d6,"unselected");
this.render();
};
ModuleEdit.prototype.load=function(){
var _7d7=$H(this.data).merge($H({load:true}));
var _7d8=_7d7.toQueryString();
var ajax=new Ajax.Updater({success:this.data.div_id},"/xml/modules.php",{method:"post",parameters:_7d8,evalScripts:true,onFailure:reportError,onComplete:this.render.bind(this)});
};
ModuleEdit.prototype.save=function(){
if(!this.data.dirty){
return;
}
if(this.tiny_mce_editor){
this.needsHtmlCleanUp=false;
this.data.content=this._cleanUpHtml(this.tiny_mce_editor,this.data.content,false);
}
var _7da=this.data.moveHoriz;
if(this.data.type=="Quiz"&&!this.data.deleted){
var ajax=new Ajax.Request("/xml/modules.php",{method:"post",parameters:$H(this.data).toQueryString(),onFailure:this.reportSaveError.bind(this),onComplete:function(_7dc){
this.setClean();
if(!_7da){
$(this.state.quiz_json_id).innerHTML=_7dc.responseText;
this._renderQuiz();
}
}.bind(this)});
}else{
var ajax=new Ajax.Request("/xml/modules.php",{method:"post",parameters:$H(this.data).toQueryString(),onFailure:this.reportSaveError.bind(this),onComplete:this.setClean.bind(this)});
}
};
ModuleEdit.prototype.animateHoriz=function(){
if(this.data.horiz_id==2){
var div=$(this.data.div_id);
var _7de=Element.getWidth(div)*2;
var _7df=new fx.Combo(div,{duration:300,width:true,height:true,opacity:false,onComplete:function(){
this.render();
}.bind(this)});
_7df.customSize(Element.getHeight(div),_7de);
_7df.toggle();
}else{
this.render();
}
};
ModuleEdit.prototype.scrollTo=function(){
var _7e0=new fx.Scroll({duration:100});
_7e0.scrollTo(this.data.div_id);
};
ModuleEdit.prototype.remove=function(_7e1){
if(_7e1){
this.data.deleted=true;
this.setDirty();
this.save();
var _7e2=new fx.Height(this.data.div_id,{duration:500,transition:fx.backIn,onComplete:function(){
Element.remove(this.data.div_id);
ModuleEdit.Manager.render();
}.bind(this)});
_7e2.toggle();
}else{
Element.remove(this.data.div_id);
}
};
ModuleEdit.prototype.reportSaveError=function(req,e){
alert("Ooops!\r\nThere was an error saving this capsule.  Please click EDIT and then SAVE to try again.  This error will be reported to the HubPages engineering team.  We thank you for your patience and understanding.");
var _7e5=$H({response:req.responseText,status:req.status,headers:req.getAllResponseHeaders()}).toQueryString();
var _7e6=new Ajax.Request("/xml/reporterror.php",{method:"post",parameters:_7e5+"&hubtoolsave=1"});
};
var ModuleManager=Class.create();
ModuleManager.prototype={initialize:function(_7e7,_7e8,_7e9){
insideHubEditor=true;
this.div_id=$(_7e7).id;
this.art_id=_7e8;
this.modules_by_order=[];
this.modules_by_id=[];
this.layout={};
this.editting=false;
ModuleEdit.Manager=this;
if(_7e9){
var _7ea=JSONstring.toObject(_7e9);
_7ea.each(function(_7eb){
var _7ec=ModuleEdit.getFromJSON(_7eb);
this.add(_7ec,false,true);
}.bind(this));
}
this._renumber();
this.render();
},getLength:function(){
return this.modules_by_order.length;
},add:function(_7ed,_7ee,bulk){
_7ee+="";
if(_7ee=="false"||_7ee.toLowerCase()=="bottom"){
_7ed.data.position=this.getLength();
}else{
if(_7ee.toLowerCase()=="top"){
_7ed.data.position=0;
}else{
_7ed.data.position=Math.min(this.getLength(),parseInt(_7ee));
}
}
this.modules_by_order.splice(_7ed.data.position,0,_7ed);
this.modules_by_id[_7ed.data.id]=_7ed;
if(!bulk){
if(ModuleEdit.options.drag_reorder_enabled){
var _7f0=_7ed.data.display_type.toLowerCase();
var _7f1="<b>"+_7f0+"</b>";
var html="<div class=\"reorder_bar\" id=\"caps_reorder_"+_7ed.data.id+"\" "+"style=\"width: 100%; height:25px; bottom: 0px; line-height:25px; z-index: 1; "+"background: url(/x/hubtool_"+_7f0+".gif) 2px 50% no-repeat #e5e5e5; cursor:move;\" "+"onselectstart=\"return false\">"+_7f1+"</div>";
var pole=new Insertion.Bottom("caps_reorder_canvas",html);
var _7f4="caps_reorder_"+_7ed.data.id;
var _7f5=_7ed.data.type=="Comment"?false:true;
var _7f6=new ReorderItem(_7f4,_7ed.data.id,_7ed.isFloated(),_7f5);
_7f6.repaint();
this.reorder.add(_7f6);
this.reorder.relayout();
}
this._renumber();
}
},addNew:function(type,_7f8){
if(undefined==_7f8){
_7f8=this.getLength();
}
addTime=new Timer();
ModuleEdit.make(type,this.art_id,_7f8,this._handleAddNewResponse.bind(this,_7f8));
},getByPosition:function(_7f9){
return this.modules_by_order[_7f9];
},getById:function(id){
return this.modules_by_id[id];
},getPosition:function(_7fb){
return this.modules_by_order.indexOf(_7fb);
},getPositionById:function(id){
var _7fd=this.modules_by_id[id];
return this.getPosition(_7fd);
},removeById:function(id,_7ff){
var _800=this.modules_by_id[id];
if(_800.editting){
return;
}
var _801=($(_800.state.empty_notification_id).style.display!="none"||(_800.data.type=="Comment"&&isNewHub))?true:false;
if(!_801&&!confirm(_800.state.delete_confirm_text)){
return;
}
delete this.modules_by_id[id];
this.modules_by_order=this.modules_by_order.reject(function(o){
return (o.data.id==_800.data.id);
});
_800.remove(_7ff);
this._renumber();
if(ModuleEdit.options.drag_reorder_enabled){
this.reorder.remove(_800.data.id);
this.reorder.relayout();
}
},removeByPosition:function(_803){
var _804=this.getByPosition(_803);
if(_804.editting){
return;
}
_804=this.modules_by_order.splice(_803,1);
delete this.modules_by_id[_804.data.id];
_804.remove(false);
this._renumber();
},renderExhaustive:function(){
this._renderFloatDivs();
this.modules_by_order.each(function(_805){
Position.set($(_805.data.div_id),[0,0]);
_805.renderExhaustive();
});
this._sweepDeadWrappers();
},render:function(){
this._renderFloatDivs();
this.modules_by_order.each(function(_806){
_806.render();
});
this._sweepDeadWrappers();
},toggle:function(id){
this.editting=!this.editting;
var mod=this.getById(id);
if(this.editting){
if($("floating_menu")){
$("floating_menu").hide();
}
this.computeState();
this.computeListener=this.computeState.bindAsEventListener(this);
Event.observe(window,"resize",this.computeListener,false);
}else{
_floatMenu();
Event.stopObserving(window,"resize",this.computeListener,false);
this.computeListener=null;
}
var _809=mod.toggle();
if(_809){
this.displayCurtain(mod.state.modal_id);
}
},moveLeft:function(id){
this.moveHoriz(id,1);
},moveCenter:function(id){
this.moveHoriz(id,2);
},moveRight:function(id){
this.moveHoriz(id,3);
},moveHoriz:function(id,_80e){
var _80f=this.getById(id);
if(_80f.editting){
return;
}
_80f.setColorbar(_80e);
_80f.setHoriz(_80e);
_80f.setDirty();
_80f.data.moveHoriz=true;
_80f.save();
_80f.data.moveHoriz=false;
this.renderExhaustive();
this.callEvent("onmove",this.modules_by_order);
},moveUp:function(id){
this.moveVert(id,0);
},moveDown:function(id){
this.moveVert(id,1);
},moveVert:function(id,_813){
this._sweepDeadWrappers();
var _814=this.getById(id);
var _815=this.getPosition(_814);
var _816=this.getLength();
var _817=(_813*2)-1;
if(_815===0&&_813===0){
return;
}
if(_815==_816-1&&_813==1){
return;
}
if(_814.editting){
return;
}
var _818=(_813==1)?_815:_815-1;
var _819=(_813==1)?_815+1:_815;
var _81a=this.getByPosition(_817+_815);
var _81b=this.getByPosition(_818);
this.modules_by_order.splice(_818,1);
this.modules_by_order.splice(_819,0,_81b);
this._saveSwap(_814,_81a);
this._renumber();
if(_814.data.type=="Image"){
_814.adjustImageWidth();
}
if(_81a.data.type=="Image"){
_81a.adjustImageWidth();
}
this._animateSwap(_814,_81a,_817);
this.callEvent("onmove",this.modules_by_order);
},_sweepDeadWrappers:function(){
setTimeout(this._sweepDeadWrappersHandler.bind(this),500);
},_sweepDeadWrappersHandler:function(){
var eles=document.getElementsByClassName("modfloat","modules");
if(eles.length!=1){
eles.each(function(ele){
if(!ele.hasChildNodes()){
Element.remove(ele);
}
});
}
var eles=document.getElementsByClassName("floatclear","modules");
eles.each(function(ele){
if(!ele.nextSibling||ele.nextSibling.nodeName!="DIV"){
Element.remove(ele);
}
});
},load:function(){
this.modules_by_order.each(function(_81f){
_81f.load();
});
},save:function(){
this.modules_by_order.each(function(_820){
_820.save();
});
},cleanUp:function(){
this.modules_by_order.each(function(m){
m.cleanUp();
});
this.div_id=null;
this.art_id=null;
this.modules_by_id=null;
this.modules_by_order=null;
},computeState:function(){
this.layout.documentSize=[Position.getDocumentWidth(),Position.getDocumentHeight()];
this.layout.viewportSize=[Position.getViewportWidth(),Position.getViewportHeight()];
this.layout.viewportScroll=[Position.getViewportScrollX(),Position.getViewportScrollY()];
},displayCurtain:function(_822){
ModuleEdit.toggleCurtain();
},toggleAutoSummary:function(){
var _823=$("autoSummary").checked;
$("articleSummary").readOnly=_823?"none":"";
$("articleSummary").style.color=_823?"#aaa":"#000";
},_saveSwap:function(_824,_825){
var _826=$H({swap:1,art_id:_824.data.art_id,id:_824.data.id,id2:_825.data.id}).toQueryString();
var ajax=new Ajax.Request("/xml/modulesswap.php",{parameters:_826,onFailure:reportError,onComplete:function(){
}});
},_animateSwap:function(_828,_829,_82a){
var _82b=$(_828.data.div_id);
var _82c=$(_829.data.div_id);
Element.makePositioned(_82b);
Element.makePositioned(_82c);
var _82d=Position.cumulativeOffset(_82b);
var _82e=Position.cumulativeOffset(_82c);
var _82f=[(_82e[0]-_82d[0])/3,(_82a)*Element.getHeight(_82c)];
var _830=[(_82d[0]-_82e[0])/3,-1*(_82a)*Element.getHeight(_82b)];
var _831=400;
var _832=new fx.Position(_82b,{duration:_831,transition:fx.backIn,onComplete:function(){
Element.undoPositioned(_82b);
Element.undoPositioned(_82c);
this.render();
}.bind(this)});
var _833=new fx.Position(_82c,{duration:_831,transition:fx.backIn,onComplete:function(){
}.bind(this)});
_82b.style.zIndex="2";
_832.move([0,0],[_82f[0],_82f[1]]);
_833.move([0,0],[_830[0],_830[1]]);
},_renumber:function(){
var _834=this.getLength();
this.modules_by_order.each(function(o,idx){
o.data.position=idx;
o.state.is_last=(idx==_834-1);
});
},_renderFloatDivs:function(){
var _837="first";
var _838;
var _839=$("modules");
var _83a=_839.firstChild;
this.modules_by_order.each(function(_83b,idx){
var _83d=$(_83b.data.div_id);
var _83e=_83b.getHoriz();
if(_83b.isLast()){
_83e=2;
}
if(_83e!=_837){
var _83f=["modfloat"];
switch(_83e){
case 1:
_83f.push("left");
break;
case 3:
_83f.push("right");
break;
case 2:
_83f.push("full");
break;
}
if(_837!="first"&&_838){
if(_837==3){
breakDiv=document.createElement("br");
breakDiv.className="floatclear";
_839.insertBefore(breakDiv,_83a);
}
_839.insertBefore(_838,_83a);
}
_838=document.createElement("div");
_838.className=_83f.join(" ");
}
_837=_83e;
if((_83b.data.type=="Comment"||_83b.data.type=="Poll"||_83b.data.type=="Quiz"||_83b.data.type=="Image"||_83b.data.type=="Video"||_83b.data.type=="Code"||_83b.data.type=="Table")&&_83e==2){
breakDiv=document.createElement("br");
breakDiv.className="floatclear";
_838.appendChild(breakDiv);
}
_838.appendChild(_83d);
if(_83b.isLast()){
_839.insertBefore(_838,_83a);
}
});
},_handleAddNewResponse:function(_840,req,json){
var _843=req.responseText.match(/ id="(.*?)" /);
var _844=(_843&&_843.length>1)?_843[1]:false;
if(_844&&json){
var pole=new Insertion.Bottom("modules",req.responseText);
var _846=ModuleEdit.getFromJSON(json);
this.add(_846,_840);
if(_840==this.getLength()-1&&!Position.withinViewport(_844)&&!$("ind")){
this._drawPointerInd("<b><img src=\"http://x.hubpages.com/i/dn-w.gif\" style=\"width: 11px; height: 10px;\" /> Added capsule below</b>");
}
_846.load();
}
this.render();
},_drawPointerInd:function(_847){
var _848="<div id=\"ind\"><div>"+_847+"</div></div>";
var pole=new Insertion.Bottom("modules",_848);
if(!window.ActiveXObject){
$("ind").style.position="fixed";
}
setTimeout("if ($('ind')) Element.remove('ind');",3500);
},callEvent:function(e){
return this[e] instanceof Function?this[e].apply(this,[].slice.call(arguments,1)):undefined;
}};
function prompt_navigate_away(_84b){
return "\n\nAre you sure you want to leave the Hubtool now?\nYou may lose some or all of your work.\n\n";
};
function selectTab(_84c,_84d,_84e){
var _84f,_850;
for(var i=0;i<_84e;i++){
_84f=$("tab_"+_84c+"_"+i);
_850=$("tabcontent_"+_84c+"_"+i);
if(!_84f||!_850){
alert("Cannot locate element: baseid="+_84c+" index="+_84d+" tabcount="+_84e);
}
if(i==_84d){
Element.addClassName(_84f,"selected");
Element.addClassName(_850,"selected");
}else{
Element.removeClassName(_84f,"selected");
Element.removeClassName(_850,"selected");
}
}
return false;
};
var ModuleReorder=Class.create();
ModuleReorder.prototype={initialize:function(_852){
ReorderItem.reorder=this;
this.art_id=_852;
this.canvas=$("caps_reorder_canvas");
this.items=[];
this.options={border_repaint_delay:800,filter_additional_overhang:40,empty_space_at_top:10,ele_height:25,ele_float_bump:10,ele_float_width:130,ele_full_width:240};
this.options.ele_space_per=this.options.empty_space_at_top+this.options.ele_height;
},add:function(item){
this.items.push(item);
},remove:function(_854){
var _855=this.items.findAll(function(o){
return (o.mod_id==_854);
});
if(_855&&_855.length>0){
_855=_855[0];
this.items=this.items.reject(function(o){
return (o.mod_id==_854);
});
Element.remove(_855.ele);
}
},findById:function(_858){
return this.items.detect(function(item){
return (item.mod_id==_858);
});
},save:function(){
this._getorder();
var _85a=this.items.collect(function(item){
return {id:item.mod_id,floated:item.floated};
});
var _85c=JSONstring.make(_85a);
var _85d=new Ajax.Request("/xml/modulesreorder.php",{parameters:"art_id="+this.art_id+"&json="+_85c,onFailure:reportError,onComplete:this.onsavedone.bind(this)});
},onsavedone:function(){
window.onbeforeunload=Prototype.emptyFunction;
location.reload();
},ondragdone:function(){
this._getorder();
this.relayout();
},resetorder:function(_85e){
var _85f=[];
_85f=_85e.collect(function(mod,i){
var _862=this.findById(mod.data.id);
_862.floated=mod.isFloated();
return _862;
}.bind(this));
this.items=_85f;
this.relayout(true);
},_getorder:function(){
this.items=this.items.sortBy(function(node,i){
return parseInt(node.ele.style.top,10);
});
},relayout:function(_865){
var i=1;
this.items.each(function(cap){
var ele=$(cap.ele);
var _869=(cap.floated)?this.options.ele_float_bump:0;
var top=(i*this.options.ele_space_per)+_869;
ele.style.bottom="";
ele.style.top=top+"px";
i++;
}.bind(this));
if(_865){
this.items.each(function(cap){
cap.repaint();
});
}
var _86c=(this.items.length+2)*(this.options.ele_height+10);
$("caps_reorder_canvas").style.height=_86c+"px";
}};
var ReorderItem=Class.create();
ReorderItem.reorder=null;
ReorderItem.prototype={initialize:function(ele,_86e,_86f,_870){
ele=$(ele);
this.mod_id=_86e;
this.ele=ele;
this.opts=ReorderItem.reorder.options;
this.floated=_86f;
this.floatable=_870;
this.dragged=false;
var d=new Dragger(ele,true);
var loc=[0,0];
var dim=Element.getDimensions(ReorderItem.reorder.canvas);
var _874=this.opts.filter_additional_overhang;
d.addFilter(Dragger.filters.SQUARE,loc[0]-_874,loc[1],dim.width-_874,dim.height-this.opts.ele_height);
d.onstop=this.ondragdone.bind(this);
d.ondrag=this.ondrag.bind(this);
this.ondblclickListener=this.ondblclick.bindAsEventListener(this);
this.ele.ondblclick=this.ondblclickListener;
},ondblclick:function(e){
if(!this.floatable){
return;
}
e=e||window.event;
var ele=Event.element(e);
this.floated=!this.floated;
this.repaint();
ReorderItem.reorder.ondragdone();
},ondrag:function(e){
this.dragged=true;
this.ele.style.zIndex="100";
this.ele.style.border="solid 2px #c00";
},ondragdone:function(){
if(this.dragged){
this.repaint();
this.dragged=false;
ReorderItem.reorder.ondragdone();
}
},width:function(){
return this.floated?this.opts.ele_float_width:this.opts.ele_full_width;
},height:function(){
return this.opts.ele_height;
},zindex:function(){
return this.floated?"2":"1";
},repaint:function(){
if(browser!="IE"){
Field.focus(this.ele);
}
this.ele.style.left="";
this.ele.style.right="5px";
this.ele.style.zIndex=this.zindex();
this.ele.style.width=this.width()+"px";
setTimeout("$('"+this.ele.id+"').style.border = 'solid 1px #aaa'",this.opts.border_repaint_delay);
}};
ReorderItem.make=function(mod){
var _879="<b>"+mod.data.display_type+"</b>";
var html="<div class=\"dragbar\" id=\"caps_reorder_"+mod.data.id+"\" "+"style=\"width:100%; height:25px; bottom:0px; "+"border:solid 1px #999; font-size:9px; padding:1px; "+"overflow:hidden; right:5px; z-index:1;"+"cursor:pointer\" onselectstart=\"return false\">"+_879+"</div>";
var pole=new Insertion.Bottom("caps_reorder_canvas",html);
var _87c="caps_reorder_"+mod.data.id;
var _87d=mod.data.type=="Comment"?false:true;
var ri=new ReorderItem(_87c,mod.data.id,mod.isFloated(),_87d);
ri.repaint();
return ri;
};
var ModuleContentReorder=Class.create();
ModuleContentReorder.prototype={disabled:false,initialize:function(_87f,_880,_881,_882){
this.canvas=$(_87f);
this.items=[];
this.options={num_cols:_880,filter_additional_overhang:40,ele_buffer_v:10,ele_buffer_h:10,ele_height:_882,ele_width:_881,offset_v:5,offset_h:0};
this.options.ele_space_per_v=this.options.ele_buffer_v+this.options.ele_height;
this.options.ele_space_per_h=this.options.ele_buffer_h+this.options.ele_width;
},add:function(item,top){
if(top){
this.items.unshift(item);
}else{
this.items.push(item);
}
},enable:function(){
if(!this.disabled){
return true;
}
this.items.each(function(item){
item.ele.ondblclick=item.ondblclickListener;
item.ele.setStyle({cursor:"move"});
item.d.enable(item.ele);
}.bind(this));
this.disabled=false;
},disable:function(){
this.items.each(function(item){
item.d.disable(item.ele);
item.ele.ondblclick=function(){
return false;
};
item.ele.setStyle({cursor:"default"});
}.bind(this));
this.disabled=true;
},remove:function(_887){
this.items=this.items.reject(function(item){
if(item.item_id==_887){
Element.remove(item.ele);
return true;
}else{
return false;
}
});
},ondragdone:function(){
this._getorder();
this.relayout();
},_getorder:function(){
this.items=this.items.sortBy(function(item,i){
if(this.options.num_cols==1){
return parseInt(item.ele.style.top,10);
}
var vIdx=parseInt(item.ele.style.top,10);
var hIdx=parseInt(item.ele.style.left,10);
var _88d=Math.round((vIdx-this.options.offset_v)/this.options.ele_space_per_v);
var _88e=Math.round((hIdx-this.options.offset_h)/this.options.ele_space_per_h);
if(item.dropped){
if(_88e<0){
_88e=0;
}
if(_88e>=this.options.num_cols){
_88e=this.options.num_cols-1;
}
var _88f=Math.round((item.startY-this.options.offset_v)/this.options.ele_space_per_v);
var _890=Math.round((item.startX-this.options.offset_h)/this.options.ele_space_per_h);
if((_88f<_88d)||(_88f==_88d&&_890<_88e)){
_88e+=0.5;
}else{
_88e-=0.5;
}
}
return (_88d*this.options.num_cols)+_88e;
}.bind(this));
},relayout:function(_891){
var i=0;
this.items.each(function(item){
var ele=$(item.ele);
var _895=Math.floor(i/this.options.num_cols);
var _896=i%this.options.num_cols;
item.startY=(_895*this.options.ele_space_per_v)+this.options.offset_v;
item.startX=(_896*this.options.ele_space_per_h)+this.options.offset_h;
ele.style.bottom="";
ele.style.top=item.startY+"px";
ele.style.left=item.startX+"px";
i++;
}.bind(this));
if(_891){
this.items.each(function(item){
item.repaint();
});
}
var rows=Math.ceil(this.items.length/this.options.num_cols);
var _899=(rows*(this.options.ele_space_per_v))+10;
if(_899!=parseInt(this.canvas.style.height,10)){
this.canvas.style.height=_899+"px";
}
},getitemstate:function(){
this._getorder();
items_state=Array();
var pos=0;
this.items.each(function(item){
items_state.push({id:item.item_id,position:pos++});
});
return items_state;
},getitemstateRec:function(){
this._getorder();
items_state=Object();
var pos=0;
this.items.each(function(item){
items_state[item.item_id]={id:item.item_id,position:pos++};
});
return items_state;
}};
var ModuleContentReorderItem=Class.create();
ModuleContentReorderItem.prototype={initialize:function(_89e,_89f,_8a0){
var ele=$(_89e);
this.item_id=_89f;
this.ele=ele;
this.reorder=_8a0;
this.opts=this.reorder.options;
this.dragged=false;
this.dropped=false;
this.startX=0;
this.startY=0;
this.d=new Dragger(ele,true);
this.d.onstart=this.onstart.bind(this);
this.d.onstop=this.ondragdone.bind(this);
this.ondblclickListener=this.ondblclick.bindAsEventListener(this);
this.ele.ondblclick=this.ondblclickListener;
},ondblclick:function(e){
},setBeforeStartCallback:function(_8a3){
this.d.setonbeforestart(_8a3);
},onstart:function(e){
this.ele.onclick();
this.dragged=true;
this.ele.style.zIndex="100";
},ondrag:function(e){
},ondragdone:function(){
if(this.dragged){
this.repaint();
this.dragged=false;
this.dropped=true;
this.reorder.ondragdone();
this.dropped=false;
}
},repaint:function(){
if(browser!="IE"){
Field.focus(this.ele);
}
this.ele.style.zIndex=1;
}};
var GroupReorder=Class.create();
GroupReorder.prototype={initialize:function(_8a6){
GroupReorderItem.reorder=this;
this.firstGroupId=_8a6;
this.canvas=$("grp_reorder_canvas");
this.items=[];
this.options={filter_additional_overhang:40,empty_space_at_top:5,ele_height:20};
this.options.ele_space_per=this.options.empty_space_at_top+this.options.ele_height;
},add:function(item){
this.items.push(item);
},remove:function(_8a8){
this.items=this.items.reject(function(item){
if(item.hp_id==_8a8){
Element.remove(item.ele);
return true;
}else{
return false;
}
});
},removegroup:function(_8aa){
targetItem=this.findById(_8aa);
if(targetItem.collapsed){
targetItem.hiddenChildren.each(function(_8ab){
_8ab.ele.style.display="";
this.items.push(_8ab);
}.bind(this));
}else{
flag=false;
offset=this.items.length+1;
this.items=this.items.sortBy(function(item,i){
if(!item.is_article){
flag=(_8aa==item.hp_id);
}
return flag?(i+offset):i;
});
}
if(_8aa==this.firstGroupId){
this.firstGroupId=this.items.first().hp_id;
}
this.remove(_8aa);
this.relayout();
},findById:function(_8ae){
return this.items.detect(function(item){
return (item.hp_id==_8ae);
});
},ondragdone:function(){
this._getorder();
this.relayout();
},toggleGroupById:function(_8b0){
targetItem=this.findById(_8b0);
this.toggleGroup(targetItem);
},toggleGroup:function(_8b1){
if(_8b1.collapsed){
this.expandGroup(_8b1);
}else{
this.hideGroup(_8b1);
}
},hideGroup:function(_8b2){
var _8b3=-1;
var res=this.items.partition(function(item){
if(!item.is_article){
_8b3=item.hp_id;
}else{
if(_8b3==_8b2.hp_id){
item.ele.style.display="none";
return false;
}
}
return true;
});
this.items=res[0];
_8b2.hiddenChildren=res[1];
_8b2.ele.getElementsByTagName("img")[0].src="/x/drop_right_grey.gif";
_8b2.collapsed=true;
this.relayout();
},expandGroup:function(_8b6){
this.items=this.items.inject(Array(),function(_8b7,item,i){
_8b7.push(item);
if(item==_8b6){
_8b6.hiddenChildren.each(function(_8ba){
_8ba.ele.style.display="";
_8b7.push(_8ba);
});
}
return _8b7;
});
_8b6.hiddenChildren=null;
_8b6.ele.getElementsByTagName("img")[0].src="/x/drop_down_grey.gif";
_8b6.collapsed=false;
this.relayout();
},hideAll:function(){
this.items.each(function(item){
if(!item.is_article&&!item.collapsed){
this.hideGroup(item);
}
}.bind(this));
},expandAll:function(){
this.items.each(function(item){
if(!item.is_article&&item.collapsed){
this.expandGroup(item);
}
}.bind(this));
},_getorder:function(){
this.items=this.items.sortBy(function(node,i){
return parseInt(node.ele.style.top,10);
});
},relayout:function(_8bf){
if(this.items.first().hp_id!=this.firstGroupId){
if(this.firstGroupId==0&&!this.items.first().is_article){
this.firstGroupId=this.items.first().hp_id;
}else{
groupItem=this.findById(this.firstGroupId);
this.items=this.items.reject(function(item){
return (item.hp_id==this.firstGroupId);
}.bind(this));
this.items.unshift(groupItem);
}
}
var i=1;
this.items.each(function(item){
ele=$(item.ele);
ele.style.bottom="";
ele.style.top=((i-0.5)*this.options.ele_space_per)+"px";
i++;
}.bind(this));
if(_8bf){
this.items.each(function(item){
item.repaint();
});
}
canvas_height=((this.items.length+0.5)*this.options.ele_space_per)+20;
this.canvas.style.height=canvas_height+"px";
},getitemstate:function(){
this._getorder();
items_state=Array();
pos=0;
this.items.each(function(item){
if(!item.is_article){
groupId=item.hp_id;
pos=0;
if(item.hiddenChildren){
item.hiddenChildren.each(function(_8c5){
items_state.push({id:_8c5.hp_id,group:groupId,pos:pos++});
});
}
}else{
if(groupId==0){
items_state.push({id:item.hp_id,group:0,pos:0});
}else{
items_state.push({id:item.hp_id,group:groupId,pos:pos++});
}
}
});
return items_state;
}};
var GroupReorderItem=Class.create();
GroupReorderItem.prototype={initialize:function(name,ele,_8c8,_8c9,_8ca){
ele=$(ele);
this.name=name;
this.hp_id=_8c8;
this.ele=ele;
this.is_article=_8c9;
this.showname=_8ca;
this.opts=GroupReorderItem.reorder.options;
this.dragged=false;
this.draggerObj=new Dragger(ele,true);
this.collapsed=false;
this.hiddenChildren=null;
loc=Position.realOffset(GroupReorderItem.reorder.canvas);
dim=Element.getDimensions(GroupReorderItem.reorder.canvas);
add_overhang=this.opts.filter_additional_overhang;
this.draggerObj.addFilter(Dragger.filters.SQUARE,loc[0]-add_overhang,loc[1],dim.width-add_overhang,dim.height-this.opts.ele_height);
this.draggerObj.onstop=this.ondragdone.bind(this);
this.draggerObj.ondrag=this.ondrag.bind(this);
this.ondblclickListener=this.ondblclick.bindAsEventListener(this);
this.ele.ondblclick=this.ondblclickListener;
},ondblclick:function(e){
GroupReorderItem.reorder.toggleGroup(this);
},ondrag:function(e){
if(!this.is_article){
this.draggerObj.stop();
this.repaint();
GroupReorderItem.reorder.relayout();
}else{
this.dragged=true;
this.ele.style.zIndex="100";
}
},ondragdone:function(){
if(this.dragged){
var _8cd=GroupReorderItem.reorder.items.first();
var top=parseInt(this.ele.style.top,10);
GroupReorderItem.reorder.items.detect(function(item){
if(parseInt(item.ele.style.top,10)>top){
return true;
}
_8cd=item;
});
if(_8cd.collapsed){
this.ele.style.display="none";
_8cd.hiddenChildren.push(this);
GroupReorderItem.reorder.items=GroupReorderItem.reorder.items.without(this);
}
this.repaint();
this.dragged=false;
GroupReorderItem.reorder.ondragdone();
}
},repaint:function(){
if(browser!="IE"){
Field.focus(this.ele);
}
this.ele.style.left="5px";
this.ele.style.right="";
this.ele.style.zIndex=1;
}};
var ImageViewerControl=Class.create();
ImageViewerControl.prototype={initialize:function(_8d0,_8d1,_8d2,_8d3){
this.modId=_8d0;
this.floatStatus=_8d1;
this.displayStatus=_8d2;
this.popupFlg=_8d3;
this.photoData=new Object();
this.photoOrder=new Array();
this.viewer_id=null;
this.timer=null;
this.slide_idx=-1;
this.displaySlideshowLinks=false;
this.resources={ht_viewer_sect:"image_viewer_"+this.modId,ht_inline_sect:"image_inline_"+this.modId,ht_slideshow_sect:"image_slideshow_"+this.modId,ht_thumbnail_sect:"image_thumbnail_"+this.modId,inline_images:"imgs_"+this.modId,viewer_display:"slide_display_"+this.modId,viewer_photo:"slide_img_"+this.modId,viewer_caption:"slide_desc_"+this.modId,thumb_tn_section:"slide_tn_section_"+this.modId,slide_play_btn:"play_"+this.modId,slide_pause_btn:"pause_"+this.modId};
},setMaxHeight:function(_8d4){
this.firstTimeLoadingImage=true;
this.maxHeight=_8d4;
},addPhoto:function(rec){
this.photoData[rec.id]=rec;
this.photoOrder.push(rec.id);
},clear:function(){
delete this.photoData;
this.photoData=new Object();
this.photoOrder.clear();
},render:function(){
switch(this.displayStatus){
case "No Border":
case "With Border":
this.renderInlineImages();
break;
case "Thumbnail":
this.renderThumbnails();
break;
case "Slideshow":
this.viewer_id=-1;
this.nextSlide(true);
break;
}
},toggleViewer:function(){
switch(this.displayStatus){
case "No Border":
case "With Border":
Element.hide(this.resources.ht_viewer_sect);
Element.show(this.resources.ht_inline_sect);
Element.hide(this.resources.ht_thumbnail_sect);
Element.hide(this.resources.ht_slideshow_sect);
break;
case "Thumbnail":
Element.show(this.resources.ht_viewer_sect);
Element.hide(this.resources.ht_inline_sect);
Element.show(this.resources.ht_thumbnail_sect);
Element.hide(this.resources.ht_slideshow_sect);
break;
case "Slideshow":
Element.show(this.resources.ht_viewer_sect);
Element.hide(this.resources.ht_inline_sect);
Element.hide(this.resources.ht_thumbnail_sect);
Element.show(this.resources.ht_slideshow_sect);
break;
}
},loadSlide:function(id){
if(!this.firstTimeLoadingImage&&this.maxHeight){
$(this.resources.viewer_display).style.height=this.maxHeight+"px";
}
this.viewer_id=id;
rec=this.photoData[id];
$(this.resources.viewer_photo).innerHTML=this._getDisplayUrl();
$(this.resources.viewer_caption).innerHTML=rec.caption;
if(this.popupFlg){
this._addpopup(id,$(this.resources.viewer_photo).firstChild);
}
this.firstTimeLoadingImage=false;
},getMaxDisplayHeight:function(){
var top=0;
this.photoOrder.each(function(id){
var hgt=this._getDisplayHeight(id);
top=hgt>top?hgt:top;
}.bind(this));
return top;
},setDisplaySlideshowLinks:function(_8da){
this.displaySlideshowLinks=_8da;
},_getDisplayUrl:function(){
rec=this.photoData[this.viewer_id];
var _8db=rec.origWidth>=200&&rec.origHeight>=150;
if(rec.maxSize==2&&this.displayStatus=="With Border"){
return this._createImageTag(rec.urlQuarter,"quarter_frame",rec.esc_cap)+(_8db&&this.displaySlideshowLinks?getHubSlideshowHtml("quarter",this.displayStatus=="With Border"):"");
}else{
if(rec.maxSize==2){
return this._createImageTag(rec.urlQuarter,"quarter",rec.esc_cap)+(_8db&&this.displaySlideshowLinks?getHubSlideshowHtml("quarter",this.displayStatus=="With Border"):"");
}else{
if((this.floatStatus=="right"||rec.maxSize==1)&&this.displayStatus=="With Border"){
return this._createImageTag(rec.urlHalfPad,"half_frame",rec.esc_cap)+(_8db&&this.displaySlideshowLinks?getHubSlideshowHtml("half",this.displayStatus=="With Border"):"");
}else{
if(this.floatStatus=="right"||rec.maxSize==1){
return this._createImageTag(rec.urlHalf,"half",rec.esc_cap)+(_8db&&this.displaySlideshowLinks?getHubSlideshowHtml("half",this.displayStatus=="With Border"):"");
}else{
if(this.floatStatus=="none"&&this.displayStatus=="With Border"){
return this._createImageTag(rec.urlFullPad,"full_frame",rec.esc_cap)+(_8db&&this.displaySlideshowLinks?getHubSlideshowHtml("full",this.displayStatus=="With Border"):"");
}else{
if(this.floatStatus=="none"){
return this._createImageTag(rec.urlFull,"full",rec.esc_cap)+(_8db&&this.displaySlideshowLinks?getHubSlideshowHtml("full",this.displayStatus=="With Border"):"");
}
}
}
}
}
}
},_createImageTag:function(url,_8dd,_8de){
if(undefined==_8de){
_8de="";
}
return "<img class='"+_8dd+"' title='"+_8de+"' alt='"+_8de+"' src='"+url+"' />";
},_getDisplayHeight:function(_8df){
rec=this.photoData[_8df];
if(rec.maxSize==2){
return rec.ratio*120;
}else{
if((this.floatStatus=="right"||rec.maxSize==1)&&this.displayStatus=="With Border"){
return rec.ratio*248;
}else{
if(this.floatStatus=="right"||rec.maxSize==1){
return rec.ratio*260;
}else{
if(this.floatStatus=="none"&&this.displayStatus=="With Border"){
return rec.ratio*496;
}else{
if(this.floatStatus=="none"){
return rec.ratio*520;
}
}
}
}
}
},_addInlineImage:function(id){
this.viewer_id=id;
var rec=this.photoData[id];
var _8e2=document.createElement("div");
var _8e3=this._getDisplayUrl();
if(this.floatStatus=="none"){
var _8e4="caption_full";
}else{
var _8e4="caption_half";
}
_8e2.id="img_"+rec.id;
_8e2.innerHTML="<div id='img_url_"+rec.id+"'>"+_8e3+"</div>"+"<div class='"+_8e4+"' id='img_desc_"+rec.id+"'>"+rec.caption+"</div>";
$(this.resources.inline_images).appendChild(_8e2);
if(this.popupFlg){
this._addpopup(rec.id,$("img_url_"+rec.id).firstChild);
}
},renderInlineImages:function(){
$(this.resources.inline_images).innerHTML="";
this.photoOrder.each(function(id){
this._addInlineImage(id);
}.bind(this));
},_addThumbnail:function(id){
var rec=this.photoData[id];
var _8e8=document.createElement("img");
_8e8.id="slide_tn_"+rec.id;
_8e8.src=rec.urlThumb;
_8e8.alt=rec.caption;
_8e8.title=rec.caption;
_8e8.onclick=function(){
this.loadSlide(rec.id);
}.bind(this);
$(this.resources.thumb_tn_section).appendChild(_8e8);
},renderThumbnails:function(){
$(this.resources.thumb_tn_section).innerHTML="";
this.photoOrder.each(function(id){
this._addThumbnail(id);
}.bind(this));
if(this.photoOrder.length>0){
$("slide_tn_"+this.photoOrder[0]).onclick();
}
},nextSlide:function(_8ea){
if(this.photoOrder.length==0){
return;
}
if(_8ea){
this.slide_idx++;
if(this.slide_idx>=this.photoOrder.length){
this.slide_idx=0;
}
}else{
this.slide_idx--;
if(this.slide_idx<0){
this.slide_idx=this.photoOrder.length-1;
}
}
var id=this.photoOrder[this.slide_idx];
this.loadSlide(id);
},startTimer:function(){
this.nextSlide(true);
this.timer=setTimeout(this.startTimer.bind(this),3000);
Element.show($("pause_"+this.modId));
Element.hide($(this.resources.slide_play_btn));
},stopTimer:function(){
clearTimeout(this.timer);
Element.show($(this.resources.slide_play_btn));
Element.hide($(this.resources.slide_pause_btn));
},_addpopup:function(id,img){
img.onclick=function(){
this.popupFullsize(id);
}.bind(this);
img.title="Click to see full-size image.";
img.style.cursor="pointer";
},popupFullsize:function(id){
rec=this.photoData[id];
attrs="width="+rec.origWidth+",height="+rec.origHeight+",resizable=yes,scrollbars=no,toolbar=no,status=no,menubar=no,directories=no,location=no";
window.open(rec.urlOriginal,"",attrs);
}};
var WidgetCanvas=Class.create();
WidgetCanvas.prototype={initialize:function(_8ef,_8f0,_8f1,_8f2,_8f3,_8f4){
this.userId=_8ef;
this.canvasId=_8f0;
this.element=$(_8f0);
this.column={};
this.widget={};
this.horizSpace=_8f3;
this.height=$(_8f0).offsetHeight;
this.draggedId=null;
if(typeof _8f4=="undefined"){
_8f4="dottedBox";
}
this.DOTTEDBOX_ID=_8f4;
this.dottedBox=$(this.DOTTEDBOX_ID);
if(!this.dottedBox){
this.element.innerHTML+="<div id='"+_8f4+"' style='display:none;'></div>";
}
this.width=this.element.offsetWidth;
this.startY=getElementTop(this.element);
for(var c=0;c<_8f1;c++){
var _8f6=_8f2+"_"+c;
this.column[_8f6]=new ColumnContainer(_8f6,this);
}
this.widget[this.DOTTEDBOX_ID]=new Widget($(this.DOTTEDBOX_ID),null,false);
this.redraw();
},addWidget:function(_8f7,_8f8,_8f9){
this.widget[_8f7.getId()]=_8f7;
_8f8.add(_8f7,_8f9);
},addNewWidget:function(_8fa,_8fb,_8fc){
if(typeof _8fb=="undefined"){
for(var prop in this.column){
_8fb=prop;
break;
}
}
if(typeof _8fc=="undefined"){
_8fc=0;
}
var _8fe=$H({action:"add",widgetTypeId:_8fa,userId:this.getUserId(),columnId:_8fb,position:_8fc}).toQueryString();
var ajax=new Ajax.Request("/xml/widgets.php",{method:"post",parameters:_8fe,onFailure:reportError,onSuccess:function(_900){
if(!_900.responseText){
reportError(_900);
}else{
var resp=JSONstring.toObject(_900.responseText);
this.column[_8fb].addWidgetHTML(resp.id,resp.widgetHTML,_8fc);
_drawPointerInd(this.canvasId,"<span class=\"indicatorClass\"><b><img src=\"http://x.hubpages.com/i/dn-w.gif\" style=\"width: 11px; height: 10px;\" /> Added widget on top</b></span>");
}
}.bind(this)});
},checkHeight:function(_902){
if(_902>this.height){
this.element.style.height=_902+"px";
this.height=_902;
}
},lock:0,saveWidgetConfig:function(id){
var _904=this.widget[id];
var _905=$H({action:"update",userId:this.getUserId(),columnId:_904.getColumnId(),position:_904.getPosition(),configData:_904.getConfigData(),widgetId:_904.getId()}).toQueryString();
var ajax=new Ajax.Request("/xml/widgets.php",{method:"post",parameters:_905,onFailure:reportError,onSuccess:_904.refresh.bind(_904)});
this.closeWidgetConfig(id);
},closeWidgetConfig:function(id){
$("edit_"+id).hide();
$("control_"+id).show();
this.widget[id].getColumn().redraw();
},removeWidget:function(id){
var _909=this.widget[id];
var _90a=$H({action:"remove",userId:this.getUserId(),position:_909.getPosition(),columnId:_909.getColumnId(),widgetId:id}).toQueryString();
var ajax=new Ajax.Request("/xml/widgets.php",{method:"post",parameters:_90a,onFailure:reportError,onSuccess:function(){
$(_909.getId()).hide();
$("edit_"+_909.getId()).hide();
_909.getColumn().remove(_909);
}});
},handlePage:function(id,_90d){
this.widget[id].refresh(_90d);
},handleWidgetInfo:function(id){
var _90f="edit_"+id;
var _910="footer_"+id;
var _911="control_"+id;
var _912="config_"+id;
var _913="content_"+id;
var _914="title_"+id;
var _915=$(id).getHeight()-$(_914).getHeight()-$(_910).getHeight()-10;
var _916=$(_90f).getHeight();
if(_915>_916){
$(_90f).style.height=$(id).getHeight()+"px";
$(_90f).style.width=$(id).style.width;
$(_912).style.height=_915+"px";
}else{
this.checkHeight(_916);
}
$(_911).toggle();
$(_90f).toggle();
this.widget[id].getColumn().redraw();
var _917=new fx.Height(_90f,{duration:1000});
_917.hide();
_917.custom(0,_916);
},getLock:function(){
return (0==this.lock++);
},makeDraggable:function(_918){
if(this.draggedId!=null){
return false;
}
this.draggedId=_918.getId();
return true;
},beingDragged:function(_919){
return this.draggedId==_919.getId();
},doneBeingDragged:function(){
this.draggedId=null;
},releaseLock:function(){
this.lock=0;
},getUserId:function(){
return this.userId;
},getCurrentColumnId:function(_91a){
var _91b=this.widget[_91a.getId()].getColumnId();
for(var _91c in this.column){
if(this.column[_91c].containsElement(_91a,_91b)){
return _91c;
}
}
return _91b;
},getStartY:function(){
return this.startY;
},getHorizSpace:function(){
return this.horizSpace;
},hideDottedBox:function(){
$(this.DOTTEDBOX_ID).hide();
},drawDottedBox:function(top,left,_91f,_920){
$(this.DOTTEDBOX_ID).hide();
$(this.DOTTEDBOX_ID).style.top=top+"px";
$(this.DOTTEDBOX_ID).style.left=left+"px";
$(this.DOTTEDBOX_ID).style.height=_91f+"px";
$(this.DOTTEDBOX_ID).style.width=_920+"px";
$(this.DOTTEDBOX_ID).show();
},swapColumns:function(_921,_922,_923){
this.widget[_921.getId()].setColumn(this.column[_923]);
this.column[_922].remove(_921);
this.column[_923].add(_921);
},columnBefore:function(_924,_925){
return this.column[_924].getStartX()<this.column[_925].getStartX();
},columnAfter:function(_926,_927){
return this.column[_926].getStartX()>this.column[_927].getStartX();
},redraw:function(){
var _928=0;
for(var _929 in this.column){
this.column[_929].redraw();
if(this.column[_929].getHeight()>_928){
_928=this.column[_929].getHeight();
}
}
this.height=_928;
this.element.style.height=_928+"px";
}};
var ColumnContainer=Class.create();
ColumnContainer.prototype={CLASSNAME:"reorderWidget",initialize:function(_92a,_92b){
this.element=$(_92a);
this.canvas=_92b;
this.width=this.element.offsetWidth;
this.height=this.element.offsetHeight;
this.startX=this.element.offsetLeft;
this.order=[];
this.stopX=this.startX+this.width;
this.element.getElementsBySelector("div."+this.CLASSNAME).each(function(elem){
this.makeWidget(elem,this.order.length);
}.bind(this));
},makeWidget:function(elem,_92e){
var _92f=true;
var _930=new Widget(elem,this,_92f,_92e);
this.canvas.addWidget(_930,this,_92e);
},getColumnId:function(){
return this.element.id;
},getCanvas:function(){
return this.canvas;
},getHeight:function(){
return this.height;
},getStartX:function(){
return this.startX;
},containsElement:function(_931,_932){
var l=_931.getLeft();
var r=_931.getRight();
if(this.element.id==_932){
return (l>=this.startX&&r<=this.stopX);
}else{
return (l<(this.stopX-0.6*this.width)&&this.canvas.columnBefore(this.element.id,_932)||r>(this.startX+0.6*this.width+10)&&this.canvas.columnAfter(this.element.id,_932));
}
},remove:function(_935){
var tmp=[];
for(var i=0;i<this.order.length;i++){
if(this.order[i]!=_935){
this.updatePosition(tmp,this.order[i]);
}
}
this.order=tmp;
this.redraw();
},addWidgetHTML:function(id,_939,_93a){
var _93b=document.createElement("div");
if(!_93b.update){
Element.extend(_93b);
}
_93b.id=id;
_93b.className=this.CLASSNAME;
_93b.update(_939);
this.element.appendChild(_93b);
var elem=$(id);
this.makeWidget(elem,_93a);
this.redraw();
},updateWidgetHTML:function(id,_93e){
var _93f=$(id);
_93f.update(_93e);
this.redraw();
},updatePosition:function(_940,_941){
_941.setPosition(_940.length);
_940[_940.length]=_941;
},add:function(_942,_943){
var tmp=[];
var done=false;
if(_943){
for(var i=0;i<this.order.length;i++){
if(_943==0){
this.updatePosition(tmp,_942);
done=true;
}
this.updatePosition(tmp,this.order[i]);
_943--;
}
if(!done){
this.updatePosition(tmp,_942);
}
this.order=tmp;
this.redraw();
return;
}
for(i=0;i<this.order.length;i++){
if(this.order[i]!=_942){
if(done||this.order[i].getTop()<_942.getTop()){
this.updatePosition(tmp,this.order[i]);
}else{
this.updatePosition(tmp,_942);
this.updatePosition(tmp,this.order[i]);
done=true;
}
}
}
if(!done){
this.updatePosition(tmp,_942);
}
this.order=tmp;
setTimeout(function(){
this.redraw();
}.bind(this),100);
},redraw:function(){
var th=this.canvas.getStartY();
for(var i=0;i<this.order.length;i++){
var _949=this.order[i];
var h=_949.getHeight();
if(_949.isSelected()){
this.canvas.drawDottedBox(th,this.startX,h,this.width);
}else{
_949.setDimensions({top:th,left:this.startX,width:this.width});
}
th+=parseInt(h)+parseInt(this.canvas.getHorizSpace());
}
this.height=th-this.canvas.getStartY()+this.canvas.getHorizSpace();
this.canvas.checkHeight(this.height);
}};
var Widget=Class.create();
Widget.prototype={initialize:function(_94b,_94c,_94d,_94e){
if(typeof _94d=="undefined"){
_94d=true;
}
this.element=_94b;
this.column=_94c;
this.draggable=_94d;
this.position=_94e;
if(_94d){
this.makeDraggable();
}
},makeDraggable:function(){
this.dragger=new Dragger(this.element,false);
this.dragger.ondrag=this.ondrag.bind(this);
this.dragger.onstop=this.onstop.bind(this);
this.dragger.onstart=this.onstart.bind(this);
var _94f=$("title_"+this.element.id);
Event.observe(_94f,"mousedown",this.dragger.handleStart,false);
_94f.onmousedown=function(){
if(browser=="Safari"){
return false;
}else{
return true;
}
};
Event.observe(document,"mouseup",this.dragger.handleStop,false);
},getColumnId:function(){
return this.column.getColumnId();
},getColumn:function(){
return this.column;
},setColumn:function(_950){
this.column=_950;
},getPosition:function(){
return this.postion;
},setPosition:function(_951){
this.position=_951;
},getTop:function(){
return parseInt(removePXFromSize(this.element.style.top));
},getLeft:function(){
return parseInt(removePXFromSize(this.element.style.left));
},getRight:function(){
return this.getLeft()+this.element.getWidth();
},getHeight:function(){
var _952="edit_"+this.getId();
if($(_952).visible()&&$(_952).getHeight()>this.element.getHeight()){
return $(_952).getHeight();
}
return this.element.getHeight();
},getCanvas:function(){
return this.column.getCanvas();
},getConfigData:function(){
var _953="config_"+this.getId();
var _954=new Array();
var list=$(_953).getElementsByTagName("input");
for(var i=0;i<list.length;i++){
var tag=list[i];
switch(tag.type.toLowerCase()){
case "hidden":
_954.push(tag.name);
break;
case "checkbox":
var _958=(tag.checked)?"_1":"_0";
_954.push(tag.name+_958);
break;
}
}
return _954.join(",");
},getId:function(){
return this.element.id;
},setDimensions:function(dim){
for(var prop in dim){
switch(prop){
case "top":
this.element.style.top=dim.top+"px";
break;
case "left":
this.element.style.left=dim.left+"px";
break;
case "width":
this.element.style.width=dim.width+"px";
break;
}
}
},save:function(){
var _95b=$H({action:"save",columnId:this.getColumnId(),position:this.position,widgetId:this.getId(),userId:this.getCanvas().getUserId()}).toQueryString();
var ajax=new Ajax.Request("/xml/widgets.php",{method:"post",parameters:_95b,onFailure:reportError});
},refresh:function(_95d){
if(typeof _95d=="undefined"){
_95d=1;
}
var _95e=$H({action:"refresh",columnId:this.getColumnId(),position:this.position,widgetId:this.getId(),pageNum:_95d,userId:this.getCanvas().getUserId()}).toQueryString();
var ajax=new Ajax.Request("/xml/widgets.php",{method:"post",parameters:_95e,onFailure:reportError,onSuccess:function(_960){
if(!_960.responseText){
reportError(_960);
}else{
var resp=JSONstring.toObject(_960.responseText);
this.column.updateWidgetHTML(resp.id,resp.widgetHTML);
this.makeDraggable();
}
}.bind(this)});
},ondrag:function(){
if(!this.getCanvas().beingDragged(this)){
return;
}
var _962=this.column.getColumnId();
var _963=this.column.getCanvas();
if(_963.getLock()){
var _964=_963.getCurrentColumnId(this);
if(_962!=_964){
_963.swapColumns(this,_962,_964);
}else{
this.column.add(this);
}
_963.releaseLock();
}
},onstop:function(){
if(!this.getCanvas().beingDragged(this)){
return;
}
if(Element.hasClassName(this.element,"opaque")){
Element.removeClassName(this.element,"opaque");
}
this.column.getCanvas().hideDottedBox();
this.column.add(this);
this.save();
this.getCanvas().doneBeingDragged();
},isSelected:function(){
return Element.hasClassName(this.element,"opaque");
},onstart:function(){
if(!this.getCanvas().makeDraggable(this)){
return;
}
if(!Element.hasClassName(this.element,"opaque")){
Element.addClassName(this.element,"opaque");
}
this.column.redraw();
}};
function addEvent(_965,type,_967){
if(!_967.$$guid){
_967.$$guid=addEvent.guid++;
}
if(!_965.events){
_965.events={};
}
var _968=_965.events[type];
if(!_968){
_968=_965.events[type]={};
if(_965["on"+type]){
_968[0]=_965["on"+type];
}
}
_968[_967.$$guid]=_967;
_965["on"+type]=handleEvent;
};
addEvent.guid=1;
function removeEvent(_969,type,_96b){
if(_969.events&&_969.events[type]){
delete _969.events[type][_96b.$$guid];
}
};
function handleEvent(_96c){
var _96d=true;
_96c=_96c||fixEvent(window.event);
if(_96c==null){
return false;
}
if(this.events==null){
return false;
}
var _96e=this.events[_96c.type];
for(var i in _96e){
this.$$handleEvent=_96e[i];
if(this.$$handleEvent(_96c)===false){
_96d=false;
}
}
return _96d;
};
function fixEvent(_970){
if(_970!=null){
_970.preventDefault=fixEvent.preventDefault;
_970.stopPropagation=fixEvent.stopPropagation;
}
return _970;
};
fixEvent.preventDefault=function(){
this.returnValue=false;
};
fixEvent.stopPropagation=function(){
this.cancelBubble=true;
};
function getEventTarget(e){
var targ;
if(!e){
e=window.event;
}
if(e.target){
targ=e.target;
}else{
if(e.srcElement){
targ=e.srcElement;
}
}
if(targ.nodeType==3){
targ=targ.parentNode;
}
return targ;
};
var css={getElementsByClass:function(node,_974,tag){
var _976=new Array();
var els=node.getElementsByTagName(tag);
var _978=els.length;
var _979=new RegExp("(^|\\s)"+_974+"(\\s|$)");
for(var i=0,j=0;i<_978;i++){
if(this.elementHasClass(els[i],_974)){
_976[j]=els[i];
j++;
}
}
return _976;
},elementHasClass:function(el,_97d){
if(!el){
return false;
}
var _97e=new RegExp("\\b"+_97d+"\\b");
if(el.className.match(_97e)){
return true;
}
return false;
}};
var standardistaTableSorting={that:false,sortColumnIndex:-1,lastAssignedId:0,newRows:-1,lastSortedTable:-1,init:function(){
if(!document.getElementsByTagName){
return;
}
this.that=this;
this.run();
},run:function(){
var _97f=document.getElementsByTagName("table");
for(var i=0;i<_97f.length;i++){
var _981=_97f[i];
if(css.elementHasClass(_981,"sortable")){
this.makeSortable(_981);
}
}
},makeSortable:function(_982){
if(!_982.id){
_982.id="sortableTable"+this.lastAssignedId++;
}
if(!_982.tHead||!_982.tHead.rows||0==_982.tHead.rows.length){
return;
}
var row=_982.tHead.rows[_982.tHead.rows.length-1];
for(var i=0;i<row.cells.length;i++){
var _985=row.cells[i].firstChild;
_985.onclick=this.headingClicked;
_985.setAttribute("columnId",i);
}
},sortTheTable:function(e){
var that=standardistaTableSorting.that;
var _988=getEventTarget(e);
var td=_988.parentNode;
var tr=td.parentNode;
var _98b=tr.parentNode;
var _98c=_98b.parentNode;
if(!_98c.tBodies||_98c.tBodies[0].rows.length<=1){
return false;
}
var _98d=_988.getAttribute("columnId")||td.cellIndex;
var _98e=css.getElementsByClass(td,"tableSortArrow","span");
var _98f="";
if(_98e.length>0){
_98f=_98e[0].getAttribute("sortOrder");
}
var itm="";
var _991=0;
while(""==itm&&_991<_98c.tBodies[0].rows.length){
var elm=_98c.tBodies[0].rows[_991].cells[_98d];
if(elm.childNodes.length==1){
itm=that.getInnerText(_98c.tBodies[0].rows[_991].cells[_98d]);
}else{
itm=that.getInnerText(_98c.tBodies[0].rows[_991].cells[_98d].firstChild);
}
_991++;
}
var _993=that.determineSortFunction(itm);
var _994;
if(_98c.id==that.lastSortedTable&&_98d==that.sortColumnIndex){
_994=that.newRows;
_994.reverse();
}else{
that.sortColumnIndex=_98d;
_994=new Array();
for(var j=0;j<_98c.tBodies[0].rows.length;j++){
_994[j]=_98c.tBodies[0].rows[j];
}
_994.sort(_993);
}
that.moveRows(_98c,_994);
that.newRows=_994;
that.lastSortedTable=_98c.id;
var _98e=css.getElementsByClass(tr,"tableSortArrow","span");
for(var j=0;j<_98e.length;j++){
if(j==_98d){
if(null==_98f||""==_98f||"DESC"==_98f){
_98e[j].innerHTML="▼";
_98e[j].setAttribute("sortOrder","ASC");
}else{
_98e[j].innerHTML="▲";
_98e[j].setAttribute("sortOrder","DESC");
}
}else{
_98e[j].innerHTML="&nbsp;";
}
}
if(Element.hasClassName(_98c.tBodies[0].rows[0],"evenRow")||Element.hasClassName(_98c.tBodies[0].rows[0],"oddRow")){
for(var i=0;i<_98c.tBodies[0].rows.length;i++){
tr=_98c.tBodies[0].rows[i];
if(i%2==0){
if(!Element.hasClassName(tr,"oddRow")){
Element.addClassName(tr,"oddRow");
}
if(Element.hasClassName(tr,"evenRow")){
Element.removeClassName(tr,"evenRow");
}
}else{
if(!Element.hasClassName(tr,"evenRow")){
Element.addClassName(tr,"evenRow");
}
if(Element.hasClassName(tr,"oddRow")){
Element.removeClassName(tr,"oddRow");
}
}
}
}
return false;
},headingClicked:function(e){
var that=standardistaTableSorting.that;
that.sortTheTable(e);
return false;
},getInnerText:function(el){
if("string"==typeof el||"undefined"==typeof el){
return el;
}
if(el.innerText){
return el.innerText;
}
var str=el.getAttribute("standardistaTableSortingInnerText");
if(null!=str&&""!=str){
return str;
}
str="";
var cs=el.childNodes;
var l=cs.length;
for(var i=0;i<l;i++){
if(1==cs[i].nodeType){
str+=this.getInnerText(cs[i]);
break;
}else{
if(3==cs[i].nodeType){
str+=cs[i].nodeValue;
break;
}
}
}
el.setAttribute("standardistaTableSortingInnerText",str);
return str;
},determineSortFunction:function(itm){
var _99f=this.sortCaseInsensitive;
if(itm.match(/^\d\d[\/-]\d\d[\/-]\d\d\d\d$/)){
_99f=this.sortDate;
}
if(itm.match(/^\d\d[\/-]\d\d[\/-]\d\d$/)){
_99f=this.sortDate;
}
if(itm.match(/^[�$]/)){
_99f=this.sortCurrency;
}
if(itm.match(/^\d?\.?\d+$/)){
_99f=this.sortNumeric;
}
if(itm.match(/^[+-]?\d*\.?\d+([eE]-?\d+)?$/)){
_99f=this.sortNumeric;
}
if(itm.match(/^([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])$/)){
_99f=this.sortIP;
}
return _99f;
},sortCaseInsensitive:function(a,b){
var that=standardistaTableSorting.that;
var aa=that.getInnerText(a.cells[that.sortColumnIndex]).toLowerCase();
var bb=that.getInnerText(b.cells[that.sortColumnIndex]).toLowerCase();
if(aa==bb){
return 0;
}else{
if(aa<bb){
return -1;
}else{
return 1;
}
}
},sortDate:function(a,b){
var that=standardistaTableSorting.that;
var aa=that.getInnerText(a.cells[that.sortColumnIndex]);
var bb=that.getInnerText(b.cells[that.sortColumnIndex]);
var dt1,dt2,yr=-1;
if(aa.length==10){
dt1=aa.substr(6,4)+aa.substr(3,2)+aa.substr(0,2);
}else{
yr=aa.substr(6,2);
if(parseInt(yr)<50){
yr="20"+yr;
}else{
yr="19"+yr;
}
dt1=yr+aa.substr(3,2)+aa.substr(0,2);
}
if(bb.length==10){
dt2=bb.substr(6,4)+bb.substr(3,2)+bb.substr(0,2);
}else{
yr=bb.substr(6,2);
if(parseInt(yr)<50){
yr="20"+yr;
}else{
yr="19"+yr;
}
dt2=yr+bb.substr(3,2)+bb.substr(0,2);
}
if(dt1==dt2){
return 0;
}else{
if(dt1<dt2){
return -1;
}
}
return 1;
},sortCurrency:function(a,b){
var that=standardistaTableSorting.that;
var aa=that.getInnerText(a.cells[that.sortColumnIndex]).replace(/[^0-9.]/g,"");
var bb=that.getInnerText(b.cells[that.sortColumnIndex]).replace(/[^0-9.]/g,"");
return parseFloat(aa)-parseFloat(bb);
},sortNumeric:function(a,b){
var that=standardistaTableSorting.that;
var _9b5=a.cells[that.sortColumnIndex];
if(_9b5.childNodes.length>1){
var aa=parseFloat(that.getInnerText(a.cells[that.sortColumnIndex].firstChild));
}else{
aa=parseFloat(that.getInnerText(a.cells[that.sortColumnIndex]));
}
if(isNaN(aa)){
aa=0;
}
var _9b7=b.cells[that.sortColumnIndex];
if(_9b7.childNodes.length>1){
var bb=parseFloat(that.getInnerText(b.cells[that.sortColumnIndex].firstChild));
}else{
bb=parseFloat(that.getInnerText(b.cells[that.sortColumnIndex]));
}
if(isNaN(bb)){
bb=0;
}
return aa-bb;
},makeStandardIPAddress:function(val){
var vals=val.split(".");
for(x in vals){
val=vals[x];
while(3>val.length){
val="0"+val;
}
vals[x]=val;
}
val=vals.join(".");
return val;
},sortIP:function(a,b){
var that=standardistaTableSorting.that;
var aa=that.makeStandardIPAddress(that.getInnerText(a.cells[that.sortColumnIndex]).toLowerCase());
var bb=that.makeStandardIPAddress(that.getInnerText(b.cells[that.sortColumnIndex]).toLowerCase());
if(aa==bb){
return 0;
}else{
if(aa<bb){
return -1;
}else{
return 1;
}
}
},moveRows:function(_9c0,_9c1){
for(var i=0;i<_9c1.length;i++){
var _9c3=_9c1[i];
_9c0.tBodies[0].appendChild(_9c3);
}
}};
function standardistaTableSortingInit(){
standardistaTableSorting.init();
};
Event.observe(window,"load",standardistaTableSortingInit);
var PollManager=Class.create();
PollManager.prototype={initialize:function(_9c4,_9c5){
this.modId=_9c4;
this.pollId=_9c5;
this.results_div_id=_9c4+"_poll_results";
this.vote_form_id=_9c4+"_vote_form";
this.vote_radio_name=_9c4+"_vote";
},seePollVotes:function(){
this.question_HTML=$(this.results_div_id).innerHTML;
var _9c6=$H({id:this.pollId}).toQueryString();
var ajax=new Ajax.Updater({success:this.results_div_id},"/xml/pollvote.php",{parameters:_9c6,onFailure:reportError,onComplete:function(){
}});
},goBackAndVote:function(){
$(this.results_div_id).innerHTML=this.question_HTML;
},voteInPoll:function(){
var vote;
var _9c9=Form.getInputs(this.vote_form_id,"radio",this.vote_radio_name).find(function(_9ca){
return _9ca.checked;
});
if(null==_9c9){
return;
}else{
vote=_9c9.value;
}
var _9cb=$H({id:this.pollId,vote:vote}).toQueryString();
var ajax=new Ajax.Updater({success:this.results_div_id},"/xml/pollvote.php",{parameters:_9cb,onFailure:reportError,onComplete:function(){
}});
}};
var isIE=(navigator.appVersion.indexOf("MSIE")!=-1)?true:false;
var isWin=(navigator.appVersion.toLowerCase().indexOf("win")!=-1)?true:false;
var isOpera=(navigator.userAgent.indexOf("Opera")!=-1)?true:false;
function ControlVersion(){
var _9cd;
var axo;
var e;
try{
axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
_9cd=axo.GetVariable("$version");
}
catch(e){
}
if(!_9cd){
try{
axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
_9cd="WIN 6,0,21,0";
axo.AllowScriptAccess="always";
_9cd=axo.GetVariable("$version");
}
catch(e){
}
}
if(!_9cd){
try{
axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
_9cd=axo.GetVariable("$version");
}
catch(e){
}
}
if(!_9cd){
try{
axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
_9cd="WIN 3,0,18,0";
}
catch(e){
}
}
if(!_9cd){
try{
axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
_9cd="WIN 2,0,0,11";
}
catch(e){
_9cd=-1;
}
}
return _9cd;
};
function GetSwfVer(){
var _9d0=-1;
if(navigator.plugins!=null&&navigator.plugins.length>0){
if(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]){
var _9d1=navigator.plugins["Shockwave Flash 2.0"]?" 2.0":"";
var _9d2=navigator.plugins["Shockwave Flash"+_9d1].description;
var _9d3=_9d2.split(" ");
var _9d4=_9d3[2].split(".");
var _9d5=_9d4[0];
var _9d6=_9d4[1];
var _9d7=_9d3[3];
if(_9d7==""){
_9d7=_9d3[4];
}
if(_9d7[0]=="d"){
_9d7=_9d7.substring(1);
}else{
if(_9d7[0]=="r"){
_9d7=_9d7.substring(1);
if(_9d7.indexOf("d")>0){
_9d7=_9d7.substring(0,_9d7.indexOf("d"));
}
}
}
var _9d0=_9d5+"."+_9d6+"."+_9d7;
}
}else{
if(navigator.userAgent.toLowerCase().indexOf("webtv/2.6")!=-1){
_9d0=4;
}else{
if(navigator.userAgent.toLowerCase().indexOf("webtv/2.5")!=-1){
_9d0=3;
}else{
if(navigator.userAgent.toLowerCase().indexOf("webtv")!=-1){
_9d0=2;
}else{
if(isIE&&isWin&&!isOpera){
_9d0=ControlVersion();
}
}
}
}
}
return _9d0;
};
function DetectFlashVer(_9d8,_9d9,_9da){
versionStr=GetSwfVer();
if(versionStr==-1){
return false;
}else{
if(versionStr!=0){
if(isIE&&isWin&&!isOpera){
tempArray=versionStr.split(" ");
tempString=tempArray[1];
versionArray=tempString.split(",");
}else{
versionArray=versionStr.split(".");
}
var _9db=versionArray[0];
var _9dc=versionArray[1];
var _9dd=versionArray[2];
if(_9db>parseFloat(_9d8)){
return true;
}else{
if(_9db==parseFloat(_9d8)){
if(_9dc>parseFloat(_9d9)){
return true;
}else{
if(_9dc==parseFloat(_9d9)){
if(_9dd>=parseFloat(_9da)){
return true;
}
}
}
}
}
return false;
}
}
};
function AC_AddExtension(src,ext){
if(src.indexOf("?")!=-1){
return src.replace(/\?/,ext+"?");
}else{
return src+ext;
}
};
function AC_Generateobj(_9e0,_9e1,_9e2){
var str="";
if(isIE&&isWin&&!isOpera){
str+="<object ";
for(var i in _9e0){
str+=i+"=\""+_9e0[i]+"\" ";
}
str+=">";
for(var i in _9e1){
str+="<param name=\""+i+"\" value=\""+_9e1[i]+"\" /> ";
}
str+="</object>";
}else{
str+="<embed ";
for(var i in _9e2){
str+=i+"=\""+_9e2[i]+"\" ";
}
str+="> </embed>";
}
document.write(str);
};
function AC_FL_RunContent(){
var ret=AC_GetArgs(arguments,".swf","movie","clsid:d27cdb6e-ae6d-11cf-96b8-444553540000","application/x-shockwave-flash");
AC_Generateobj(ret.objAttrs,ret.params,ret.embedAttrs);
};
function AC_SW_RunContent(){
var ret=AC_GetArgs(arguments,".dcr","src","clsid:166B1BCA-3F9C-11CF-8075-444553540000",null);
AC_Generateobj(ret.objAttrs,ret.params,ret.embedAttrs);
};
function AC_GetArgs(args,ext,_9e9,_9ea,_9eb){
var ret=new Object();
ret.embedAttrs=new Object();
ret.params=new Object();
ret.objAttrs=new Object();
for(var i=0;i<args.length;i=i+2){
var _9ee=args[i].toLowerCase();
switch(_9ee){
case "classid":
break;
case "pluginspage":
ret.embedAttrs[args[i]]=args[i+1];
break;
case "src":
case "movie":
args[i+1]=AC_AddExtension(args[i+1],ext);
ret.embedAttrs["src"]=args[i+1];
ret.params[_9e9]=args[i+1];
break;
case "onafterupdate":
case "onbeforeupdate":
case "onblur":
case "oncellchange":
case "onclick":
case "ondblClick":
case "ondrag":
case "ondragend":
case "ondragenter":
case "ondragleave":
case "ondragover":
case "ondrop":
case "onfinish":
case "onfocus":
case "onhelp":
case "onmousedown":
case "onmouseup":
case "onmouseover":
case "onmousemove":
case "onmouseout":
case "onkeypress":
case "onkeydown":
case "onkeyup":
case "onload":
case "onlosecapture":
case "onpropertychange":
case "onreadystatechange":
case "onrowsdelete":
case "onrowenter":
case "onrowexit":
case "onrowsinserted":
case "onstart":
case "onscroll":
case "onbeforeeditfocus":
case "onactivate":
case "onbeforedeactivate":
case "ondeactivate":
case "type":
case "codebase":
case "id":
ret.objAttrs[args[i]]=args[i+1];
break;
case "width":
case "height":
case "align":
case "vspace":
case "hspace":
case "class":
case "title":
case "accesskey":
case "name":
case "tabindex":
ret.embedAttrs[args[i]]=ret.objAttrs[args[i]]=args[i+1];
break;
default:
ret.embedAttrs[args[i]]=ret.params[args[i]]=args[i+1];
}
}
ret.objAttrs["classid"]=_9ea;
if(_9eb){
ret.embedAttrs["type"]=_9eb;
}
return ret;
};
function AC_AX_RunContent(){
var ret=AC_AX_GetArgs(arguments);
AC_Generateobj(ret.objAttrs,ret.params,ret.embedAttrs);
};
function AC_AX_GetArgs(args){
var ret=new Object();
ret.embedAttrs=new Object();
ret.params=new Object();
ret.objAttrs=new Object();
for(var i=0;i<args.length;i=i+2){
var _9f3=args[i].toLowerCase();
switch(_9f3){
case "pluginspage":
case "type":
ret.embedAttrs[args[i]]=args[i+1];
break;
case "data":
case "codebase":
case "classid":
case "id":
case "onafterupdate":
case "onbeforeupdate":
case "onblur":
case "oncellchange":
case "onclick":
case "ondblClick":
case "ondrag":
case "ondragend":
case "ondragenter":
case "ondragleave":
case "ondragover":
case "ondrop":
case "onfinish":
case "onfocus":
case "onhelp":
case "onmousedown":
case "onmouseup":
case "onmouseover":
case "onmousemove":
case "onmouseout":
case "onkeypress":
case "onkeydown":
case "onkeyup":
case "onload":
case "onlosecapture":
case "onpropertychange":
case "onreadystatechange":
case "onrowsdelete":
case "onrowenter":
case "onrowexit":
case "onrowsinserted":
case "onstart":
case "onscroll":
case "onbeforeeditfocus":
case "onactivate":
case "onbeforedeactivate":
case "ondeactivate":
ret.objAttrs[args[i]]=args[i+1];
break;
case "width":
case "height":
case "align":
case "vspace":
case "hspace":
case "class":
case "title":
case "accesskey":
case "name":
case "tabindex":
ret.embedAttrs[args[i]]=ret.objAttrs[args[i]]=args[i+1];
break;
default:
ret.embedAttrs[args[i]]=ret.params[args[i]]=args[i+1];
}
}
return ret;
};
var ContentRotator=Class.create();
ContentRotator.prototype={initialize:function(ids,_9f5,_9f6,_9f7,_9f8,_9f9,_9fa,_9fb,_9fc,loop){
this.ids=ids;
this.prefix=_9f5;
this.interval=_9f6;
this.position=0;
this.paused=false;
this.transitionEffect=_9f7;
this.transitioning=false;
this.activeUpdateThreadId=0;
if(_9f8){
this.playId=_9f8;
}
if(_9f9){
this.pauseId=_9f9;
}
if(_9fa){
this.positionIndicatorId=_9fa;
}
if(this.interval>0){
setTimeout(this.update.bind(this,this.activeUpdateThreadId),this.interval);
}
if(_9fb){
this.prevId=_9fb;
}
if(_9fc){
this.nextId=_9fc;
}
if(loop==undefined||loop){
this.loop=true;
}else{
this.loop=false;
}
},update:function(_9fe){
if(this.paused||this.activeUpdateThreadId!=_9fe){
return;
}
this.next();
setTimeout(this.update.bind(this,_9fe),this.interval);
},pause:function(){
$(this.pauseId).hide();
$(this.playId).show();
this.paused=true;
},play:function(){
$(this.playId).hide();
$(this.pauseId).show();
this.paused=false;
this.activeUpdateThreadId++;
this.update(this.activeUpdateThreadId);
},endTransition:function(){
this.transitioning=false;
},seek:function(_9ff){
newPosition=_9ff%this.ids.length;
while(newPosition<0){
newPosition+=this.ids.length;
}
if(this.positionIndicatorId){
$(this.positionIndicatorId+"_"+this.position).removeClassName("active");
}
if(this.transitionEffect>0){
if(this.transitioning){
setTimeout(this.next.bind(this),400);
return;
}
this.transitioning=true;
var _a00=new fx.Opacity(this.prefix+this.ids[this.position],{duration:this.transitionEffect});
_a00.toggle();
this.position=newPosition;
var _a01=new fx.Height(this.prefix+this.ids[this.position],{duration:this.transitionEffect});
if(window.ActiveXObject){
$(this.prefix+this.ids[this.position]).setStyle({display:"inline",visibility:"visible"});
$(this.prefix+this.ids[this.position]).style.removeAttribute("filter");
}else{
$(this.prefix+this.ids[this.position]).setStyle({display:"inline",visibility:"visible",opacity:1});
}
_a01.options.onComplete=this.endTransition.bind(this);
_a01.hide();
_a01.toggle();
}else{
$(this.prefix+this.ids[this.position]).hide();
this.position=newPosition;
$(this.prefix+this.ids[this.position]).show();
}
if(this.positionIndicatorId){
$(this.positionIndicatorId+"_"+this.position).addClassName("active");
}
if(!this.loop){
$(this.nextId).removeClassName("disabled");
$(this.prevId).removeClassName("disabled");
if(this.position==this.ids.length-1){
$(this.nextId).addClassName("disabled");
}
if(this.position==0){
$(this.prevId).addClassName("disabled");
}
}
},next:function(){
this.seek(this.position+1);
},previous:function(){
this.seek(this.position-1);
}};
var dp={sh:{Toolbar:{},Utils:{},RegexLib:{},Brushes:{},Strings:{AboutDialog:"<html><head><title>About...</title></head><body class=\"dp-about\"><table cellspacing=\"0\"><tr><td class=\"copy\"><p class=\"title\">dp.SyntaxHighlighter</div><div class=\"para\">Version: {V}</p><p><a href=\"http://www.dreamprojections.com/syntaxhighlighter/?ref=about\" target=\"_blank\">http://www.dreamprojections.com/syntaxhighlighter</a></p>&copy;2004-2007 Alex Gorbatchev.</td></tr><tr><td class=\"footer\"><input type=\"button\" class=\"close\" value=\"OK\" onClick=\"window.close()\"/></td></tr></table></body></html>"},ClipboardSwf:null,Version:"1.5.1"}};
dp.SyntaxHighlighter=dp.sh;
dp.sh.Toolbar.Commands={ExpandSource:{label:"+ expand source",check:function(_a02){
return _a02.collapse;
},func:function(_a03,_a04){
_a03.parentNode.removeChild(_a03);
_a04.div.className=_a04.div.className.replace("collapsed","");
}},ViewSource:{label:"view plain",func:function(_a05,_a06){
var code=dp.sh.Utils.FixForBlogger(_a06.originalCode).replace(/</g,"&lt;");
var wnd=window.open("","_blank","width=750, height=400, location=0, resizable=1, menubar=0, scrollbars=0");
wnd.document.write("<textarea style=\"width:99%;height:99%\">"+code+"</textarea>");
wnd.document.close();
}}};
dp.sh.Toolbar.Create=function(_a09){
var div=document.createElement("DIV");
div.className="tools";
for(var name in dp.sh.Toolbar.Commands){
var cmd=dp.sh.Toolbar.Commands[name];
if(cmd.check!=null&&!cmd.check(_a09)){
continue;
}
div.innerHTML+="<a href=\"#\" onclick=\"dp.sh.Toolbar.Command('"+name+"',this);return false;\">"+cmd.label+"</a>";
}
return div;
};
dp.sh.Toolbar.Command=function(name,_a0e){
var n=_a0e;
while(n!=null&&n.className.indexOf("dp-highlighter")==-1){
n=n.parentNode;
}
if(n!=null){
dp.sh.Toolbar.Commands[name].func(_a0e,n.highlighter);
}
};
dp.sh.Utils.CopyStyles=function(_a10,_a11){
var _a12=_a11.getElementsByTagName("link");
for(var i=0;i<_a12.length;i++){
if(_a12[i].rel.toLowerCase()=="stylesheet"){
_a10.write("<link type=\"text/css\" rel=\"stylesheet\" href=\""+_a12[i].href+"\"></link>");
}
}
};
dp.sh.Utils.FixForBlogger=function(str){
return (dp.sh.isBloggerMode==true)?str.replace(/<br\s*\/?>|&lt;br\s*\/?&gt;/gi,"\n"):str;
};
dp.sh.RegexLib={MultiLineCComments:new RegExp("/\\*[\\s\\S]*?\\*/","gm"),SingleLineCComments:new RegExp("//.*$","gm"),SingleLinePerlComments:new RegExp("#.*$","gm"),DoubleQuotedString:new RegExp("\"(?:\\.|(\\\\\\\")|[^\\\"\"\\n])*\"","g"),SingleQuotedString:new RegExp("'(?:\\.|(\\\\\\')|[^\\''\\n])*'","g")};
dp.sh.Match=function(_a15,_a16,css){
this.value=_a15;
this.index=_a16;
this.length=_a15.length;
this.css=css;
};
dp.sh.Highlighter=function(){
this.noGutter=false;
this.addControls=true;
this.collapse=false;
this.tabsToSpaces=true;
this.wrapColumn=80;
this.showColumns=true;
};
dp.sh.Highlighter.SortCallback=function(m1,m2){
if(m1.index<m2.index){
return -1;
}else{
if(m1.index>m2.index){
return 1;
}else{
if(m1.length<m2.length){
return -1;
}else{
if(m1.length>m2.length){
return 1;
}
}
}
}
return 0;
};
dp.sh.Highlighter.prototype.CreateElement=function(name){
var _a1b=document.createElement(name);
_a1b.highlighter=this;
return _a1b;
};
dp.sh.Highlighter.prototype.GetMatches=function(_a1c,css){
var _a1e=0;
var _a1f=null;
while((_a1f=_a1c.exec(this.code))!=null){
this.matches[this.matches.length]=new dp.sh.Match(_a1f[0],_a1f.index,css);
}
};
dp.sh.Highlighter.prototype.AddBit=function(str,css){
if(str==null||str.length==0){
return;
}
var span=this.CreateElement("SPAN");
str=str.replace(/ /g,"&nbsp;");
str=str.replace(/</g,"&lt;");
str=str.replace(/\n/gm,"&nbsp;<br>");
if(css!=null){
if((/br/gi).test(str)){
var _a23=str.split("&nbsp;<br>");
for(var i=0;i<_a23.length;i++){
span=this.CreateElement("SPAN");
span.className=css;
span.innerHTML=_a23[i];
this.div.appendChild(span);
if(i+1<_a23.length){
this.div.appendChild(this.CreateElement("BR"));
}
}
}else{
span.className=css;
span.innerHTML=str;
this.div.appendChild(span);
}
}else{
span.innerHTML=str;
this.div.appendChild(span);
}
};
dp.sh.Highlighter.prototype.IsInside=function(_a25){
if(_a25==null||_a25.length==0){
return false;
}
for(var i=0;i<this.matches.length;i++){
var c=this.matches[i];
if(c==null){
continue;
}
if((_a25.index>c.index)&&(_a25.index<c.index+c.length)){
return true;
}
}
return false;
};
dp.sh.Highlighter.prototype.ProcessRegexList=function(){
for(var i=0;i<this.regexList.length;i++){
this.GetMatches(this.regexList[i].regex,this.regexList[i].css);
}
};
dp.sh.Highlighter.prototype.ProcessSmartTabs=function(code){
var _a2a=code.split("\n");
var _a2b="";
var _a2c=4;
var tab="\t";
function InsertSpaces(line,pos,_a30){
var left=line.substr(0,pos);
var _a32=line.substr(pos+1,line.length);
var _a33="";
for(var i=0;i<_a30;i++){
_a33+=" ";
}
return left+_a33+_a32;
};
function ProcessLine(line,_a36){
if(line.indexOf(tab)==-1){
return line;
}
var pos=0;
while((pos=line.indexOf(tab))!=-1){
var _a38=_a36-pos%_a36;
line=InsertSpaces(line,pos,_a38);
}
return line;
};
for(var i=0;i<_a2a.length;i++){
_a2b+=ProcessLine(_a2a[i],_a2c)+"\n";
}
return _a2b;
};
dp.sh.Highlighter.prototype.SwitchToList=function(){
var html=this.div.innerHTML.replace(/<(br)\/?>/gi,"\n");
var _a3b=html.split("\n");
if(this.addControls==true){
this.bar.appendChild(dp.sh.Toolbar.Create(this));
}
if(this.showColumns){
var div=this.CreateElement("div");
var _a3d=this.CreateElement("div");
var _a3e=10;
var i=1;
while(i<=150){
if(i%_a3e==0){
div.innerHTML+=i;
i+=(i+"").length;
}else{
div.innerHTML+="&middot;";
i++;
}
}
_a3d.className="columns";
_a3d.appendChild(div);
this.bar.appendChild(_a3d);
}
for(var i=0,_a40=this.firstLine;i<_a3b.length-1;i++,_a40++){
var li=this.CreateElement("LI");
var span=this.CreateElement("SPAN");
li.className=(i%2==0)?"alt":"";
span.innerHTML=_a3b[i]+"&nbsp;";
li.appendChild(span);
this.ol.appendChild(li);
}
this.div.innerHTML="";
};
dp.sh.Highlighter.prototype.Highlight=function(code){
function Trim(str){
return str.replace(/^\s*(.*?)[\s\n]*$/g,"$1");
};
function Chop(str){
return str.replace(/\n*$/,"").replace(/^\n*/,"");
};
function Unindent(str){
var _a47=dp.sh.Utils.FixForBlogger(str).split("\n");
var _a48=new Array();
var _a49=new RegExp("^\\s*","g");
var min=1000;
for(var i=0;i<_a47.length&&min>0;i++){
if(Trim(_a47[i]).length==0){
continue;
}
var _a4c=_a49.exec(_a47[i]);
if(_a4c!=null&&_a4c.length>0){
min=Math.min(_a4c[0].length,min);
}
}
if(min>0){
for(var i=0;i<_a47.length;i++){
_a47[i]=_a47[i].substr(min);
}
}
return _a47.join("\n");
};
function Copy(_a4d,pos1,pos2){
return _a4d.substr(pos1,pos2-pos1);
};
var pos=0;
if(code==null){
code="";
}
this.originalCode=code;
this.code=Chop(Unindent(code));
this.div=this.CreateElement("DIV");
this.bar=this.CreateElement("DIV");
this.ol=this.CreateElement("OL");
this.matches=new Array();
this.div.className="dp-highlighter";
this.div.highlighter=this;
this.bar.className="bar";
this.ol.start=this.firstLine;
if(this.CssClass!=null){
this.ol.className=this.CssClass;
}
if(this.collapse){
this.div.className+=" collapsed";
}
if(this.noGutter){
this.div.className+=" nogutter";
}
if(this.tabsToSpaces==true){
this.code=this.ProcessSmartTabs(this.code);
}
this.ProcessRegexList();
if(this.matches.length==0){
this.AddBit(this.code,null);
this.SwitchToList();
this.div.appendChild(this.bar);
this.div.appendChild(this.ol);
return;
}
this.matches=this.matches.sort(dp.sh.Highlighter.SortCallback);
for(var i=0;i<this.matches.length;i++){
if(this.IsInside(this.matches[i])){
this.matches[i]=null;
}
}
for(var i=0;i<this.matches.length;i++){
var _a52=this.matches[i];
if(_a52==null||_a52.length==0){
continue;
}
this.AddBit(Copy(this.code,pos,_a52.index),null);
this.AddBit(_a52.value,_a52.css);
pos=_a52.index+_a52.length;
}
this.AddBit(this.code.substr(pos),null);
this.SwitchToList();
this.div.appendChild(this.bar);
this.div.appendChild(this.ol);
};
dp.sh.Highlighter.prototype.GetKeywords=function(str){
return "\\b"+str.replace(/ /g,"\\b|\\b")+"\\b";
};
dp.sh.BloggerMode=function(){
dp.sh.isBloggerMode=true;
};
dp.sh.HighlightAll=function(name,_a55,_a56,_a57,_a58,_a59){
function FindValue(){
var a=arguments;
for(var i=0;i<a.length;i++){
if(a[i]==null){
continue;
}
if(typeof (a[i])=="string"&&a[i]!=""){
return a[i]+"";
}
if(typeof (a[i])=="object"&&a[i].value!=""){
return a[i].value+"";
}
}
return null;
};
function IsOptionSet(_a5c,list){
for(var i=0;i<list.length;i++){
if(list[i]==_a5c){
return true;
}
}
return false;
};
function GetOptionValue(name,list,_a61){
var _a62=new RegExp("^"+name+"\\[(\\w+)\\]$","gi");
var _a63=null;
for(var i=0;i<list.length;i++){
if((_a63=_a62.exec(list[i]))!=null){
return _a63[1];
}
}
return _a61;
};
function FindTagsByName(list,name,_a67){
var tags=document.getElementsByTagName(_a67);
for(var i=0;i<tags.length;i++){
if(tags[i].getAttribute("name")==name){
list.push(tags[i]);
}
}
};
var _a6a=[];
var _a6b=null;
var _a6c={};
var _a6d="innerHTML";
FindTagsByName(_a6a,name,"pre");
FindTagsByName(_a6a,name,"textarea");
if(_a6a.length==0){
return;
}
for(var _a6e in dp.sh.Brushes){
var _a6f=dp.sh.Brushes[_a6e].Aliases;
if(_a6f==null){
continue;
}
for(var i=0;i<_a6f.length;i++){
_a6c[_a6f[i]]=_a6e;
}
}
for(var i=0;i<_a6a.length;i++){
var _a71=_a6a[i];
var _a72=FindValue(_a71.attributes["class"],_a71.className,_a71.attributes["language"],_a71.language);
var _a73="";
if(_a72==null){
continue;
}
_a72=_a72.split(":");
_a73=_a72[0].toLowerCase();
if(_a6c[_a73]==null){
continue;
}
_a6b=new dp.sh.Brushes[_a6c[_a73]]();
_a71.style.display="none";
_a6b.noGutter=(_a55==null)?IsOptionSet("nogutter",_a72):!_a55;
_a6b.addControls=(_a56==null)?!IsOptionSet("nocontrols",_a72):_a56;
_a6b.collapse=(_a57==null)?IsOptionSet("collapse",_a72):_a57;
_a6b.showColumns=(_a59==null)?IsOptionSet("showcolumns",_a72):_a59;
var _a74=document.getElementsByTagName("head")[0];
if(_a6b.Style&&_a74){
var _a75=document.createElement("style");
_a75.setAttribute("type","text/css");
if(_a75.styleSheet){
_a75.styleSheet.cssText=_a6b.Style;
}else{
var _a76=document.createTextNode(_a6b.Style);
_a75.appendChild(_a76);
}
_a74.appendChild(_a75);
}
_a6b.firstLine=(_a58==null)?parseInt(GetOptionValue("firstline",_a72,1)):_a58;
_a6b.Highlight(_a71[_a6d]);
_a6b.source=_a71;
_a71.parentNode.insertBefore(_a6b.div,_a71);
}
};
dp.sh.Brushes.Cpp=function(){
var _a77="ATOM BOOL BOOLEAN BYTE CHAR COLORREF DWORD DWORDLONG DWORD_PTR "+"DWORD32 DWORD64 FLOAT HACCEL HALF_PTR HANDLE HBITMAP HBRUSH "+"HCOLORSPACE HCONV HCONVLIST HCURSOR HDC HDDEDATA HDESK HDROP HDWP "+"HENHMETAFILE HFILE HFONT HGDIOBJ HGLOBAL HHOOK HICON HINSTANCE HKEY "+"HKL HLOCAL HMENU HMETAFILE HMODULE HMONITOR HPALETTE HPEN HRESULT "+"HRGN HRSRC HSZ HWINSTA HWND INT INT_PTR INT32 INT64 LANGID LCID LCTYPE "+"LGRPID LONG LONGLONG LONG_PTR LONG32 LONG64 LPARAM LPBOOL LPBYTE LPCOLORREF "+"LPCSTR LPCTSTR LPCVOID LPCWSTR LPDWORD LPHANDLE LPINT LPLONG LPSTR LPTSTR "+"LPVOID LPWORD LPWSTR LRESULT PBOOL PBOOLEAN PBYTE PCHAR PCSTR PCTSTR PCWSTR "+"PDWORDLONG PDWORD_PTR PDWORD32 PDWORD64 PFLOAT PHALF_PTR PHANDLE PHKEY PINT "+"PINT_PTR PINT32 PINT64 PLCID PLONG PLONGLONG PLONG_PTR PLONG32 PLONG64 POINTER_32 "+"POINTER_64 PSHORT PSIZE_T PSSIZE_T PSTR PTBYTE PTCHAR PTSTR PUCHAR PUHALF_PTR "+"PUINT PUINT_PTR PUINT32 PUINT64 PULONG PULONGLONG PULONG_PTR PULONG32 PULONG64 "+"PUSHORT PVOID PWCHAR PWORD PWSTR SC_HANDLE SC_LOCK SERVICE_STATUS_HANDLE SHORT "+"SIZE_T SSIZE_T TBYTE TCHAR UCHAR UHALF_PTR UINT UINT_PTR UINT32 UINT64 ULONG "+"ULONGLONG ULONG_PTR ULONG32 ULONG64 USHORT USN VOID WCHAR WORD WPARAM WPARAM WPARAM "+"char bool short int __int32 __int64 __int8 __int16 long float double __wchar_t "+"clock_t _complex _dev_t _diskfree_t div_t ldiv_t _exception _EXCEPTION_POINTERS "+"FILE _finddata_t _finddatai64_t _wfinddata_t _wfinddatai64_t __finddata64_t "+"__wfinddata64_t _FPIEEE_RECORD fpos_t _HEAPINFO _HFILE lconv intptr_t "+"jmp_buf mbstate_t _off_t _onexit_t _PNH ptrdiff_t _purecall_handler "+"sig_atomic_t size_t _stat __stat64 _stati64 terminate_function "+"time_t __time64_t _timeb __timeb64 tm uintptr_t _utimbuf "+"va_list wchar_t wctrans_t wctype_t wint_t signed";
var _a78="break case catch class const __finally __exception __try "+"const_cast continue private public protected __declspec "+"default delete deprecated dllexport dllimport do dynamic_cast "+"else enum explicit extern if for friend goto inline "+"mutable naked namespace new noinline noreturn nothrow "+"register reinterpret_cast return selectany "+"sizeof static static_cast struct switch template this "+"thread throw true false try typedef typeid typename union "+"using uuid virtual void volatile whcar_t while";
this.regexList=[{regex:dp.sh.RegexLib.SingleLineCComments,css:"comment"},{regex:dp.sh.RegexLib.MultiLineCComments,css:"comment"},{regex:dp.sh.RegexLib.DoubleQuotedString,css:"string"},{regex:dp.sh.RegexLib.SingleQuotedString,css:"string"},{regex:new RegExp("^ *#.*","gm"),css:"preprocessor"},{regex:new RegExp(this.GetKeywords(_a77),"gm"),css:"datatypes"},{regex:new RegExp(this.GetKeywords(_a78),"gm"),css:"keyword"}];
this.CssClass="dp-cpp";
this.Style=".dp-cpp .datatypes { color: #2E8B57; font-weight: bold; }";
};
dp.sh.Brushes.Cpp.prototype=new dp.sh.Highlighter();
dp.sh.Brushes.Cpp.Aliases=["cpp","c","c++"];
dp.sh.Brushes.CSharp=function(){
var _a79="abstract as base bool break byte case catch char checked class const "+"continue decimal default delegate do double else enum event explicit "+"extern false finally fixed float for foreach get goto if implicit in int "+"interface internal is lock long namespace new null object operator out "+"override params private protected public readonly ref return sbyte sealed set "+"short sizeof stackalloc static string struct switch this throw true try "+"typeof uint ulong unchecked unsafe ushort using virtual void while";
this.regexList=[{regex:dp.sh.RegexLib.SingleLineCComments,css:"comment"},{regex:dp.sh.RegexLib.MultiLineCComments,css:"comment"},{regex:dp.sh.RegexLib.DoubleQuotedString,css:"string"},{regex:dp.sh.RegexLib.SingleQuotedString,css:"string"},{regex:new RegExp("^\\s*#.*","gm"),css:"preprocessor"},{regex:new RegExp(this.GetKeywords(_a79),"gm"),css:"keyword"}];
this.CssClass="dp-c";
this.Style=".dp-c .vars { color: #d00; }";
};
dp.sh.Brushes.CSharp.prototype=new dp.sh.Highlighter();
dp.sh.Brushes.CSharp.Aliases=["c#","c-sharp","csharp"];
dp.sh.Brushes.CSS=function(){
var _a7a="ascent azimuth background-attachment background-color background-image background-position "+"background-repeat background baseline bbox border-collapse border-color border-spacing border-style border-top "+"border-right border-bottom border-left border-top-color border-right-color border-bottom-color border-left-color "+"border-top-style border-right-style border-bottom-style border-left-style border-top-width border-right-width "+"border-bottom-width border-left-width border-width border cap-height caption-side centerline clear clip color "+"content counter-increment counter-reset cue-after cue-before cue cursor definition-src descent direction display "+"elevation empty-cells float font-size-adjust font-family font-size font-stretch font-style font-variant font-weight font "+"height letter-spacing line-height list-style-image list-style-position list-style-type list-style margin-top "+"margin-right margin-bottom margin-left margin marker-offset marks mathline max-height max-width min-height min-width orphans "+"outline-color outline-style outline-width outline overflow padding-top padding-right padding-bottom padding-left padding page "+"page-break-after page-break-before page-break-inside pause pause-after pause-before pitch pitch-range play-during position "+"quotes richness size slope src speak-header speak-numeral speak-punctuation speak speech-rate stemh stemv stress "+"table-layout text-align text-decoration text-indent text-shadow text-transform unicode-bidi unicode-range units-per-em "+"vertical-align visibility voice-family volume white-space widows width widths word-spacing x-height z-index";
var _a7b="above absolute all always aqua armenian attr aural auto avoid baseline behind below bidi-override black blink block blue bold bolder "+"both bottom braille capitalize caption center center-left center-right circle close-quote code collapse compact condensed "+"continuous counter counters crop cross crosshair cursive dashed decimal decimal-leading-zero default digits disc dotted double "+"embed embossed e-resize expanded extra-condensed extra-expanded fantasy far-left far-right fast faster fixed format fuchsia "+"gray green groove handheld hebrew help hidden hide high higher icon inline-table inline inset inside invert italic "+"justify landscape large larger left-side left leftwards level lighter lime line-through list-item local loud lower-alpha "+"lowercase lower-greek lower-latin lower-roman lower low ltr marker maroon medium message-box middle mix move narrower "+"navy ne-resize no-close-quote none no-open-quote no-repeat normal nowrap n-resize nw-resize oblique olive once open-quote outset "+"outside overline pointer portrait pre print projection purple red relative repeat repeat-x repeat-y rgb ridge right right-side "+"rightwards rtl run-in screen scroll semi-condensed semi-expanded separate se-resize show silent silver slower slow "+"small small-caps small-caption smaller soft solid speech spell-out square s-resize static status-bar sub super sw-resize "+"table-caption table-cell table-column table-column-group table-footer-group table-header-group table-row table-row-group teal "+"text-bottom text-top thick thin top transparent tty tv ultra-condensed ultra-expanded underline upper-alpha uppercase upper-latin "+"upper-roman url visible wait white wider w-resize x-fast x-high x-large x-loud x-low x-slow x-small x-soft xx-large xx-small yellow";
var _a7c="[mM]onospace [tT]ahoma [vV]erdana [aA]rial [hH]elvetica [sS]ans-serif [sS]erif";
this.regexList=[{regex:dp.sh.RegexLib.MultiLineCComments,css:"comment"},{regex:dp.sh.RegexLib.DoubleQuotedString,css:"string"},{regex:dp.sh.RegexLib.SingleQuotedString,css:"string"},{regex:new RegExp("\\#[a-zA-Z0-9]{3,6}","g"),css:"value"},{regex:new RegExp("(-?\\d+)(.\\d+)?(px|em|pt|:|%|)","g"),css:"value"},{regex:new RegExp("!important","g"),css:"important"},{regex:new RegExp(this.GetKeywordsCSS(_a7a),"gm"),css:"keyword"},{regex:new RegExp(this.GetValuesCSS(_a7b),"g"),css:"value"},{regex:new RegExp(this.GetValuesCSS(_a7c),"g"),css:"value"}];
this.CssClass="dp-css";
this.Style=".dp-css .value { color: black; }"+".dp-css .important { color: red; }";
};
dp.sh.Highlighter.prototype.GetKeywordsCSS=function(str){
return "\\b([a-z_]|)"+str.replace(/ /g,"(?=:)\\b|\\b([a-z_\\*]|\\*|)")+"(?=:)\\b";
};
dp.sh.Highlighter.prototype.GetValuesCSS=function(str){
return "\\b"+str.replace(/ /g,"(?!-)(?!:)\\b|\\b()")+":\\b";
};
dp.sh.Brushes.CSS.prototype=new dp.sh.Highlighter();
dp.sh.Brushes.CSS.Aliases=["css"];
dp.sh.Brushes.Delphi=function(){
var _a7f="abs addr and ansichar ansistring array as asm begin boolean byte cardinal "+"case char class comp const constructor currency destructor div do double "+"downto else end except exports extended false file finalization finally "+"for function goto if implementation in inherited int64 initialization "+"integer interface is label library longint longword mod nil not object "+"of on or packed pansichar pansistring pchar pcurrency pdatetime pextended "+"pint64 pointer private procedure program property pshortstring pstring "+"pvariant pwidechar pwidestring protected public published raise real real48 "+"record repeat set shl shortint shortstring shr single smallint string then "+"threadvar to true try type unit until uses val var varirnt while widechar "+"widestring with word write writeln xor";
this.regexList=[{regex:new RegExp("\\(\\*[\\s\\S]*?\\*\\)","gm"),css:"comment"},{regex:new RegExp("{(?!\\$)[\\s\\S]*?}","gm"),css:"comment"},{regex:dp.sh.RegexLib.SingleLineCComments,css:"comment"},{regex:dp.sh.RegexLib.SingleQuotedString,css:"string"},{regex:new RegExp("\\{\\$[a-zA-Z]+ .+\\}","g"),css:"directive"},{regex:new RegExp("\\b[\\d\\.]+\\b","g"),css:"number"},{regex:new RegExp("\\$[a-zA-Z0-9]+\\b","g"),css:"number"},{regex:new RegExp(this.GetKeywords(_a7f),"gm"),css:"keyword"}];
this.CssClass="dp-delphi";
this.Style=".dp-delphi .number { color: blue; }"+".dp-delphi .directive { color: #008284; }"+".dp-delphi .vars { color: #000; }";
};
dp.sh.Brushes.Delphi.prototype=new dp.sh.Highlighter();
dp.sh.Brushes.Delphi.Aliases=["delphi","pascal"];
dp.sh.Brushes.Xml=function(){
this.CssClass="dp-xml";
this.Style=".dp-xml .cdata { color: #ff1493; }"+".dp-xml .tag, .dp-xml .tag-name { color: #069; font-weight: bold; }"+".dp-xml .attribute { color: red; }"+".dp-xml .attribute-value { color: blue; }";
};
dp.sh.Brushes.Xml.prototype=new dp.sh.Highlighter();
dp.sh.Brushes.Xml.Aliases=["xml","xhtml","xslt","html","xhtml"];
dp.sh.Brushes.Xml.prototype.ProcessRegexList=function(){
function push(_a80,_a81){
_a80[_a80.length]=_a81;
};
var _a82=0;
var _a83=null;
var _a84=null;
this.GetMatches(new RegExp("(&lt;|<)\\!\\[[\\w\\s]*?\\[(.|\\s)*?\\]\\](&gt;|>)","gm"),"cdata");
this.GetMatches(new RegExp("(&lt;|<)!--\\s*.*?\\s*--(&gt;|>)","gm"),"comments");
_a84=new RegExp("([:\\w-.]+)\\s*=\\s*(\".*?\"|'.*?'|\\w+)*|(\\w+)","gm");
while((_a83=_a84.exec(this.code))!=null){
if(_a83[1]==null){
continue;
}
push(this.matches,new dp.sh.Match(_a83[1],_a83.index,"attribute"));
if(_a83[2]!=undefined){
push(this.matches,new dp.sh.Match(_a83[2],_a83.index+_a83[0].indexOf(_a83[2]),"attribute-value"));
}
}
this.GetMatches(new RegExp("(&lt;|<)/*\\?*(?!\\!)|/*\\?*(&gt;|>)","gm"),"tag");
_a84=new RegExp("(?:&lt;|<)/*\\?*\\s*([:\\w-.]+)","gm");
while((_a83=_a84.exec(this.code))!=null){
push(this.matches,new dp.sh.Match(_a83[1],_a83.index+_a83[0].indexOf(_a83[1]),"tag-name"));
}
};
dp.sh.Brushes.Java=function(){
var _a85="abstract assert boolean break byte case catch char class const "+"continue default do double else enum extends "+"false final finally float for goto if implements import "+"instanceof int interface long native new null "+"package private protected public return "+"short static strictfp super switch synchronized this throw throws true "+"transient try void volatile while";
this.regexList=[{regex:dp.sh.RegexLib.SingleLineCComments,css:"comment"},{regex:dp.sh.RegexLib.MultiLineCComments,css:"comment"},{regex:dp.sh.RegexLib.DoubleQuotedString,css:"string"},{regex:dp.sh.RegexLib.SingleQuotedString,css:"string"},{regex:new RegExp("\\b([\\d]+(\\.[\\d]+)?|0x[a-f0-9]+)\\b","gi"),css:"number"},{regex:new RegExp("(?!\\@interface\\b)\\@[\\$\\w]+\\b","g"),css:"annotation"},{regex:new RegExp("\\@interface\\b","g"),css:"keyword"},{regex:new RegExp(this.GetKeywords(_a85),"gm"),css:"keyword"}];
this.CssClass="dp-j";
this.Style=".dp-j .annotation { color: #646464; }"+".dp-j .number { color: #C00000; }";
};
dp.sh.Brushes.Java.prototype=new dp.sh.Highlighter();
dp.sh.Brushes.Java.Aliases=["java"];
dp.sh.Brushes.JScript=function(){
var _a86="abstract boolean break byte case catch char class const continue debugger "+"default delete do double else enum export extends false final finally float "+"for function goto if implements import in instanceof int interface long native "+"new null package private protected public return short static super switch "+"synchronized this throw throws transient true try typeof var void volatile while with";
this.regexList=[{regex:dp.sh.RegexLib.SingleLineCComments,css:"comment"},{regex:dp.sh.RegexLib.MultiLineCComments,css:"comment"},{regex:dp.sh.RegexLib.DoubleQuotedString,css:"string"},{regex:dp.sh.RegexLib.SingleQuotedString,css:"string"},{regex:new RegExp("^\\s*#.*","gm"),css:"preprocessor"},{regex:new RegExp(this.GetKeywords(_a86),"gm"),css:"keyword"}];
this.CssClass="dp-c";
};
dp.sh.Brushes.JScript.prototype=new dp.sh.Highlighter();
dp.sh.Brushes.JScript.Aliases=["js","jscript","javascript"];
dp.sh.Brushes.Php=function(){
var _a87="abs acos acosh addcslashes addslashes "+"array_change_key_case array_chunk array_combine array_count_values array_diff "+"array_diff_assoc array_diff_key array_diff_uassoc array_diff_ukey array_fill "+"array_filter array_flip array_intersect array_intersect_assoc array_intersect_key "+"array_intersect_uassoc array_intersect_ukey array_key_exists array_keys array_map "+"array_merge array_merge_recursive array_multisort array_pad array_pop array_product "+"array_push array_rand array_reduce array_reverse array_search array_shift "+"array_slice array_splice array_sum array_udiff array_udiff_assoc "+"array_udiff_uassoc array_uintersect array_uintersect_assoc "+"array_uintersect_uassoc array_unique array_unshift array_values array_walk "+"array_walk_recursive atan atan2 atanh base64_decode base64_encode base_convert "+"basename bcadd bccomp bcdiv bcmod bcmul bindec bindtextdomain bzclose bzcompress "+"bzdecompress bzerrno bzerror bzerrstr bzflush bzopen bzread bzwrite ceil chdir "+"checkdate checkdnsrr chgrp chmod chop chown chr chroot chunk_split class_exists "+"closedir closelog copy cos cosh count count_chars date decbin dechex decoct "+"deg2rad delete ebcdic2ascii echo empty end ereg ereg_replace eregi eregi_replace error_log "+"error_reporting escapeshellarg escapeshellcmd eval exec exit exp explode extension_loaded "+"feof fflush fgetc fgetcsv fgets fgetss file_exists file_get_contents file_put_contents "+"fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype "+"floatval flock floor flush fmod fnmatch fopen fpassthru fprintf fputcsv fputs fread fscanf "+"fseek fsockopen fstat ftell ftok getallheaders getcwd getdate getenv gethostbyaddr gethostbyname "+"gethostbynamel getimagesize getlastmod getmxrr getmygid getmyinode getmypid getmyuid getopt "+"getprotobyname getprotobynumber getrandmax getrusage getservbyname getservbyport gettext "+"gettimeofday gettype glob gmdate gmmktime ini_alter ini_get ini_get_all ini_restore ini_set "+"interface_exists intval ip2long is_a is_array is_bool is_callable is_dir is_double "+"is_executable is_file is_finite is_float is_infinite is_int is_integer is_link is_long "+"is_nan is_null is_numeric is_object is_readable is_real is_resource is_scalar is_soap_fault "+"is_string is_subclass_of is_uploaded_file is_writable is_writeable mkdir mktime nl2br "+"parse_ini_file parse_str parse_url passthru pathinfo readlink realpath rewind rewinddir rmdir "+"round str_ireplace str_pad str_repeat str_replace str_rot13 str_shuffle str_split "+"str_word_count strcasecmp strchr strcmp strcoll strcspn strftime strip_tags stripcslashes "+"stripos stripslashes stristr strlen strnatcasecmp strnatcmp strncasecmp strncmp strpbrk "+"strpos strptime strrchr strrev strripos strrpos strspn strstr strtok strtolower strtotime "+"strtoupper strtr strval substr substr_compare";
var _a88="and or xor __FILE__ __LINE__ array as break case "+"cfunction class const continue declare default die do else "+"elseif empty enddeclare endfor endforeach endif endswitch endwhile "+"extends for foreach function include include_once global if "+"new old_function return static switch use require require_once "+"var while __FUNCTION__ __CLASS__ "+"__METHOD__ abstract interface public implements extends private protected throw";
this.regexList=[{regex:dp.sh.RegexLib.SingleLineCComments,css:"comment"},{regex:dp.sh.RegexLib.MultiLineCComments,css:"comment"},{regex:dp.sh.RegexLib.DoubleQuotedString,css:"string"},{regex:dp.sh.RegexLib.SingleQuotedString,css:"string"},{regex:new RegExp("\\$\\w+","g"),css:"vars"},{regex:new RegExp(this.GetKeywords(_a87),"gmi"),css:"func"},{regex:new RegExp(this.GetKeywords(_a88),"gm"),css:"keyword"}];
this.CssClass="dp-c";
};
dp.sh.Brushes.Php.prototype=new dp.sh.Highlighter();
dp.sh.Brushes.Php.Aliases=["php"];
dp.sh.Brushes.Python=function(){
var _a89="and assert break class continue def del elif else "+"except exec finally for from global if import in is "+"lambda not or pass print raise return try yield while";
var _a8a="None True False self cls class_";
this.regexList=[{regex:dp.sh.RegexLib.SingleLinePerlComments,css:"comment"},{regex:new RegExp("^\\s*@\\w+","gm"),css:"decorator"},{regex:new RegExp("(['\"]{3})([^\\1])*?\\1","gm"),css:"comment"},{regex:new RegExp("\"(?!\")(?:\\.|\\\\\\\"|[^\\\"\"\\n\\r])*\"","gm"),css:"string"},{regex:new RegExp("'(?!')*(?:\\.|(\\\\\\')|[^\\''\\n\\r])*'","gm"),css:"string"},{regex:new RegExp("\\b\\d+\\.?\\w*","g"),css:"number"},{regex:new RegExp(this.GetKeywords(_a89),"gm"),css:"keyword"},{regex:new RegExp(this.GetKeywords(_a8a),"gm"),css:"special"}];
this.CssClass="dp-py";
this.Style=".dp-py .builtins { color: #ff1493; }"+".dp-py .magicmethods { color: #808080; }"+".dp-py .exceptions { color: brown; }"+".dp-py .types { color: brown; font-style: italic; }"+".dp-py .commonlibs { color: #8A2BE2; font-style: italic; }";
};
dp.sh.Brushes.Python.prototype=new dp.sh.Highlighter();
dp.sh.Brushes.Python.Aliases=["py","python"];
dp.sh.Brushes.Ruby=function(){
var _a8b="alias and BEGIN begin break case class def define_method defined do each else elsif "+"END end ensure false for if in module new next nil not or raise redo rescue retry return "+"self super then throw true undef unless until when while yield";
var _a8c="Array Bignum Binding Class Continuation Dir Exception FalseClass File::Stat File Fixnum Fload "+"Hash Integer IO MatchData Method Module NilClass Numeric Object Proc Range Regexp String Struct::TMS Symbol "+"ThreadGroup Thread Time TrueClass";
this.regexList=[{regex:dp.sh.RegexLib.SingleLinePerlComments,css:"comment"},{regex:dp.sh.RegexLib.DoubleQuotedString,css:"string"},{regex:dp.sh.RegexLib.SingleQuotedString,css:"string"},{regex:new RegExp(":[a-z][A-Za-z0-9_]*","g"),css:"symbol"},{regex:new RegExp("(\\$|@@|@)\\w+","g"),css:"variable"},{regex:new RegExp(this.GetKeywords(_a8b),"gm"),css:"keyword"},{regex:new RegExp(this.GetKeywords(_a8c),"gm"),css:"builtin"}];
this.CssClass="dp-rb";
this.Style=".dp-rb .symbol { color: #a70; }"+".dp-rb .variable { color: #a70; font-weight: bold; }";
};
dp.sh.Brushes.Ruby.prototype=new dp.sh.Highlighter();
dp.sh.Brushes.Ruby.Aliases=["ruby","rails","ror"];
dp.sh.Brushes.Sql=function(){
var _a8d="abs avg case cast coalesce convert count current_timestamp "+"current_user day isnull left lower month nullif replace right "+"session_user space substring sum system_user upper user year";
var _a8e="absolute action add after alter as asc at authorization begin bigint "+"binary bit by cascade char character check checkpoint close collate "+"column commit committed connect connection constraint contains continue "+"create cube current current_date current_time cursor database date "+"deallocate dec decimal declare default delete desc distinct double drop "+"dynamic else end end-exec escape except exec execute false fetch first "+"float for force foreign forward free from full function global goto grant "+"group grouping having hour ignore index inner insensitive insert instead "+"int integer intersect into is isolation key last level load local max min "+"minute modify move name national nchar next no numeric of off on only "+"open option order out output partial password precision prepare primary "+"prior privileges procedure public read real references relative repeatable "+"restrict return returns revoke rollback rollup rows rule schema scroll "+"second section select sequence serializable set size smallint static "+"statistics table temp temporary then time timestamp to top transaction "+"translation trigger true truncate uncommitted union unique update values "+"varchar varying view when where with work";
var _a8f="all and any between cross in join like not null or outer some";
this.regexList=[{regex:new RegExp("--(.*)$","gm"),css:"comment"},{regex:dp.sh.RegexLib.DoubleQuotedString,css:"string"},{regex:dp.sh.RegexLib.SingleQuotedString,css:"string"},{regex:new RegExp(this.GetKeywords(_a8d),"gmi"),css:"func"},{regex:new RegExp(this.GetKeywords(_a8f),"gmi"),css:"op"},{regex:new RegExp(this.GetKeywords(_a8e),"gmi"),css:"keyword"}];
this.CssClass="dp-sql";
this.Style=".dp-sql .func { color: #ff1493; }"+".dp-sql .op { color: #808080; }";
};
dp.sh.Brushes.Sql.prototype=new dp.sh.Highlighter();
dp.sh.Brushes.Sql.Aliases=["sql"];
dp.sh.Brushes.Vb=function(){
var _a90="AddHandler AddressOf AndAlso Alias And Ansi As Assembly Auto "+"Boolean ByRef Byte ByVal Call Case Catch CBool CByte CChar CDate "+"CDec CDbl Char CInt Class CLng CObj Const CShort CSng CStr CType "+"Date Decimal Declare Default Delegate Dim DirectCast Do Double Each "+"Else ElseIf End Enum Erase Error Event Exit False Finally For Friend "+"Function Get GetType GoSub GoTo Handles If Implements Imports In "+"Inherits Integer Interface Is Let Lib Like Long Loop Me Mod Module "+"MustInherit MustOverride MyBase MyClass Namespace New Next Not Nothing "+"NotInheritable NotOverridable Object On Option Optional Or OrElse "+"Overloads Overridable Overrides ParamArray Preserve Private Property "+"Protected Public RaiseEvent ReadOnly ReDim REM RemoveHandler Resume "+"Return Select Set Shadows Shared Short Single Static Step Stop String "+"Structure Sub SyncLock Then Throw To True Try TypeOf Unicode Until "+"Variant When While With WithEvents WriteOnly Xor";
this.regexList=[{regex:new RegExp("'.*$","gm"),css:"comment"},{regex:dp.sh.RegexLib.DoubleQuotedString,css:"string"},{regex:new RegExp("^\\s*#.*","gm"),css:"preprocessor"},{regex:new RegExp(this.GetKeywords(_a90),"gm"),css:"keyword"}];
this.CssClass="dp-vb";
};
dp.sh.Brushes.Vb.prototype=new dp.sh.Highlighter();
dp.sh.Brushes.Vb.Aliases=["vb","vb.net"];
dp.sh.Brushes.Xml=function(){
this.CssClass="dp-xml";
this.Style=".dp-xml .cdata { color: #ff1493; }"+".dp-xml .tag, .dp-xml .tag-name { color: #069; font-weight: bold; }"+".dp-xml .attribute { color: red; }"+".dp-xml .attribute-value { color: blue; }";
};
dp.sh.Brushes.Xml.prototype=new dp.sh.Highlighter();
dp.sh.Brushes.Xml.Aliases=["xml","xhtml","xslt","html","xhtml"];
dp.sh.Brushes.Xml.prototype.ProcessRegexList=function(){
function push(_a91,_a92){
_a91[_a91.length]=_a92;
};
var _a93=0;
var _a94=null;
var _a95=null;
this.GetMatches(new RegExp("(&lt;|<)\\!\\[[\\w\\s]*?\\[(.|\\s)*?\\]\\](&gt;|>)","gm"),"cdata");
this.GetMatches(new RegExp("(&lt;|<)!--\\s*.*?\\s*--(&gt;|>)","gm"),"comments");
_a95=new RegExp("([:\\w-.]+)\\s*=\\s*(\".*?\"|'.*?'|\\w+)*|(\\w+)","gm");
while((_a94=_a95.exec(this.code))!=null){
if(_a94[1]==null){
continue;
}
push(this.matches,new dp.sh.Match(_a94[1],_a94.index,"attribute"));
if(_a94[2]!=undefined){
push(this.matches,new dp.sh.Match(_a94[2],_a94.index+_a94[0].indexOf(_a94[2]),"attribute-value"));
}
}
this.GetMatches(new RegExp("(&lt;|<)/*\\?*(?!\\!)|/*\\?*(&gt;|>)","gm"),"tag");
_a95=new RegExp("(?:&lt;|<)/*\\?*\\s*([:\\w-.]+)","gm");
while((_a94=_a95.exec(this.code))!=null){
push(this.matches,new dp.sh.Match(_a94[1],_a94.index+_a94[0].indexOf(_a94[1]),"tag-name"));
}
};


