PageRenderTime 42ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 1ms

/ajax/simile-ajax-bundle.js

http://showslow.googlecode.com/
JavaScript | 1574 lines | 1547 code | 18 blank | 9 comment | 69 complexity | f291fe0a0894de37c4e426cffc387b8b MD5 | raw file
  1. /* platform.js */
  2. SimileAjax.version="2.2.1";
  3. SimileAjax.jQuery=jQuery.noConflict(true);
  4. if(typeof window["$"]=="undefined"){window.$=SimileAjax.jQuery;
  5. }SimileAjax.Platform.os={isMac:false,isWin:false,isWin32:false,isUnix:false};
  6. SimileAjax.Platform.browser={isIE:false,isNetscape:false,isMozilla:false,isFirefox:false,isOpera:false,isSafari:false,majorVersion:0,minorVersion:0};
  7. (function(){var C=navigator.appName.toLowerCase();
  8. var A=navigator.userAgent.toLowerCase();
  9. SimileAjax.Platform.os.isMac=(A.indexOf("mac")!=-1);
  10. SimileAjax.Platform.os.isWin=(A.indexOf("win")!=-1);
  11. SimileAjax.Platform.os.isWin32=SimileAjax.Platform.isWin&&(A.indexOf("95")!=-1||A.indexOf("98")!=-1||A.indexOf("nt")!=-1||A.indexOf("win32")!=-1||A.indexOf("32bit")!=-1);
  12. SimileAjax.Platform.os.isUnix=(A.indexOf("x11")!=-1);
  13. SimileAjax.Platform.browser.isIE=(C.indexOf("microsoft")!=-1);
  14. SimileAjax.Platform.browser.isNetscape=(C.indexOf("netscape")!=-1);
  15. SimileAjax.Platform.browser.isMozilla=(A.indexOf("mozilla")!=-1);
  16. SimileAjax.Platform.browser.isFirefox=(A.indexOf("firefox")!=-1);
  17. SimileAjax.Platform.browser.isOpera=(C.indexOf("opera")!=-1);
  18. SimileAjax.Platform.browser.isSafari=(C.indexOf("safari")!=-1);
  19. var E=function(G){var F=G.split(".");
  20. SimileAjax.Platform.browser.majorVersion=parseInt(F[0]);
  21. SimileAjax.Platform.browser.minorVersion=parseInt(F[1]);
  22. };
  23. var B=function(H,G,I){var F=H.indexOf(G,I);
  24. return F>=0?F:H.length;
  25. };
  26. if(SimileAjax.Platform.browser.isMozilla){var D=A.indexOf("mozilla/");
  27. if(D>=0){E(A.substring(D+8,B(A," ",D)));
  28. }}if(SimileAjax.Platform.browser.isIE){var D=A.indexOf("msie ");
  29. if(D>=0){E(A.substring(D+5,B(A,";",D)));
  30. }}if(SimileAjax.Platform.browser.isNetscape){var D=A.indexOf("rv:");
  31. if(D>=0){E(A.substring(D+3,B(A,")",D)));
  32. }}if(SimileAjax.Platform.browser.isFirefox){var D=A.indexOf("firefox/");
  33. if(D>=0){E(A.substring(D+8,B(A," ",D)));
  34. }}if(!("localeCompare" in String.prototype)){String.prototype.localeCompare=function(F){if(this<F){return -1;
  35. }else{if(this>F){return 1;
  36. }else{return 0;
  37. }}};
  38. }})();
  39. SimileAjax.Platform.getDefaultLocale=function(){return SimileAjax.Platform.clientLocale;
  40. };
  41. /* ajax.js */
  42. SimileAjax.ListenerQueue=function(A){this._listeners=[];
  43. this._wildcardHandlerName=A;
  44. };
  45. SimileAjax.ListenerQueue.prototype.add=function(A){this._listeners.push(A);
  46. };
  47. SimileAjax.ListenerQueue.prototype.remove=function(C){var B=this._listeners;
  48. for(var A=0;
  49. A<B.length;
  50. A++){if(B[A]==C){B.splice(A,1);
  51. break;
  52. }}};
  53. SimileAjax.ListenerQueue.prototype.fire=function(B,A){var D=[].concat(this._listeners);
  54. for(var C=0;
  55. C<D.length;
  56. C++){var E=D[C];
  57. if(B in E){try{E[B].apply(E,A);
  58. }catch(F){SimileAjax.Debug.exception("Error firing event of name "+B,F);
  59. }}else{if(this._wildcardHandlerName!=null&&this._wildcardHandlerName in E){try{E[this._wildcardHandlerName].apply(E,[B]);
  60. }catch(F){SimileAjax.Debug.exception("Error firing event of name "+B+" to wildcard handler",F);
  61. }}}}};
  62. /* data-structure.js */
  63. SimileAjax.Set=function(A){this._hash={};
  64. this._count=0;
  65. if(A instanceof Array){for(var B=0;
  66. B<A.length;
  67. B++){this.add(A[B]);
  68. }}else{if(A instanceof SimileAjax.Set){this.addSet(A);
  69. }}};
  70. SimileAjax.Set.prototype.add=function(A){if(!(A in this._hash)){this._hash[A]=true;
  71. this._count++;
  72. return true;
  73. }return false;
  74. };
  75. SimileAjax.Set.prototype.addSet=function(B){for(var A in B._hash){this.add(A);
  76. }};
  77. SimileAjax.Set.prototype.remove=function(A){if(A in this._hash){delete this._hash[A];
  78. this._count--;
  79. return true;
  80. }return false;
  81. };
  82. SimileAjax.Set.prototype.removeSet=function(B){for(var A in B._hash){this.remove(A);
  83. }};
  84. SimileAjax.Set.prototype.retainSet=function(B){for(var A in this._hash){if(!B.contains(A)){delete this._hash[A];
  85. this._count--;
  86. }}};
  87. SimileAjax.Set.prototype.contains=function(A){return(A in this._hash);
  88. };
  89. SimileAjax.Set.prototype.size=function(){return this._count;
  90. };
  91. SimileAjax.Set.prototype.toArray=function(){var A=[];
  92. for(var B in this._hash){A.push(B);
  93. }return A;
  94. };
  95. SimileAjax.Set.prototype.visit=function(A){for(var B in this._hash){if(A(B)==true){break;
  96. }}};
  97. SimileAjax.SortedArray=function(B,A){this._a=(A instanceof Array)?A:[];
  98. this._compare=B;
  99. };
  100. SimileAjax.SortedArray.prototype.add=function(C){var A=this;
  101. var B=this.find(function(D){return A._compare(D,C);
  102. });
  103. if(B<this._a.length){this._a.splice(B,0,C);
  104. }else{this._a.push(C);
  105. }};
  106. SimileAjax.SortedArray.prototype.remove=function(C){var A=this;
  107. var B=this.find(function(D){return A._compare(D,C);
  108. });
  109. while(B<this._a.length&&this._compare(this._a[B],C)==0){if(this._a[B]==C){this._a.splice(B,1);
  110. return true;
  111. }else{B++;
  112. }}return false;
  113. };
  114. SimileAjax.SortedArray.prototype.removeAll=function(){this._a=[];
  115. };
  116. SimileAjax.SortedArray.prototype.elementAt=function(A){return this._a[A];
  117. };
  118. SimileAjax.SortedArray.prototype.length=function(){return this._a.length;
  119. };
  120. SimileAjax.SortedArray.prototype.find=function(D){var B=0;
  121. var A=this._a.length;
  122. while(B<A){var C=Math.floor((B+A)/2);
  123. var E=D(this._a[C]);
  124. if(C==B){return E<0?B+1:B;
  125. }else{if(E<0){B=C;
  126. }else{A=C;
  127. }}}return B;
  128. };
  129. SimileAjax.SortedArray.prototype.getFirst=function(){return(this._a.length>0)?this._a[0]:null;
  130. };
  131. SimileAjax.SortedArray.prototype.getLast=function(){return(this._a.length>0)?this._a[this._a.length-1]:null;
  132. };
  133. SimileAjax.EventIndex=function(B){var A=this;
  134. this._unit=(B!=null)?B:SimileAjax.NativeDateUnit;
  135. this._events=new SimileAjax.SortedArray(function(D,C){return A._unit.compare(D.getStart(),C.getStart());
  136. });
  137. this._idToEvent={};
  138. this._indexed=true;
  139. };
  140. SimileAjax.EventIndex.prototype.getUnit=function(){return this._unit;
  141. };
  142. SimileAjax.EventIndex.prototype.getEvent=function(A){return this._idToEvent[A];
  143. };
  144. SimileAjax.EventIndex.prototype.add=function(A){this._events.add(A);
  145. this._idToEvent[A.getID()]=A;
  146. this._indexed=false;
  147. };
  148. SimileAjax.EventIndex.prototype.removeAll=function(){this._events.removeAll();
  149. this._idToEvent={};
  150. this._indexed=false;
  151. };
  152. SimileAjax.EventIndex.prototype.getCount=function(){return this._events.length();
  153. };
  154. SimileAjax.EventIndex.prototype.getIterator=function(A,B){if(!this._indexed){this._index();
  155. }return new SimileAjax.EventIndex._Iterator(this._events,A,B,this._unit);
  156. };
  157. SimileAjax.EventIndex.prototype.getReverseIterator=function(A,B){if(!this._indexed){this._index();
  158. }return new SimileAjax.EventIndex._ReverseIterator(this._events,A,B,this._unit);
  159. };
  160. SimileAjax.EventIndex.prototype.getAllIterator=function(){return new SimileAjax.EventIndex._AllIterator(this._events);
  161. };
  162. SimileAjax.EventIndex.prototype.getEarliestDate=function(){var A=this._events.getFirst();
  163. return(A==null)?null:A.getStart();
  164. };
  165. SimileAjax.EventIndex.prototype.getLatestDate=function(){var A=this._events.getLast();
  166. if(A==null){return null;
  167. }if(!this._indexed){this._index();
  168. }var C=A._earliestOverlapIndex;
  169. var B=this._events.elementAt(C).getEnd();
  170. for(var D=C+1;
  171. D<this._events.length();
  172. D++){B=this._unit.later(B,this._events.elementAt(D).getEnd());
  173. }return B;
  174. };
  175. SimileAjax.EventIndex.prototype._index=function(){var D=this._events.length();
  176. for(var E=0;
  177. E<D;
  178. E++){var C=this._events.elementAt(E);
  179. C._earliestOverlapIndex=E;
  180. }var G=1;
  181. for(var E=0;
  182. E<D;
  183. E++){var C=this._events.elementAt(E);
  184. var B=C.getEnd();
  185. G=Math.max(G,E+1);
  186. while(G<D){var A=this._events.elementAt(G);
  187. var F=A.getStart();
  188. if(this._unit.compare(F,B)<0){A._earliestOverlapIndex=E;
  189. G++;
  190. }else{break;
  191. }}}this._indexed=true;
  192. };
  193. SimileAjax.EventIndex._Iterator=function(B,A,D,C){this._events=B;
  194. this._startDate=A;
  195. this._endDate=D;
  196. this._unit=C;
  197. this._currentIndex=B.find(function(E){return C.compare(E.getStart(),A);
  198. });
  199. if(this._currentIndex-1>=0){this._currentIndex=this._events.elementAt(this._currentIndex-1)._earliestOverlapIndex;
  200. }this._currentIndex--;
  201. this._maxIndex=B.find(function(E){return C.compare(E.getStart(),D);
  202. });
  203. this._hasNext=false;
  204. this._next=null;
  205. this._findNext();
  206. };
  207. SimileAjax.EventIndex._Iterator.prototype={hasNext:function(){return this._hasNext;
  208. },next:function(){if(this._hasNext){var A=this._next;
  209. this._findNext();
  210. return A;
  211. }else{return null;
  212. }},_findNext:function(){var B=this._unit;
  213. while((++this._currentIndex)<this._maxIndex){var A=this._events.elementAt(this._currentIndex);
  214. if(B.compare(A.getStart(),this._endDate)<0&&B.compare(A.getEnd(),this._startDate)>0){this._next=A;
  215. this._hasNext=true;
  216. return ;
  217. }}this._next=null;
  218. this._hasNext=false;
  219. }};
  220. SimileAjax.EventIndex._ReverseIterator=function(B,A,D,C){this._events=B;
  221. this._startDate=A;
  222. this._endDate=D;
  223. this._unit=C;
  224. this._minIndex=B.find(function(E){return C.compare(E.getStart(),A);
  225. });
  226. if(this._minIndex-1>=0){this._minIndex=this._events.elementAt(this._minIndex-1)._earliestOverlapIndex;
  227. }this._maxIndex=B.find(function(E){return C.compare(E.getStart(),D);
  228. });
  229. this._currentIndex=this._maxIndex;
  230. this._hasNext=false;
  231. this._next=null;
  232. this._findNext();
  233. };
  234. SimileAjax.EventIndex._ReverseIterator.prototype={hasNext:function(){return this._hasNext;
  235. },next:function(){if(this._hasNext){var A=this._next;
  236. this._findNext();
  237. return A;
  238. }else{return null;
  239. }},_findNext:function(){var B=this._unit;
  240. while((--this._currentIndex)>=this._minIndex){var A=this._events.elementAt(this._currentIndex);
  241. if(B.compare(A.getStart(),this._endDate)<0&&B.compare(A.getEnd(),this._startDate)>0){this._next=A;
  242. this._hasNext=true;
  243. return ;
  244. }}this._next=null;
  245. this._hasNext=false;
  246. }};
  247. SimileAjax.EventIndex._AllIterator=function(A){this._events=A;
  248. this._index=0;
  249. };
  250. SimileAjax.EventIndex._AllIterator.prototype={hasNext:function(){return this._index<this._events.length();
  251. },next:function(){return this._index<this._events.length()?this._events.elementAt(this._index++):null;
  252. }};
  253. /* date-time.js */
  254. SimileAjax.DateTime=new Object();
  255. SimileAjax.DateTime.MILLISECOND=0;
  256. SimileAjax.DateTime.SECOND=1;
  257. SimileAjax.DateTime.MINUTE=2;
  258. SimileAjax.DateTime.HOUR=3;
  259. SimileAjax.DateTime.DAY=4;
  260. SimileAjax.DateTime.WEEK=5;
  261. SimileAjax.DateTime.MONTH=6;
  262. SimileAjax.DateTime.YEAR=7;
  263. SimileAjax.DateTime.DECADE=8;
  264. SimileAjax.DateTime.CENTURY=9;
  265. SimileAjax.DateTime.MILLENNIUM=10;
  266. SimileAjax.DateTime.EPOCH=-1;
  267. SimileAjax.DateTime.ERA=-2;
  268. SimileAjax.DateTime.gregorianUnitLengths=[];
  269. (function(){var B=SimileAjax.DateTime;
  270. var A=B.gregorianUnitLengths;
  271. A[B.MILLISECOND]=1;
  272. A[B.SECOND]=1000;
  273. A[B.MINUTE]=A[B.SECOND]*60;
  274. A[B.HOUR]=A[B.MINUTE]*60;
  275. A[B.DAY]=A[B.HOUR]*24;
  276. A[B.WEEK]=A[B.DAY]*7;
  277. A[B.MONTH]=A[B.DAY]*31;
  278. A[B.YEAR]=A[B.DAY]*365;
  279. A[B.DECADE]=A[B.YEAR]*10;
  280. A[B.CENTURY]=A[B.YEAR]*100;
  281. A[B.MILLENNIUM]=A[B.YEAR]*1000;
  282. })();
  283. SimileAjax.DateTime._dateRegexp=new RegExp("^(-?)([0-9]{4})("+["(-?([0-9]{2})(-?([0-9]{2}))?)","(-?([0-9]{3}))","(-?W([0-9]{2})(-?([1-7]))?)"].join("|")+")?$");
  284. SimileAjax.DateTime._timezoneRegexp=new RegExp("Z|(([-+])([0-9]{2})(:?([0-9]{2}))?)$");
  285. SimileAjax.DateTime._timeRegexp=new RegExp("^([0-9]{2})(:?([0-9]{2})(:?([0-9]{2})(.([0-9]+))?)?)?$");
  286. SimileAjax.DateTime.setIso8601Date=function(H,F){var I=F.match(SimileAjax.DateTime._dateRegexp);
  287. if(!I){throw new Error("Invalid date string: "+F);
  288. }var B=(I[1]=="-")?-1:1;
  289. var J=B*I[2];
  290. var G=I[5];
  291. var C=I[7];
  292. var E=I[9];
  293. var A=I[11];
  294. var M=(I[13])?I[13]:1;
  295. H.setUTCFullYear(J);
  296. if(E){H.setUTCMonth(0);
  297. H.setUTCDate(Number(E));
  298. }else{if(A){H.setUTCMonth(0);
  299. H.setUTCDate(1);
  300. var L=H.getUTCDay();
  301. var K=(L)?L:7;
  302. var D=Number(M)+(7*Number(A));
  303. if(K<=4){H.setUTCDate(D+1-K);
  304. }else{H.setUTCDate(D+8-K);
  305. }}else{if(G){H.setUTCDate(1);
  306. H.setUTCMonth(G-1);
  307. }if(C){H.setUTCDate(C);
  308. }}}return H;
  309. };
  310. SimileAjax.DateTime.setIso8601Time=function(F,C){var G=C.match(SimileAjax.DateTime._timeRegexp);
  311. if(!G){SimileAjax.Debug.warn("Invalid time string: "+C);
  312. return false;
  313. }var A=G[1];
  314. var E=Number((G[3])?G[3]:0);
  315. var D=(G[5])?G[5]:0;
  316. var B=G[7]?(Number("0."+G[7])*1000):0;
  317. F.setUTCHours(A);
  318. F.setUTCMinutes(E);
  319. F.setUTCSeconds(D);
  320. F.setUTCMilliseconds(B);
  321. return F;
  322. };
  323. SimileAjax.DateTime.timezoneOffset=new Date().getTimezoneOffset();
  324. SimileAjax.DateTime.setIso8601=function(B,A){var D=null;
  325. var E=(A.indexOf("T")==-1)?A.split(" "):A.split("T");
  326. SimileAjax.DateTime.setIso8601Date(B,E[0]);
  327. if(E.length==2){var C=E[1].match(SimileAjax.DateTime._timezoneRegexp);
  328. if(C){if(C[0]=="Z"){D=0;
  329. }else{D=(Number(C[3])*60)+Number(C[5]);
  330. D*=((C[2]=="-")?1:-1);
  331. }E[1]=E[1].substr(0,E[1].length-C[0].length);
  332. }SimileAjax.DateTime.setIso8601Time(B,E[1]);
  333. }if(D==null){D=B.getTimezoneOffset();
  334. }B.setTime(B.getTime()+D*60000);
  335. return B;
  336. };
  337. SimileAjax.DateTime.parseIso8601DateTime=function(A){try{return SimileAjax.DateTime.setIso8601(new Date(0),A);
  338. }catch(B){return null;
  339. }};
  340. SimileAjax.DateTime.parseGregorianDateTime=function(G){if(G==null){return null;
  341. }else{if(G instanceof Date){return G;
  342. }}var B=G.toString();
  343. if(B.length>0&&B.length<8){var C=B.indexOf(" ");
  344. if(C>0){var A=parseInt(B.substr(0,C));
  345. var E=B.substr(C+1);
  346. if(E.toLowerCase()=="bc"){A=1-A;
  347. }}else{var A=parseInt(B);
  348. }var F=new Date(0);
  349. F.setUTCFullYear(A);
  350. return F;
  351. }try{return new Date(Date.parse(B));
  352. }catch(D){return null;
  353. }};
  354. SimileAjax.DateTime.roundDownToInterval=function(B,G,J,K,A){var D=J*SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.HOUR];
  355. var I=new Date(B.getTime()+D);
  356. var E=function(L){L.setUTCMilliseconds(0);
  357. L.setUTCSeconds(0);
  358. L.setUTCMinutes(0);
  359. L.setUTCHours(0);
  360. };
  361. var C=function(L){E(L);
  362. L.setUTCDate(1);
  363. L.setUTCMonth(0);
  364. };
  365. switch(G){case SimileAjax.DateTime.MILLISECOND:var H=I.getUTCMilliseconds();
  366. I.setUTCMilliseconds(H-(H%K));
  367. break;
  368. case SimileAjax.DateTime.SECOND:I.setUTCMilliseconds(0);
  369. var H=I.getUTCSeconds();
  370. I.setUTCSeconds(H-(H%K));
  371. break;
  372. case SimileAjax.DateTime.MINUTE:I.setUTCMilliseconds(0);
  373. I.setUTCSeconds(0);
  374. var H=I.getUTCMinutes();
  375. I.setTime(I.getTime()-(H%K)*SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.MINUTE]);
  376. break;
  377. case SimileAjax.DateTime.HOUR:I.setUTCMilliseconds(0);
  378. I.setUTCSeconds(0);
  379. I.setUTCMinutes(0);
  380. var H=I.getUTCHours();
  381. I.setUTCHours(H-(H%K));
  382. break;
  383. case SimileAjax.DateTime.DAY:E(I);
  384. break;
  385. case SimileAjax.DateTime.WEEK:E(I);
  386. var F=(I.getUTCDay()+7-A)%7;
  387. I.setTime(I.getTime()-F*SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.DAY]);
  388. break;
  389. case SimileAjax.DateTime.MONTH:E(I);
  390. I.setUTCDate(1);
  391. var H=I.getUTCMonth();
  392. I.setUTCMonth(H-(H%K));
  393. break;
  394. case SimileAjax.DateTime.YEAR:C(I);
  395. var H=I.getUTCFullYear();
  396. I.setUTCFullYear(H-(H%K));
  397. break;
  398. case SimileAjax.DateTime.DECADE:C(I);
  399. I.setUTCFullYear(Math.floor(I.getUTCFullYear()/10)*10);
  400. break;
  401. case SimileAjax.DateTime.CENTURY:C(I);
  402. I.setUTCFullYear(Math.floor(I.getUTCFullYear()/100)*100);
  403. break;
  404. case SimileAjax.DateTime.MILLENNIUM:C(I);
  405. I.setUTCFullYear(Math.floor(I.getUTCFullYear()/1000)*1000);
  406. break;
  407. }B.setTime(I.getTime()-D);
  408. };
  409. SimileAjax.DateTime.roundUpToInterval=function(D,F,C,A,B){var E=D.getTime();
  410. SimileAjax.DateTime.roundDownToInterval(D,F,C,A,B);
  411. if(D.getTime()<E){D.setTime(D.getTime()+SimileAjax.DateTime.gregorianUnitLengths[F]*A);
  412. }};
  413. SimileAjax.DateTime.incrementByInterval=function(B,E,A){A=(typeof A=="undefined")?0:A;
  414. var D=A*SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.HOUR];
  415. var C=new Date(B.getTime()+D);
  416. switch(E){case SimileAjax.DateTime.MILLISECOND:C.setTime(C.getTime()+1);
  417. break;
  418. case SimileAjax.DateTime.SECOND:C.setTime(C.getTime()+1000);
  419. break;
  420. case SimileAjax.DateTime.MINUTE:C.setTime(C.getTime()+SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.MINUTE]);
  421. break;
  422. case SimileAjax.DateTime.HOUR:C.setTime(C.getTime()+SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.HOUR]);
  423. break;
  424. case SimileAjax.DateTime.DAY:C.setUTCDate(C.getUTCDate()+1);
  425. break;
  426. case SimileAjax.DateTime.WEEK:C.setUTCDate(C.getUTCDate()+7);
  427. break;
  428. case SimileAjax.DateTime.MONTH:C.setUTCMonth(C.getUTCMonth()+1);
  429. break;
  430. case SimileAjax.DateTime.YEAR:C.setUTCFullYear(C.getUTCFullYear()+1);
  431. break;
  432. case SimileAjax.DateTime.DECADE:C.setUTCFullYear(C.getUTCFullYear()+10);
  433. break;
  434. case SimileAjax.DateTime.CENTURY:C.setUTCFullYear(C.getUTCFullYear()+100);
  435. break;
  436. case SimileAjax.DateTime.MILLENNIUM:C.setUTCFullYear(C.getUTCFullYear()+1000);
  437. break;
  438. }B.setTime(C.getTime()-D);
  439. };
  440. SimileAjax.DateTime.removeTimeZoneOffset=function(B,A){return new Date(B.getTime()+A*SimileAjax.DateTime.gregorianUnitLengths[SimileAjax.DateTime.HOUR]);
  441. };
  442. SimileAjax.DateTime.getTimezone=function(){var A=new Date().getTimezoneOffset();
  443. return A/-60;
  444. };
  445. /* debug.js */
  446. SimileAjax.Debug={silent:false};
  447. SimileAjax.Debug.log=function(B){var A;
  448. if("console" in window&&"log" in window.console){A=function(C){console.log(C);
  449. };
  450. }else{A=function(C){if(!SimileAjax.Debug.silent){alert(C);
  451. }};
  452. }SimileAjax.Debug.log=A;
  453. A(B);
  454. };
  455. SimileAjax.Debug.warn=function(B){var A;
  456. if("console" in window&&"warn" in window.console){A=function(C){console.warn(C);
  457. };
  458. }else{A=function(C){if(!SimileAjax.Debug.silent){alert(C);
  459. }};
  460. }SimileAjax.Debug.warn=A;
  461. A(B);
  462. };
  463. SimileAjax.Debug.exception=function(B,D){var A,C=SimileAjax.parseURLParameters();
  464. if(C.errors=="throw"||SimileAjax.params.errors=="throw"){A=function(F,E){throw (F);
  465. };
  466. }else{if("console" in window&&"error" in window.console){A=function(F,E){if(E!=null){console.error(E+" %o",F);
  467. }else{console.error(F);
  468. }throw (F);
  469. };
  470. }else{A=function(F,E){if(!SimileAjax.Debug.silent){alert("Caught exception: "+E+"\n\nDetails: "+("description" in F?F.description:F));
  471. }throw (F);
  472. };
  473. }}SimileAjax.Debug.exception=A;
  474. A(B,D);
  475. };
  476. SimileAjax.Debug.objectToString=function(A){return SimileAjax.Debug._objectToString(A,"");
  477. };
  478. SimileAjax.Debug._objectToString=function(D,A){var C=A+" ";
  479. if(typeof D=="object"){var B="{";
  480. for(E in D){B+=C+E+": "+SimileAjax.Debug._objectToString(D[E],C)+"\n";
  481. }B+=A+"}";
  482. return B;
  483. }else{if(typeof D=="array"){var B="[";
  484. for(var E=0;
  485. E<D.length;
  486. E++){B+=SimileAjax.Debug._objectToString(D[E],C)+"\n";
  487. }B+=A+"]";
  488. return B;
  489. }else{return D;
  490. }}};
  491. /* dom.js */
  492. SimileAjax.DOM=new Object();
  493. SimileAjax.DOM.registerEventWithObject=function(C,A,D,B){SimileAjax.DOM.registerEvent(C,A,function(F,E,G){return D[B].call(D,F,E,G);
  494. });
  495. };
  496. SimileAjax.DOM.registerEvent=function(C,B,D){var A=function(E){E=(E)?E:((event)?event:null);
  497. if(E){var F=(E.target)?E.target:((E.srcElement)?E.srcElement:null);
  498. if(F){F=(F.nodeType==1||F.nodeType==9)?F:F.parentNode;
  499. }return D(C,E,F);
  500. }return true;
  501. };
  502. if(SimileAjax.Platform.browser.isIE){C.attachEvent("on"+B,A);
  503. }else{C.addEventListener(B,A,false);
  504. }};
  505. SimileAjax.DOM.getPageCoordinates=function(B){var E=0;
  506. var D=0;
  507. if(B.nodeType!=1){B=B.parentNode;
  508. }var C=B;
  509. while(C!=null){E+=C.offsetLeft;
  510. D+=C.offsetTop;
  511. C=C.offsetParent;
  512. }var A=document.body;
  513. while(B!=null&&B!=A){if("scrollLeft" in B){E-=B.scrollLeft;
  514. D-=B.scrollTop;
  515. }B=B.parentNode;
  516. }return{left:E,top:D};
  517. };
  518. SimileAjax.DOM.getSize=function(B){var A=this.getStyle(B,"width");
  519. var C=this.getStyle(B,"height");
  520. if(A.indexOf("px")>-1){A=A.replace("px","");
  521. }if(C.indexOf("px")>-1){C=C.replace("px","");
  522. }return{w:A,h:C};
  523. };
  524. SimileAjax.DOM.getStyle=function(B,A){if(B.currentStyle){var C=B.currentStyle[A];
  525. }else{if(window.getComputedStyle){var C=document.defaultView.getComputedStyle(B,null).getPropertyValue(A);
  526. }else{var C="";
  527. }}return C;
  528. };
  529. SimileAjax.DOM.getEventRelativeCoordinates=function(A,B){if(SimileAjax.Platform.browser.isIE){if(A.type=="mousewheel"){var C=SimileAjax.DOM.getPageCoordinates(B);
  530. return{x:A.clientX-C.left,y:A.clientY-C.top};
  531. }else{return{x:A.offsetX,y:A.offsetY};
  532. }}else{var C=SimileAjax.DOM.getPageCoordinates(B);
  533. if((A.type=="DOMMouseScroll")&&SimileAjax.Platform.browser.isFirefox&&(SimileAjax.Platform.browser.majorVersion==2)){return{x:A.screenX-C.left,y:A.screenY-C.top};
  534. }else{return{x:A.pageX-C.left,y:A.pageY-C.top};
  535. }}};
  536. SimileAjax.DOM.getEventPageCoordinates=function(A){if(SimileAjax.Platform.browser.isIE){var B=0;
  537. var C=0;
  538. if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){B=document.body.scrollTop;
  539. C=document.body.scrollLeft;
  540. }else{if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){B=document.documentElement.scrollTop;
  541. C=document.documentElement.scrollLeft;
  542. }}return{x:A.clientX+C,y:A.clientY+B};
  543. }else{return{x:A.pageX,y:A.pageY};
  544. }};
  545. SimileAjax.DOM.hittest=function(A,C,B){return SimileAjax.DOM._hittest(document.body,A,C,B);
  546. };
  547. SimileAjax.DOM._hittest=function(C,L,K,H){var M=C.childNodes;
  548. outer:for(var G=0;
  549. G<M.length;
  550. G++){var A=M[G];
  551. for(var F=0;
  552. F<H.length;
  553. F++){if(A==H[F]){continue outer;
  554. }}if(A.offsetWidth==0&&A.offsetHeight==0){var B=SimileAjax.DOM._hittest(A,L,K,H);
  555. if(B!=A){return B;
  556. }}else{var J=0;
  557. var E=0;
  558. var D=A;
  559. while(D){J+=D.offsetTop;
  560. E+=D.offsetLeft;
  561. D=D.offsetParent;
  562. }if(E<=L&&J<=K&&(L-E)<A.offsetWidth&&(K-J)<A.offsetHeight){return SimileAjax.DOM._hittest(A,L,K,H);
  563. }else{if(A.nodeType==1&&A.tagName=="TR"){var I=SimileAjax.DOM._hittest(A,L,K,H);
  564. if(I!=A){return I;
  565. }}}}}return C;
  566. };
  567. SimileAjax.DOM.cancelEvent=function(A){A.returnValue=false;
  568. A.cancelBubble=true;
  569. if("preventDefault" in A){A.preventDefault();
  570. }};
  571. SimileAjax.DOM.appendClassName=function(C,D){var B=C.className.split(" ");
  572. for(var A=0;
  573. A<B.length;
  574. A++){if(B[A]==D){return ;
  575. }}B.push(D);
  576. C.className=B.join(" ");
  577. };
  578. SimileAjax.DOM.createInputElement=function(A){var B=document.createElement("div");
  579. B.innerHTML="<input type='"+A+"' />";
  580. return B.firstChild;
  581. };
  582. SimileAjax.DOM.createDOMFromTemplate=function(B){var A={};
  583. A.elmt=SimileAjax.DOM._createDOMFromTemplate(B,A,null);
  584. return A;
  585. };
  586. SimileAjax.DOM._createDOMFromTemplate=function(A,I,E){if(A==null){return null;
  587. }else{if(typeof A!="object"){var D=document.createTextNode(A);
  588. if(E!=null){E.appendChild(D);
  589. }return D;
  590. }else{var C=null;
  591. if("tag" in A){var J=A.tag;
  592. if(E!=null){if(J=="tr"){C=E.insertRow(E.rows.length);
  593. }else{if(J=="td"){C=E.insertCell(E.cells.length);
  594. }}}if(C==null){C=J=="input"?SimileAjax.DOM.createInputElement(A.type):document.createElement(J);
  595. if(E!=null){E.appendChild(C);
  596. }}}else{C=A.elmt;
  597. if(E!=null){E.appendChild(C);
  598. }}for(var B in A){var G=A[B];
  599. if(B=="field"){I[G]=C;
  600. }else{if(B=="className"){C.className=G;
  601. }else{if(B=="id"){C.id=G;
  602. }else{if(B=="title"){C.title=G;
  603. }else{if(B=="type"&&C.tagName=="input"){}else{if(B=="style"){for(n in G){var H=G[n];
  604. if(n=="float"){n=SimileAjax.Platform.browser.isIE?"styleFloat":"cssFloat";
  605. }C.style[n]=H;
  606. }}else{if(B=="children"){for(var F=0;
  607. F<G.length;
  608. F++){SimileAjax.DOM._createDOMFromTemplate(G[F],I,C);
  609. }}else{if(B!="tag"&&B!="elmt"){C.setAttribute(B,G);
  610. }}}}}}}}}return C;
  611. }}};
  612. SimileAjax.DOM._cachedParent=null;
  613. SimileAjax.DOM.createElementFromString=function(A){if(SimileAjax.DOM._cachedParent==null){SimileAjax.DOM._cachedParent=document.createElement("div");
  614. }SimileAjax.DOM._cachedParent.innerHTML=A;
  615. return SimileAjax.DOM._cachedParent.firstChild;
  616. };
  617. SimileAjax.DOM.createDOMFromString=function(A,C,D){var B=typeof A=="string"?document.createElement(A):A;
  618. B.innerHTML=C;
  619. var E={elmt:B};
  620. SimileAjax.DOM._processDOMChildrenConstructedFromString(E,B,D!=null?D:{});
  621. return E;
  622. };
  623. SimileAjax.DOM._processDOMConstructedFromString=function(D,A,B){var E=A.id;
  624. if(E!=null&&E.length>0){A.removeAttribute("id");
  625. if(E in B){var C=A.parentNode;
  626. C.insertBefore(B[E],A);
  627. C.removeChild(A);
  628. D[E]=B[E];
  629. return ;
  630. }else{D[E]=A;
  631. }}if(A.hasChildNodes()){SimileAjax.DOM._processDOMChildrenConstructedFromString(D,A,B);
  632. }};
  633. SimileAjax.DOM._processDOMChildrenConstructedFromString=function(E,B,D){var C=B.firstChild;
  634. while(C!=null){var A=C.nextSibling;
  635. if(C.nodeType==1){SimileAjax.DOM._processDOMConstructedFromString(E,C,D);
  636. }C=A;
  637. }};
  638. /* graphics.js */
  639. SimileAjax.Graphics=new Object();
  640. SimileAjax.Graphics.pngIsTranslucent=(!SimileAjax.Platform.browser.isIE)||(SimileAjax.Platform.browser.majorVersion>6);
  641. if(!SimileAjax.Graphics.pngIsTranslucent){SimileAjax.includeCssFile(document,SimileAjax.urlPrefix+"styles/graphics-ie6.css");
  642. }SimileAjax.Graphics._createTranslucentImage1=function(A,C){var B=document.createElement("img");
  643. B.setAttribute("src",A);
  644. if(C!=null){B.style.verticalAlign=C;
  645. }return B;
  646. };
  647. SimileAjax.Graphics._createTranslucentImage2=function(A,C){var B=document.createElement("img");
  648. B.style.width="1px";
  649. B.style.height="1px";
  650. B.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+A+"', sizingMethod='image')";
  651. B.style.verticalAlign=(C!=null)?C:"middle";
  652. return B;
  653. };
  654. SimileAjax.Graphics.createTranslucentImage=SimileAjax.Graphics.pngIsTranslucent?SimileAjax.Graphics._createTranslucentImage1:SimileAjax.Graphics._createTranslucentImage2;
  655. SimileAjax.Graphics._createTranslucentImageHTML1=function(A,B){return'<img src="'+A+'"'+(B!=null?' style="vertical-align: '+B+';"':"")+" />";
  656. };
  657. SimileAjax.Graphics._createTranslucentImageHTML2=function(A,C){var B="width: 1px; height: 1px; filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+A+"', sizingMethod='image');"+(C!=null?" vertical-align: "+C+";":"");
  658. return"<img src='"+A+"' style=\""+B+'" />';
  659. };
  660. SimileAjax.Graphics.createTranslucentImageHTML=SimileAjax.Graphics.pngIsTranslucent?SimileAjax.Graphics._createTranslucentImageHTML1:SimileAjax.Graphics._createTranslucentImageHTML2;
  661. SimileAjax.Graphics.setOpacity=function(B,A){if(SimileAjax.Platform.browser.isIE){B.style.filter="progid:DXImageTransform.Microsoft.Alpha(Style=0,Opacity="+A+")";
  662. }else{var C=(A/100).toString();
  663. B.style.opacity=C;
  664. B.style.MozOpacity=C;
  665. }};
  666. SimileAjax.Graphics.bubbleConfig={containerCSSClass:"simileAjax-bubble-container",innerContainerCSSClass:"simileAjax-bubble-innerContainer",contentContainerCSSClass:"simileAjax-bubble-contentContainer",borderGraphicSize:50,borderGraphicCSSClassPrefix:"simileAjax-bubble-border-",arrowGraphicTargetOffset:33,arrowGraphicLength:100,arrowGraphicWidth:49,arrowGraphicCSSClassPrefix:"simileAjax-bubble-arrow-",closeGraphicCSSClass:"simileAjax-bubble-close",extraPadding:20};
  667. SimileAjax.Graphics.createBubbleForContentAndPoint=function(F,D,C,A,B,E){if(typeof A!="number"){A=300;
  668. }if(typeof E!="number"){E=0;
  669. }F.style.position="absolute";
  670. F.style.left="-5000px";
  671. F.style.top="0px";
  672. F.style.width=A+"px";
  673. document.body.appendChild(F);
  674. window.setTimeout(function(){var J=F.scrollWidth+10;
  675. var G=F.scrollHeight+10;
  676. var I=0;
  677. if(E>0&&G>E){G=E;
  678. I=J-25;
  679. }var H=SimileAjax.Graphics.createBubbleForPoint(D,C,J,G,B);
  680. document.body.removeChild(F);
  681. F.style.position="static";
  682. F.style.left="";
  683. F.style.top="";
  684. if(I>0){var K=document.createElement("div");
  685. F.style.width="";
  686. K.style.width=I+"px";
  687. K.appendChild(F);
  688. H.content.appendChild(K);
  689. }else{F.style.width=J+"px";
  690. H.content.appendChild(F);
  691. }},200);
  692. };
  693. SimileAjax.Graphics.createBubbleForPoint=function(B,A,K,M,D){K=parseInt(K,10);
  694. M=parseInt(M,10);
  695. var E=SimileAjax.Graphics.bubbleConfig;
  696. var N=SimileAjax.Graphics.pngIsTranslucent?"pngTranslucent":"pngNotTranslucent";
  697. var L=K+2*E.borderGraphicSize;
  698. var P=M+2*E.borderGraphicSize;
  699. var O=function(S){return S+" "+S+"-"+N;
  700. };
  701. var H=document.createElement("div");
  702. H.className=O(E.containerCSSClass);
  703. H.style.width=K+"px";
  704. H.style.height=M+"px";
  705. var F=document.createElement("div");
  706. F.className=O(E.innerContainerCSSClass);
  707. H.appendChild(F);
  708. var I=function(){if(!J._closed){document.body.removeChild(J._div);
  709. J._doc=null;
  710. J._div=null;
  711. J._content=null;
  712. J._closed=true;
  713. }};
  714. var J={_closed:false};
  715. var R=SimileAjax.WindowManager.pushLayer(I,true,H);
  716. J._div=H;
  717. J.close=function(){SimileAjax.WindowManager.popLayer(R);
  718. };
  719. var G=function(T){var S=document.createElement("div");
  720. S.className=O(E.borderGraphicCSSClassPrefix+T);
  721. F.appendChild(S);
  722. };
  723. G("top-left");
  724. G("top-right");
  725. G("bottom-left");
  726. G("bottom-right");
  727. G("left");
  728. G("right");
  729. G("top");
  730. G("bottom");
  731. var C=document.createElement("div");
  732. C.className=O(E.contentContainerCSSClass);
  733. F.appendChild(C);
  734. J.content=C;
  735. var Q=document.createElement("div");
  736. Q.className=O(E.closeGraphicCSSClass);
  737. F.appendChild(Q);
  738. SimileAjax.WindowManager.registerEventWithObject(Q,"click",J,"close");
  739. (function(){var Z=SimileAjax.Graphics.getWindowDimensions();
  740. var U=Z.w;
  741. var S=Z.h;
  742. var V=Math.ceil(E.arrowGraphicWidth/2);
  743. var Y=function(a){var b=document.createElement("div");
  744. b.className=O(E.arrowGraphicCSSClassPrefix+"point-"+a);
  745. F.appendChild(b);
  746. return b;
  747. };
  748. if(B-V-E.borderGraphicSize-E.extraPadding>0&&B+V+E.borderGraphicSize+E.extraPadding<U){var X=B-Math.round(K/2);
  749. X=B<(U/2)?Math.max(X,E.extraPadding+E.borderGraphicSize):Math.min(X,U-E.extraPadding-E.borderGraphicSize-K);
  750. if((D&&D=="top")||(!D&&(A-E.arrowGraphicTargetOffset-M-E.borderGraphicSize-E.extraPadding>0))){var T=Y("down");
  751. T.style.left=(B-V-X)+"px";
  752. H.style.left=X+"px";
  753. H.style.top=(A-E.arrowGraphicTargetOffset-M)+"px";
  754. return ;
  755. }else{if((D&&D=="bottom")||(!D&&(A+E.arrowGraphicTargetOffset+M+E.borderGraphicSize+E.extraPadding<S))){var T=Y("up");
  756. T.style.left=(B-V-X)+"px";
  757. H.style.left=X+"px";
  758. H.style.top=(A+E.arrowGraphicTargetOffset)+"px";
  759. return ;
  760. }}}var W=A-Math.round(M/2);
  761. W=A<(S/2)?Math.max(W,E.extraPadding+E.borderGraphicSize):Math.min(W,S-E.extraPadding-E.borderGraphicSize-M);
  762. if((D&&D=="left")||(!D&&(B-E.arrowGraphicTargetOffset-K-E.borderGraphicSize-E.extraPadding>0))){var T=Y("right");
  763. T.style.top=(A-V-W)+"px";
  764. H.style.top=W+"px";
  765. H.style.left=(B-E.arrowGraphicTargetOffset-K)+"px";
  766. }else{var T=Y("left");
  767. T.style.top=(A-V-W)+"px";
  768. H.style.top=W+"px";
  769. H.style.left=(B+E.arrowGraphicTargetOffset)+"px";
  770. }})();
  771. document.body.appendChild(H);
  772. return J;
  773. };
  774. SimileAjax.Graphics.getWindowDimensions=function(){if(typeof window.innerHeight=="number"){return{w:window.innerWidth,h:window.innerHeight};
  775. }else{if(document.documentElement&&document.documentElement.clientHeight){return{w:document.documentElement.clientWidth,h:document.documentElement.clientHeight};
  776. }else{if(document.body&&document.body.clientHeight){return{w:document.body.clientWidth,h:document.body.clientHeight};
  777. }}}};
  778. SimileAjax.Graphics.createMessageBubble=function(H){var G=H.createElement("div");
  779. if(SimileAjax.Graphics.pngIsTranslucent){var I=H.createElement("div");
  780. I.style.height="33px";
  781. I.style.background="url("+SimileAjax.urlPrefix+"images/message-top-left.png) top left no-repeat";
  782. I.style.paddingLeft="44px";
  783. G.appendChild(I);
  784. var C=H.createElement("div");
  785. C.style.height="33px";
  786. C.style.background="url("+SimileAjax.urlPrefix+"images/message-top-right.png) top right no-repeat";
  787. I.appendChild(C);
  788. var F=H.createElement("div");
  789. F.style.background="url("+SimileAjax.urlPrefix+"images/message-left.png) top left repeat-y";
  790. F.style.paddingLeft="44px";
  791. G.appendChild(F);
  792. var A=H.createElement("div");
  793. A.style.background="url("+SimileAjax.urlPrefix+"images/message-right.png) top right repeat-y";
  794. A.style.paddingRight="44px";
  795. F.appendChild(A);
  796. var D=H.createElement("div");
  797. A.appendChild(D);
  798. var B=H.createElement("div");
  799. B.style.height="55px";
  800. B.style.background="url("+SimileAjax.urlPrefix+"images/message-bottom-left.png) bottom left no-repeat";
  801. B.style.paddingLeft="44px";
  802. G.appendChild(B);
  803. var E=H.createElement("div");
  804. E.style.height="55px";
  805. E.style.background="url("+SimileAjax.urlPrefix+"images/message-bottom-right.png) bottom right no-repeat";
  806. B.appendChild(E);
  807. }else{G.style.border="2px solid #7777AA";
  808. G.style.padding="20px";
  809. G.style.background="white";
  810. SimileAjax.Graphics.setOpacity(G,90);
  811. var D=H.createElement("div");
  812. G.appendChild(D);
  813. }return{containerDiv:G,contentDiv:D};
  814. };
  815. SimileAjax.Graphics.createAnimation=function(B,E,D,C,A){return new SimileAjax.Graphics._Animation(B,E,D,C,A);
  816. };
  817. SimileAjax.Graphics._Animation=function(B,E,D,C,A){this.f=B;
  818. this.cont=(typeof A=="function")?A:function(){};
  819. this.from=E;
  820. this.to=D;
  821. this.current=E;
  822. this.duration=C;
  823. this.start=new Date().getTime();
  824. this.timePassed=0;
  825. };
  826. SimileAjax.Graphics._Animation.prototype.run=function(){var A=this;
  827. window.setTimeout(function(){A.step();
  828. },50);
  829. };
  830. SimileAjax.Graphics._Animation.prototype.step=function(){this.timePassed+=50;
  831. var B=this.timePassed/this.duration;
  832. var A=-Math.cos(B*Math.PI)/2+0.5;
  833. var D=A*(this.to-this.from)+this.from;
  834. try{this.f(D,D-this.current);
  835. }catch(C){}this.current=D;
  836. if(this.timePassed<this.duration){this.run();
  837. }else{this.f(this.to,0);
  838. this["cont"]();
  839. }};
  840. SimileAjax.Graphics.createStructuredDataCopyButton=function(F,D,A,E){var G=document.createElement("div");
  841. G.style.position="relative";
  842. G.style.display="inline";
  843. G.style.width=D+"px";
  844. G.style.height=A+"px";
  845. G.style.overflow="hidden";
  846. G.style.margin="2px";
  847. if(SimileAjax.Graphics.pngIsTranslucent){G.style.background="url("+F+") no-repeat";
  848. }else{G.style.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+F+"', sizingMethod='image')";
  849. }var C;
  850. if(SimileAjax.Platform.browser.isIE){C="filter:alpha(opacity=0)";
  851. }else{C="opacity: 0";
  852. }G.innerHTML="<textarea rows='1' autocomplete='off' value='none' style='"+C+"' />";
  853. var B=G.firstChild;
  854. B.style.width=D+"px";
  855. B.style.height=A+"px";
  856. B.onmousedown=function(H){H=(H)?H:((event)?event:null);
  857. if(H.button==2){B.value=E();
  858. B.select();
  859. }};
  860. return G;
  861. };
  862. SimileAjax.Graphics.getWidthHeight=function(C){var A,B;
  863. if(C.getBoundingClientRect==null){A=C.offsetWidth;
  864. B=C.offsetHeight;
  865. }else{var D=C.getBoundingClientRect();
  866. A=Math.ceil(D.right-D.left);
  867. B=Math.ceil(D.bottom-D.top);
  868. }return{width:A,height:B};
  869. };
  870. SimileAjax.Graphics.getFontRenderingContext=function(A,B){return new SimileAjax.Graphics._FontRenderingContext(A,B);
  871. };
  872. SimileAjax.Graphics._FontRenderingContext=function(A,B){this._elmt=A;
  873. this._elmt.style.visibility="hidden";
  874. if(typeof B=="string"){this._elmt.style.width=B;
  875. }else{if(typeof B=="number"){this._elmt.style.width=B+"px";
  876. }}};
  877. SimileAjax.Graphics._FontRenderingContext.prototype.dispose=function(){this._elmt=null;
  878. };
  879. SimileAjax.Graphics._FontRenderingContext.prototype.update=function(){this._elmt.innerHTML="A";
  880. this._lineHeight=this._elmt.offsetHeight;
  881. };
  882. SimileAjax.Graphics._FontRenderingContext.prototype.computeSize=function(D,C){var B=this._elmt;
  883. B.innerHTML=D;
  884. B.className=C===undefined?"":C;
  885. var A=SimileAjax.Graphics.getWidthHeight(B);
  886. B.className="";
  887. return A;
  888. };
  889. SimileAjax.Graphics._FontRenderingContext.prototype.getLineHeight=function(){return this._lineHeight;
  890. };
  891. /* history.js */
  892. SimileAjax.History={maxHistoryLength:10,historyFile:"__history__.html",enabled:true,_initialized:false,_listeners:new SimileAjax.ListenerQueue(),_actions:[],_baseIndex:0,_currentIndex:0,_plainDocumentTitle:document.title};
  893. SimileAjax.History.formatHistoryEntryTitle=function(A){return SimileAjax.History._plainDocumentTitle+" {"+A+"}";
  894. };
  895. SimileAjax.History.initialize=function(){if(SimileAjax.History._initialized){return ;
  896. }if(SimileAjax.History.enabled){var A=document.createElement("iframe");
  897. A.id="simile-ajax-history";
  898. A.style.position="absolute";
  899. A.style.width="10px";
  900. A.style.height="10px";
  901. A.style.top="0px";
  902. A.style.left="0px";
  903. A.style.visibility="hidden";
  904. A.src=SimileAjax.History.historyFile+"?0";
  905. document.body.appendChild(A);
  906. SimileAjax.DOM.registerEvent(A,"load",SimileAjax.History._handleIFrameOnLoad);
  907. SimileAjax.History._iframe=A;
  908. }SimileAjax.History._initialized=true;
  909. };
  910. SimileAjax.History.addListener=function(A){SimileAjax.History.initialize();
  911. SimileAjax.History._listeners.add(A);
  912. };
  913. SimileAjax.History.removeListener=function(A){SimileAjax.History.initialize();
  914. SimileAjax.History._listeners.remove(A);
  915. };
  916. SimileAjax.History.addAction=function(A){SimileAjax.History.initialize();
  917. SimileAjax.History._listeners.fire("onBeforePerform",[A]);
  918. window.setTimeout(function(){try{A.perform();
  919. SimileAjax.History._listeners.fire("onAfterPerform",[A]);
  920. if(SimileAjax.History.enabled){SimileAjax.History._actions=SimileAjax.History._actions.slice(0,SimileAjax.History._currentIndex-SimileAjax.History._baseIndex);
  921. SimileAjax.History._actions.push(A);
  922. SimileAjax.History._currentIndex++;
  923. var C=SimileAjax.History._actions.length-SimileAjax.History.maxHistoryLength;
  924. if(C>0){SimileAjax.History._actions=SimileAjax.History._actions.slice(C);
  925. SimileAjax.History._baseIndex+=C;
  926. }try{SimileAjax.History._iframe.contentWindow.location.search="?"+SimileAjax.History._currentIndex;
  927. }catch(B){var D=SimileAjax.History.formatHistoryEntryTitle(A.label);
  928. document.title=D;
  929. }}}catch(B){SimileAjax.Debug.exception(B,"Error adding action {"+A.label+"} to history");
  930. }},0);
  931. };
  932. SimileAjax.History.addLengthyAction=function(C,A,B){SimileAjax.History.addAction({perform:C,undo:A,label:B,uiLayer:SimileAjax.WindowManager.getBaseLayer(),lengthy:true});
  933. };
  934. SimileAjax.History._handleIFrameOnLoad=function(){try{var B=SimileAjax.History._iframe.contentWindow.location.search;
  935. var F=(B.length==0)?0:Math.max(0,parseInt(B.substr(1)));
  936. var E=function(){var G=F-SimileAjax.History._currentIndex;
  937. SimileAjax.History._currentIndex+=G;
  938. SimileAjax.History._baseIndex+=G;
  939. SimileAjax.History._iframe.contentWindow.location.search="?"+F;
  940. };
  941. if(F<SimileAjax.History._currentIndex){SimileAjax.History._listeners.fire("onBeforeUndoSeveral",[]);
  942. window.setTimeout(function(){while(SimileAjax.History._currentIndex>F&&SimileAjax.History._currentIndex>SimileAjax.History._baseIndex){SimileAjax.History._currentIndex--;
  943. var G=SimileAjax.History._actions[SimileAjax.History._currentIndex-SimileAjax.History._baseIndex];
  944. try{G.undo();
  945. }catch(H){SimileAjax.Debug.exception(H,"History: Failed to undo action {"+G.label+"}");
  946. }}SimileAjax.History._listeners.fire("onAfterUndoSeveral",[]);
  947. E();
  948. },0);
  949. }else{if(F>SimileAjax.History._currentIndex){SimileAjax.History._listeners.fire("onBeforeRedoSeveral",[]);
  950. window.setTimeout(function(){while(SimileAjax.History._currentIndex<F&&SimileAjax.History._currentIndex-SimileAjax.History._baseIndex<SimileAjax.History._actions.length){var G=SimileAjax.History._actions[SimileAjax.History._currentIndex-SimileAjax.History._baseIndex];
  951. try{G.perform();
  952. }catch(H){SimileAjax.Debug.exception(H,"History: Failed to redo action {"+G.label+"}");
  953. }SimileAjax.History._currentIndex++;
  954. }SimileAjax.History._listeners.fire("onAfterRedoSeveral",[]);
  955. E();
  956. },0);
  957. }else{var A=SimileAjax.History._currentIndex-SimileAjax.History._baseIndex-1;
  958. var D=(A>=0&&A<SimileAjax.History._actions.length)?SimileAjax.History.formatHistoryEntryTitle(SimileAjax.History._actions[A].label):SimileAjax.History._plainDocumentTitle;
  959. SimileAjax.History._iframe.contentWindow.document.title=D;
  960. document.title=D;
  961. }}}catch(C){}};
  962. SimileAjax.History.getNextUndoAction=function(){try{var A=SimileAjax.History._currentIndex-SimileAjax.History._baseIndex-1;
  963. return SimileAjax.History._actions[A];
  964. }catch(B){return null;
  965. }};
  966. SimileAjax.History.getNextRedoAction=function(){try{var A=SimileAjax.History._currentIndex-SimileAjax.History._baseIndex;
  967. return SimileAjax.History._actions[A];
  968. }catch(B){return null;
  969. }};
  970. /* html.js */
  971. SimileAjax.HTML=new Object();
  972. SimileAjax.HTML._e2uHash={};
  973. (function(){var A=SimileAjax.HTML._e2uHash;
  974. A["nbsp"]="\u00A0";
  975. A["iexcl"]="\u00A1";
  976. A["cent"]="\u00A2";
  977. A["pound"]="\u00A3";
  978. A["curren"]="\u00A4";
  979. A["yen"]="\u00A5";
  980. A["brvbar"]="\u00A6";
  981. A["sect"]="\u00A7";
  982. A["uml"]="\u00A8";
  983. A["copy"]="\u00A9";
  984. A["ordf"]="\u00AA";
  985. A["laquo"]="\u00AB";
  986. A["not"]="\u00AC";
  987. A["shy"]="\u00AD";
  988. A["reg"]="\u00AE";
  989. A["macr"]="\u00AF";
  990. A["deg"]="\u00B0";
  991. A["plusmn"]="\u00B1";
  992. A["sup2"]="\u00B2";
  993. A["sup3"]="\u00B3";
  994. A["acute"]="\u00B4";
  995. A["micro"]="\u00B5";
  996. A["para"]="\u00B6";
  997. A["middot"]="\u00B7";
  998. A["cedil"]="\u00B8";
  999. A["sup1"]="\u00B9";
  1000. A["ordm"]="\u00BA";
  1001. A["raquo"]="\u00BB";
  1002. A["frac14"]="\u00BC";
  1003. A["frac12"]="\u00BD";
  1004. A["frac34"]="\u00BE";
  1005. A["iquest"]="\u00BF";
  1006. A["Agrave"]="\u00C0";
  1007. A["Aacute"]="\u00C1";
  1008. A["Acirc"]="\u00C2";
  1009. A["Atilde"]="\u00C3";
  1010. A["Auml"]="\u00C4";
  1011. A["Aring"]="\u00C5";
  1012. A["AElig"]="\u00C6";
  1013. A["Ccedil"]="\u00C7";
  1014. A["Egrave"]="\u00C8";
  1015. A["Eacute"]="\u00C9";
  1016. A["Ecirc"]="\u00CA";
  1017. A["Euml"]="\u00CB";
  1018. A["Igrave"]="\u00CC";
  1019. A["Iacute"]="\u00CD";
  1020. A["Icirc"]="\u00CE";
  1021. A["Iuml"]="\u00CF";
  1022. A["ETH"]="\u00D0";
  1023. A["Ntilde"]="\u00D1";
  1024. A["Ograve"]="\u00D2";
  1025. A["Oacute"]="\u00D3";
  1026. A["Ocirc"]="\u00D4";
  1027. A["Otilde"]="\u00D5";
  1028. A["Ouml"]="\u00D6";
  1029. A["times"]="\u00D7";
  1030. A["Oslash"]="\u00D8";
  1031. A["Ugrave"]="\u00D9";
  1032. A["Uacute"]="\u00DA";
  1033. A["Ucirc"]="\u00DB";
  1034. A["Uuml"]="\u00DC";
  1035. A["Yacute"]="\u00DD";
  1036. A["THORN"]="\u00DE";
  1037. A["szlig"]="\u00DF";
  1038. A["agrave"]="\u00E0";
  1039. A["aacute"]="\u00E1";
  1040. A["acirc"]="\u00E2";
  1041. A["atilde"]="\u00E3";
  1042. A["auml"]="\u00E4";
  1043. A["aring"]="\u00E5";
  1044. A["aelig"]="\u00E6";
  1045. A["ccedil"]="\u00E7";
  1046. A["egrave"]="\u00E8";
  1047. A["eacute"]="\u00E9";
  1048. A["ecirc"]="\u00EA";
  1049. A["euml"]="\u00EB";
  1050. A["igrave"]="\u00EC";
  1051. A["iacute"]="\u00ED";
  1052. A["icirc"]="\u00EE";
  1053. A["iuml"]="\u00EF";
  1054. A["eth"]="\u00F0";
  1055. A["ntilde"]="\u00F1";
  1056. A["ograve"]="\u00F2";
  1057. A["oacute"]="\u00F3";
  1058. A["ocirc"]="\u00F4";
  1059. A["otilde"]="\u00F5";
  1060. A["ouml"]="\u00F6";
  1061. A["divide"]="\u00F7";
  1062. A["oslash"]="\u00F8";
  1063. A["ugrave"]="\u00F9";
  1064. A["uacute"]="\u00FA";
  1065. A["ucirc"]="\u00FB";
  1066. A["uuml"]="\u00FC";
  1067. A["yacute"]="\u00FD";
  1068. A["thorn"]="\u00FE";
  1069. A["yuml"]="\u00FF";
  1070. A["quot"]="\u0022";
  1071. A["amp"]="\u0026";
  1072. A["lt"]="\u003C";
  1073. A["gt"]="\u003E";
  1074. A["OElig"]="";
  1075. A["oelig"]="\u0153";
  1076. A["Scaron"]="\u0160";
  1077. A["scaron"]="\u0161";
  1078. A["Yuml"]="\u0178";
  1079. A["circ"]="\u02C6";
  1080. A["tilde"]="\u02DC";
  1081. A["ensp"]="\u2002";
  1082. A["emsp"]="\u2003";
  1083. A["thinsp"]="\u2009";
  1084. A["zwnj"]="\u200C";
  1085. A["zwj"]="\u200D";
  1086. A["lrm"]="\u200E";
  1087. A["rlm"]="\u200F";
  1088. A["ndash"]="\u2013";
  1089. A["mdash"]="\u2014";
  1090. A["lsquo"]="\u2018";
  1091. A["rsquo"]="\u2019";
  1092. A["sbquo"]="\u201A";
  1093. A["ldquo"]="\u201C";
  1094. A["rdquo"]="\u201D";
  1095. A["bdquo"]="\u201E";
  1096. A["dagger"]="\u2020";
  1097. A["Dagger"]="\u2021";
  1098. A["permil"]="\u2030";
  1099. A["lsaquo"]="\u2039";
  1100. A["rsaquo"]="\u203A";
  1101. A["euro"]="\u20AC";
  1102. A["fnof"]="\u0192";
  1103. A["Alpha"]="\u0391";
  1104. A["Beta"]="\u0392";
  1105. A["Gamma"]="\u0393";
  1106. A["Delta"]="\u0394";
  1107. A["Epsilon"]="\u0395";
  1108. A["Zeta"]="\u0396";
  1109. A["Eta"]="\u0397";
  1110. A["Theta"]="\u0398";
  1111. A["Iota"]="\u0399";
  1112. A["Kappa"]="\u039A";
  1113. A["Lambda"]="\u039B";
  1114. A["Mu"]="\u039C";
  1115. A["Nu"]="\u039D";
  1116. A["Xi"]="\u039E";
  1117. A["Omicron"]="\u039F";
  1118. A["Pi"]="\u03A0";
  1119. A["Rho"]="\u03A1";
  1120. A["Sigma"]="\u03A3";
  1121. A["Tau"]="\u03A4";
  1122. A["Upsilon"]="\u03A5";
  1123. A["Phi"]="\u03A6";
  1124. A["Chi"]="\u03A7";
  1125. A["Psi"]="\u03A8";
  1126. A["Omega"]="\u03A9";
  1127. A["alpha"]="\u03B1";
  1128. A["beta"]="\u03B2";
  1129. A["gamma"]="\u03B3";
  1130. A["delta"]="\u03B4";
  1131. A["epsilon"]="\u03B5";
  1132. A["zeta"]="\u03B6";
  1133. A["eta"]="\u03B7";
  1134. A["theta"]="\u03B8";
  1135. A["iota"]="\u03B9";
  1136. A["kappa"]="\u03BA";
  1137. A["lambda"]="\u03BB";
  1138. A["mu"]="\u03BC";
  1139. A["nu"]="\u03BD";
  1140. A["xi"]="\u03BE";
  1141. A["omicron"]="\u03BF";
  1142. A["pi"]="\u03C0";
  1143. A["rho"]="\u03C1";
  1144. A["sigmaf"]="\u03C2";
  1145. A["sigma"]="\u03C3";
  1146. A["tau"]="\u03C4";
  1147. A["upsilon"]="\u03C5";
  1148. A["phi"]="\u03C6";
  1149. A["chi"]="\u03C7";
  1150. A["psi"]="\u03C8";
  1151. A["omega"]="\u03C9";
  1152. A["thetasym"]="\u03D1";
  1153. A["upsih"]="\u03D2";
  1154. A["piv"]="\u03D6";
  1155. A["bull"]="\u2022";
  1156. A["hellip"]="\u2026";
  1157. A["prime"]="\u2032";
  1158. A["Prime"]="\u2033";
  1159. A["oline"]="\u203E";
  1160. A["frasl"]="\u2044";
  1161. A["weierp"]="\u2118";
  1162. A["image"]="\u2111";
  1163. A["real"]="\u211C";
  1164. A["trade"]="\u2122";
  1165. A["alefsym"]="\u2135";
  1166. A["larr"]="\u2190";
  1167. A["uarr"]="\u2191";
  1168. A["rarr"]="\u2192";
  1169. A["darr"]="\u2193";
  1170. A["harr"]="\u2194";
  1171. A["crarr"]="\u21B5";
  1172. A["lArr"]="\u21D0";
  1173. A["uArr"]="\u21D1";
  1174. A["rArr"]="\u21D2";
  1175. A["dArr"]="\u21D3";
  1176. A["hArr"]="\u21D4";
  1177. A["forall"]="\u2200";
  1178. A["part"]="\u2202";
  1179. A["exist"]="\u2203";
  1180. A["empty"]="\u2205";
  1181. A["nabla"]="\u2207";
  1182. A["isin"]="\u2208";
  1183. A["notin"]="\u2209";
  1184. A["ni"]="\u220B";
  1185. A["prod"]="\u220F";
  1186. A["sum"]="\u2211";
  1187. A["minus"]="\u2212";
  1188. A["lowast"]="\u2217";
  1189. A["radic"]="\u221A";
  1190. A["prop"]="\u221D";
  1191. A["infin"]="\u221E";
  1192. A["ang"]="\u2220";
  1193. A["and"]="\u2227";
  1194. A["or"]="\u2228";
  1195. A["cap"]="\u2229";
  1196. A["cup"]="\u222A";
  1197. A["int"]="\u222B";
  1198. A["there4"]="\u2234";
  1199. A["sim"]="\u223C";
  1200. A["cong"]="\u2245";
  1201. A["asymp"]="\u2248";
  1202. A["ne"]="\u2260";
  1203. A["equiv"]="\u2261";
  1204. A["le"]="\u2264";
  1205. A["ge"]="\u2265";
  1206. A["sub"]="\u2282";
  1207. A["sup"]="\u2283";
  1208. A["nsub"]="\u2284";
  1209. A["sube"]="\u2286";
  1210. A["supe"]="\u2287";
  1211. A["oplus"]="\u2295";
  1212. A["otimes"]="\u2297";
  1213. A["perp"]="\u22A5";
  1214. A["sdot"]="\u22C5";
  1215. A["lceil"]="\u2308";
  1216. A["rceil"]="\u2309";
  1217. A["lfloor"]="\u230A";
  1218. A["rfloor"]="\u230B";
  1219. A["lang"]="\u2329";
  1220. A["rang"]="\u232A";
  1221. A["loz"]="\u25CA";
  1222. A["spades"]="\u2660";
  1223. A["clubs"]="\u2663";
  1224. A["hearts"]="\u2665";
  1225. A["diams"]="\u2666";
  1226. })();
  1227. SimileAjax.HTML.deEntify=function(C){var D=SimileAjax.HTML._e2uHash;
  1228. var B=/&(\w+?);/;
  1229. while(B.test(C)){var A=C.match(B);
  1230. C=C.replace(B,D[A[1]]);
  1231. }return C;
  1232. };
  1233. /* json.js */
  1234. SimileAjax.JSON=new Object();
  1235. (function(){var m={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};
  1236. var s={array:function(x){var a=["["],b,f,i,l=x.length,v;
  1237. for(i=0;
  1238. i<l;
  1239. i+=1){v=x[i];
  1240. f=s[typeof v];
  1241. if(f){v=f(v);
  1242. if(typeof v=="string"){if(b){a[a.length]=",";
  1243. }a[a.length]=v;
  1244. b=true;
  1245. }}}a[a.length]="]";
  1246. return a.join("");
  1247. },"boolean":function(x){return String(x);
  1248. },"null":function(x){return"null";
  1249. },number:function(x){return isFinite(x)?String(x):"null";
  1250. },object:function(x){if(x){if(x instanceof Array){return s.array(x);
  1251. }var a=["{"],b,f,i,v;
  1252. for(i in x){v=x[i];
  1253. f=s[typeof v];
  1254. if(f){v=f(v);
  1255. if(typeof v=="string"){if(b){a[a.length]=",";
  1256. }a.push(s.string(i),":",v);
  1257. b=true;
  1258. }}}a[a.length]="}";
  1259. return a.join("");
  1260. }return"null";
  1261. },string:function(x){if(/["\\\x00-\x1f]/.test(x)){x=x.replace(/([\x00-\x1f\\"])/g,function(a,b){var c=m[b];
  1262. if(c){return c;
  1263. }c=b.charCodeAt();
  1264. return"\\u00"+Math.floor(c/16).toString(16)+(c%16).toString(16);
  1265. });
  1266. }return'"'+x+'"';
  1267. }};
  1268. SimileAjax.JSON.toJSONString=function(o){if(o instanceof Object){return s.object(o);
  1269. }else{if(o instanceof Array){return s.array(o);
  1270. }else{return o.toString();
  1271. }}};
  1272. SimileAjax.JSON.parseJSON=function(){try{return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(this.replace(/"(\\.|[^"\\])*"/g,"")))&&eval("("+this+")");
  1273. }catch(e){return false;
  1274. }};
  1275. })();
  1276. /* remoteLog.js */
  1277. SimileAjax.RemoteLog={defaultURL:"http://groups.csail.mit.edu/haystack/facetlog/logger.php",url:null,logActive:false};
  1278. SimileAjax.RemoteLog.possiblyLog=function(A){if((SimileAjax.RemoteLog.logActive)&&(SimileAjax.RemoteLog.url!=null)){A["url"]=window.location.href;
  1279. try{SimileAjax.jQuery.ajax({type:"POST",url:SimileAjax.RemoteLog.url,data:A});
  1280. }catch(B){}}};
  1281. /* string.js */
  1282. String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"");
  1283. };
  1284. String.prototype.startsWith=function(A){return this.length>=A.length&&this.substr(0,A.length)==A;
  1285. };
  1286. String.prototype.endsWith=function(A){return this.length>=A.length&&this.substr(this.length-A.length)==A;
  1287. };
  1288. String.substitute=function(B,D){var A="";
  1289. var F=0;
  1290. while(F<B.length-1){var C=B.indexOf("%",F);
  1291. if(C<0||C==B.length-1){break;
  1292. }else{if(C>F&&B.charAt(C-1)=="\\"){A+=B.substring(F,C-1)+"%";
  1293. F=C+1;
  1294. }else{var E=parseInt(B.charAt(C+1));
  1295. if(isNaN(E)||E>=D.length){A+=B.substring(F,C+2);
  1296. }else{A+=B.substring(F,C)+D[E].toString();
  1297. }F=C+2;
  1298. }}}if(F<B.length){A+=B.substring(F);
  1299. }return A;
  1300. };
  1301. /* units.js */
  1302. SimileAjax.NativeDateUnit=new Object();
  1303. SimileAjax.NativeDateUnit.makeDefaultValue=function(){return new Date();
  1304. };
  1305. SimileAjax.NativeDateUnit.cloneValue=function(A){return new Date(A.getTime());
  1306. };
  1307. SimileAjax.NativeDateUnit.getParser=function(A){if(typeof A=="string"){A=A.toLowerCase();
  1308. }var B=(A=="iso8601"||A=="iso 8601")?SimileAjax.DateTime.parseIso8601DateTime:SimileAjax.DateTime.parseGregorianDateTime;
  1309. return function(C){if(typeof C!="undefined"&&typeof C.toUTCString=="function"){return C;
  1310. }else{return B(C);
  1311. }};
  1312. };
  1313. SimileAjax.NativeDateUnit.parseFromObject=function(A){return SimileAjax.DateTime.parseGregorianDateTime(A);
  1314. };
  1315. SimileAjax.NativeDateUnit.toNumber=function(A){return A.getTime();
  1316. };
  1317. SimileAjax.NativeDateUnit.fromNumber=function(A){return new Date(A);
  1318. };
  1319. SimileAjax.NativeDateUnit.compare=function(D,C){var B,A;
  1320. if(typeof D=="object"){B=D.getTime();
  1321. }else{B=Number(D);
  1322. }if(typeof C=="object"){A=C.getTime();
  1323. }else{A=Number(C);
  1324. }return B-A;
  1325. };
  1326. SimileAjax.NativeDateUnit.earlier=function(B,A){return SimileAjax.NativeDateUnit.compare(B,A)<0?B:A;
  1327. };
  1328. SimileAjax.NativeDateUnit.later=function(B,A){return SimileAjax.NativeDateUnit.compare(B,A)>0?B:A;
  1329. };
  1330. SimileAjax.NativeDateUnit.change=function(A,B){return new Date(A.getTime()+B);
  1331. };
  1332. /* window-manager.js */
  1333. SimileAjax.WindowManager={_initialized:false,_listeners:[],_draggedElement:null,_draggedElementCallback:null,_dropTargetHighlightElement:null,_lastCoords:null,_ghostCoords:null,_draggingMode:"",_dragging:false,_layers:[]};
  1334. SimileAjax.WindowManager.initialize=function(){if(SimileAjax.WindowManager._initialized){return ;
  1335. }SimileAjax.DOM.registerEvent(document.body,"mousedown",SimileAjax.WindowManager._onBodyMouseDown);
  1336. SimileAjax.DOM.registerEvent(document.body,"mousemove",SimileAjax.WindowManager._onBodyMouseMove);
  1337. SimileAjax.DOM.registerEvent(document.body,"mouseup",SimileAjax.WindowManager._onBodyMouseUp);
  1338. SimileAjax.DOM.registerEvent(document,"keydown",SimileAjax.WindowManager._onBodyKeyDown);
  1339. SimileAjax.DOM.registerEvent(document,"keyup",SimileAjax.WindowManager._onBodyKeyUp);
  1340. SimileAjax.WindowManager._layers.push({index:0});
  1341. SimileAjax.WindowManager._historyListener={onBeforeUndoSeveral:function(){},onAfterUndoSeveral:function(){},onBeforeUndo:function(){},onAfterUndo:function(){},onBeforeRedoSeveral:function(){},onAfterRedoSeveral:function(){},onBeforeRedo:function(){},onAfterRedo:function(){}};
  1342. SimileAjax.History.addListener(SimileAjax.WindowManager._historyListener);
  1343. SimileAjax.WindowManager._initialized=true;
  1344. };
  1345. SimileAjax.WindowManager.getBaseLayer=function(){SimileAjax.WindowManager.initialize();
  1346. return SimileAjax.WindowManager._layers[0];
  1347. };
  1348. SimileAjax.WindowManager.getHighestLayer=function(){SimileAjax.WindowManager.initialize();
  1349. return SimileAjax.WindowManager._layers[SimileAjax.WindowManager._layers.length-1];
  1350. };
  1351. SimileAjax.WindowManager.registerEventWithObject=function(D,A,E,B,C){SimileAjax.WindowManager.registerEvent(D,A,function(G,F,H){return E[B].call(E,G,F,H);
  1352. },C);
  1353. };
  1354. SimileAjax.WindowManager.registerEvent=function(D,B,E,C){if(C==null){C=SimileAjax.WindowManager.getHighestLayer();
  1355. }var A=function(G,F,I){if(SimileAjax.WindowManager._canProcessEventAtLayer(C)){SimileAjax.WindowManager._popToLayer(C.index);
  1356. try{E(G,F,I);
  1357. }catch(H){SimileAjax.Debug.exception(H);
  1358. }}SimileAjax.DOM.cancelEvent(F);
  1359. return false;
  1360. };
  1361. SimileAjax.DOM.registerEvent(D,B,A);
  1362. };
  1363. SimileAjax.WindowManager.pushLayer=function(C,D,B){var A={onPop:C,index:SimileAjax.WindowManager._layers.length,ephemeral:(D),elmt:B};
  1364. SimileAjax.WindowManager._layers.push(A);
  1365. return A;
  1366. };
  1367. SimileAjax.WindowManager.popLayer=function(B){for(var A=1;
  1368. A<SimileAjax.WindowManager._layers.length;
  1369. A++){if(SimileAjax.WindowManager._layers[A]==B){SimileAjax.WindowManager._popToLayer(A-1);
  1370. break;
  1371. }}};
  1372. SimileAjax.WindowManager.popAllLayers=function(){SimileAjax.WindowManager._popToLayer(0);
  1373. };
  1374. SimileAjax.WindowManager.registerForDragging=function(B,C,A){SimileAjax.WindowManager.registerEvent(B,"mousedown",function(E,D,F){SimileAjax.WindowManager._handleMouseDown(E,D,C);
  1375. },A);
  1376. };
  1377. SimileAjax.WindowManager._popToLayer=function(C){while(C+1<SimileAjax.WindowManager._layers.length){try{var A=SimileAjax.WindowManager._layers.pop();
  1378. if(A.onPop!=null){A.onPop();
  1379. }}catch(B){}}};
  1380. SimileAjax.WindowManager._canProcessEventAtLayer=function(B){if(B.index==(SimileAjax.WindowManager._layers.length-1)){return true;
  1381. }for(var A=B.index+1;
  1382. A<SimileAjax.WindowManager._layers.length;
  1383. A++){if(!SimileAjax.WindowManager._layers[A].ephemeral){return false;
  1384. }}return true;
  1385. };
  1386. SimileAjax.WindowManager.cancelPopups=function(A){var F=(A)?SimileAjax.DOM.getEventPageCoordinates(A):{x:-1,y:-1};
  1387. var E=SimileAjax.WindowManager._layers.length-1;
  1388. while(E>0&&SimileAjax.WindowManager._layers[E].ephemeral){var D=SimileAjax.WindowManager._layers[E];
  1389. if(D.elmt!=null){var C=D.elmt;
  1390. var B=SimileAjax.DOM.getPageCoordinates(C);
  1391. if(F.x>=B.left&&F.x<(B.left+C.offsetWidth)&&F.y>=B.top&&F.y<(B.top+C.offsetHeight)){break;
  1392. }}E--;
  1393. }SimileAjax.WindowManager._popToLayer(E);
  1394. };
  1395. SimileAjax.WindowManager._onBodyMouseDown=function(B,A,C){if(!("eventPhase" in A)||A.eventPhase==A.BUBBLING_PHASE){SimileAjax.WindowManager.cancelPopups(A);
  1396. }};
  1397. SimileAjax.WindowManager._handleMouseDown=function(B,A,C){SimileAjax.WindowManager._draggedElement=B;
  1398. SimileAjax.WindowManager._draggedElementCallback=C;
  1399. SimileAjax.WindowManager._lastCoords={x:A.clientX,y:A.clientY};
  1400. SimileAjax.DOM.cancelEvent(A);
  1401. return false;
  1402. };
  1403. SimileAjax.WindowManager._onBodyKeyDown=function(C,A,D){if(SimileAjax.WindowManager._dragging){if(A.keyCode==27){SimileAjax.WindowManager._cancelDragging();
  1404. }else{if((A.keyCode==17||A.keyCode==16)&&SimileAjax.WindowManager._draggingMode!="copy"){SimileAjax.WindowManager._draggingMode="copy";
  1405. var B=SimileAjax.Graphics.createTranslucentImage(SimileAjax.urlPrefix+"images/copy.png");
  1406. B.style.position="absolute";
  1407. B.style.left=(SimileAjax.WindowManager._ghostCoords.left-16)+"px";
  1408. B.style.top=(SimileAjax.WindowManager._ghostCoords.top)+"px";
  1409. document.body.appendChild(B);
  1410. SimileAjax.WindowManager._draggingModeIndicatorElmt=B;
  1411. }}}};
  1412. SimileAjax.WindowManager._onBodyKeyUp=function(B,A,C){if(SimileAjax.WindowManager._dragging){if(A.keyCode==17||A.keyCode==16){SimileAjax.WindowManager._draggingMode="";
  1413. if(SimileAjax.WindowManager._draggingModeIndicatorElmt!=null){document.body.removeChild(SimileAjax.WindowManager._draggingModeIndicatorElmt);
  1414. SimileAjax.WindowManager._draggingModeIndicatorElmt=null;
  1415. }}}};
  1416. SimileAjax.WindowManager._onBodyMouseMove=function(A,N,H){if(SimileAjax.WindowManager._draggedElement!=null){var P=SimileAjax.WindowManager._draggedElementCallback;
  1417. var E=SimileAjax.WindowManager._lastCoords;
  1418. var M=N.clientX-E.x;
  1419. var J=N.clientY-E.y;
  1420. if(!SimileAjax.WindowManager._dragging){if(Math.abs(M)>5||Math.abs(J)>5){try{if("onDragStart" in P){P.onDragStart();
  1421. }if("ghost" in P&&P.ghost){var K=SimileAjax.WindowManager._draggedElement;
  1422. SimileAjax.WindowManager._ghostCoords=SimileAjax.DOM.getPageCoordinates(K);
  1423. SimileAjax.WindowManager._ghostCoords.left+=M;
  1424. SimileAjax.WindowManager._ghostCoords.top+=J;
  1425. var O=K.cloneNode(true);
  1426. O.style.position="absolute";
  1427. O.style.left=SimileAjax.WindowManager._ghostCoords.left+"px";
  1428. O.style.top=SimileAjax.WindowManager._ghostCoords.top+"px";
  1429. O.style.zIndex=1000;
  1430. SimileAjax.Graphics.setOpacity(O,50);
  1431. document.body.appendChild(O);
  1432. P._ghostElmt=O;
  1433. }SimileAjax.WindowManager._dragging=true;
  1434. SimileAjax.WindowManager._lastCoords={x:N.clientX,y:N.clientY};
  1435. document.body.focus();
  1436. }catch(G){SimileAjax.Debug.exception("WindowManager: Error handling mouse down",G);
  1437. SimileAjax.WindowManager._cancelDragging();
  1438. }}}else{try{SimileAjax.WindowManager._lastCoords={x:N.clientX,y:N.clientY};
  1439. if("onDragBy" in P){P.onDragBy(M,J);
  1440. }if("_ghostElmt" in P){var O=P._ghostElmt;
  1441. SimileAjax.WindowManager._ghostCoords.left+=M;
  1442. SimileAjax.WindowManager._ghostCoords.top+=J;
  1443. O.style.left=SimileAjax.WindowManager._ghostCoords.left+"px";
  1444. O.style.top=SimileAjax.WindowManager._ghostCoords.top+"px";
  1445. if(SimileAjax.WindowManager._draggingModeIndicatorElmt!=null){var I=SimileAjax.WindowManager._draggingModeIndicatorElmt;
  1446. I.style.left=(SimileAjax.WindowManager._ghostCoords.left-16)+"px";
  1447. I.style.top=SimileAjax.WindowManager._ghostCoords.top+"px";
  1448. }if("droppable" in P&&P.droppable){var L=SimileAjax.DOM.getEventPageCoordinates(N);
  1449. var H=SimileAjax.DOM.hittest(L.x,L.y,[SimileAjax.WindowManager._ghostElmt,SimileAjax.WindowManager._dropTargetHighlightElement]);
  1450. H=SimileAjax.WindowManager._findDropTarget(H);
  1451. if(H!=SimileAjax.WindowManager._potentialDropTarget){if(SimileAjax.WindowManager._dropTargetHighlightElement!=null){document.body.removeChild(SimileAjax.WindowManager._dropTargetHighlightElement);
  1452. SimileAjax.WindowManager._dropTargetHighlightElement=null;
  1453. SimileAjax.WindowManager._potentialDropTarget=null;
  1454. }var F=false;
  1455. if(H!=null){if((!("canDropOn" in P)||P.canDropOn(H))&&(!("canDrop" in H)||H.canDrop(SimileAjax.WindowManager._draggedElement))){F=true;
  1456. }}if(F){var C=4;
  1457. var D=SimileAjax.DOM.getPageCoordinates(H);
  1458. var B=document.createElement("div");
  1459. B.style.border=C+"px solid yellow";
  1460. B.style.backgroundColor="yellow";
  1461. B.style.position="absolute";
  1462. B.style.left=D.left+"px";
  1463. B.style.top=D.top+"px";
  1464. B.style.width=(H.offsetWidth-C*2)+"px";
  1465. B.style.height=(H.offsetHeight-C*2)+"px";
  1466. SimileAjax.Graphics.setOpacity(B,30);
  1467. document.body.appendChild(B);
  1468. SimileAjax.WindowManager._potentialDropTarget=H;
  1469. SimileAjax.WindowManager._dropTargetHighlightElement=B;
  1470. }}}}}catch(G){SimileAjax.Debug.exception("WindowManager: Error handling mouse move",G);
  1471. SimileAjax.WindowManager._cancelDragging();
  1472. }}SimileAjax.DOM.cancelEvent(N);
  1473. return false;
  1474. }};
  1475. SimileAjax.WindowManager._onBodyMouseUp=function(B,A,C){if(SimileAjax.WindowManager._draggedElement!=null){try{if(SimileAjax.WindowManager._dragging){var E=SimileAjax.WindowManager._draggedElementCallback;
  1476. if("onDragEnd" in E){E.onDragEnd();
  1477. }if("droppable" in E&&E.droppable){var D=false;
  1478. var C=SimileAjax.WindowManager._potentialDropTarget;
  1479. if(C!=null){if((!("canDropOn" in E)||E.canDropOn(C))&&(!("canDrop" in C)||C.canDrop(SimileAjax.WindowManager._draggedElement))){if("onDropOn" in E){E.onDropOn(C);
  1480. }C.ondrop(SimileAjax.WindowManager._draggedElement,SimileAjax.WindowManager._draggingMode);
  1481. D=true;
  1482. }}if(!D){}}}}finally{SimileAjax.WindowManager._cancelDragging();
  1483. }SimileAjax.DOM.cancelEvent(A);
  1484. return false;
  1485. }};
  1486. SimileAjax.WindowManager._cancelDragging=function(){var B=SimileAjax.WindowManager._draggedElementCallback;
  1487. if("_ghostElmt" in B){var A=B._ghostElmt;
  1488. document.body.removeChild(A);
  1489. delete B._ghostElmt;
  1490. }if(SimileAjax.WindowManager._dropTargetHighlightElement!=null){document.body.removeChild(SimileAjax.WindowManager._dropTargetHighlightElement);
  1491. SimileAjax.WindowManager._dropTargetHighlightElement=null;
  1492. }if(SimileAjax.WindowManager._draggingModeIndicatorElmt!=null){document.body.removeChild(SimileAjax.WindowManager._draggingModeIndicatorElmt);
  1493. SimileAjax.WindowManager._draggingModeIndicatorElmt=null;
  1494. }SimileAjax.WindowManager._draggedElement=null;
  1495. SimileAjax.WindowManager._draggedElementCallback=null;
  1496. SimileAjax.WindowManager._potentialDropTarget=null;
  1497. SimileAjax.WindowManager._dropTargetHighlightElement=null;
  1498. SimileAjax.WindowManager._lastCoords=null;
  1499. SimileAjax.WindowManager._ghostCoords=null;
  1500. SimileAjax.WindowManager._draggingMode="";
  1501. SimileAjax.WindowManager._dragging=false;
  1502. };
  1503. SimileAjax.WindowManager._findDropTarget=function(A){while(A!=null){if("ondrop" in A&&(typeof A.ondrop)=="function"){break;
  1504. }A=A.parentNode;
  1505. }return A;
  1506. };
  1507. /* xmlhttp.js */
  1508. SimileAjax.XmlHttp=new Object();
  1509. SimileAjax.XmlHttp._onReadyStateChange=function(A,D,B){switch(A.readyState){case 4:try{if(A.status==0||A.status==200){if(B){B(A);
  1510. }}else{if(D){D(A.statusText,A.status,A);
  1511. }}}catch(C){SimileAjax.Debug.exception("XmlHttp: Error handling onReadyStateChange",C);
  1512. }break;
  1513. }};
  1514. SimileAjax.XmlHttp._createRequest=function(){if(SimileAjax.Platform.browser.isIE){var A=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"];
  1515. for(var B=0;
  1516. B<A.length;
  1517. B++){try{var C=A[B];
  1518. var D=function(){return new ActiveXObject(C);
  1519. };
  1520. var F=D();
  1521. SimileAjax.XmlHttp._createRequest=D;
  1522. return F;
  1523. }catch(E){}}}try{var D=function(){return new XMLHttpRequest();
  1524. };
  1525. var F=D();
  1526. SimileAjax.XmlHttp._createRequest=D;
  1527. return F;
  1528. }catch(E){throw new Error("Failed to create an XMLHttpRequest object");
  1529. }};
  1530. SimileAjax.XmlHttp.get=function(A,D,C){var B=SimileAjax.XmlHttp._createRequest();
  1531. B.open("GET",A,true);
  1532. B.onreadystatechange=function(){SimileAjax.XmlHttp._onReadyStateChange(B,D,C);
  1533. };
  1534. B.send(null);
  1535. };
  1536. SimileAjax.XmlHttp.post=function(B,A,E,D){var C=SimileAjax.XmlHttp._createRequest();
  1537. C.open("POST",B,true);
  1538. C.onreadystatechange=function(){SimileAjax.XmlHttp._onReadyStateChange(C,E,D);
  1539. };
  1540. C.send(A);
  1541. };
  1542. SimileAjax.XmlHttp._forceXML=function(A){try{A.overrideMimeType("text/xml");
  1543. }catch(B){A.setrequestheader("Content-Type","text/xml");
  1544. }};