--- /dev/null
+AJS={BASE_URL:"",drag_obj:null,drag_elm:null,_drop_zones:[],_cur_pos:null,join:function(_1,_2){
+try{
+return _2.join(_1);
+}
+catch(e){
+var r=_2[0]||"";
+AJS.map(_2,function(_4){
+r+=_1+_4;
+},1);
+return r+"";
+}
+},getScrollTop:function(){
+var t;
+if(document.documentElement&&document.documentElement.scrollTop){
+t=document.documentElement.scrollTop;
+}else{
+if(document.body){
+t=document.body.scrollTop;
+}
+}
+return t;
+},addClass:function(){
+var _6=AJS.forceArray(arguments);
+var _7=_6.pop();
+var _8=function(o){
+if(!new RegExp("(^|\\s)"+_7+"(\\s|$)").test(o.className)){
+o.className+=(o.className?" ":"")+_7;
+}
+};
+AJS.map(_6,function(_a){
+_8(_a);
+});
+},setStyle:function(){
+var _b=AJS.forceArray(arguments);
+var _c=_b.pop();
+var _d=_b.pop();
+AJS.map(_b,function(_e){
+_e.style[_d]=AJS.getCssDim(_c);
+});
+},_getRealScope:function(fn,_10,_11,_12){
+var _13=window;
+_10=AJS.$A(_10);
+if(fn._cscope){
+_13=fn._cscope;
+}
+return function(){
+var _14=[];
+var i=0;
+if(_11){
+i=1;
+}
+AJS.map(arguments,function(arg){
+_14.push(arg);
+},i);
+_14=_14.concat(_10);
+if(_12){
+_14=_14.reverse();
+}
+return fn.apply(_13,_14);
+};
+},preloadImages:function(){
+AJS.AEV(window,"load",AJS.$p(function(_17){
+AJS.map(_17,function(src){
+var pic=new Image();
+pic.src=src;
+});
+},arguments));
+},_createDomShortcuts:function(){
+var _1a=["ul","li","td","tr","th","tbody","table","input","span","b","a","div","img","button","h1","h2","h3","br","textarea","form","p","select","option","iframe","script","center","dl","dt","dd","small","pre"];
+var _1b=function(elm){
+var _1d="return AJS.createDOM.apply(null, ['"+elm+"', arguments]);";
+var _1e="function() { "+_1d+" }";
+eval("AJS."+elm.toUpperCase()+"="+_1e);
+};
+AJS.map(_1a,_1b);
+AJS.TN=function(_1f){
+return document.createTextNode(_1f);
+};
+},documentInsert:function(elm){
+if(typeof (elm)=="string"){
+elm=AJS.HTML2DOM(elm);
+}
+document.write("<span id=\"dummy_holder\"></span>");
+AJS.swapDOM(AJS.$("dummy_holder"),elm);
+},getWindowSize:function(doc){
+doc=doc||document;
+var _22,_23;
+if(self.innerHeight){
+_22=self.innerWidth;
+_23=self.innerHeight;
+}else{
+if(doc.documentElement&&doc.documentElement.clientHeight){
+_22=doc.documentElement.clientWidth;
+_23=doc.documentElement.clientHeight;
+}else{
+if(doc.body){
+_22=doc.body.clientWidth;
+_23=doc.body.clientHeight;
+}
+}
+}
+return {"w":_22,"h":_23};
+},flattenList:function(_24){
+var r=[];
+var _26=function(r,l){
+AJS.map(l,function(o){
+if(o==null){
+}else{
+if(AJS.isArray(o)){
+_26(r,o);
+}else{
+r.push(o);
+}
+}
+});
+};
+_26(r,_24);
+return r;
+},setEventKey:function(e){
+e.key=e.keyCode?e.keyCode:e.charCode;
+if(window.event){
+e.ctrl=window.event.ctrlKey;
+e.shift=window.event.shiftKey;
+}else{
+e.ctrl=e.ctrlKey;
+e.shift=e.shiftKey;
+}
+switch(e.key){
+case 63232:
+e.key=38;
+break;
+case 63233:
+e.key=40;
+break;
+case 63235:
+e.key=39;
+break;
+case 63234:
+e.key=37;
+break;
+}
+},removeElement:function(){
+var _2b=AJS.forceArray(arguments);
+AJS.map(_2b,function(elm){
+AJS.swapDOM(elm,null);
+});
+},_unloadListeners:function(){
+if(AJS.listeners){
+AJS.map(AJS.listeners,function(elm,_2e,fn){
+AJS.REV(elm,_2e,fn);
+});
+}
+AJS.listeners=[];
+},partial:function(fn){
+var _31=AJS.forceArray(arguments);
+return AJS.$b(fn,null,_31.slice(1,_31.length).reverse(),false,true);
+},getIndex:function(elm,_33,_34){
+for(var i=0;i<_33.length;i++){
+if(_34&&_34(_33[i])||elm==_33[i]){
+return i;
+}
+}
+return -1;
+},isDefined:function(o){
+return (o!="undefined"&&o!=null);
+},isArray:function(obj){
+return obj instanceof Array;
+},setLeft:function(){
+var _38=AJS.forceArray(arguments);
+_38.splice(_38.length-1,0,"left");
+AJS.setStyle.apply(null,_38);
+},appendChildNodes:function(elm){
+if(arguments.length>=2){
+AJS.map(arguments,function(n){
+if(AJS.isString(n)){
+n=AJS.TN(n);
+}
+if(AJS.isDefined(n)){
+elm.appendChild(n);
+}
+},1);
+}
+return elm;
+},isOpera:function(){
+return (navigator.userAgent.toLowerCase().indexOf("opera")!=-1);
+},isString:function(obj){
+return (typeof obj=="string");
+},hideElement:function(elm){
+var _3d=AJS.forceArray(arguments);
+AJS.map(_3d,function(elm){
+elm.style.display="none";
+});
+},setOpacity:function(elm,p){
+elm.style.opacity=p;
+elm.style.filter="alpha(opacity="+p*100+")";
+},setHeight:function(){
+var _41=AJS.forceArray(arguments);
+_41.splice(_41.length-1,0,"height");
+AJS.setStyle.apply(null,_41);
+},setWidth:function(){
+var _42=AJS.forceArray(arguments);
+_42.splice(_42.length-1,0,"width");
+AJS.setStyle.apply(null,_42);
+},createArray:function(v){
+if(AJS.isArray(v)&&!AJS.isString(v)){
+return v;
+}else{
+if(!v){
+return [];
+}else{
+return [v];
+}
+}
+},isDict:function(o){
+var _45=String(o);
+return _45.indexOf(" Object")!=-1;
+},isMozilla:function(){
+return (navigator.userAgent.toLowerCase().indexOf("gecko")!=-1&&navigator.productSub>=20030210);
+},_listenOnce:function(elm,_47,fn){
+var _49=function(){
+AJS.removeEventListener(elm,_47,_49);
+fn(arguments);
+};
+return _49;
+},addEventListener:function(elm,_4b,fn,_4d,_4e){
+if(!_4e){
+_4e=false;
+}
+var _4f=AJS.$A(elm);
+AJS.map(_4f,function(_50){
+if(_4d){
+fn=AJS._listenOnce(_50,_4b,fn);
+}
+if(AJS.isIn(_4b,["submit","load","scroll","resize"])){
+var old=elm["on"+_4b];
+elm["on"+_4b]=function(){
+if(old){
+fn(arguments);
+return old(arguments);
+}else{
+return fn(arguments);
+}
+};
+return;
+}
+if(AJS.isIn(_4b,["keypress","keydown","keyup","click"])){
+var _52=fn;
+fn=function(e){
+AJS.setEventKey(e);
+return _52.apply(null,arguments);
+};
+}
+if(_50.attachEvent){
+_50.attachEvent("on"+_4b,fn);
+}else{
+if(_50.addEventListener){
+_50.addEventListener(_4b,fn,_4e);
+}
+}
+AJS.listeners=AJS.$A(AJS.listeners);
+AJS.listeners.push([_50,_4b,fn]);
+});
+},createDOM:function(_54,_55){
+var i=0,_57;
+elm=document.createElement(_54);
+if(AJS.isDict(_55[i])){
+for(k in _55[0]){
+_57=_55[0][k];
+if(k=="style"){
+elm.style.cssText=_57;
+}else{
+if(k=="class"||k=="className"){
+elm.className=_57;
+}else{
+elm.setAttribute(k,_57);
+}
+}
+}
+i++;
+}
+if(_55[0]==null){
+i=1;
+}
+AJS.map(_55,function(n){
+if(n){
+if(AJS.isString(n)||AJS.isNumber(n)){
+n=AJS.TN(n);
+}
+elm.appendChild(n);
+}
+},i);
+return elm;
+},setTop:function(){
+var _59=AJS.forceArray(arguments);
+_59.splice(_59.length-1,0,"top");
+AJS.setStyle.apply(null,_59);
+},getElementsByTagAndClassName:function(_5a,_5b,_5c){
+var _5d=[];
+if(!AJS.isDefined(_5c)){
+_5c=document;
+}
+if(!AJS.isDefined(_5a)){
+_5a="*";
+}
+var els=_5c.getElementsByTagName(_5a);
+var _5f=els.length;
+var _60=new RegExp("(^|\\s)"+_5b+"(\\s|$)");
+for(i=0,j=0;i<_5f;i++){
+if(_60.test(els[i].className)||_5b==null){
+_5d[j]=els[i];
+j++;
+}
+}
+return _5d;
+},removeClass:function(){
+var _61=AJS.forceArray(arguments);
+var cls=_61.pop();
+var _63=function(o){
+o.className=o.className.replace(new RegExp("\\s?"+cls,"g"),"");
+};
+AJS.map(_61,function(elm){
+_63(elm);
+});
+},bindMethods:function(_66){
+for(var k in _66){
+var _68=_66[k];
+if(typeof (_68)=="function"){
+_66[k]=AJS.$b(_68,_66);
+}
+}
+},log:function(o){
+if(AJS.isMozilla()){
+console.log(o);
+}else{
+var div=AJS.DIV({"style":"color: green"});
+AJS.ACN(AJS.getBody(),AJS.setHTML(div,""+o));
+}
+},isNumber:function(obj){
+return (typeof obj=="number");
+},map:function(_6c,fn,_6e,_6f){
+var i=0,l=_6c.length;
+if(_6e){
+i=_6e;
+}
+if(_6f){
+l=_6f;
+}
+for(i;i<l;i++){
+fn.apply(null,[_6c[i],i]);
+}
+},removeEventListener:function(elm,_73,fn,_75){
+if(!_75){
+_75=false;
+}
+if(elm.removeEventListener){
+elm.removeEventListener(_73,fn,_75);
+if(AJS.isOpera()){
+elm.removeEventListener(_73,fn,!_75);
+}
+}else{
+if(elm.detachEvent){
+elm.detachEvent("on"+_73,fn);
+}
+}
+},getCssDim:function(dim){
+if(AJS.isString(dim)){
+return dim;
+}else{
+return dim+"px";
+}
+},setHTML:function(elm,_78){
+elm.innerHTML=_78;
+return elm;
+},bind:function(fn,_7a,_7b,_7c,_7d){
+fn._cscope=_7a;
+return AJS._getRealScope(fn,_7b,_7c,_7d);
+},forceArray:function(_7e){
+var r=[];
+AJS.map(_7e,function(elm){
+r.push(elm);
+});
+return r;
+},update:function(l1,l2){
+for(var i in l2){
+l1[i]=l2[i];
+}
+return l1;
+},getBody:function(){
+return AJS.$bytc("body")[0];
+},HTML2DOM:function(_84,_85){
+var d=AJS.DIV();
+d.innerHTML=_84;
+if(_85){
+return d.childNodes[0];
+}else{
+return d;
+}
+},getElement:function(id){
+if(AJS.isString(id)||AJS.isNumber(id)){
+return document.getElementById(id);
+}else{
+return id;
+}
+},showElement:function(){
+var _88=AJS.forceArray(arguments);
+AJS.map(_88,function(elm){
+elm.style.display="";
+});
+},swapDOM:function(_8a,src){
+_8a=AJS.getElement(_8a);
+var _8c=_8a.parentNode;
+if(src){
+src=AJS.getElement(src);
+_8c.replaceChild(src,_8a);
+}else{
+_8c.removeChild(_8a);
+}
+return src;
+},isIn:function(elm,_8e){
+var i=AJS.getIndex(elm,_8e);
+if(i!=-1){
+return true;
+}else{
+return false;
+}
+}};
+AJS.$=AJS.getElement;
+AJS.$$=AJS.getElements;
+AJS.$f=AJS.getFormElement;
+AJS.$p=AJS.partial;
+AJS.$b=AJS.bind;
+AJS.$A=AJS.createArray;
+AJS.DI=AJS.documentInsert;
+AJS.ACN=AJS.appendChildNodes;
+AJS.RCN=AJS.replaceChildNodes;
+AJS.AEV=AJS.addEventListener;
+AJS.REV=AJS.removeEventListener;
+AJS.$bytc=AJS.getElementsByTagAndClassName;
+AJS.addEventListener(window,"unload",AJS._unloadListeners);
+AJS._createDomShortcuts();
+AJS.Class=function(_90){
+var fn=function(){
+if(arguments[0]!="no_init"){
+return this.init.apply(this,arguments);
+}
+};
+fn.prototype=_90;
+AJS.update(fn,AJS.Class.prototype);
+return fn;
+};
+AJS.Class.prototype={extend:function(_92){
+var _93=new this("no_init");
+for(k in _92){
+var _94=_93[k];
+var cur=_92[k];
+if(_94&&_94!=cur&&typeof cur=="function"){
+cur=this._parentize(cur,_94);
+}
+_93[k]=cur;
+}
+return new AJS.Class(_93);
+},implement:function(_96){
+AJS.update(this.prototype,_96);
+},_parentize:function(cur,_98){
+return function(){
+this.parent=_98;
+return cur.apply(this,arguments);
+};
+}};
+AJS.$=AJS.getElement;
+AJS.$$=AJS.getElements;
+AJS.$f=AJS.getFormElement;
+AJS.$b=AJS.bind;
+AJS.$p=AJS.partial;
+AJS.$FA=AJS.forceArray;
+AJS.$A=AJS.createArray;
+AJS.DI=AJS.documentInsert;
+AJS.ACN=AJS.appendChildNodes;
+AJS.RCN=AJS.replaceChildNodes;
+AJS.AEV=AJS.addEventListener;
+AJS.REV=AJS.removeEventListener;
+AJS.$bytc=AJS.getElementsByTagAndClassName;
+AJSDeferred=function(req){
+this.callbacks=[];
+this.errbacks=[];
+this.req=req;
+};
+AJSDeferred.prototype={excCallbackSeq:function(req,_9b){
+var _9c=req.responseText;
+while(_9b.length>0){
+var fn=_9b.pop();
+var _9e=fn(_9c,req);
+if(_9e){
+_9c=_9e;
+}
+}
+},callback:function(){
+this.excCallbackSeq(this.req,this.callbacks);
+},errback:function(){
+if(this.errbacks.length==0){
+alert("Error encountered:\n"+this.req.responseText);
+}
+this.excCallbackSeq(this.req,this.errbacks);
+},addErrback:function(fn){
+this.errbacks.unshift(fn);
+},addCallback:function(fn){
+this.callbacks.unshift(fn);
+},addCallbacks:function(fn1,fn2){
+this.addCallback(fn1);
+this.addErrback(fn2);
+},sendReq:function(_a3){
+if(AJS.isObject(_a3)){
+this.req.send(AJS.queryArguments(_a3));
+}else{
+if(AJS.isDefined(_a3)){
+this.req.send(_a3);
+}else{
+this.req.send("");
+}
+}
+}};
+script_loaded=true;
+
+
+script_loaded=true;
\ No newline at end of file
--- /dev/null
+AJS.fx={_shades:{0:"ffffff",1:"ffffee",2:"ffffdd",3:"ffffcc",4:"ffffbb",5:"ffffaa",6:"ffff99"},highlight:function(_1,_2){
+var _3=new AJS.fx.Base();
+_3.elm=AJS.$(_1);
+_3.setOptions(_2);
+_3.options.duration=600;
+AJS.update(_3,{increase:function(){
+if(this.now==7){
+_1.style.backgroundColor="transparent";
+}else{
+_1.style.backgroundColor="#"+AJS.fx._shades[Math.floor(this.now)];
+}
+}});
+return _3.custom(6,0);
+},fadeIn:function(_4,_5){
+_5=_5||{};
+if(!_5.from){
+_5.from=0;
+AJS.setOpacity(_4,0);
+}
+if(!_5.to){
+_5.to=1;
+}
+var s=new AJS.fx.Style(_4,"opacity",_5);
+return s.custom(_5.from,_5.to);
+},fadeOut:function(_7,_8){
+_8=_8||{};
+if(!_8.from){
+_8.from=1;
+}
+if(!_8.to){
+_8.to=0;
+}
+_8.duration=300;
+var s=new AJS.fx.Style(_7,"opacity",_8);
+return s.custom(_8.from,_8.to);
+},setWidth:function(_a,_b){
+var s=new AJS.fx.Style(_a,"width",_b);
+return s.custom(_b.from,_b.to);
+},setHeight:function(_d,_e){
+var s=new AJS.fx.Style(_d,"height",_e);
+return s.custom(_e.from,_e.to);
+}};
+AJS.fx.Base=new AJS.Class({init:function(){
+AJS.bindMethods(this);
+},setOptions:function(_10){
+this.options=AJS.update({onStart:function(){
+},onComplete:function(){
+},transition:AJS.fx.Transitions.sineInOut,duration:500,wait:true,fps:50},_10||{});
+},step:function(){
+var _11=new Date().getTime();
+if(_11<this.time+this.options.duration){
+this.cTime=_11-this.time;
+this.setNow();
+}else{
+setTimeout(AJS.$b(this.options.onComplete,this,[this.elm]),10);
+this.clearTimer();
+this.now=this.to;
+}
+this.increase();
+},setNow:function(){
+this.now=this.compute(this.from,this.to);
+},compute:function(_12,to){
+var _14=to-_12;
+return this.options.transition(this.cTime,_12,_14,this.options.duration);
+},clearTimer:function(){
+clearInterval(this.timer);
+this.timer=null;
+return this;
+},_start:function(_15,to){
+if(!this.options.wait){
+this.clearTimer();
+}
+if(this.timer){
+return;
+}
+setTimeout(AJS.$p(this.options.onStart,this.elm),10);
+this.from=_15;
+this.to=to;
+this.time=new Date().getTime();
+this.timer=setInterval(this.step,Math.round(1000/this.options.fps));
+return this;
+},custom:function(_17,to){
+return this._start(_17,to);
+},set:function(to){
+this.now=to;
+this.increase();
+return this;
+},setStyle:function(elm,_1b,val){
+if(this.property=="opacity"){
+AJS.setOpacity(elm,val);
+}else{
+AJS.setStyle(elm,_1b,val);
+}
+}});
+AJS.fx.Style=AJS.fx.Base.extend({init:function(elm,_1e,_1f){
+this.parent();
+this.elm=elm;
+this.setOptions(_1f);
+this.property=_1e;
+},increase:function(){
+this.setStyle(this.elm,this.property,this.now);
+}});
+AJS.fx.Styles=AJS.fx.Base.extend({init:function(elm,_21){
+this.parent();
+this.elm=AJS.$(elm);
+this.setOptions(_21);
+this.now={};
+},setNow:function(){
+for(p in this.from){
+this.now[p]=this.compute(this.from[p],this.to[p]);
+}
+},custom:function(obj){
+if(this.timer&&this.options.wait){
+return;
+}
+var _23={};
+var to={};
+for(p in obj){
+_23[p]=obj[p][0];
+to[p]=obj[p][1];
+}
+return this._start(_23,to);
+},increase:function(){
+for(var p in this.now){
+this.setStyle(this.elm,p,this.now[p]);
+}
+}});
+AJS.fx.Transitions={linear:function(t,b,c,d){
+return c*t/d+b;
+},sineInOut:function(t,b,c,d){
+return -c/2*(Math.cos(Math.PI*t/d)-1)+b;
+}};
+script_loaded=true;
+
+
+script_loaded=true;
\ No newline at end of file
--- /dev/null
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+\f
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+\f
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+\f
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+\f
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+\f
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+\f
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+\f
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+\f
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+\f
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+ <title>GreyBox - About</title>
+
+ <script type="text/javascript">
+ var GB_ROOT_DIR = "./greybox/";
+ </script>
+
+ <script type="text/javascript" src="greybox/AJS.js"></script>
+ <script type="text/javascript" src="greybox/AJS_fx.js"></script>
+ <script type="text/javascript" src="greybox/gb_scripts.js"></script>
+ <link href="greybox/gb_styles.css" rel="stylesheet" type="text/css" media="all" />
+
+ <script type="text/javascript" src="static_files/help.js"></script>
+ <link href="static_files/help.css" rel="stylesheet" type="text/css" media="all" />
+</head>
+
+<body>
+
+<script>
+ insertHeader();
+ insertMenu('about');
+</script>
+
+<p>
+GreyBox is copyrighted work by <a href="http://amix.dk/">Amir Salihefendic</a>.
+</p>
+
+<p>
+It is based on <a href="http://orangoo.com/labs/AJS/">AJS</a> JavaScript library.
+</p>
+
+<p>
+It is realesed under <a href="LGPL.txt">LGPL</a>.
+</p>
+
+<h3>Links</h3>
+<ul>
+ <li> <a href="http://orangoo.com/labs/GreyBox/">GreyBox official site</a> </li>
+</ul>
+
+<h3>Need help?</h3>
+<ul>
+ <li><a href="http://groups.google.com/group/greybox">GreyBox Google group</a> - A group where you can ask questions and get answers</li>
+ <li><a href="http://orangoo.com/labs/GreyBox/FAQ/">GreyBox FAQ</a> -Frequently Asked Questions about GreyBox</li>
+</ul>
+
+</body>
+</html>
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+ <title>GreyBox - Advance usage</title>
+
+ <script type="text/javascript">
+ var GB_ROOT_DIR = "./greybox/";
+ </script>
+
+ <script type="text/javascript" src="greybox/AJS.js"></script>
+ <script type="text/javascript" src="greybox/AJS_fx.js"></script>
+ <script type="text/javascript" src="greybox/gb_scripts.js"></script>
+ <link href="greybox/gb_styles.css" rel="stylesheet" type="text/css" media="all" />
+
+ <script type="text/javascript" src="static_files/help.js"></script>
+ <link href="static_files/help.css" rel="stylesheet" type="text/css" media="all" />
+</head>
+<body>
+
+<script>
+insertHeader();
+insertMenu('adv_usage');
+</script>
+
+<h2>Methods for showing windows</h2>
+
+<h3 class="first">GB_show</h3>
+
+<h4>Signature:</h4>
+<script>
+insertCode(
+ 'GB_show(caption, url, /*optional*/ height, width, callback_fn)'
+);
+</script>
+
+<h4>Example:</h4>
+<script>
+insertCode(
+ '<a href="http://google.com/" onclick="return GB_show(\'Google\', this.href)">Visit Google</a>'
+);
+</script>
+
+<h4>Example rendered:</h4>
+<a href="http://google.com/" onclick="return GB_show('Google', this.href)">Visit Google</a>
+
+
+<h3>GB_showCenter</h3>
+
+<h4>Signature:</h4>
+<script>
+insertCode(
+ 'GB_showCenter(caption, url, /* optional */ height, width, callback_fn)'
+);
+</script>
+
+<h4>Example:</h4>
+<script>
+insertCode(
+ '<a href="http://google.com/" onclick="return GB_showCenter(\'Google\', this.href)">Visit Google</a>'
+);
+</script>
+
+<h4>Example rendered:</h4>
+<a href="http://google.com/" onclick="return GB_showCenter('Google', this.href)">Visit Google</a>
+
+
+<h3>GB_showFullScreen</h3>
+
+<h4>Signature:</h4>
+<script>
+insertCode(
+ 'GB_showFullScreen(caption, url, callback_fn)'
+);
+</script>
+
+<h4>Example:</h4>
+<script>
+insertCode(
+ '<a href="http://google.com/" onclick="return GB_showFullScreen(\'Google\', this.href)">Visit Google</a>'
+);
+</script>
+
+<h4>Example rendered:</h4>
+<a href="http://google.com/" onclick="return GB_showFullScreen('Google', this.href)">Visit Google</a>
+
+<h2>Methods for showing overlays</h2>
+
+<h3 class="first">GB_showImage</h3>
+<h4>Signature:</h4>
+<script>
+insertCode(
+ 'GB_showImage(caption, url, callback_fn)'
+);
+</script>
+
+<h4>Example:</h4>
+<script>
+insertCode(
+ '<a href="http://static.flickr.com/119/294309231_a3d2a339b9.jpg"\n'+
+ 'onclick="return GB_showImage(\'Flower\', this.href)">A flower in my hand</a>'
+);
+</script>
+
+<h4>Example rendered:</h4>
+<a href="http://static.flickr.com/119/294309231_a3d2a339b9.jpg" onclick="return GB_showImage('Flower', this.href)">A flower in my hand</a>
+
+<h3>GB_showPage</h3>
+<h4>Signature:</h4>
+<script>
+insertCode(
+ 'GB_showPage(caption, url, callback_fn)'
+);
+</script>
+
+<h4>Example:</h4>
+<script>
+insertCode(
+ '<a href="http://google.com" onclick="return GB_showPage(\'Google\', this.href)">Show Google in another layout</a>'
+);
+</script>
+
+<h4>Example rendered:</h4>
+<a href="http://google.com" onclick="return GB_showPage('Google', this.href)">Show Google in another layout</a>
+
+
+<h2>Methods for showing sets</h2>
+
+<h3 class="first">GB_showFullScreenSet</h3>
+<h4>Signature:</h4>
+<script>
+insertCode(
+ 'GB_showFullScreenSet(set, start_index, callback_fn)'
+);
+</script>
+
+<h4>Example:</h4>
+<script>
+insertCode(
+ "<script>",
+ "var page_set = [{'caption': 'Google', 'url': 'http://google.com/'},",
+ " {'caption': 'Yahoo', 'url': 'http://yahoo.com/'}];",
+ "<\/script>",
+ '<a href="#" onclick="return GB_showFullScreenSet(page_set, 1)">Show first page in page_set</a>'
+);
+</script>
+
+<h4>Example rendered:</h4>
+<script>
+var page_set = [{'caption': 'Google', 'url': 'http://google.com/'},
+ {'caption': 'Yahoo', 'url': 'http://yahoo.com/'}];
+</script>
+<a href="#" onclick="return GB_showFullScreenSet(page_set, 1)">Show first page in page_set</a>
+
+<h3>GB_showImageSet</h3>
+<h4>Signature:</h4>
+<script>
+insertCode(
+ 'GB_showImageSet(set, start_index, callback_fn)'
+);
+</script>
+
+<h4>Example:</h4>
+<script>
+insertCode(
+ "<script>",
+ "var image_set = [{'caption': 'Flower', 'url': 'http://static.flickr.com/119/294309231_a3d2a339b9.jpg'},",
+ " {'caption': 'Nice waterfall', 'url': 'http://www.widerange.org/images/large/plitvicka.jpg'}];",
+ "<\/script>",
+ '<a href="#" onclick="return GB_showImageSet(image_set, 1)">Show first picture in image_set</a>'
+);
+</script>
+
+<h4>Example rendered:</h4>
+<script>
+var image_set = [{'caption': 'Flower', 'url': 'http://static.flickr.com/119/294309231_a3d2a339b9.jpg'},
+ {'caption': 'Nice waterfall', 'url': 'http://www.widerange.org/images/large/plitvicka.jpg'}];
+</script>
+<a href="#" onclick="return GB_showImageSet(image_set, 1)">Show first picture in image_set</a>
+
+
+</body>
+</html>
--- /dev/null
+#!/usr/bin/env python
+"""
+Used to combine the different parts of GreyBox.
+- Python 2.4 required
+- Java 1.4+ required
+- Dojo's JavaScript compressor (http://dojotoolkit.org/docs/compressor_system.html). Place it under compression_lib/custom_rhino.jar
+"""
+import os, sys, shutil
+from compression_lib import AJS_minify
+
+
+if __name__ == '__main__':
+ args = sys.argv
+
+ if len(args) < 2:
+ print """
+Usage is:
+ python combiner.py [full|gallery|window]
+Example usage:
+ python combiner.py full
+The files will be store in greybox_dist/* depending on the dist. type
+"""
+ sys.exit(0)
+
+ type = args[1]
+ output_dir = 'greybox'
+
+ ##
+ # Config file list
+ #
+ js = []
+ css = []
+ static = []
+
+ append = lambda l, x: l.append('greybox_source/%s' % x)
+
+ def appendBase():
+ append(js, 'base/base.js')
+ append(js, 'auto_deco.js')
+ append(css, 'base/base.css')
+ append(static, 'base/indicator.gif')
+ append(static, 'base/loader_frame.html')
+
+ def appendSet():
+ append(js, 'set/set.js')
+ append(css, 'set/set.css')
+ append(static, 'set/next.gif')
+ append(static, 'set/prev.gif')
+
+ def appendGallery():
+ append(js, 'gallery/gallery.js')
+ append(css, 'gallery/gallery.css')
+ append(static, 'gallery/g_close.gif')
+
+ def appendWindow():
+ append(js, 'window/window.js')
+ append(css, 'window/window.css')
+ append(static, 'window/header_bg.gif')
+ append(static, 'window/w_close.gif')
+
+ appendBase()
+
+ if type == 'full':
+ appendGallery()
+ appendSet()
+ appendWindow()
+ elif type == 'gallery':
+ appendGallery()
+ appendSet()
+ elif type == 'window':
+ appendWindow()
+ else:
+ sys.exit('Uknown type')
+
+ print 'Follwoing styles are used:'
+ for style in css:
+ print ' %s' % style
+
+ print 'Follwoing JavaScript is used:'
+ for script in js:
+ print ' %s' % script
+
+ ##
+ # Copy the files
+ #
+ try:
+ shutil.rmtree(output_dir)
+ except:
+ pass
+ os.mkdir(output_dir)
+
+ def concatFiles(f_list):
+ data = []
+ for f in f_list:
+ data.append(open(f, 'r').read())
+ return '\n\n'.join(data)
+
+ def copyFiles(f_list):
+ for f in f_list:
+ shutil.copy(f, output_dir)
+
+ copyFiles(static)
+ fp = open('%s/%s' % (output_dir, 'gb_styles.css'), 'w')
+ fp.write(concatFiles(css))
+ fp.close()
+ print 'Compressed styles in %s' % ('greybox/gb_styles.css')
+
+ ##
+ # Concat js
+ #
+ fp = open('%s/%s' % (output_dir, 'gb_scripts_tmp.js'), 'w')
+ fp.write(concatFiles(js))
+ fp.close()
+
+ AJS_minify.AJS_SRC = 'greybox_source/base/AJS.js'
+ AJS_minify.AJS_MINI_SRC = 'greybox/AJS_tmp.js'
+ files = ['greybox/gb_scripts_tmp.js', 'greybox_source/base/AJS_fx.js', 'static_files/help.js']
+ code_analyzer = AJS_minify.ExternalCodeAnalyzer(files)
+ composer = AJS_minify.AjsComposer(code_analyzer.findFunctions())
+ composer.writeToOutput()
+
+ os.popen('java -jar compression_lib/custom_rhino.jar -c greybox/AJS_tmp.js > greybox/AJS.js')
+ os.remove('greybox/AJS_tmp.js')
+ os.popen('java -jar compression_lib/custom_rhino.jar -c greybox_source/base/AJS_fx.js > greybox/AJS_fx.js')
+ print 'Compressed AJS.js and AJS.js into greybox/'
+
+ os.popen('java -jar compression_lib/custom_rhino.jar -c greybox/gb_scripts_tmp.js > greybox/gb_scripts.js')
+ os.remove('greybox/gb_scripts_tmp.js')
+ print 'Compressed JavaScript in %s' % ('greybox/gb_scripts.css')
+
+ #Append script_loaded
+ open('greybox/AJS.js', 'a').write('\nscript_loaded=true;')
+ open('greybox/AJS_fx.js', 'a').write('\nscript_loaded=true;')
+ open('greybox/gb_scripts.js', 'a').write('\nscript_loaded=true;')
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+ <title>GreyBox - Compressing GreyBox</title>
+
+ <script type="text/javascript">
+ var GB_ROOT_DIR = "./greybox/";
+ </script>
+
+ <script type="text/javascript" src="greybox/AJS.js"></script>
+ <script type="text/javascript" src="greybox/AJS_fx.js"></script>
+ <script type="text/javascript" src="greybox/gb_scripts.js"></script>
+ <link href="greybox/gb_styles.css" rel="stylesheet" type="text/css" media="all" />
+
+ <script type="text/javascript" src="static_files/help.js"></script>
+ <link href="static_files/help.css" rel="stylesheet" type="text/css" media="all" />
+</head>
+<body>
+
+<script>
+insertHeader();
+insertMenu('cmpr');
+</script>
+
+<h2>Code structure</h2>
+<ul>
+ <li><b>greybox:</b> Generated and compressed JavaScript and CSS is located here</li>
+ <li><b>greybox_source:</b> CSS and JavaScript structured in directories.</li>
+</ul>
+It's not recommend that you alter code in the <b>greybox</b> directory, since it's computer generated and very unreadable!
+
+
+<h2>Download Dojo ShrinkSafe</h2>
+To make the filesize as small as possible GreyBox JavaScript is compressed down using <a href="http://alex.dojotoolkit.org/shrinksafe/">Dojo ShrinkSafe</a>. This library requires <a href="http://www.java.com/getjava/">Java</a>, so make sure you got Java installed. Download following JAR file:
+<ul>
+ <li><a href="http://svn.dojotoolkit.org/dojo/trunk/buildscripts/lib/custom_rhino.jar">custom_rhino.jar</a></li>
+</ul>
+Place <b>custom_rhino.jar</b> in GreyBox's <b>compression_lib</b> directory.
+
+
+<h2>Compressing GreyBox</h2>
+Now, you are ready to compress GreyBox. This is done by running a Python script called <b>combiner.py</b>. I.e. you need to download and install <a href="http://www.python.org/download/">Pyhton</a>.
+
+<p>
+You can run <b>combiner.py</b> in following ways:
+</p>
+
+<ul>
+ <li><b>python combiner.py full:</b> Compress everything</li>
+ <li><b>python combiner.py gallery:</b> Compress only gallery related CSS and JavaScript</li>
+ <li><b>python combiner.py window:</b> Compress only window related CSS and JavaScript</li>
+</ul>
+
+</body>
+</html>
--- /dev/null
+#!/usr/bin/env python
+#Last-update: 08/05/07 12:39:17
+import re
+import sys
+from sets import Set
+
+##
+# External files
+#
+AJS_SRC = 'AJS.js'
+AJS_MINI_SRC = 'AJS_compressed.js'
+
+
+##
+# Standard stuff that may change in the future
+#
+DOM_SHORTCUTS = [
+ "ul", "li", "td", "tr", "th",
+ "tbody", "table", "input", "span", "b",
+ "a", "div", "img", "button", "h1",
+ "h2", "h3", "br", "textarea", "form",
+ "p", "select", "option", "iframe", "script",
+ "center", "dl", "dt", "dd", "small",
+ "pre", "tn"
+]
+
+FN_SHORTCUTS = {
+ '$': 'getElement',
+ '$$': 'getElements',
+ '$f': 'getFormElement',
+ '$b': 'bind',
+ '$p': 'partial',
+ '$A': 'createArray',
+ 'DI': 'documentInsert',
+ 'ACN': 'appendChildNodes',
+ 'RCN': 'replaceChildNodes',
+ 'AEV': 'addEventListener',
+ 'REV': 'removeEventListener',
+ '$bytc': 'getElementsByTagAndClassName'
+}
+
+AJS_TEMPLATE = """//AJS JavaScript library (minify'ed version)
+//Copyright (c) 2006 Amir Salihefendic. All rights reserved.
+//Copyright (c) 2005 Bob Ippolito. All rights reserved.
+//License: http://www.opensource.org/licenses/mit-license.php
+//Visit http://orangoo.com/AmiNation/AJS for full version.
+AJS = {
+BASE_URL: "",
+drag_obj: null,
+drag_elm: null,
+_drop_zones: [],
+_cur_pos: null,
+
+%(functions)s
+}
+
+AJS.$ = AJS.getElement;
+AJS.$$ = AJS.getElements;
+AJS.$f = AJS.getFormElement;
+AJS.$p = AJS.partial;
+AJS.$b = AJS.bind;
+AJS.$A = AJS.createArray;
+AJS.DI = AJS.documentInsert;
+AJS.ACN = AJS.appendChildNodes;
+AJS.RCN = AJS.replaceChildNodes;
+AJS.AEV = AJS.addEventListener;
+AJS.REV = AJS.removeEventListener;
+AJS.$bytc = AJS.getElementsByTagAndClassName;
+
+AJS.addEventListener(window, 'unload', AJS._unloadListeners);
+AJS._createDomShortcuts();
+
+%(AJSClass)s
+
+%(AJSDeferred)s
+script_loaded = true;
+"""
+
+
+def getAjsCode():
+ return open(AJS_SRC).read()
+
+def writeAjsMini(code):
+ open(AJS_MINI_SRC, "w").write(code)
+
+
+class AjsAnalyzer:
+
+ def __init__(self):
+ self.code = getAjsCode()
+ self.ajs_fns = {}
+ self.ajs_deps = {}
+ self._parseAJS()
+ self._findDeps()
+
+ def _parseAJS(self):
+ ajs_code = re.search("AJS =(.|\n)*\n}\n", self.code).group(0)
+ fns = re.findall("\s+((\w*?):.*?{(.|\n)*?\n\s*})(,|\n+})\n", ajs_code)
+ for f in fns:
+ self.ajs_fns[f[1]] = f[0]
+
+ def getFnCode(self, fn_name, caller=None):
+ """
+ Returns the code of function and it's dependencies as a list
+ """
+ fn_name = self._unfoldFn(fn_name)
+ r = []
+ if self.ajs_fns.get(fn_name):
+ r.append(self.ajs_fns[fn_name])
+ for dep_fn in self.ajs_deps[fn_name]:
+ if fn_name != dep_fn and dep_fn != caller:
+ r.extend(self.getFnCode(dep_fn, fn_name))
+ elif fn_name not in ['listeners', 'Class']:
+ print 'Could not find "%s"' % fn_name
+ return r
+
+ def getAjsClassCode(self):
+ return re.search("AJS.Class =(.|\n)*\n};\n", self.code).group(0)
+
+ def getAjsDeferredCode(self):
+ return re.search("AJSDeferred =(.|\n)*\n};\n", self.code).group(0)
+
+ def _findDeps(self):
+ """
+ Parses AJS and for every function it finds dependencies for the other functions.
+ """
+ for fn_name, fn_code in self.ajs_fns.items():
+ self.ajs_deps[fn_name] = self._findFns(fn_code)
+
+ def _findFns(self, inner):
+ """
+ Searches after AJS.fnX( in inner and returns all the fnX in a Set.
+ """
+ s = re.findall("AJS\.([\w_$]*?)(?:\(|,|\.)", inner)
+ s = list(Set(s))
+ return self._unfoldFns(s)
+
+ def _unfoldFns(self, list):
+ """
+ Unfolds:
+ AJS.B, AJS.H1 etc. to _createDomShortcuts
+ AJS.$ to AJS.getElement etc.
+ """
+ return [self._unfoldFn(n) for n in list]
+
+ def _unfoldFn(self, fn_name):
+ if fn_name.lower() in DOM_SHORTCUTS:
+ return "_createDomShortcuts"
+ elif FN_SHORTCUTS.get(fn_name):
+ return FN_SHORTCUTS[fn_name]
+ else:
+ return fn_name
+
+
+class ExternalCodeAnalyzer:
+
+ def __init__(self, files):
+ self.found_ajs_fns = []
+ self.files = files
+
+ def findFunctions(self):
+ for f in self.files:
+ self.found_ajs_fns.extend( self._parseFile(f) )
+ return list(Set(self.found_ajs_fns))
+
+ def _parseFile(self, f):
+ """
+ Parses the file, looks for AJS functions and returns all the found functions.
+ """
+ code = open(f).read()
+ return re.findall("AJS\.([\w_$]*?)\(", code)
+
+
+
+class AjsComposer:
+
+ def __init__(self, fn_list):
+ self.code = getAjsCode()
+ self.analyzer = AjsAnalyzer()
+ self.fn_list = fn_list
+
+ #Append standard functions
+ req = ['_unloadListeners', 'createDOM', '_createDomShortcuts', 'log', 'addEventListener']
+ self.fn_list.extend(req)
+
+ #Append AJSDeferred only if needed
+ in_list = lambda x: x in self.fn_list
+ if in_list('getRequest') or in_list('loadJSONDoc'):
+ self.deferred = self._minify(self.analyzer.getAjsDeferredCode())
+ self.fn_list.append('isObject')
+ else:
+ self.deferred = ''
+
+ def writeToOutput(self):
+ fns = self._getFns()
+ d = {}
+ d['functions'] = ",\n".join(fns)
+ d['AJSDeferred'] = self.deferred
+ d['AJSClass'] = self.analyzer.getAjsClassCode()
+
+ mini_code = AJS_TEMPLATE % d
+ writeAjsMini(mini_code)
+
+ def _minify(self, code):
+ new_lines = []
+ for l in code.split("\n"):
+ if l not in ['\n', '']:
+ new_lines.append(l.lstrip())
+ return "\n".join(new_lines)
+
+ def _getFns(self):
+ """
+ Returns a list with real code of functions
+ """
+ r = []
+ for fn in self.fn_list:
+ r.extend(self.analyzer.getFnCode(fn))
+
+ r = list(Set(r))
+ return [self._minify(fn) for fn in r]
+
+
+if __name__ == '__main__':
+ args = sys.argv
+
+ if len(args) < 3:
+ print """Usage is:
+ python AJS_minify.py [-o output_file] ajs_file js_file.js html_using_ajs.html ...
+Example usage:
+ Using relative paths:
+ python AJS_minify.py -o AJS_mini.js AJS.js test.js index.html
+ This will create AJS_mini.js from test.js and index.html.
+ Using absolute paths:
+ python AJS_minify.py ~/Desktop/AJS/AJS.js ~/Desktop/GreyBox_v3_42/greybox/greybox.js
+ This will create a new file called '%s' that has the needed AJS functions.""" % AJS_MINI_SRC
+
+ sys.exit(0)
+
+ if sys.argv[1] == '-o':
+ AJS_MINI_SRC = sys.argv[2]
+ AJS_SRC = sys.argv[3]
+ FILES = sys.argv[4:]
+ else:
+ AJS_SRC = sys.argv[1]
+ FILES = sys.argv[2:]
+
+ print 'Parsing through:\n %s' % "\n ".join(FILES)
+
+ code_analyzer = ExternalCodeAnalyzer(FILES)
+ found_fns = code_analyzer.findFunctions()
+ print 'Found following AJS functions:\n %s' % ("\n ".join(found_fns))
+
+ composer = AjsComposer(found_fns)
+ composer.writeToOutput()
+ print "Written the minified code to '%s'" % AJS_MINI_SRC
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+ <title>GreyBox - Examples</title>
+
+ <script type="text/javascript">
+ var GB_ROOT_DIR = "./greybox/";
+ </script>
+
+ <script type="text/javascript" src="greybox/AJS.js"></script>
+ <script type="text/javascript" src="greybox/AJS_fx.js"></script>
+ <script type="text/javascript" src="greybox/gb_scripts.js"></script>
+ <link href="greybox/gb_styles.css" rel="stylesheet" type="text/css" media="all" />
+
+ <script type="text/javascript" src="static_files/help.js"></script>
+ <link href="static_files/help.css" rel="stylesheet" type="text/css" media="all" />
+</head>
+<body>
+
+<script>
+ insertHeader();
+ insertMenu('examples');
+</script>
+
+
+<h3>One website</h3>
+<ul>
+ <li>
+ <a href="http://google.com/" title="Google" rel="gb_page_center[640, 480]">Launch google.com in a 640x480 window</a>
+ </li>
+ <li>
+ <a href="http://google.com/" title="Google" rel="gb_page_fs[]">Launch google.com in fullscreen window</a>
+ </li>
+</ul>
+
+<h3>Website gallery</h3>
+<ul>
+ <li>
+ <a href="http://google.com/" title="Google" rel="gb_pageset[search_sites]">Launch Google search</a>
+ </li>
+ <li>
+ <a href="http://search.yahoo.com/" rel="gb_pageset[search_sites]">Launch Yahoo search</a>
+ </li>
+ <li>
+ <a href="http://www.koders.com/" rel="gb_pageset[search_sites]">Launch Koders search</a>
+ </li>
+</ul>
+
+<h3>Image gallery</h3>
+<script type="text/javascript">
+var image_set = [{'caption': 'Flower', 'url': 'http://static.flickr.com/119/294309231_a3d2a339b9.jpg'},
+ {'caption': 'Nice waterfall', 'url': 'http://www.widerange.org/images/large/plitvicka.jpg'}];
+</script>
+
+<ul>
+ <li>
+ <a href="#" onclick="return GB_showImageSet(image_set, 1)">Launch gallery</a>
+ </li>
+
+ <li>
+ <a href="static_files/night_valley.jpg" rel="gb_imageset[nice_pics]" title="Night valley">
+ <img src="static_files/night_valley_thumb.jpg" />
+ </a>
+ </li>
+
+ <li>
+ <a href="static_files/salt.jpg" rel="gb_imageset[nice_pics]" title="Salt flats in Chile">
+ <img src="static_files/salt_thumb.gif" />
+ </a>
+ </li>
+</ul>
+
+<h3>Without loading</h3>
+<script type="text/javascript">
+GB_myShow = function(caption, url, /* optional */ height, width, callback_fn) {
+ var options = {
+ caption: caption,
+ height: height || 500,
+ width: width || 500,
+ fullscreen: false,
+ show_loading: false,
+ callback_fn: callback_fn
+ }
+ var win = new GB_Window(options);
+ return win.show(url);
+}
+</script>
+<ul>
+ <li>
+ <a href="http://google.com/" onclick="return GB_myShow('Google', this.href)">Visit Google without loading</a>
+ </li>
+</ul>
+
+</body>
+</html>
--- /dev/null
+var GB_SETS = {};
+function decoGreyboxLinks() {
+ var as = AJS.$bytc('a');
+ AJS.map(as, function(a) {
+ if(a.getAttribute('href') && a.getAttribute('rel')) {
+ var rel = a.getAttribute('rel');
+ if(rel.indexOf('gb_') == 0) {
+ var name = rel.match(/\w+/)[0];
+ var attrs = rel.match(/\[(.*)\]/)[1];
+ var index = 0;
+
+ var item = {
+ 'caption': a.title || '',
+ 'url': a.href
+ }
+
+ //Set up GB_SETS
+ if(name == 'gb_pageset' || name == 'gb_imageset') {
+ if(!GB_SETS[attrs]) { GB_SETS[attrs] = []; }
+ GB_SETS[attrs].push(item);
+ index = GB_SETS[attrs].length;
+ }
+
+ //Append onclick
+ if(name == 'gb_pageset') {
+ a.onclick = function() {
+ GB_showFullScreenSet(GB_SETS[attrs], index);
+ return false;
+ };
+ }
+ if(name == 'gb_imageset') {
+ a.onclick = function() {
+ GB_showImageSet(GB_SETS[attrs], index);
+ return false;
+ };
+ }
+ if(name == 'gb_image') {
+ a.onclick = function() {
+ GB_showImage(item.caption, item.url);
+ return false;
+ };
+ }
+ if(name == 'gb_page') {
+ a.onclick = function() {
+ var sp = attrs.split(/, ?/);
+ GB_show(item.caption, item.url, parseInt(sp[1]), parseInt(sp[0]));
+ return false;
+ };
+ }
+ if(name == 'gb_page_fs') {
+ a.onclick = function() {
+ GB_showFullScreen(item.caption, item.url);
+ return false;
+ };
+ }
+ if(name == 'gb_page_center') {
+ a.onclick = function() {
+ var sp = attrs.split(/, ?/);
+ GB_showCenter(item.caption, item.url, parseInt(sp[1]), parseInt(sp[0]));
+ return false;
+ };
+ }
+ }
+ }});
+}
+
+AJS.AEV(window, 'load', decoGreyboxLinks);
--- /dev/null
+/*
+Last Modified: 29/01/07 14:16:09
+
+AJS JavaScript library
+ A very small library with a lot of functionality
+AUTHOR
+ 4mir Salihefendic (http://amix.dk) - amix@amix.dk
+LICENSE
+ Copyright (c) 2006 Amir Salihefendic. All rights reserved.
+ Copyright (c) 2005 Bob Ippolito. All rights reserved.
+ http://www.opensource.org/licenses/mit-license.php
+VERSION
+ 3.7
+SITE
+ http://orangoo.com/AmiNation/AJS
+**/
+if(!AJS) {
+var AJS = {
+ BASE_URL: "",
+
+ drag_obj: null,
+ drag_elm: null,
+ _drop_zones: [],
+ _drag_zones: [],
+ _cur_pos: null,
+
+ ajaxErrorHandler: null,
+
+////
+// General accessor functions
+////
+ getQueryArgument: function(var_name) {
+ var query = window.location.search.substring(1);
+ var vars = query.split("&");
+ for (var i=0;i<vars.length;i++) {
+ var pair = vars[i].split("=");
+ if (pair[0] == var_name) {
+ return pair[1];
+ }
+ }
+ return null;
+ },
+
+ isIe: function() {
+ return (navigator.userAgent.toLowerCase().indexOf("msie") != -1 && navigator.userAgent.toLowerCase().indexOf("opera") == -1);
+ },
+ isNetscape7: function() {
+ return (navigator.userAgent.toLowerCase().indexOf("netscape") != -1 && navigator.userAgent.toLowerCase().indexOf("7.") != -1);
+ },
+ isSafari: function() {
+ return (navigator.userAgent.toLowerCase().indexOf("khtml") != -1);
+ },
+ isOpera: function() {
+ return (navigator.userAgent.toLowerCase().indexOf("opera") != -1);
+ },
+ isMozilla: function() {
+ return (navigator.userAgent.toLowerCase().indexOf("gecko") != -1 && navigator.productSub >= 20030210);
+ },
+
+
+////
+// Array functions
+////
+ //Shortcut: AJS.$A
+ createArray: function(v) {
+ if(AJS.isArray(v) && !AJS.isString(v))
+ return v;
+ else if(!v)
+ return [];
+ else
+ return [v];
+ },
+
+ forceArray: function(args) {
+ var r = [];
+ AJS.map(args, function(elm) {
+ r.push(elm);
+ });
+ return r;
+ },
+
+ join: function(delim, list) {
+ try {
+ return list.join(delim);
+ }
+ catch(e) {
+ var r = list[0] || '';
+ AJS.map(list, function(elm) {
+ r += delim + elm;
+ }, 1);
+ return r + '';
+ }
+ },
+
+ isIn: function(elm, list) {
+ var i = AJS.getIndex(elm, list);
+ if(i != -1)
+ return true;
+ else
+ return false;
+ },
+
+ getIndex: function(elm, list/*optional*/, eval_fn) {
+ for(var i=0; i < list.length; i++)
+ if(eval_fn && eval_fn(list[i]) || elm == list[i])
+ return i;
+ return -1;
+ },
+
+ getFirst: function(list) {
+ if(list.length > 0)
+ return list[0];
+ else
+ return null;
+ },
+
+ getLast: function(list) {
+ if(list.length > 0)
+ return list[list.length-1];
+ else
+ return null;
+ },
+
+ update: function(l1, l2) {
+ for(var i in l2)
+ l1[i] = l2[i];
+ return l1;
+ },
+
+ flattenList: function(list) {
+ var r = [];
+ var _flatten = function(r, l) {
+ AJS.map(l, function(o) {
+ if(o == null) {}
+ else if (AJS.isArray(o))
+ _flatten(r, o);
+ else
+ r.push(o);
+ });
+ }
+ _flatten(r, list);
+ return r;
+ },
+
+
+////
+// Functional programming
+////
+ map: function(list, fn,/*optional*/ start_index, end_index) {
+ var i = 0, l = list.length;
+ if(start_index)
+ i = start_index;
+ if(end_index)
+ l = end_index;
+ for(i; i < l; i++)
+ fn.apply(null, [list[i], i]);
+ },
+
+ rmap: function(list, fn) {
+ var i = list.length-1, l = 0;
+ for(i; i >= l; i--)
+ fn.apply(null, [list[i], i]);
+ },
+
+ filter: function(list, fn, /*optional*/ start_index, end_index) {
+ var r = [];
+ AJS.map(list, function(elm) {
+ if(fn(elm))
+ r.push(elm);
+ }, start_index, end_index);
+ return r;
+ },
+
+ partial: function(fn) {
+ var args = AJS.forceArray(arguments);
+ return AJS.$b(fn, null, args.slice(1, args.length).reverse(), false, true);
+ },
+
+
+////
+// DOM functions
+////
+ //Shortcut: AJS.$
+ getElement: function(id) {
+ if(AJS.isString(id) || AJS.isNumber(id))
+ return document.getElementById(id);
+ else
+ return id;
+ },
+
+ //Shortcut: AJS.$$
+ getElements: function(/*id1, id2, id3*/) {
+ var args = AJS.forceArray(arguments);
+ var elements = new Array();
+ for (var i = 0; i < args.length; i++) {
+ var element = AJS.getElement(args[i]);
+ elements.push(element);
+ }
+ return elements;
+ },
+
+ //Shortcut: AJS.$bytc
+ getElementsByTagAndClassName: function(tag_name, class_name, /*optional*/ parent) {
+ var class_elements = [];
+ if(!AJS.isDefined(parent))
+ parent = document;
+ if(!AJS.isDefined(tag_name))
+ tag_name = '*';
+
+ var els = parent.getElementsByTagName(tag_name);
+ var els_len = els.length;
+ var pattern = new RegExp("(^|\\s)" + class_name + "(\\s|$)");
+
+ for (i = 0, j = 0; i < els_len; i++) {
+ if ( pattern.test(els[i].className) || class_name == null ) {
+ class_elements[j] = els[i];
+ j++;
+ }
+ }
+ return class_elements;
+ },
+
+ _nodeWalk: function(elm, tag_name, class_name, fn_next_elm) {
+ var p = fn_next_elm(elm);
+
+ var checkFn;
+ if(tag_name && class_name) {
+ checkFn = function(p) {
+ return AJS.nodeName(p) == tag_name && AJS.hasClass(p, class_name);
+ }
+ }
+ else if(tag_name) {
+ checkFn = function(p) { return AJS.nodeName(p) == tag_name; }
+ }
+ else {
+ checkFn = function(p) { return AJS.hasClass(p, class_name); }
+ }
+
+ while(p) {
+ if(checkFn(p))
+ return p;
+ p = fn_next_elm(p);
+ }
+ return null;
+ },
+
+ getParentBytc: function(elm, tag_name, class_name) {
+ return AJS._nodeWalk(elm, tag_name, class_name, function(m) { return m.parentNode; });
+ },
+
+ getPreviousSiblingBytc: function(elm, tag_name, class_name) {
+ return AJS._nodeWalk(elm, tag_name, class_name, function(m) { return m.previousSibling; });
+ },
+
+ getNextSiblingBytc: function(elm, tag_name, class_name) {
+ return AJS._nodeWalk(elm, tag_name, class_name, function(m) { return m.nextSibling; });
+ },
+
+ //Shortcut: AJS.$f
+ getFormElement: function(form, name) {
+ form = AJS.$(form);
+ var r = null;
+ AJS.map(form.elements, function(elm) {
+ if(elm.name && elm.name == name)
+ r = elm;
+ });
+ return r;
+ },
+
+ formContents: function(form) {
+ var form = AJS.$(form);
+ var r = {};
+ var fn = function(elms) {
+ AJS.map(elms, function(e) {
+ if(e.name)
+ r[e.name] = e.value || '';
+ });
+ }
+ fn(AJS.$bytc('input', null, form));
+ fn(AJS.$bytc('textarea', null, form));
+ return r;
+ },
+
+ getBody: function() {
+ return AJS.$bytc('body')[0]
+ },
+
+ nodeName: function(elm) {
+ return elm.nodeName.toLowerCase();
+ },
+
+ hasParent: function(elm, parent_to_consider, max_look_up) {
+ if(elm == parent_to_consider)
+ return true;
+ if(max_look_up == 0)
+ return false;
+ return AJS.hasParent(elm.parentNode, parent_to_consider, max_look_up-1);
+ },
+
+ isElementHidden: function(elm) {
+ return elm.style.visibility == "hidden";
+ },
+
+ //Shortcut: AJS.DI
+ documentInsert: function(elm) {
+ if(typeof(elm) == 'string')
+ elm = AJS.HTML2DOM(elm);
+ document.write('<span id="dummy_holder"></span>');
+ AJS.swapDOM(AJS.$('dummy_holder'), elm);
+ },
+
+ cloner: function(element) {
+ return function() {
+ return element.cloneNode(true);
+ }
+ },
+
+ appendToTop: function(elm/*, elms...*/) {
+ var args = AJS.forceArray(arguments).slice(1);
+ if(args.length >= 1) {
+ var first_child = elm.firstChild;
+ if(first_child) {
+ while(true) {
+ var t_elm = args.shift();
+ if(t_elm)
+ AJS.insertBefore(t_elm, first_child);
+ else
+ break;
+ }
+ }
+ else {
+ AJS.ACN.apply(null, arguments);
+ }
+ }
+ return elm;
+ },
+
+ //Shortcut: AJS.ACN
+ appendChildNodes: function(elm/*, elms...*/) {
+ if(arguments.length >= 2) {
+ AJS.map(arguments, function(n) {
+ if(AJS.isString(n))
+ n = AJS.TN(n);
+ if(AJS.isDefined(n))
+ elm.appendChild(n);
+ }, 1);
+ }
+ return elm;
+ },
+
+ //Shortcut: AJS.RCN
+ replaceChildNodes: function(elm/*, elms...*/) {
+ var child;
+ while ((child = elm.firstChild))
+ elm.removeChild(child);
+ if (arguments.length < 2)
+ return elm;
+ else
+ return AJS.appendChildNodes.apply(null, arguments);
+ return elm;
+ },
+
+ insertAfter: function(elm, reference_elm) {
+ reference_elm.parentNode.insertBefore(elm, reference_elm.nextSibling);
+ return elm;
+ },
+
+ insertBefore: function(elm, reference_elm) {
+ reference_elm.parentNode.insertBefore(elm, reference_elm);
+ return elm;
+ },
+
+ showElement: function(/*elms...*/) {
+ var args = AJS.forceArray(arguments);
+ AJS.map(args, function(elm) { elm.style.display = ''});
+ },
+
+ hideElement: function(elm) {
+ var args = AJS.forceArray(arguments);
+ AJS.map(args, function(elm) { elm.style.display = 'none'});
+ },
+
+ swapDOM: function(dest, src) {
+ dest = AJS.getElement(dest);
+ var parent = dest.parentNode;
+ if (src) {
+ src = AJS.getElement(src);
+ parent.replaceChild(src, dest);
+ } else {
+ parent.removeChild(dest);
+ }
+ return src;
+ },
+
+ removeElement: function(/*elm1, elm2...*/) {
+ var args = AJS.forceArray(arguments);
+ AJS.map(args, function(elm) { AJS.swapDOM(elm, null); });
+ },
+
+ createDOM: function(name, attrs) {
+ var i=0, attr;
+ elm = document.createElement(name);
+
+ if(AJS.isDict(attrs[i])) {
+ for(k in attrs[0]) {
+ attr = attrs[0][k];
+ if(k == "style")
+ elm.style.cssText = attr;
+ else if(k == "class" || k == 'className')
+ elm.className = attr;
+ else {
+ elm.setAttribute(k, attr);
+ }
+ }
+ i++;
+ }
+
+ if(attrs[0] == null)
+ i = 1;
+
+ AJS.map(attrs, function(n) {
+ if(n) {
+ if(AJS.isString(n) || AJS.isNumber(n))
+ n = AJS.TN(n);
+ elm.appendChild(n);
+ }
+ }, i);
+ return elm;
+ },
+
+ _createDomShortcuts: function() {
+ var elms = [
+ "ul", "li", "td", "tr", "th",
+ "tbody", "table", "input", "span", "b",
+ "a", "div", "img", "button", "h1",
+ "h2", "h3", "br", "textarea", "form",
+ "p", "select", "option", "iframe", "script",
+ "center", "dl", "dt", "dd", "small",
+ "pre"
+ ];
+ var extends_ajs = function(elm) {
+ var c_dom = "return AJS.createDOM.apply(null, ['" + elm + "', arguments]);";
+ var c_fun_dom = 'function() { ' + c_dom + ' }';
+ eval("AJS." + elm.toUpperCase() + "=" + c_fun_dom);
+ }
+ AJS.map(elms, extends_ajs);
+ AJS.TN = function(text) { return document.createTextNode(text) };
+ },
+
+ getCssDim: function(dim) {
+ if(AJS.isString(dim))
+ return dim;
+ else
+ return dim + "px";
+ },
+ getCssProperty: function(elm, prop) {
+ elm = AJS.$(elm);
+ var y;
+ if(elm.currentStyle)
+ y = elm.currentStyle[prop];
+ else if (window.getComputedStyle)
+ y = document.defaultView.getComputedStyle(elm,null).getPropertyValue(prop);
+ return y;
+ },
+
+ setStyle: function(/*elm1, elm2..., property, new_value*/) {
+ var args = AJS.forceArray(arguments);
+ var new_val = args.pop();
+ var property = args.pop();
+ AJS.map(args, function(elm) {
+ elm.style[property] = AJS.getCssDim(new_val);
+ });
+ },
+
+ setWidth: function(/*elm1, elm2..., width*/) {
+ var args = AJS.forceArray(arguments);
+ args.splice(args.length-1, 0, 'width');
+ AJS.setStyle.apply(null, args);
+ },
+ setHeight: function(/*elm1, elm2..., height*/) {
+ var args = AJS.forceArray(arguments);
+ args.splice(args.length-1, 0, 'height');
+ AJS.setStyle.apply(null, args);
+ },
+ setLeft: function(/*elm1, elm2..., left*/) {
+ var args = AJS.forceArray(arguments);
+ args.splice(args.length-1, 0, 'left');
+ AJS.setStyle.apply(null, args);
+ },
+ setTop: function(/*elm1, elm2..., top*/) {
+ var args = AJS.forceArray(arguments);
+ args.splice(args.length-1, 0, 'top');
+ AJS.setStyle.apply(null, args);
+ },
+ setClass: function(/*elm1, elm2..., className*/) {
+ var args = AJS.forceArray(arguments);
+ var c = args.pop();
+ AJS.map(args, function(elm) { elm.className = c});
+ },
+ addClass: function(/*elm1, elm2..., className*/) {
+ var args = AJS.forceArray(arguments);
+ var cls = args.pop();
+ var add_class = function(o) {
+ if(!new RegExp("(^|\\s)" + cls + "(\\s|$)").test(o.className))
+ o.className += (o.className ? " " : "") + cls;
+ };
+ AJS.map(args, function(elm) { add_class(elm); });
+ },
+ hasClass: function(elm, cls) {
+ if(!elm.className)
+ return false;
+ return elm.className == cls ||
+ elm.className.search(new RegExp(" " + cls)) != -1
+ },
+ removeClass: function(/*elm1, elm2..., className*/) {
+ var args = AJS.forceArray(arguments);
+ var cls = args.pop();
+ var rm_class = function(o) {
+ o.className = o.className.replace(new RegExp("\\s?" + cls, 'g'), "");
+ };
+ AJS.map(args, function(elm) { rm_class(elm); });
+ },
+
+ setHTML: function(elm, html) {
+ elm.innerHTML = html;
+ return elm;
+ },
+
+ RND: function(tmpl, ns, scope) {
+ scope = scope || window;
+ var fn = function(w, g) {
+ g = g.split("|");
+ var cnt = ns[g[0]];
+ for(var i=1; i < g.length; i++)
+ cnt = scope[g[i]](cnt);
+ if(cnt == '')
+ return '';
+ if(cnt == 0 || cnt == -1)
+ cnt += '';
+ return cnt || w;
+ };
+ return tmpl.replace(/%\(([A-Za-z0-9_|.]*)\)/g, fn);
+ },
+
+ HTML2DOM: function(html,/*optional*/ first_child) {
+ var d = AJS.DIV();
+ d.innerHTML = html;
+ if(first_child)
+ return d.childNodes[0];
+ else
+ return d;
+ },
+
+ preloadImages: function(/*img_src1, ..., img_srcN*/) {
+ AJS.AEV(window, 'load', AJS.$p(function(args) {
+ AJS.map(args, function(src) {
+ var pic = new Image();
+ pic.src = src;
+ });
+ }, arguments));
+ },
+
+
+////
+// Effects
+////
+ setOpacity: function(elm, p) {
+ elm.style.opacity = p;
+ elm.style.filter = "alpha(opacity="+ p*100 +")";
+ },
+
+
+////
+// Ajax functions
+////
+ getXMLHttpRequest: function() {
+ var try_these = [
+ function () { return new XMLHttpRequest(); },
+ function () { return new ActiveXObject('Msxml2.XMLHTTP'); },
+ function () { return new ActiveXObject('Microsoft.XMLHTTP'); },
+ function () { return new ActiveXObject('Msxml2.XMLHTTP.4.0'); },
+ function () { throw "Browser does not support XMLHttpRequest"; }
+ ];
+ for (var i = 0; i < try_these.length; i++) {
+ var func = try_these[i];
+ try {
+ return func();
+ } catch (e) {
+ }
+ }
+ },
+
+ getRequest: function(url, data, type) {
+ if(!type)
+ type = "POST";
+ var req = AJS.getXMLHttpRequest();
+
+ if(url.indexOf("http://") == -1) {
+ if(AJS.BASE_URL != '') {
+ if(AJS.BASE_URL.lastIndexOf('/') != AJS.BASE_URL.length-1)
+ AJS.BASE_URL += '/';
+ url = AJS.BASE_URL + url;
+ }
+ else
+ url = window.location + url;
+ }
+
+ req.open(type, url, true);
+ if(type == "POST")
+ req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
+ return AJS._sendXMLHttpRequest(req);
+ },
+
+ _sendXMLHttpRequest: function(req, data) {
+ var d = new AJSDeferred(req);
+
+ var onreadystatechange = function () {
+ if (req.readyState == 4) {
+ var status = '';
+ try {
+ status = req.status;
+ }
+ catch(e) {};
+ if(status == 200 || status == 304 || req.responseText == null) {
+ d.callback();
+ }
+ else {
+ if(AJS.ajaxErrorHandler)
+ AJS.ajaxErrorHandler(req.responseText, req);
+ else
+ d.errback();
+ }
+ }
+ }
+ req.onreadystatechange = onreadystatechange;
+ return d;
+ },
+
+ _reprString: function(o) {
+ return ('"' + o.replace(/(["\\])/g, '\\$1') + '"'
+ ).replace(/[\f]/g, "\\f"
+ ).replace(/[\b]/g, "\\b"
+ ).replace(/[\n]/g, "\\n"
+ ).replace(/[\t]/g, "\\t"
+ ).replace(/[\r]/g, "\\r");
+ },
+
+ serializeJSON: function(o) {
+ var objtype = typeof(o);
+ if (objtype == "undefined") {
+ return "undefined";
+ } else if (objtype == "number" || objtype == "boolean") {
+ return o + "";
+ } else if (o === null) {
+ return "null";
+ }
+ if (objtype == "string") {
+ return AJS._reprString(o);
+ }
+ var me = arguments.callee;
+ if (objtype != "function" && typeof(o.length) == "number") {
+ var res = [];
+ for (var i = 0; i < o.length; i++) {
+ var val = me(o[i]);
+ if (typeof(val) != "string") {
+ val = "undefined";
+ }
+ res.push(val);
+ }
+ return "[" + res.join(",") + "]";
+ }
+ // it's a function with no adapter, bad
+ if (objtype == "function")
+ return null;
+ res = [];
+ for (var k in o) {
+ var useKey;
+ if (typeof(k) == "number") {
+ useKey = '"' + k + '"';
+ } else if (typeof(k) == "string") {
+ useKey = AJS._reprString(k);
+ } else {
+ // skip non-string or number keys
+ continue;
+ }
+ val = me(o[k]);
+ if (typeof(val) != "string") {
+ // skip non-serializable values
+ continue;
+ }
+ res.push(useKey + ":" + val);
+ }
+ return "{" + res.join(",") + "}";
+ },
+
+ loadJSONDoc: function(url) {
+ var d = AJS.getRequest(url);
+ var eval_req = function(data, req) {
+ var text = req.responseText;
+ if(text == "Error")
+ d.errback(req);
+ else
+ return AJS.evalTxt(text);
+ };
+ d.addCallback(eval_req);
+ return d;
+ },
+
+ evalTxt: function(txt) {
+ try {
+ return eval('('+ txt + ')');
+ }
+ catch(e) {
+ return eval(txt);
+ }
+ },
+
+ evalScriptTags: function(html) {
+ var script_data = html.match(/<script.*?>((\n|\r|.)*?)<\/script>/g);
+ if(script_data != null) {
+ for(var i=0; i < script_data.length; i++) {
+ var script_only = script_data[i].replace(/<script.*?>/g, "");
+ script_only = script_only.replace(/<\/script>/g, "");
+ eval(script_only);
+ }
+ }
+ },
+
+ queryArguments: function(data) {
+ var post_data = [];
+ for(k in data)
+ post_data.push(k + "=" + AJS.urlencode(data[k]));
+ return post_data.join("&");
+ },
+
+
+////
+// Position and size
+////
+ getMousePos: function(e) {
+ var posx = 0;
+ var posy = 0;
+ if (!e) var e = window.event;
+ if (e.pageX || e.pageY)
+ {
+ posx = e.pageX;
+ posy = e.pageY;
+ }
+ else if (e.clientX || e.clientY)
+ {
+ posx = e.clientX + document.body.scrollLeft;
+ posy = e.clientY + document.body.scrollTop;
+ }
+ return {x: posx, y: posy};
+ },
+
+ getScrollTop: function() {
+ //From: http://www.quirksmode.org/js/doctypes.html
+ var t;
+ if (document.documentElement && document.documentElement.scrollTop)
+ t = document.documentElement.scrollTop;
+ else if (document.body)
+ t = document.body.scrollTop;
+ return t;
+ },
+
+ absolutePosition: function(elm) {
+ var posObj = {'x': elm.offsetLeft, 'y': elm.offsetTop};
+ if(elm.offsetParent) {
+ var temp_pos = AJS.absolutePosition(elm.offsetParent);
+ posObj.x += temp_pos.x;
+ posObj.y += temp_pos.y;
+ }
+ // safari bug
+ if (AJS.isSafari() && elm.style.position == 'absolute' ) {
+ posObj.x -= document.body.offsetLeft;
+ posObj.y -= document.body.offsetTop;
+ }
+ return posObj;
+ },
+
+ getWindowSize: function(doc) {
+ doc = doc || document;
+ var win_w, win_h;
+ if (self.innerHeight) {
+ win_w = self.innerWidth;
+ win_h = self.innerHeight;
+ } else if (doc.documentElement && doc.documentElement.clientHeight) {
+ win_w = doc.documentElement.clientWidth;
+ win_h = doc.documentElement.clientHeight;
+ } else if (doc.body) {
+ win_w = doc.body.clientWidth;
+ win_h = doc.body.clientHeight;
+ }
+ return {'w': win_w, 'h': win_h};
+ },
+
+ isOverlapping: function(elm1, elm2) {
+ var pos_elm1 = AJS.absolutePosition(elm1);
+ var pos_elm2 = AJS.absolutePosition(elm2);
+
+ var top1 = pos_elm1.y;
+ var left1 = pos_elm1.x;
+ var right1 = left1 + elm1.offsetWidth;
+ var bottom1 = top1 + elm1.offsetHeight;
+ var top2 = pos_elm2.y;
+ var left2 = pos_elm2.x;
+ var right2 = left2 + elm2.offsetWidth;
+ var bottom2 = top2 + elm2.offsetHeight;
+ var getSign = function(v) {
+ if(v > 0) return "+";
+ else if(v < 0) return "-";
+ else return 0;
+ }
+
+ if ((getSign(top1 - bottom2) != getSign(bottom1 - top2)) &&
+ (getSign(left1 - right2) != getSign(right1 - left2)))
+ return true;
+ return false;
+ },
+
+
+////
+// Events
+////
+ getEventElm: function(e) {
+ if(e && !e.type && !e.keyCode)
+ return e
+ var targ;
+ if (!e) var e = window.event;
+ if (e.target) targ = e.target;
+ else if (e.srcElement) targ = e.srcElement;
+ if (targ.nodeType == 3) // defeat Safari bug
+ targ = targ.parentNode;
+ return targ;
+ },
+
+ _getRealScope: function(fn, /*optional*/ extra_args, dont_send_event, rev_extra_args) {
+ var scope = window;
+ extra_args = AJS.$A(extra_args);
+ if(fn._cscope)
+ scope = fn._cscope;
+
+ return function() {
+ //Append all the orginal arguments + extra_args
+ var args = [];
+ var i = 0;
+ if(dont_send_event)
+ i = 1;
+
+ AJS.map(arguments, function(arg) { args.push(arg) }, i);
+ args = args.concat(extra_args);
+ if(rev_extra_args)
+ args = args.reverse();
+ return fn.apply(scope, args);
+ };
+ },
+
+ _unloadListeners: function() {
+ if(AJS.listeners)
+ AJS.map(AJS.listeners, function(elm, type, fn) { AJS.REV(elm, type, fn) });
+ AJS.listeners = [];
+ },
+
+ setEventKey: function(e) {
+ e.key = e.keyCode ? e.keyCode : e.charCode;
+
+ if(window.event) {
+ e.ctrl = window.event.ctrlKey;
+ e.shift = window.event.shiftKey;
+ }
+ else {
+ e.ctrl = e.ctrlKey;
+ e.shift = e.shiftKey;
+ }
+ switch(e.key) {
+ case 63232:
+ e.key = 38;
+ break;
+ case 63233:
+ e.key = 40;
+ break;
+ case 63235:
+ e.key = 39;
+ break;
+ case 63234:
+ e.key = 37;
+ break;
+ }
+ },
+
+ //Shortcut: AJS.AEV
+ addEventListener: function(elm, type, fn, /*optional*/listen_once, cancle_bubble) {
+ if(!cancle_bubble)
+ cancle_bubble = false;
+
+ var elms = AJS.$A(elm);
+ AJS.map(elms, function(elmz) {
+ if(listen_once)
+ fn = AJS._listenOnce(elmz, type, fn);
+
+ //Hack since it does not work in all browsers
+ if(AJS.isIn(type, ['submit', 'load', 'scroll', 'resize'])) {
+ var old = elm['on' + type];
+ elm['on' + type] = function() {
+ if(old) {
+ fn(arguments);
+ return old(arguments);
+ }
+ else
+ return fn(arguments);
+ };
+ return;
+ }
+
+ //Fix keyCode
+ if(AJS.isIn(type, ['keypress', 'keydown', 'keyup', 'click'])) {
+ var old_fn = fn;
+ fn = function(e) {
+ AJS.setEventKey(e);
+ return old_fn.apply(null, arguments);
+ }
+ }
+
+ if (elmz.attachEvent) {
+ //FIXME: We ignore cancle_bubble for IE... could be a problem?
+ elmz.attachEvent("on" + type, fn);
+ }
+ else if(elmz.addEventListener)
+ elmz.addEventListener(type, fn, cancle_bubble);
+
+ AJS.listeners = AJS.$A(AJS.listeners);
+ AJS.listeners.push([elmz, type, fn]);
+ });
+ },
+
+ //Shortcut: AJS.REV
+ removeEventListener: function(elm, type, fn, /*optional*/cancle_bubble) {
+ if(!cancle_bubble)
+ cancle_bubble = false;
+ if(elm.removeEventListener) {
+ elm.removeEventListener(type, fn, cancle_bubble);
+ if(AJS.isOpera())
+ elm.removeEventListener(type, fn, !cancle_bubble);
+ }
+ else if(elm.detachEvent)
+ elm.detachEvent("on" + type, fn);
+ },
+
+ //Shortcut: AJS.$b
+ bind: function(fn, scope, /*optional*/ extra_args, dont_send_event, rev_extra_args) {
+ fn._cscope = scope;
+ return AJS._getRealScope(fn, extra_args, dont_send_event, rev_extra_args);
+ },
+
+ bindMethods: function(self) {
+ for (var k in self) {
+ var func = self[k];
+ if (typeof(func) == 'function') {
+ self[k] = AJS.$b(func, self);
+ }
+ }
+ },
+
+ _listenOnce: function(elm, type, fn) {
+ var r_fn = function() {
+ AJS.removeEventListener(elm, type, r_fn);
+ fn(arguments);
+ }
+ return r_fn;
+ },
+
+ callLater: function(fn, interval) {
+ var fn_no_send = function() {
+ fn();
+ };
+ window.setTimeout(fn_no_send, interval);
+ },
+
+ preventDefault: function(e) {
+ if(AJS.isIe())
+ window.event.returnValue = false;
+ else
+ e.preventDefault();
+ },
+
+
+////
+// Drag and drop
+////
+ dragAble: function(elm, /*optional*/ handler, args) {
+ if(!args)
+ args = {};
+ if(!AJS.isDefined(args['move_x']))
+ args['move_x'] = true;
+ if(!AJS.isDefined(args['move_y']))
+ args['move_y'] = true;
+ if(!AJS.isDefined(args['moveable']))
+ args['moveable'] = false;
+ if(!AJS.isDefined(args['hide_on_move']))
+ args['hide_on_move'] = true;
+ if(!AJS.isDefined(args['on_mouse_up']))
+ args['on_mouse_up'] = null;
+ if(!AJS.isDefined(args['cursor']))
+ args['cursor'] = 'move';
+ if(!AJS.isDefined(args['max_move']))
+ args['max_move'] = {'top': null, 'left': null};
+
+ elm = AJS.$(elm);
+
+ if(!handler)
+ handler = elm;
+
+ handler = AJS.$(handler);
+ var old_cursor = handler.style.cursor;
+ handler.style.cursor = args['cursor'];
+ elm.style.position = 'relative';
+
+ AJS.addClass(handler, '_ajs_handler');
+ handler._args = args;
+ handler._elm = elm;
+ AJS.AEV(handler, 'mousedown', AJS._dragStart);
+ },
+
+ _dragStart: function(e) {
+ var handler = AJS.getEventElm(e);
+ if(!AJS.hasClass(handler, '_ajs_handler')) {
+ handler = AJS.getParentBytc(handler, null, '_ajs_handler');
+ }
+ if(handler)
+ AJS._dragInit(e, handler._elm, handler._args);
+ },
+
+ dropZone: function(elm, args) {
+ elm = AJS.$(elm);
+ var item = {elm: elm};
+ AJS.update(item, args);
+ AJS._drop_zones.push(item);
+ },
+
+ removeDragAble: function(elm) {
+ AJS.REV(elm, 'mousedown', AJS._dragStart);
+ elm.style.cursor = '';
+ },
+
+ removeDropZone: function(elm) {
+ var i = AJS.getIndex(elm, AJS._drop_zones, function(item) {
+ if(item.elm == elm) return true;
+ });
+ if(i != -1) {
+ AJS._drop_zones.splice(i, 1);
+ }
+ },
+
+ _dragInit: function(e, click_elm, args) {
+ AJS.drag_obj = new Object();
+ AJS.drag_obj.args = args;
+
+ AJS.drag_obj.click_elm = click_elm;
+ AJS.drag_obj.mouse_pos = AJS.getMousePos(e);
+ AJS.drag_obj.click_elm_pos = AJS.absolutePosition(click_elm);
+
+ AJS.AEV(document, 'mousemove', AJS._dragMove, false, true);
+ AJS.AEV(document, 'mouseup', AJS._dragStop, false, true);
+
+ if (AJS.isIe())
+ window.event.cancelBubble = true;
+ AJS.preventDefault(e);
+ },
+
+ _initDragElm: function(elm) {
+ if(AJS.drag_elm && AJS.drag_elm.style.display == 'none')
+ AJS.removeElement(AJS.drag_elm);
+
+ if(!AJS.drag_elm) {
+ AJS.drag_elm = AJS.DIV();
+ var d = AJS.drag_elm;
+ AJS.insertBefore(d, AJS.getBody().firstChild);
+ AJS.setHTML(d, elm.innerHTML);
+
+ d.className = elm.className;
+ d.style.cssText = elm.style.cssText;
+
+ d.style.position = 'absolute';
+ d.style.zIndex = 10000;
+
+ var t = AJS.absolutePosition(elm);
+ AJS.setTop(d, t.y);
+ AJS.setLeft(d, t.x);
+
+ if(AJS.drag_obj.args.on_init) {
+ AJS.drag_obj.args.on_init(elm);
+ }
+ }
+ },
+
+ _dragMove: function(e) {
+ var drag_obj = AJS.drag_obj;
+ var click_elm = drag_obj.click_elm;
+
+ AJS._initDragElm(click_elm);
+ var drag_elm = AJS.drag_elm;
+
+ if(drag_obj.args['hide_on_move'])
+ click_elm.style.visibility = 'hidden';
+
+ var cur_pos = AJS.getMousePos(e);
+
+ var mouse_pos = drag_obj.mouse_pos;
+
+ var click_elm_pos = drag_obj.click_elm_pos;
+
+ AJS.map(AJS._drop_zones, function(d_z) {
+ if(AJS.isOverlapping(d_z['elm'], drag_elm)) {
+ if(d_z['elm'] != drag_elm) {
+ var on_hover = d_z['on_hover'];
+ if(on_hover)
+ on_hover(d_z['elm'], click_elm, drag_elm);
+ }
+ }
+ });
+
+ if(drag_obj.args['on_drag'])
+ drag_obj.args['on_drag'](click_elm, e);
+
+ var max_move_top = drag_obj.args['max_move']['top'];
+ var max_move_left = drag_obj.args['max_move']['left'];
+ var p;
+ if(drag_obj.args['move_x']) {
+ p = cur_pos.x - (mouse_pos.x - click_elm_pos.x);
+ if(max_move_left == null || max_move_left <= p)
+ AJS.setLeft(elm, p);
+ }
+
+ if(drag_obj.args['move_y']) {
+ p = cur_pos.y - (mouse_pos.y - click_elm_pos.y);
+ if(max_move_top == null || max_move_top <= p)
+ AJS.setTop(elm, p);
+ }
+ if(AJS.isIe()) {
+ window.event.cancelBubble = true;
+ window.event.returnValue = false;
+ }
+ else
+ e.preventDefault();
+ },
+
+ _dragStop: function(e) {
+ var drag_obj = AJS.drag_obj;
+ var drag_elm = AJS.drag_elm;
+ var click_elm = drag_obj.click_elm;
+
+ AJS.REV(document, "mousemove", AJS._dragMove, true);
+ AJS.REV(document, "mouseup", AJS._dragStop, true);
+
+ var dropped = false;
+ AJS.map(AJS._drop_zones, function(d_z) {
+ if(AJS.isOverlapping(d_z['elm'], click_elm)) {
+ if(d_z['elm'] != click_elm) {
+ var on_drop = d_z['on_drop'];
+ if(on_drop) {
+ dropped = true;
+ on_drop(d_z['elm'], click_elm);
+ }
+ }
+ }
+ });
+
+ if(drag_obj.args['moveable']) {
+ var t = parseInt(click_elm.style.top) || 0;
+ var l = parseInt(click_elm.style.left) || 0;
+ var drag_elm_xy = AJS.absolutePosition(drag_elm);
+ var click_elm_xy = AJS.absolutePosition(click_elm);
+ AJS.setTop(click_elm, t + drag_elm_xy.y - click_elm_xy.y);
+ AJS.setLeft(click_elm, l + drag_elm_xy.x - click_elm_xy.x);
+ }
+
+ if(!dropped && drag_obj.args['on_mouse_up'])
+ drag_obj.args['on_mouse_up'](click_elm, e);
+
+ if(drag_obj.args['hide_on_move'])
+ drag_obj.click_elm.style.visibility = 'visible';
+
+ if(drag_obj.args.on_end) {
+ drag_obj.args.on_end(click_elm);
+ }
+
+ AJS._dragObj = null;
+ if(drag_elm)
+ AJS.hideElement(drag_elm);
+ AJS.drag_elm = null;
+ },
+
+
+////
+// Misc.
+////
+ keys: function(obj) {
+ var rval = [];
+ for (var prop in obj) {
+ rval.push(prop);
+ }
+ return rval;
+ },
+
+ values: function(obj) {
+ var rval = [];
+ for (var prop in obj) {
+ rval.push(obj[prop]);
+ }
+ return rval;
+ },
+
+ urlencode: function(str) {
+ return encodeURIComponent(str.toString());
+ },
+
+ isDefined: function(o) {
+ return (o != "undefined" && o != null)
+ },
+
+ isArray: function(obj) {
+ return obj instanceof Array;
+ },
+
+ isString: function(obj) {
+ return (typeof obj == 'string');
+ },
+
+ isNumber: function(obj) {
+ return (typeof obj == 'number');
+ },
+
+ isObject: function(obj) {
+ return (typeof obj == 'object');
+ },
+
+ isFunction: function(obj) {
+ return (typeof obj == 'function');
+ },
+
+ isDict: function(o) {
+ var str_repr = String(o);
+ return str_repr.indexOf(" Object") != -1;
+ },
+
+ exportToGlobalScope: function() {
+ for(e in AJS)
+ eval(e + " = AJS." + e);
+ },
+
+ log: function(o) {
+ if(AJS.isMozilla())
+ console.log(o);
+ else {
+ var div = AJS.DIV({'style': 'color: green'});
+ AJS.ACN(AJS.getBody(), AJS.setHTML(div, ''+o));
+ }
+ }
+
+}
+
+AJS.Class = function(members) {
+ var fn = function() {
+ if(arguments[0] != 'no_init') {
+ return this.init.apply(this, arguments);
+ }
+ }
+ fn.prototype = members;
+ AJS.update(fn, AJS.Class.prototype);
+ return fn;
+}
+AJS.Class.prototype = {
+ extend: function(members) {
+ var parent = new this('no_init');
+ for(k in members) {
+ var prev = parent[k];
+ var cur = members[k];
+ if (prev && prev != cur && typeof cur == 'function') {
+ cur = this._parentize(cur, prev);
+ }
+ parent[k] = cur;
+ }
+ return new AJS.Class(parent);
+ },
+
+ implement: function(members) {
+ AJS.update(this.prototype, members);
+ },
+
+ _parentize: function(cur, prev) {
+ return function(){
+ this.parent = prev;
+ return cur.apply(this, arguments);
+ }
+ }
+};
+
+//Shortcuts
+AJS.$ = AJS.getElement;
+AJS.$$ = AJS.getElements;
+AJS.$f = AJS.getFormElement;
+AJS.$b = AJS.bind;
+AJS.$p = AJS.partial;
+AJS.$FA = AJS.forceArray;
+AJS.$A = AJS.createArray;
+AJS.DI = AJS.documentInsert;
+AJS.ACN = AJS.appendChildNodes;
+AJS.RCN = AJS.replaceChildNodes;
+AJS.AEV = AJS.addEventListener;
+AJS.REV = AJS.removeEventListener;
+AJS.$bytc = AJS.getElementsByTagAndClassName;
+
+AJSDeferred = function(req) {
+ this.callbacks = [];
+ this.errbacks = [];
+ this.req = req;
+}
+AJSDeferred.prototype = {
+ excCallbackSeq: function(req, list) {
+ var data = req.responseText;
+ while (list.length > 0) {
+ var fn = list.pop();
+ var new_data = fn(data, req);
+ if(new_data)
+ data = new_data;
+ }
+ },
+
+ callback: function () {
+ this.excCallbackSeq(this.req, this.callbacks);
+ },
+
+ errback: function() {
+ if(this.errbacks.length == 0)
+ alert("Error encountered:\n" + this.req.responseText);
+
+ this.excCallbackSeq(this.req, this.errbacks);
+ },
+
+ addErrback: function(fn) {
+ this.errbacks.unshift(fn);
+ },
+
+ addCallback: function(fn) {
+ this.callbacks.unshift(fn);
+ },
+
+ addCallbacks: function(fn1, fn2) {
+ this.addCallback(fn1);
+ this.addErrback(fn2);
+ },
+
+ sendReq: function(data) {
+ if(AJS.isObject(data)) {
+ this.req.send(AJS.queryArguments(data));
+ }
+ else if(AJS.isDefined(data))
+ this.req.send(data);
+ else {
+ this.req.send("");
+ }
+ }
+};
+
+//Prevent memory-leaks
+AJS.addEventListener(window, 'unload', AJS._unloadListeners);
+AJS._createDomShortcuts()
+}
+
+script_loaded = true;
--- /dev/null
+/*
+Last Modified: 25/12/06 18:26:30
+
+AJS effects
+ A very small library with a lot of functionality
+AUTHOR
+ 4mir Salihefendic (http://amix.dk) - amix@amix.dk
+LICENSE
+ Copyright (c) 2006 Amir Salihefendic. All rights reserved.
+ Copyright (c) 2005 Bob Ippolito. All rights reserved.
+ Copyright (c) 2006 Valerio Proietti, http://www.mad4milk.net
+ http://www.opensource.org/licenses/mit-license.php
+VERSION
+ 3.6
+SITE
+ http://orangoo.com/AmiNation/AJS
+**/
+AJS.fx = {
+ _shades: {0: 'ffffff', 1: 'ffffee', 2: 'ffffdd',
+ 3: 'ffffcc', 4: 'ffffbb', 5: 'ffffaa',
+ 6: 'ffff99'},
+
+ highlight: function(elm, options) {
+ var base = new AJS.fx.Base();
+ base.elm = AJS.$(elm);
+ base.setOptions(options);
+ base.options.duration = 600;
+
+ AJS.update(base, {
+ increase: function(){
+ if(this.now == 7)
+ elm.style.backgroundColor = 'transparent';
+ else
+ elm.style.backgroundColor = '#' + AJS.fx._shades[Math.floor(this.now)];
+ }
+ });
+ return base.custom(6, 0);
+ },
+
+ fadeIn: function(elm, options) {
+ options = options || {};
+ if(!options.from) {
+ options.from = 0;
+ AJS.setOpacity(elm, 0);
+ }
+ if(!options.to) options.to = 1;
+ var s = new AJS.fx.Style(elm, 'opacity', options);
+ return s.custom(options.from, options.to);
+ },
+
+ fadeOut: function(elm, options) {
+ options = options || {};
+ if(!options.from) options.from = 1;
+ if(!options.to) options.to = 0;
+ options.duration = 300;
+ var s = new AJS.fx.Style(elm, 'opacity', options);
+ return s.custom(options.from, options.to);
+ },
+
+ setWidth: function(elm, options) {
+ var s = new AJS.fx.Style(elm, 'width', options);
+ return s.custom(options.from, options.to);
+ },
+
+ setHeight: function(elm, options) {
+ var s = new AJS.fx.Style(elm, 'height', options);
+ return s.custom(options.from, options.to);
+ }
+}
+
+
+//From moo.fx
+AJS.fx.Base = new AJS.Class({
+ init: function() {
+ AJS.bindMethods(this);
+ },
+
+ setOptions: function(options){
+ this.options = AJS.update({
+ onStart: function(){},
+ onComplete: function(){},
+ transition: AJS.fx.Transitions.sineInOut,
+ duration: 500,
+ wait: true,
+ fps: 50
+ }, options || {});
+ },
+
+ step: function(){
+ var time = new Date().getTime();
+ if (time < this.time + this.options.duration){
+ this.cTime = time - this.time;
+ this.setNow();
+ } else {
+ setTimeout(AJS.$b(this.options.onComplete, this, [this.elm]), 10);
+ this.clearTimer();
+ this.now = this.to;
+ }
+ this.increase();
+ },
+
+ setNow: function(){
+ this.now = this.compute(this.from, this.to);
+ },
+
+ compute: function(from, to){
+ var change = to - from;
+ return this.options.transition(this.cTime, from, change, this.options.duration);
+ },
+
+ clearTimer: function(){
+ clearInterval(this.timer);
+ this.timer = null;
+ return this;
+ },
+
+ _start: function(from, to){
+ if (!this.options.wait) this.clearTimer();
+ if (this.timer) return;
+ setTimeout(AJS.$p(this.options.onStart, this.elm), 10);
+ this.from = from;
+ this.to = to;
+ this.time = new Date().getTime();
+ this.timer = setInterval(this.step, Math.round(1000/this.options.fps));
+ return this;
+ },
+
+ custom: function(from, to){
+ return this._start(from, to);
+ },
+
+ set: function(to){
+ this.now = to;
+ this.increase();
+ return this;
+ },
+
+ setStyle: function(elm, property, val) {
+ if(this.property == 'opacity')
+ AJS.setOpacity(elm, val);
+ else
+ AJS.setStyle(elm, property, val);
+ }
+});
+
+AJS.fx.Style = AJS.fx.Base.extend({
+ init: function(elm, property, options) {
+ this.parent();
+ this.elm = elm;
+ this.setOptions(options);
+ this.property = property;
+ },
+
+ increase: function(){
+ this.setStyle(this.elm, this.property, this.now);
+ }
+});
+
+AJS.fx.Styles = AJS.fx.Base.extend({
+ init: function(elm, options){
+ this.parent();
+ this.elm = AJS.$(elm);
+ this.setOptions(options);
+ this.now = {};
+ },
+
+ setNow: function(){
+ for (p in this.from)
+ this.now[p] = this.compute(this.from[p], this.to[p]);
+ },
+
+ custom: function(obj){
+ if (this.timer && this.options.wait) return;
+ var from = {};
+ var to = {};
+ for (p in obj){
+ from[p] = obj[p][0];
+ to[p] = obj[p][1];
+ }
+ return this._start(from, to);
+ },
+
+ increase: function(){
+ for (var p in this.now) this.setStyle(this.elm, p, this.now[p]);
+ }
+});
+
+//Transitions (c) 2003 Robert Penner (http://www.robertpenner.com/easing/), BSD License.
+AJS.fx.Transitions = {
+ linear: function(t, b, c, d) { return c*t/d + b; },
+ sineInOut: function(t, b, c, d) { return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; }
+};
+
+script_loaded = true;
--- /dev/null
+/* Last-Modified: 28/06/06 00:08:22 */
+#GB_overlay {
+ background-color: #000;
+ position: absolute;
+ margin: auto;
+ top: 0;
+ left: 0;
+ z-index: 100;
+}
+
+#GB_window {
+ left: 0;
+ top: 0;
+ font-size: 1px;
+ position: absolute;
+ overflow: visible;
+ z-index: 150;
+}
+
+#GB_window .content {
+ width: auto;
+ margin: 0;
+ padding: 0;
+}
+
+#GB_frame {
+ border: 0;
+ margin: 0;
+ padding: 0;
+ overflow: auto;
+ white-space: nowrap;
+}
--- /dev/null
+var GB_CURRENT = null;
+
+GB_hide = function() {
+ GB_CURRENT.hide();
+}
+
+GreyBox = new AJS.Class({
+ init: function(options) {
+ this.use_fx = AJS.fx;
+ this.type = "page";
+ this.overlay_click_close = false;
+ this.salt = 0;
+ this.root_dir = GB_ROOT_DIR;
+ this.callback_fns = [];
+ this.reload_on_close = false;
+ this.src_loader = this.root_dir + 'loader_frame.html';
+
+ //Solve the www issue
+ var h_www = window.location.hostname.indexOf('www');
+ var src_www = this.src_loader.indexOf('www');
+ if(h_www != -1 && src_www == -1)
+ this.src_loader = this.src_loader.replace('://', '://www.');
+
+ if(h_www == -1 && src_www != -1)
+ this.src_loader = this.src_loader.replace('://www.', '://');
+
+ this.show_loading = true;
+ AJS.update(this, options);
+ },
+
+ addCallback: function(fn) {
+ if(fn) this.callback_fns.push(fn);
+ },
+
+ show: function(url) {
+ GB_CURRENT = this;
+ this.url = url;
+
+ var elms = [AJS.$bytc("object"), AJS.$bytc("select")];
+ AJS.map(AJS.flattenList(elms), function(elm) {
+ elm.style.visibility = "hidden";
+ });
+
+ this.createElements();
+ return false;
+ },
+
+ hide: function() {
+ var c_bs = this.callback_fns;
+ if(c_bs != []) {
+ AJS.map(c_bs, function(fn) {
+ fn();
+ });
+ }
+
+ this.onHide();
+ if(this.use_fx) {
+ var elm = this.overlay;
+ AJS.fx.fadeOut(this.overlay, {
+ onComplete: function() {
+ AJS.removeElement(elm);
+ elm = null;
+ },
+ duration: 300
+ });
+ AJS.removeElement(this.g_window);
+ }
+ else {
+ AJS.removeElement(this.g_window, this.overlay);
+ }
+
+ this.removeFrame();
+
+ AJS.REV(window, "scroll", _GB_setOverlayDimension);
+ AJS.REV(window, "resize", _GB_update);
+
+ var elms = [AJS.$bytc("object"), AJS.$bytc("select")];
+ AJS.map(AJS.flattenList(elms), function(elm) {
+ elm.style.visibility = "visible";
+ });
+
+ GB_CURRENT = null;
+
+ if(this.reload_on_close)
+ window.location.reload();
+ },
+
+ update: function() {
+ this.setOverlayDimension();
+ this.setFrameSize();
+ this.setWindowPosition();
+ },
+
+ createElements: function() {
+ this.initOverlay();
+
+ this.g_window = AJS.DIV({'id': 'GB_window'});
+ AJS.hideElement(this.g_window);
+ AJS.getBody().insertBefore(this.g_window, this.overlay.nextSibling);
+
+ this.initFrame();
+ this.initHook();
+ this.update();
+
+ var me = this;
+ if(this.use_fx) {
+ AJS.fx.fadeIn(this.overlay, {
+ duration: 300,
+ to: 0.7,
+ onComplete: function() {
+ me.onShow();
+ AJS.showElement(me.g_window);
+ me.startLoading();
+ }
+ });
+ }
+ else {
+ AJS.setOpacity(this.overlay, 0.7);
+ AJS.showElement(this.g_window);
+ this.onShow();
+ this.startLoading();
+ }
+
+ AJS.AEV(window, "scroll", _GB_setOverlayDimension);
+ AJS.AEV(window, "resize", _GB_update);
+ },
+
+ removeFrame: function() {
+ try{ AJS.removeElement(this.iframe); }
+ catch(e) {}
+
+ this.iframe = null;
+ },
+
+ startLoading: function() {
+ this.iframe.src = this.src_loader + '?s='+this.salt++;
+ AJS.showElement(this.iframe);
+ },
+
+ setOverlayDimension: function() {
+ var page_size = AJS.getWindowSize();
+ if(AJS.isMozilla() || AJS.isOpera())
+ AJS.setWidth(this.overlay, "100%");
+ else
+ AJS.setWidth(this.overlay, page_size.w);
+
+ var max_height = Math.max(AJS.getScrollTop()+page_size.h, AJS.getScrollTop()+this.height);
+
+ if(max_height < AJS.getScrollTop())
+ AJS.setHeight(this.overlay, max_height);
+ else
+ AJS.setHeight(this.overlay, AJS.getScrollTop()+page_size.h);
+ },
+
+ initOverlay: function() {
+ this.overlay = AJS.DIV({'id': 'GB_overlay'});
+
+ if(this.overlay_click_close)
+ AJS.AEV(this.overlay, "click", GB_hide);
+
+ AJS.setOpacity(this.overlay, 0);
+ AJS.getBody().insertBefore(this.overlay, AJS.getBody().firstChild);
+ },
+
+ initFrame: function() {
+ if(!this.iframe) {
+ var d = {'name': 'GB_frame', 'class': 'GB_frame', 'frameBorder': 0};
+ this.iframe = AJS.IFRAME(d);
+ this.middle_cnt = AJS.DIV({'class': 'content'}, this.iframe);
+
+ this.top_cnt = AJS.DIV();
+ this.bottom_cnt = AJS.DIV();
+
+ AJS.ACN(this.g_window, this.top_cnt, this.middle_cnt, this.bottom_cnt);
+ }
+ },
+
+ /* Can be implemented */
+ onHide: function() {},
+ onShow: function() {},
+ setFrameSize: function() {},
+ setWindowPosition: function() {},
+ initHook: function() {}
+
+});
+
+_GB_update = function() { if(GB_CURRENT) GB_CURRENT.update(); }
+_GB_setOverlayDimension = function() { if(GB_CURRENT) GB_CURRENT.setOverlayDimension(); }
+
+AJS.preloadImages(GB_ROOT_DIR+'indicator.gif');
+
+script_loaded = true;
--- /dev/null
+<!--
+Notice: I feel so dirty doing this, but its the only way to make it cross browser.
+-->
+<html>
+<head>
+ <script>
+ var GB = parent.GB_CURRENT;
+ document.write('<script type="text/javascript" src="AJS.js"><\/script>');
+ if(GB.use_fx) {
+ document.write('<script type="text/javascript" src="AJS_fx.js"><\/script>');
+ }
+ </script>
+ <style>
+ body {
+ padding: 0;
+ margin: 0;
+ overflow: hidden;
+ }
+
+ #GB_frame {
+ visibility: hidden;
+ width: 100%;
+ height: 100%;
+ }
+
+ #loading {
+ padding-top: 50px;
+ position: absolute;
+ width: 100%;
+ top: 0;
+ text-align: center;
+ vertical-align: middle;
+ }
+ </style>
+</head>
+<body>
+
+<div id="loading">
+ <img src="indicator.gif">
+</div>
+
+<script>
+var loading = AJS.$('loading');
+var gb_type = GB.type;
+var gb_url = GB.url;
+
+//Start loading in the iframe
+if(gb_type == "page") {
+ document.write('<iframe id="GB_frame" src="' + gb_url + '" frameborder="0"></iframe>');
+}
+else {
+ var img_holder = new Image();
+ img_holder.src = gb_url;
+ document.write('<img id="GB_frame" src="' + gb_url + '">');
+}
+var frame = AJS.$('GB_frame');
+</script>
+
+</body>
+<script>
+function setupOuterGB() {
+ frame.style.visibility = 'visible';
+ GB.setFrameSize();
+ GB.setWindowPosition();
+}
+
+function loaded() {
+ AJS.removeElement(loading);
+
+ GB.overlay.innerHTML += " "; //Safari bugfix
+
+ if(gb_type == "image") {
+ if(img_holder.width != 0 && img_holder.height != 0) {
+ var width = img_holder.width;
+ var height = img_holder.height;
+
+ GB.width = width;
+ GB.height = height;
+
+ setupOuterGB();
+
+ if(GB.use_fx) {
+ AJS.setOpacity(frame, 0);
+ AJS.fx.fadeIn(frame);
+ }
+ }
+ }
+ else {
+ GB.width = frame.offsetWidth;
+ GB.height = frame.offsetHeight;
+ setupOuterGB();
+ }
+}
+
+if(GB.show_loading) {
+ AJS.AEV(window, 'load', function(e) {
+ loaded();
+ });
+}
+else {
+ loaded();
+}
+</script>
+</html>
--- /dev/null
+.GB_Gallery {
+ margin: 0 22px 0 22px;
+}
+
+.GB_Gallery .content {
+ background-color: #fff;
+ border: 3px solid #ddd;
+}
+
+.GB_header {
+ top: 10px;
+ left: 0;
+ margin: 0;
+ z-index: 500;
+ position: absolute;
+ border-bottom: 2px solid #555;
+ border-top: 2px solid #555;
+}
+
+.GB_header .inner {
+ background-color: #333;
+ font-family: Arial, Verdana, sans-serif;
+ padding: 2px 20px 2px 20px;
+}
+
+.GB_header table {
+ margin: 0;
+ width: 100%;
+ border-collapse: collapse;
+}
+
+.GB_header .caption {
+ text-align: left;
+ color: #eee;
+ white-space: nowrap;
+ font-size: 20px;
+}
+
+.GB_header .close {
+ text-align: right;
+}
+
+.GB_header .close img {
+ z-index: 500;
+ cursor: pointer;
+}
+
+.GB_header .middle {
+ white-space: nowrap;
+ text-align: center;
+}
--- /dev/null
+GB_showImage = function(caption, url, callback_fn) {
+ var options = {
+ width: 300,
+ height: 300,
+ type: 'image',
+
+ fullscreen: false,
+ center_win: true,
+ caption: caption,
+ callback_fn: callback_fn
+ }
+ var win = new GB_Gallery(options);
+ return win.show(url);
+}
+
+GB_showPage = function(caption, url, callback_fn) {
+ var options = {
+ type: 'page',
+
+ caption: caption,
+ callback_fn: callback_fn,
+ fullscreen: true,
+ center_win: false
+ }
+ var win = new GB_Gallery(options);
+ return win.show(url);
+}
+
+GB_Gallery = GreyBox.extend({
+ init: function(options) {
+ this.parent({});
+ this.img_close = this.root_dir + 'g_close.gif';
+ AJS.update(this, options);
+ this.addCallback(this.callback_fn);
+ },
+
+ initHook: function() {
+ AJS.addClass(this.g_window, 'GB_Gallery');
+
+ var inner = AJS.DIV({'class': 'inner'});
+ this.header = AJS.DIV({'class': 'GB_header'}, inner);
+ AJS.setOpacity(this.header, 0);
+ AJS.getBody().insertBefore(this.header, this.overlay.nextSibling);
+
+ var td_caption = AJS.TD({'id': 'GB_caption', 'class': 'caption', 'width': '40%'}, this.caption);
+ var td_middle = AJS.TD({'id': 'GB_middle', 'class': 'middle', 'width': '20%'});
+
+ var img_close = AJS.IMG({'src': this.img_close});
+ AJS.AEV(img_close, 'click', GB_hide);
+ var td_close = AJS.TD({'class': 'close', 'width': '40%'}, img_close);
+
+ var tbody = AJS.TBODY(AJS.TR(td_caption, td_middle, td_close));
+
+ var table = AJS.TABLE({'cellspacing': '0', 'cellpadding': 0, 'border': 0}, tbody);
+ AJS.ACN(inner, table);
+
+ if(this.fullscreen)
+ AJS.AEV(window, 'scroll', AJS.$b(this.setWindowPosition, this));
+ else
+ AJS.AEV(window, 'scroll', AJS.$b(this._setHeaderPos, this));
+ },
+
+ setFrameSize: function() {
+ var overlay_w = this.overlay.offsetWidth;
+ var page_size = AJS.getWindowSize();
+
+ if(this.fullscreen) {
+ this.width = overlay_w-40;
+ this.height = page_size.h-80;
+ }
+ AJS.setWidth(this.iframe, this.width);
+ AJS.setHeight(this.iframe, this.height);
+
+ AJS.setWidth(this.header, overlay_w);
+ },
+
+ _setHeaderPos: function() {
+ AJS.setTop(this.header, AJS.getScrollTop()+10);
+ },
+
+ setWindowPosition: function() {
+ var overlay_w = this.overlay.offsetWidth;
+ var page_size = AJS.getWindowSize();
+ AJS.setLeft(this.g_window, ((overlay_w - 50 - this.width)/2));
+
+ var header_top = AJS.getScrollTop()+55;
+ if(!this.center_win) {
+ AJS.setTop(this.g_window, header_top);
+ }
+ else {
+ var fl = ((page_size.h - this.height) /2) + 20 + AJS.getScrollTop();
+ if(fl < 0) fl = 0;
+ if(header_top > fl) {
+ fl = header_top;
+ }
+ AJS.setTop(this.g_window, fl);
+ }
+ this._setHeaderPos();
+ },
+
+ onHide: function() {
+ AJS.removeElement(this.header);
+ AJS.removeClass(this.g_window, 'GB_Gallery');
+ },
+
+ onShow: function() {
+ if(this.use_fx)
+ AJS.fx.fadeIn(this.header, {to: 1});
+ else
+ AJS.setOpacity(this.header, 1);
+ }
+});
+
+AJS.preloadImages(GB_ROOT_DIR+'g_close.gif');
--- /dev/null
+#GB_middle {
+ color: #eee;
+}
+
+#GB_middle img {
+ cursor: pointer;
+ vertical-align: middle;
+}
+
+#GB_middle .disabled {
+ cursor: default;
+}
+
+#GB_middle .left {
+ padding-right: 10px;
+}
+
+#GB_middle .right {
+ padding-left: 10px;
+}
--- /dev/null
+GB_showFullScreenSet = function(set, start_index, callback_fn) {
+ var options = {
+ type: 'page',
+ fullscreen: true,
+ center_win: false
+ }
+ var gb_sets = new GB_Sets(options, set);
+ gb_sets.addCallback(callback_fn);
+ gb_sets.showSet(start_index-1);
+ return false;
+}
+
+GB_showImageSet = function(set, start_index, callback_fn) {
+ var options = {
+ type: 'image',
+ fullscreen: false,
+ center_win: true,
+ width: 300,
+ height: 300
+ }
+ var gb_sets = new GB_Sets(options, set);
+ gb_sets.addCallback(callback_fn);
+ gb_sets.showSet(start_index-1);
+ return false;
+}
+
+GB_Sets = GB_Gallery.extend({
+ init: function(options, set) {
+ this.parent(options);
+ if(!this.img_next) this.img_next = this.root_dir + 'next.gif';
+ if(!this.img_prev) this.img_prev = this.root_dir + 'prev.gif';
+ this.current_set = set;
+ },
+
+ showSet: function(start_index) {
+ this.current_index = start_index;
+
+ var item = this.current_set[this.current_index];
+ this.show(item.url);
+ this._setCaption(item.caption);
+
+ this.btn_prev = AJS.IMG({'class': 'left', src: this.img_prev});
+ this.btn_next = AJS.IMG({'class': 'right', src: this.img_next});
+
+ AJS.AEV(this.btn_prev, 'click', AJS.$b(this.switchPrev, this));
+ AJS.AEV(this.btn_next, 'click', AJS.$b(this.switchNext, this));
+
+ GB_STATUS = AJS.SPAN({'class': 'GB_navStatus'});
+ AJS.ACN(AJS.$('GB_middle'), this.btn_prev, GB_STATUS, this.btn_next);
+
+ this.updateStatus();
+ },
+
+ updateStatus: function() {
+ AJS.setHTML(GB_STATUS, (this.current_index + 1) + ' / ' + this.current_set.length);
+ if(this.current_index == 0) {
+ AJS.addClass(this.btn_prev, 'disabled');
+ }
+ else {
+ AJS.removeClass(this.btn_prev, 'disabled');
+ }
+
+ if(this.current_index == this.current_set.length-1) {
+ AJS.addClass(this.btn_next, 'disabled');
+ }
+ else {
+ AJS.removeClass(this.btn_next, 'disabled');
+ }
+ },
+
+ _setCaption: function(caption) {
+ AJS.setHTML(AJS.$('GB_caption'), caption);
+ },
+
+ updateFrame: function() {
+ var item = this.current_set[this.current_index];
+ this._setCaption(item.caption);
+ this.url = item.url;
+ this.startLoading();
+ },
+
+ switchPrev: function() {
+ if(this.current_index != 0) {
+ this.current_index--;
+ this.updateFrame();
+ this.updateStatus();
+ }
+ },
+
+ switchNext: function() {
+ if(this.current_index != this.current_set.length-1) {
+ this.current_index++
+ this.updateFrame();
+ this.updateStatus();
+ }
+ }
+});
+
+AJS.AEV(window, 'load', function() {
+ AJS.preloadImages(GB_ROOT_DIR+'next.gif', GB_ROOT_DIR+'prev.gif');
+});
--- /dev/null
+.GB_Window .content {
+ background-color: #fff;
+ border: 3px solid #ccc;
+ border-top: none;
+}
+
+.GB_Window .header {
+ border-bottom: 1px solid #aaa;
+ border-top: 1px solid #999;
+ border-left: 3px solid #ccc;
+ border-right: 3px solid #ccc;
+ margin: 0;
+
+ height: 22px;
+ font-size: 12px;
+ padding: 3px 0;
+ color: #333;
+}
+
+.GB_Window .caption {
+ font-size: 12px;
+ text-align: left;
+ font-weight: bold;
+ white-space: nowrap;
+ padding-right: 20px;
+}
+
+.GB_Window .close { text-align: right; }
+.GB_Window .close span {
+ font-size: 12px;
+ cursor: pointer;
+}
+.GB_Window .close img {
+ cursor: pointer;
+ padding: 0 3px 0 0;
+}
+
+.GB_Window .on { border-bottom: 1px solid #333; }
+.GB_Window .click { border-bottom: 1px solid red; }
--- /dev/null
+GB_show = function(caption, url, /* optional */ height, width, callback_fn) {
+ var options = {
+ caption: caption,
+ height: height || 500,
+ width: width || 500,
+ fullscreen: false,
+ callback_fn: callback_fn
+ }
+ var win = new GB_Window(options);
+ return win.show(url);
+}
+
+GB_showCenter = function(caption, url, /* optional */ height, width, callback_fn) {
+ var options = {
+ caption: caption,
+ center_win: true,
+ height: height || 500,
+ width: width || 500,
+ fullscreen: false,
+ callback_fn: callback_fn
+ }
+ var win = new GB_Window(options);
+ return win.show(url);
+}
+
+GB_showFullScreen = function(caption, url, callback_fn) {
+ var options = {
+ caption: caption,
+ fullscreen: true,
+ callback_fn: callback_fn
+ }
+ var win = new GB_Window(options);
+ return win.show(url);
+}
+
+GB_Window = GreyBox.extend({
+ init: function(options) {
+ this.parent({});
+ this.img_header = this.root_dir+"header_bg.gif";
+ this.img_close = this.root_dir+"w_close.gif";
+ this.show_close_img = true;
+ AJS.update(this, options);
+ this.addCallback(this.callback_fn);
+ },
+
+ initHook: function() {
+ AJS.addClass(this.g_window, 'GB_Window');
+
+ this.header = AJS.TABLE({'class': 'header'});
+ this.header.style.backgroundImage = "url("+ this.img_header +")";
+
+ var td_caption = AJS.TD({'class': 'caption'}, this.caption);
+ var td_close = AJS.TD({'class': 'close'});
+
+ if(this.show_close_img) {
+ var img_close = AJS.IMG({'src': this.img_close});
+ var span = AJS.SPAN('Close');
+
+ var btn = AJS.DIV(img_close, span);
+
+ AJS.AEV([img_close, span], 'mouseover', function() { AJS.addClass(span, 'on'); });
+ AJS.AEV([img_close, span], 'mouseout', function() { AJS.removeClass(span, 'on'); });
+ AJS.AEV([img_close, span], 'mousedown', function() { AJS.addClass(span, 'click'); });
+ AJS.AEV([img_close, span], 'mouseup', function() { AJS.removeClass(span, 'click'); });
+ AJS.AEV([img_close, span], 'click', GB_hide);
+
+ AJS.ACN(td_close, btn);
+ }
+
+ tbody_header = AJS.TBODY();
+ AJS.ACN(tbody_header, AJS.TR(td_caption, td_close));
+
+ AJS.ACN(this.header, tbody_header);
+ AJS.ACN(this.top_cnt, this.header);
+
+ if(this.fullscreen)
+ AJS.AEV(window, 'scroll', AJS.$b(this.setWindowPosition, this));
+ },
+
+ setFrameSize: function() {
+ if(this.fullscreen) {
+ var page_size = AJS.getWindowSize();
+ overlay_h = page_size.h;
+ this.width = Math.round(this.overlay.offsetWidth - (this.overlay.offsetWidth/100)*10);
+ this.height = Math.round(overlay_h - (overlay_h/100)*10);
+ }
+
+ AJS.setWidth(this.header, this.width+6); //6 is for the left+right border
+ AJS.setWidth(this.iframe, this.width);
+ AJS.setHeight(this.iframe, this.height);
+ },
+
+ setWindowPosition: function() {
+ var page_size = AJS.getWindowSize();
+ AJS.setLeft(this.g_window, ((page_size.w - this.width)/2)-13);
+
+ if(!this.center_win) {
+ AJS.setTop(this.g_window, AJS.getScrollTop());
+ }
+ else {
+ var fl = ((page_size.h - this.height) /2) - 20 + AJS.getScrollTop();
+ if(fl < 0)
+ fl = 0;
+ AJS.setTop(this.g_window, fl);
+ }
+ }
+});
+
+AJS.preloadImages(GB_ROOT_DIR+'w_close.gif', GB_ROOT_DIR+'header_bg.gif');
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+ <title>GreyBox - Installation</title>
+
+ <script type="text/javascript" src="greybox/AJS.js"></script>
+
+ <script type="text/javascript" src="static_files/help.js"></script>
+ <link href="static_files/help.css" rel="stylesheet" type="text/css" media="all" />
+</head>
+<body>
+
+<script>
+ insertHeader();
+ insertMenu('installation');
+</script>
+
+<ol>
+<li>
+Append following to your header section (in between <code><header>...</header></code>).
+<br />
+<span class="hl">GB_ROOT_DIR</span> is the URL where static files are located:
+<pre>
+<code><script type="text/javascript">
+ var GB_ROOT_DIR = "http://mydomain.com/greybox/";
+</script></code>
+</pre>
+</li>
+GB_ROOT_DIR should be absolute.
+
+<li>
+Append also following scripts and one stylesheet:
+<pre>
+<code><script type="text/javascript" src="greybox/AJS.js"></script>
+<script type="text/javascript" src="greybox/AJS_fx.js"></script>
+<script type="text/javascript" src="greybox/gb_scripts.js"></script>
+<link href="greybox/gb_styles.css" rel="stylesheet" type="text/css" /></code>
+</pre>
+
+AJS_fx.js is optional, it's used for effects. If you don't wish effects, then don't include AJS_fx.js in your header section.
+</li>
+
+<li>
+That's it, you are now ready to use GreyBox!
+</li>
+</ol>
+
+</body>
+</html>
--- /dev/null
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+<head>
+ <title>GreyBox - Normal usage</title>
+
+ <script type="text/javascript">
+ var GB_ROOT_DIR = "./greybox/";
+ </script>
+
+ <script type="text/javascript" src="greybox/AJS.js"></script>
+ <script type="text/javascript" src="greybox/AJS_fx.js"></script>
+ <script type="text/javascript" src="greybox/gb_scripts.js"></script>
+ <link href="greybox/gb_styles.css" rel="stylesheet" type="text/css" media="all" />
+
+ <script type="text/javascript" src="static_files/help.js"></script>
+ <link href="static_files/help.css" rel="stylesheet" type="text/css" media="all" />
+</head>
+
+<body>
+
+<script>
+ insertHeader();
+ insertMenu('nrm_usage');
+</script>
+
+<h2>Showing images</h2>
+
+<h3 class="first">Showing one image:</h3>
+<h4>Syntax:</h4>
+<pre>
+<code><a href="URL" title="CAPTION" rel="gb_image[]">HTML</a></code>
+</pre>
+
+<h4>Example:</h4>
+<pre>
+<code><a href="http://static.flickr.com/119/294309231_a3d2a339b9.jpg" title="Flower" rel="gb_image[]">Show flower</a></code>
+</pre>
+
+<h4>Example rendered:</h4>
+<a href="http://static.flickr.com/119/294309231_a3d2a339b9.jpg" title="Flower" rel="gb_image[]">Show flower</a>
+
+
+<h3>Showing a group of images:</h3>
+<h4>Syntax:</h4>
+<pre>
+<code><a href="URL" title="CAPTION" rel="gb_imageset[NAME]">HTML</a></code>
+<code><a href="URL" title="CAPTION" rel="gb_imageset[NAME]">HTML</a></code>
+</pre>
+
+<h4>Example:</h4>
+<pre>
+<code><a href="static_files/salt.jpg" rel="gb_imageset[nice_pics]" title="Salt flats in Chile">Salt flats</a></code>
+<code><a href="static_files/night_valley.jpg" rel="gb_imageset[nice_pics]" title="Night valley">Night valley</a></code>
+</pre>
+
+<h4>Example rendered:</h4>
+<a href="static_files/salt.jpg" rel="gb_imageset[nice_pics]" title="Salt flats in Chile">Salt flats</a>
+<a href="static_files/night_valley.jpg" rel="gb_imageset[nice_pics]" title="Night valley">Night valley</a>
+
+
+<h2>Showing pages</h2>
+
+<h3>Showing one page:</h3>
+<h4>Syntax:</h4>
+<pre>
+<code><a href="URL" title="CAPTION" rel="gb_page[WIDTH, HEIGHT]">HTML</a></code>
+</pre>
+
+<h4>Example:</h4>
+<pre>
+<code><a href="http://google.com/" title="Google" rel="gb_page[500, 500]">Launch Google.com</a></code>
+</pre>
+
+<h4>Example rendered:</h4>
+<a href="http://google.com/" title="Google" rel="gb_page[500, 500]">Launch Google.com</a>
+
+
+<h3>Showing one page as center window:</h3>
+<h4>Syntax:</h4>
+<pre>
+<code><a href="URL" title="CAPTION" rel="gb_page_center[WIDTH, HEIGHT]">HTML</a></code>
+</pre>
+
+<h4>Example:</h4>
+<pre>
+<code><a href="http://google.com/" title="Google" rel="gb_page_center[500, 500]">Launch Google.com</a></code>
+</pre>
+
+<h4>Example rendered:</h4>
+<a href="http://google.com/" title="Google" rel="gb_page_center[500, 500]">Launch Google.com</a>
+
+
+<h3>Showing one page in fullscreen:</h3>
+<h4>Syntax:</h4>
+<pre>
+<code><a href="URL" title="CAPTION" rel="gb_page_fs[]">HTML</a></code>
+</pre>
+
+<h4>Example:</h4>
+<pre>
+<code><a href="http://google.com/" title="Google" rel="gb_page_fs[]">Launch Google.com</a></code>
+</pre>
+
+<h4>Example rendered:</h4>
+<a href="http://google.com/" title="Google" rel="gb_page_fs[]">Launch Google.com</a>
+
+<h3>Showing a group of pages:</h3>
+<h4>Syntax:</h4>
+<pre>
+<code><a href="URL" title="CAPTION" rel="gb_pageset[NAME]">HTML</a></code>
+<code><a href="URL" title="CAPTION" rel="gb_pageset[NAME]">HTML</a></code>
+</pre>
+
+<h4>Example:</h4>
+<pre>
+<code><a href="http://google.com/" title="Google" rel="gb_pageset[search_sites]">Launch Google search</a></code>
+<code><a href="http://search.yahoo.com/" rel="gb_pageset[search_sites]">Launch Yahoo search</a></code>
+</pre>
+
+<h4>Example rendered:</h4>
+<a href="http://google.com/" title="Google" rel="gb_pageset[search_sites]">Launch Google search</a>
+<a href="http://search.yahoo.com/" rel="gb_pageset[search_sites]">Launch Yahoo search</a>
+
+
+</body>
+</html>
--- /dev/null
+body {
+ font-family: helvetica, verdana, sans-serif;
+ font-size: 12px;
+ background-color: #fff;
+ padding: 10px 35px 35px 35px;
+ width: 800px;
+ margin: auto;
+}
+
+#top {
+ text-align: center;
+}
+
+h2 {
+ font-size: 18px;
+ color: #333;
+ margin: 35px 0 10px 0;
+}
+
+h3 {
+ color: #333;
+ border-bottom: 1px solid #999;
+ font-size: 15px;
+ margin: 30px 0 3px 0;
+}
+
+.first {
+ margin-top: 20px;
+}
+
+h4 {
+ color: black;
+ font-size: 13px;
+ margin: 10px 0 5px 0;
+}
+
+pre {
+ font-size: 11px;
+ margin-top: 5px;
+ padding: 4px;
+ background-color: #e3e2c6;
+ border: 1px solid #999;
+}
+
+.hl {
+ background-color: #ffffcc;
+}
+
+ol {
+ margin: 0;
+ padding: 0 0px 0 20px;
+}
+
+li {
+ padding: 5px 0 5px 0;
+}
+
+img {
+ border: 0;
+}
+
+/*
+ * Menu
+ */
+#menu {
+ border-bottom: 1px solid #999;
+ margin: 20px 0px;
+ padding: 10px 0pt 5px;
+ text-align: center;
+}
+
+#menu li {
+ display: inline;
+ margin: 0px;
+ padding: 0px;
+}
+
+#menu a {
+ background: #ddd none repeat;
+ border: 1px solid #999;
+ margin: 0 5px 0 5px;
+ padding: 5px;
+}
+
+#menu a.current {
+ background: #fff none repeat;
+ border-bottom: 1px solid #fff;
+}
+
+#menu a {
+ color: black;
+ text-decoration: none;
+}
--- /dev/null
+var tmpl_header = AJS.join('', [
+ '<div id="top"> <img src="static_files/logo.gif" alt="" /> <br />',
+ '<span style="font-weight: bold; color: #333">A pop-up window that doesn\'t suck.</span>',
+ '</div>'
+]);
+
+function insertHeader() {
+ AJS.DI(tmpl_header);
+}
+
+var LINKS = {
+ 'installation': 'installation.html',
+ 'examples': 'examples.html',
+ 'nrm_usage': 'normal_usage.html',
+ 'adv_usage': 'advance_usage.html',
+ 'cmpr': 'compressing_greybox.html',
+ 'about': 'about.html'
+}
+
+function insertMenu(current_page) {
+ var menu = AJS.UL({id: 'menu'});
+ var create_item = function(cls, name) {
+ var item = AJS.LI({'class': cls});
+ AJS.ACN(item, AJS.A({href: LINKS[cls]}, name));
+ return item;
+ }
+ var items = [
+ create_item('installation', 'Installation'),
+ create_item('examples', 'Examples'),
+ create_item('nrm_usage', 'Normal usage'),
+ create_item('adv_usage', 'Advance usage'),
+ create_item('cmpr', 'Compressing GreyBox'),
+ create_item('about', 'About')
+ ];
+
+ AJS.map(items, function(item) {
+ if(item.className == current_page) {
+ AJS.addClass(AJS.$bytc('a', null, item)[0], 'current');
+ }
+ AJS.ACN(menu, item);
+ });
+ AJS.DI(menu);
+}
+
+function insertCode() {
+ var code = AJS.join('\n', arguments);
+ var result = '<pre><code>';
+ code = code.replace(/</g, '<').replace(/>/g, '>');
+ result += code;
+ result += '</code></pre>';
+ document.write(result);
+}
--- /dev/null
+var GB_CURRENT=null;
+GB_hide=function(){
+GB_CURRENT.hide();
+};
+GreyBox=new AJS.Class({init:function(_1){
+this.use_fx=AJS.fx;
+this.type="page";
+this.overlay_click_close=false;
+this.salt=0;
+this.root_dir=GB_ROOT_DIR;
+this.callback_fns=[];
+this.reload_on_close=false;
+this.src_loader=this.root_dir+"loader_frame.html";
+var _2=window.location.hostname.indexOf("www");
+var _3=this.src_loader.indexOf("www");
+if(_2!=-1&&_3==-1){
+this.src_loader=this.src_loader.replace("://","://www.");
+}
+if(_2==-1&&_3!=-1){
+this.src_loader=this.src_loader.replace("://www.","://");
+}
+this.show_loading=true;
+AJS.update(this,_1);
+},addCallback:function(fn){
+if(fn){
+this.callback_fns.push(fn);
+}
+},show:function(_5){
+GB_CURRENT=this;
+this.url=_5;
+var _6=[AJS.$bytc("object"),AJS.$bytc("select")];
+AJS.map(AJS.flattenList(_6),function(_7){
+_7.style.visibility="hidden";
+});
+this.createElements();
+return false;
+},hide:function(){
+var _8=this.callback_fns;
+if(_8!=[]){
+AJS.map(_8,function(fn){
+fn();
+});
+}
+this.onHide();
+if(this.use_fx){
+var _a=this.overlay;
+AJS.fx.fadeOut(this.overlay,{onComplete:function(){
+AJS.removeElement(_a);
+_a=null;
+},duration:300});
+AJS.removeElement(this.g_window);
+}else{
+AJS.removeElement(this.g_window,this.overlay);
+}
+this.removeFrame();
+AJS.REV(window,"scroll",_GB_setOverlayDimension);
+AJS.REV(window,"resize",_GB_update);
+var _b=[AJS.$bytc("object"),AJS.$bytc("select")];
+AJS.map(AJS.flattenList(_b),function(_c){
+_c.style.visibility="visible";
+});
+GB_CURRENT=null;
+if(this.reload_on_close){
+window.location.reload();
+}
+},update:function(){
+this.setOverlayDimension();
+this.setFrameSize();
+this.setWindowPosition();
+},createElements:function(){
+this.initOverlay();
+this.g_window=AJS.DIV({"id":"GB_window"});
+AJS.hideElement(this.g_window);
+AJS.getBody().insertBefore(this.g_window,this.overlay.nextSibling);
+this.initFrame();
+this.initHook();
+this.update();
+var me=this;
+if(this.use_fx){
+AJS.fx.fadeIn(this.overlay,{duration:300,to:0.7,onComplete:function(){
+me.onShow();
+AJS.showElement(me.g_window);
+me.startLoading();
+}});
+}else{
+AJS.setOpacity(this.overlay,0.7);
+AJS.showElement(this.g_window);
+this.onShow();
+this.startLoading();
+}
+AJS.AEV(window,"scroll",_GB_setOverlayDimension);
+AJS.AEV(window,"resize",_GB_update);
+},removeFrame:function(){
+try{
+AJS.removeElement(this.iframe);
+}
+catch(e){
+}
+this.iframe=null;
+},startLoading:function(){
+this.iframe.src=this.src_loader+"?s="+this.salt++;
+AJS.showElement(this.iframe);
+},setOverlayDimension:function(){
+var _e=AJS.getWindowSize();
+if(AJS.isMozilla()||AJS.isOpera()){
+AJS.setWidth(this.overlay,"100%");
+}else{
+AJS.setWidth(this.overlay,_e.w);
+}
+var _f=Math.max(AJS.getScrollTop()+_e.h,AJS.getScrollTop()+this.height);
+if(_f<AJS.getScrollTop()){
+AJS.setHeight(this.overlay,_f);
+}else{
+AJS.setHeight(this.overlay,AJS.getScrollTop()+_e.h);
+}
+},initOverlay:function(){
+this.overlay=AJS.DIV({"id":"GB_overlay"});
+if(this.overlay_click_close){
+AJS.AEV(this.overlay,"click",GB_hide);
+}
+AJS.setOpacity(this.overlay,0);
+AJS.getBody().insertBefore(this.overlay,AJS.getBody().firstChild);
+},initFrame:function(){
+if(!this.iframe){
+var d={"name":"GB_frame","class":"GB_frame","frameBorder":0};
+this.iframe=AJS.IFRAME(d);
+this.middle_cnt=AJS.DIV({"class":"content"},this.iframe);
+this.top_cnt=AJS.DIV();
+this.bottom_cnt=AJS.DIV();
+AJS.ACN(this.g_window,this.top_cnt,this.middle_cnt,this.bottom_cnt);
+}
+},onHide:function(){
+},onShow:function(){
+},setFrameSize:function(){
+},setWindowPosition:function(){
+},initHook:function(){
+}});
+_GB_update=function(){
+if(GB_CURRENT){
+GB_CURRENT.update();
+}
+};
+_GB_setOverlayDimension=function(){
+if(GB_CURRENT){
+GB_CURRENT.setOverlayDimension();
+}
+};
+AJS.preloadImages(GB_ROOT_DIR+"indicator.gif");
+script_loaded=true;
+var GB_SETS={};
+function decoGreyboxLinks(){
+var as=AJS.$bytc("a");
+AJS.map(as,function(a){
+if(a.getAttribute("href")&&a.getAttribute("rel")){
+var rel=a.getAttribute("rel");
+if(rel.indexOf("gb_")==0){
+var _14=rel.match(/\w+/)[0];
+var _15=rel.match(/\[(.*)\]/)[1];
+var _16=0;
+var _17={"caption":a.title||"","url":a.href};
+if(_14=="gb_pageset"||_14=="gb_imageset"){
+if(!GB_SETS[_15]){
+GB_SETS[_15]=[];
+}
+GB_SETS[_15].push(_17);
+_16=GB_SETS[_15].length;
+}
+if(_14=="gb_pageset"){
+a.onclick=function(){
+GB_showFullScreenSet(GB_SETS[_15],_16);
+return false;
+};
+}
+if(_14=="gb_imageset"){
+a.onclick=function(){
+GB_showImageSet(GB_SETS[_15],_16);
+return false;
+};
+}
+if(_14=="gb_image"){
+a.onclick=function(){
+GB_showImage(_17.caption,_17.url);
+return false;
+};
+}
+if(_14=="gb_page"){
+a.onclick=function(){
+var sp=_15.split(/, ?/);
+GB_show(_17.caption,_17.url,parseInt(sp[1]),parseInt(sp[0]));
+return false;
+};
+}
+if(_14=="gb_page_fs"){
+a.onclick=function(){
+GB_showFullScreen(_17.caption,_17.url);
+return false;
+};
+}
+if(_14=="gb_page_center"){
+a.onclick=function(){
+var sp=_15.split(/, ?/);
+GB_showCenter(_17.caption,_17.url,parseInt(sp[1]),parseInt(sp[0]));
+return false;
+};
+}
+}
+}
+});
+}
+AJS.AEV(window,"load",decoGreyboxLinks);
+GB_showImage=function(_1a,url,_1c){
+var _1d={width:300,height:300,type:"image",fullscreen:false,center_win:true,caption:_1a,callback_fn:_1c};
+var win=new GB_Gallery(_1d);
+return win.show(url);
+};
+GB_showPage=function(_1f,url,_21){
+var _22={type:"page",caption:_1f,callback_fn:_21,fullscreen:true,center_win:false};
+var win=new GB_Gallery(_22);
+return win.show(url);
+};
+GB_Gallery=GreyBox.extend({init:function(_24){
+this.parent({});
+this.img_close=this.root_dir+"g_close.gif";
+AJS.update(this,_24);
+this.addCallback(this.callback_fn);
+},initHook:function(){
+AJS.addClass(this.g_window,"GB_Gallery");
+var _25=AJS.DIV({"class":"inner"});
+this.header=AJS.DIV({"class":"GB_header"},_25);
+AJS.setOpacity(this.header,0);
+AJS.getBody().insertBefore(this.header,this.overlay.nextSibling);
+var _26=AJS.TD({"id":"GB_caption","class":"caption","width":"40%"},this.caption);
+var _27=AJS.TD({"id":"GB_middle","class":"middle","width":"20%"});
+var _28=AJS.IMG({"src":this.img_close});
+AJS.AEV(_28,"click",GB_hide);
+var _29=AJS.TD({"class":"close","width":"40%"},_28);
+var _2a=AJS.TBODY(AJS.TR(_26,_27,_29));
+var _2b=AJS.TABLE({"cellspacing":"0","cellpadding":0,"border":0},_2a);
+AJS.ACN(_25,_2b);
+if(this.fullscreen){
+AJS.AEV(window,"scroll",AJS.$b(this.setWindowPosition,this));
+}else{
+AJS.AEV(window,"scroll",AJS.$b(this._setHeaderPos,this));
+}
+},setFrameSize:function(){
+var _2c=this.overlay.offsetWidth;
+var _2d=AJS.getWindowSize();
+if(this.fullscreen){
+this.width=_2c-40;
+this.height=_2d.h-80;
+}
+AJS.setWidth(this.iframe,this.width);
+AJS.setHeight(this.iframe,this.height);
+AJS.setWidth(this.header,_2c);
+},_setHeaderPos:function(){
+AJS.setTop(this.header,AJS.getScrollTop()+10);
+},setWindowPosition:function(){
+var _2e=this.overlay.offsetWidth;
+var _2f=AJS.getWindowSize();
+AJS.setLeft(this.g_window,((_2e-50-this.width)/2));
+var _30=AJS.getScrollTop()+55;
+if(!this.center_win){
+AJS.setTop(this.g_window,_30);
+}else{
+var fl=((_2f.h-this.height)/2)+20+AJS.getScrollTop();
+if(fl<0){
+fl=0;
+}
+if(_30>fl){
+fl=_30;
+}
+AJS.setTop(this.g_window,fl);
+}
+this._setHeaderPos();
+},onHide:function(){
+AJS.removeElement(this.header);
+AJS.removeClass(this.g_window,"GB_Gallery");
+},onShow:function(){
+if(this.use_fx){
+AJS.fx.fadeIn(this.header,{to:1});
+}else{
+AJS.setOpacity(this.header,1);
+}
+}});
+AJS.preloadImages(GB_ROOT_DIR+"g_close.gif");
+GB_showFullScreenSet=function(set,_33,_34){
+var _35={type:"page",fullscreen:true,center_win:false};
+var _36=new GB_Sets(_35,set);
+_36.addCallback(_34);
+_36.showSet(_33-1);
+return false;
+};
+GB_showImageSet=function(set,_38,_39){
+var _3a={type:"image",fullscreen:false,center_win:true,width:300,height:300};
+var _3b=new GB_Sets(_3a,set);
+_3b.addCallback(_39);
+_3b.showSet(_38-1);
+return false;
+};
+GB_Sets=GB_Gallery.extend({init:function(_3c,set){
+this.parent(_3c);
+if(!this.img_next){
+this.img_next=this.root_dir+"next.gif";
+}
+if(!this.img_prev){
+this.img_prev=this.root_dir+"prev.gif";
+}
+this.current_set=set;
+},showSet:function(_3e){
+this.current_index=_3e;
+var _3f=this.current_set[this.current_index];
+this.show(_3f.url);
+this._setCaption(_3f.caption);
+this.btn_prev=AJS.IMG({"class":"left",src:this.img_prev});
+this.btn_next=AJS.IMG({"class":"right",src:this.img_next});
+AJS.AEV(this.btn_prev,"click",AJS.$b(this.switchPrev,this));
+AJS.AEV(this.btn_next,"click",AJS.$b(this.switchNext,this));
+GB_STATUS=AJS.SPAN({"class":"GB_navStatus"});
+AJS.ACN(AJS.$("GB_middle"),this.btn_prev,GB_STATUS,this.btn_next);
+this.updateStatus();
+},updateStatus:function(){
+AJS.setHTML(GB_STATUS,(this.current_index+1)+" / "+this.current_set.length);
+if(this.current_index==0){
+AJS.addClass(this.btn_prev,"disabled");
+}else{
+AJS.removeClass(this.btn_prev,"disabled");
+}
+if(this.current_index==this.current_set.length-1){
+AJS.addClass(this.btn_next,"disabled");
+}else{
+AJS.removeClass(this.btn_next,"disabled");
+}
+},_setCaption:function(_40){
+AJS.setHTML(AJS.$("GB_caption"),_40);
+},updateFrame:function(){
+var _41=this.current_set[this.current_index];
+this._setCaption(_41.caption);
+this.url=_41.url;
+this.startLoading();
+},switchPrev:function(){
+if(this.current_index!=0){
+this.current_index--;
+this.updateFrame();
+this.updateStatus();
+}
+},switchNext:function(){
+if(this.current_index!=this.current_set.length-1){
+this.current_index++;
+this.updateFrame();
+this.updateStatus();
+}
+}});
+AJS.AEV(window,"load",function(){
+AJS.preloadImages(GB_ROOT_DIR+"next.gif",GB_ROOT_DIR+"prev.gif");
+});
+GB_show=function(_42,url,_44,_45,_46){
+var _47={caption:_42,height:_44||500,width:_45||500,fullscreen:false,callback_fn:_46};
+var win=new GB_Window(_47);
+return win.show(url);
+};
+GB_showCenter=function(_49,url,_4b,_4c,_4d){
+var _4e={caption:_49,center_win:true,height:_4b||500,width:_4c||500,fullscreen:false,callback_fn:_4d};
+var win=new GB_Window(_4e);
+return win.show(url);
+};
+GB_showFullScreen=function(_50,url,_52){
+var _53={caption:_50,fullscreen:true,callback_fn:_52};
+var win=new GB_Window(_53);
+return win.show(url);
+};
+GB_Window=GreyBox.extend({init:function(_55){
+this.parent({});
+this.img_header=this.root_dir+"header_bg.gif";
+this.img_close=this.root_dir+"w_close.gif";
+this.show_close_img=true;
+AJS.update(this,_55);
+this.addCallback(this.callback_fn);
+},initHook:function(){
+AJS.addClass(this.g_window,"GB_Window");
+this.header=AJS.TABLE({"class":"header"});
+this.header.style.backgroundImage="url("+this.img_header+")";
+var _56=AJS.TD({"class":"caption"},this.caption);
+var _57=AJS.TD({"class":"close"});
+if(this.show_close_img){
+var _58=AJS.IMG({"src":this.img_close});
+var _59=AJS.SPAN("Close");
+var btn=AJS.DIV(_58,_59);
+AJS.AEV([_58,_59],"mouseover",function(){
+AJS.addClass(_59,"on");
+});
+AJS.AEV([_58,_59],"mouseout",function(){
+AJS.removeClass(_59,"on");
+});
+AJS.AEV([_58,_59],"mousedown",function(){
+AJS.addClass(_59,"click");
+});
+AJS.AEV([_58,_59],"mouseup",function(){
+AJS.removeClass(_59,"click");
+});
+AJS.AEV([_58,_59],"click",GB_hide);
+AJS.ACN(_57,btn);
+}
+tbody_header=AJS.TBODY();
+AJS.ACN(tbody_header,AJS.TR(_56,_57));
+AJS.ACN(this.header,tbody_header);
+AJS.ACN(this.top_cnt,this.header);
+if(this.fullscreen){
+AJS.AEV(window,"scroll",AJS.$b(this.setWindowPosition,this));
+}
+},setFrameSize:function(){
+if(this.fullscreen){
+var _5b=AJS.getWindowSize();
+overlay_h=_5b.h;
+this.width=Math.round(this.overlay.offsetWidth-(this.overlay.offsetWidth/100)*10);
+this.height=Math.round(overlay_h-(overlay_h/100)*10);
+}
+AJS.setWidth(this.header,this.width+6);
+AJS.setWidth(this.iframe,this.width);
+AJS.setHeight(this.iframe,this.height);
+},setWindowPosition:function(){
+var _5c=AJS.getWindowSize();
+AJS.setLeft(this.g_window,((_5c.w-this.width)/2)-13);
+if(!this.center_win){
+AJS.setTop(this.g_window,AJS.getScrollTop());
+}else{
+var fl=((_5c.h-this.height)/2)-20+AJS.getScrollTop();
+if(fl<0){
+fl=0;
+}
+AJS.setTop(this.g_window,fl);
+}
+}});
+AJS.preloadImages(GB_ROOT_DIR+"w_close.gif",GB_ROOT_DIR+"header_bg.gif");
+
+
+script_loaded=true;
\ No newline at end of file
--- /dev/null
+/* Last-Modified: 28/06/06 00:08:22 */
+#GB_overlay {
+ background-color: #000;
+ position: absolute;
+ margin: auto;
+ top: 0;
+ left: 0;
+ z-index: 100;
+}
+
+#GB_window {
+ left: 0;
+ top: 0;
+ font-size: 1px;
+ position: absolute;
+ overflow: visible;
+ z-index: 150;
+}
+
+#GB_window .content {
+ width: auto;
+ margin: 0;
+ padding: 0;
+}
+
+#GB_frame {
+ border: 0;
+ margin: 0;
+ padding: 0;
+ overflow: auto;
+ white-space: nowrap;
+}
+
+
+.GB_Gallery {
+ margin: 0 22px 0 22px;
+}
+
+.GB_Gallery .content {
+ background-color: #fff;
+ border: 3px solid #ddd;
+}
+
+.GB_header {
+ top: 10px;
+ left: 0;
+ margin: 0;
+ z-index: 500;
+ position: absolute;
+ border-bottom: 2px solid #555;
+ border-top: 2px solid #555;
+}
+
+.GB_header .inner {
+ background-color: #333;
+ font-family: Arial, Verdana, sans-serif;
+ padding: 2px 20px 2px 20px;
+}
+
+.GB_header table {
+ margin: 0;
+ width: 100%;
+ border-collapse: separate;
+ border-right: 0px;
+ border-top: 0px;
+}
+
+.GB_header td {
+ background-color: #333333;
+ border-bottom: 0px;
+ border-left: 0px;
+ padding: 0em 0em;
+}
+
+.GB_header .caption {
+ text-align: left;
+ color: #eee;
+ white-space: nowrap;
+ font-size: 20px;
+ border-collapse: separate;
+}
+
+.GB_header .close {
+ text-align: right;
+}
+
+.GB_header .close img {
+ z-index: 500;
+ cursor: pointer;
+}
+
+.GB_header .middle {
+ white-space: nowrap;
+ text-align: center;
+}
+
+
+#GB_middle {
+ color: #eee;
+}
+
+#GB_middle img {
+ cursor: pointer;
+ vertical-align: middle;
+}
+
+#GB_middle .disabled {
+ cursor: default;
+}
+
+#GB_middle .left {
+ padding-right: 10px;
+}
+
+#GB_middle .right {
+ padding-left: 10px;
+}
+
+
+.GB_Window .content {
+ background-color: #fff;
+ border: 3px solid #ccc;
+ border-top: none;
+}
+
+.GB_Window .header {
+ border-bottom: 1px solid #aaa;
+ border-top: 1px solid #999;
+ border-left: 3px solid #ccc;
+ border-right: 3px solid #ccc;
+ margin: 0;
+
+ height: 22px;
+ font-size: 12px;
+ padding: 3px 0;
+ color: #333;
+}
+
+.GB_Window .caption {
+ font-size: 12px;
+ text-align: left;
+ font-weight: bold;
+ white-space: nowrap;
+ padding-right: 20px;
+}
+
+.GB_Window .close { text-align: right; }
+.GB_Window .close span {
+ font-size: 12px;
+ cursor: pointer;
+}
+.GB_Window .close img {
+ cursor: pointer;
+ padding: 0 3px 0 0;
+}
+
+.GB_Window .on { border-bottom: 1px solid #333; }
+.GB_Window .click { border-bottom: 1px solid red; }
--- /dev/null
+<!--
+Notice: I feel so dirty doing this, but its the only way to make it cross browser.
+-->
+<html>
+<head>
+ <script>
+ var GB = parent.GB_CURRENT;
+ document.write('<script type="text/javascript" src="AJS.js"><\/script>');
+ if(GB.use_fx) {
+ document.write('<script type="text/javascript" src="AJS_fx.js"><\/script>');
+ }
+ </script>
+ <style>
+ body {
+ padding: 0;
+ margin: 0;
+ overflow: hidden;
+ }
+
+ #GB_frame {
+ visibility: hidden;
+ width: 100%;
+ height: 100%;
+ }
+
+ #loading {
+ padding-top: 50px;
+ position: absolute;
+ width: 100%;
+ top: 0;
+ text-align: center;
+ vertical-align: middle;
+ }
+ </style>
+</head>
+<body>
+
+<div id="loading">
+ <img src="indicator.gif">
+</div>
+
+<script>
+var loading = AJS.$('loading');
+var gb_type = GB.type;
+var gb_url = GB.url;
+
+//Start loading in the iframe
+if(gb_type == "page") {
+ document.write('<iframe id="GB_frame" src="' + gb_url + '" frameborder="0"></iframe>');
+}
+else {
+ var img_holder = new Image();
+ img_holder.src = gb_url;
+ document.write('<img id="GB_frame" src="' + gb_url + '">');
+}
+var frame = AJS.$('GB_frame');
+</script>
+
+</body>
+<script>
+function setupOuterGB() {
+ frame.style.visibility = 'visible';
+ GB.setFrameSize();
+ GB.setWindowPosition();
+}
+
+function loaded() {
+ AJS.removeElement(loading);
+
+ GB.overlay.innerHTML += " "; //Safari bugfix
+
+ if(gb_type == "image") {
+ if(img_holder.width != 0 && img_holder.height != 0) {
+ var width = img_holder.width;
+ var height = img_holder.height;
+
+ GB.width = width;
+ GB.height = height;
+
+ setupOuterGB();
+
+ if(GB.use_fx) {
+ AJS.setOpacity(frame, 0);
+ AJS.fx.fadeIn(frame);
+ }
+ }
+ }
+ else {
+ GB.width = frame.offsetWidth;
+ GB.height = frame.offsetHeight;
+ setupOuterGB();
+ }
+}
+
+if(GB.show_loading) {
+ AJS.AEV(window, 'load', function(e) {
+ loaded();
+ });
+}
+else {
+ loaded();
+}
+</script>
+</html>
-<script type="text/javascript">
- var GB_ROOT_DIR = "[% themelang %]/lib/greybox/";
+<script type="text/javascript">
+ var GB_ROOT_DIR = "[% interface %]/lib/greybox/";
</script>
-<script type="text/javascript" src="[% themelang %]/lib/greybox/AJS.js"></script>
-<script type="text/javascript" src="[% themelang %]/lib/greybox/AJS_fx.js"></script>
-<script type="text/javascript" src="[% themelang %]/lib/greybox/gb_scripts.js"></script>
-<link href="[% themelang %]/lib/greybox/gb_styles.css" rel="stylesheet" type="text/css" />
+<script type="text/javascript" src="[% interface %]/lib/greybox/AJS.js"></script>
+<script type="text/javascript" src="[% interface %]/lib/greybox/AJS_fx.js"></script>
+<script type="text/javascript" src="[% interface %]/lib/greybox/gb_scripts.js"></script>
+<link href="[% interface %]/lib/greybox/gb_styles.css" rel="stylesheet" type="text/css" />
+++ /dev/null
-AJS={BASE_URL:"",drag_obj:null,drag_elm:null,_drop_zones:[],_cur_pos:null,join:function(_1,_2){
-try{
-return _2.join(_1);
-}
-catch(e){
-var r=_2[0]||"";
-AJS.map(_2,function(_4){
-r+=_1+_4;
-},1);
-return r+"";
-}
-},getScrollTop:function(){
-var t;
-if(document.documentElement&&document.documentElement.scrollTop){
-t=document.documentElement.scrollTop;
-}else{
-if(document.body){
-t=document.body.scrollTop;
-}
-}
-return t;
-},addClass:function(){
-var _6=AJS.forceArray(arguments);
-var _7=_6.pop();
-var _8=function(o){
-if(!new RegExp("(^|\\s)"+_7+"(\\s|$)").test(o.className)){
-o.className+=(o.className?" ":"")+_7;
-}
-};
-AJS.map(_6,function(_a){
-_8(_a);
-});
-},setStyle:function(){
-var _b=AJS.forceArray(arguments);
-var _c=_b.pop();
-var _d=_b.pop();
-AJS.map(_b,function(_e){
-_e.style[_d]=AJS.getCssDim(_c);
-});
-},_getRealScope:function(fn,_10,_11,_12){
-var _13=window;
-_10=AJS.$A(_10);
-if(fn._cscope){
-_13=fn._cscope;
-}
-return function(){
-var _14=[];
-var i=0;
-if(_11){
-i=1;
-}
-AJS.map(arguments,function(arg){
-_14.push(arg);
-},i);
-_14=_14.concat(_10);
-if(_12){
-_14=_14.reverse();
-}
-return fn.apply(_13,_14);
-};
-},preloadImages:function(){
-AJS.AEV(window,"load",AJS.$p(function(_17){
-AJS.map(_17,function(src){
-var pic=new Image();
-pic.src=src;
-});
-},arguments));
-},_createDomShortcuts:function(){
-var _1a=["ul","li","td","tr","th","tbody","table","input","span","b","a","div","img","button","h1","h2","h3","br","textarea","form","p","select","option","iframe","script","center","dl","dt","dd","small","pre"];
-var _1b=function(elm){
-var _1d="return AJS.createDOM.apply(null, ['"+elm+"', arguments]);";
-var _1e="function() { "+_1d+" }";
-eval("AJS."+elm.toUpperCase()+"="+_1e);
-};
-AJS.map(_1a,_1b);
-AJS.TN=function(_1f){
-return document.createTextNode(_1f);
-};
-},documentInsert:function(elm){
-if(typeof (elm)=="string"){
-elm=AJS.HTML2DOM(elm);
-}
-document.write("<span id=\"dummy_holder\"></span>");
-AJS.swapDOM(AJS.$("dummy_holder"),elm);
-},getWindowSize:function(doc){
-doc=doc||document;
-var _22,_23;
-if(self.innerHeight){
-_22=self.innerWidth;
-_23=self.innerHeight;
-}else{
-if(doc.documentElement&&doc.documentElement.clientHeight){
-_22=doc.documentElement.clientWidth;
-_23=doc.documentElement.clientHeight;
-}else{
-if(doc.body){
-_22=doc.body.clientWidth;
-_23=doc.body.clientHeight;
-}
-}
-}
-return {"w":_22,"h":_23};
-},flattenList:function(_24){
-var r=[];
-var _26=function(r,l){
-AJS.map(l,function(o){
-if(o==null){
-}else{
-if(AJS.isArray(o)){
-_26(r,o);
-}else{
-r.push(o);
-}
-}
-});
-};
-_26(r,_24);
-return r;
-},setEventKey:function(e){
-e.key=e.keyCode?e.keyCode:e.charCode;
-if(window.event){
-e.ctrl=window.event.ctrlKey;
-e.shift=window.event.shiftKey;
-}else{
-e.ctrl=e.ctrlKey;
-e.shift=e.shiftKey;
-}
-switch(e.key){
-case 63232:
-e.key=38;
-break;
-case 63233:
-e.key=40;
-break;
-case 63235:
-e.key=39;
-break;
-case 63234:
-e.key=37;
-break;
-}
-},removeElement:function(){
-var _2b=AJS.forceArray(arguments);
-AJS.map(_2b,function(elm){
-AJS.swapDOM(elm,null);
-});
-},_unloadListeners:function(){
-if(AJS.listeners){
-AJS.map(AJS.listeners,function(elm,_2e,fn){
-AJS.REV(elm,_2e,fn);
-});
-}
-AJS.listeners=[];
-},partial:function(fn){
-var _31=AJS.forceArray(arguments);
-return AJS.$b(fn,null,_31.slice(1,_31.length).reverse(),false,true);
-},getIndex:function(elm,_33,_34){
-for(var i=0;i<_33.length;i++){
-if(_34&&_34(_33[i])||elm==_33[i]){
-return i;
-}
-}
-return -1;
-},isDefined:function(o){
-return (o!="undefined"&&o!=null);
-},isArray:function(obj){
-return obj instanceof Array;
-},setLeft:function(){
-var _38=AJS.forceArray(arguments);
-_38.splice(_38.length-1,0,"left");
-AJS.setStyle.apply(null,_38);
-},appendChildNodes:function(elm){
-if(arguments.length>=2){
-AJS.map(arguments,function(n){
-if(AJS.isString(n)){
-n=AJS.TN(n);
-}
-if(AJS.isDefined(n)){
-elm.appendChild(n);
-}
-},1);
-}
-return elm;
-},isOpera:function(){
-return (navigator.userAgent.toLowerCase().indexOf("opera")!=-1);
-},isString:function(obj){
-return (typeof obj=="string");
-},hideElement:function(elm){
-var _3d=AJS.forceArray(arguments);
-AJS.map(_3d,function(elm){
-elm.style.display="none";
-});
-},setOpacity:function(elm,p){
-elm.style.opacity=p;
-elm.style.filter="alpha(opacity="+p*100+")";
-},setHeight:function(){
-var _41=AJS.forceArray(arguments);
-_41.splice(_41.length-1,0,"height");
-AJS.setStyle.apply(null,_41);
-},setWidth:function(){
-var _42=AJS.forceArray(arguments);
-_42.splice(_42.length-1,0,"width");
-AJS.setStyle.apply(null,_42);
-},createArray:function(v){
-if(AJS.isArray(v)&&!AJS.isString(v)){
-return v;
-}else{
-if(!v){
-return [];
-}else{
-return [v];
-}
-}
-},isDict:function(o){
-var _45=String(o);
-return _45.indexOf(" Object")!=-1;
-},isMozilla:function(){
-return (navigator.userAgent.toLowerCase().indexOf("gecko")!=-1&&navigator.productSub>=20030210);
-},_listenOnce:function(elm,_47,fn){
-var _49=function(){
-AJS.removeEventListener(elm,_47,_49);
-fn(arguments);
-};
-return _49;
-},addEventListener:function(elm,_4b,fn,_4d,_4e){
-if(!_4e){
-_4e=false;
-}
-var _4f=AJS.$A(elm);
-AJS.map(_4f,function(_50){
-if(_4d){
-fn=AJS._listenOnce(_50,_4b,fn);
-}
-if(AJS.isIn(_4b,["submit","load","scroll","resize"])){
-var old=elm["on"+_4b];
-elm["on"+_4b]=function(){
-if(old){
-fn(arguments);
-return old(arguments);
-}else{
-return fn(arguments);
-}
-};
-return;
-}
-if(AJS.isIn(_4b,["keypress","keydown","keyup","click"])){
-var _52=fn;
-fn=function(e){
-AJS.setEventKey(e);
-return _52.apply(null,arguments);
-};
-}
-if(_50.attachEvent){
-_50.attachEvent("on"+_4b,fn);
-}else{
-if(_50.addEventListener){
-_50.addEventListener(_4b,fn,_4e);
-}
-}
-AJS.listeners=AJS.$A(AJS.listeners);
-AJS.listeners.push([_50,_4b,fn]);
-});
-},createDOM:function(_54,_55){
-var i=0,_57;
-elm=document.createElement(_54);
-if(AJS.isDict(_55[i])){
-for(k in _55[0]){
-_57=_55[0][k];
-if(k=="style"){
-elm.style.cssText=_57;
-}else{
-if(k=="class"||k=="className"){
-elm.className=_57;
-}else{
-elm.setAttribute(k,_57);
-}
-}
-}
-i++;
-}
-if(_55[0]==null){
-i=1;
-}
-AJS.map(_55,function(n){
-if(n){
-if(AJS.isString(n)||AJS.isNumber(n)){
-n=AJS.TN(n);
-}
-elm.appendChild(n);
-}
-},i);
-return elm;
-},setTop:function(){
-var _59=AJS.forceArray(arguments);
-_59.splice(_59.length-1,0,"top");
-AJS.setStyle.apply(null,_59);
-},getElementsByTagAndClassName:function(_5a,_5b,_5c){
-var _5d=[];
-if(!AJS.isDefined(_5c)){
-_5c=document;
-}
-if(!AJS.isDefined(_5a)){
-_5a="*";
-}
-var els=_5c.getElementsByTagName(_5a);
-var _5f=els.length;
-var _60=new RegExp("(^|\\s)"+_5b+"(\\s|$)");
-for(i=0,j=0;i<_5f;i++){
-if(_60.test(els[i].className)||_5b==null){
-_5d[j]=els[i];
-j++;
-}
-}
-return _5d;
-},removeClass:function(){
-var _61=AJS.forceArray(arguments);
-var cls=_61.pop();
-var _63=function(o){
-o.className=o.className.replace(new RegExp("\\s?"+cls,"g"),"");
-};
-AJS.map(_61,function(elm){
-_63(elm);
-});
-},bindMethods:function(_66){
-for(var k in _66){
-var _68=_66[k];
-if(typeof (_68)=="function"){
-_66[k]=AJS.$b(_68,_66);
-}
-}
-},log:function(o){
-if(AJS.isMozilla()){
-console.log(o);
-}else{
-var div=AJS.DIV({"style":"color: green"});
-AJS.ACN(AJS.getBody(),AJS.setHTML(div,""+o));
-}
-},isNumber:function(obj){
-return (typeof obj=="number");
-},map:function(_6c,fn,_6e,_6f){
-var i=0,l=_6c.length;
-if(_6e){
-i=_6e;
-}
-if(_6f){
-l=_6f;
-}
-for(i;i<l;i++){
-fn.apply(null,[_6c[i],i]);
-}
-},removeEventListener:function(elm,_73,fn,_75){
-if(!_75){
-_75=false;
-}
-if(elm.removeEventListener){
-elm.removeEventListener(_73,fn,_75);
-if(AJS.isOpera()){
-elm.removeEventListener(_73,fn,!_75);
-}
-}else{
-if(elm.detachEvent){
-elm.detachEvent("on"+_73,fn);
-}
-}
-},getCssDim:function(dim){
-if(AJS.isString(dim)){
-return dim;
-}else{
-return dim+"px";
-}
-},setHTML:function(elm,_78){
-elm.innerHTML=_78;
-return elm;
-},bind:function(fn,_7a,_7b,_7c,_7d){
-fn._cscope=_7a;
-return AJS._getRealScope(fn,_7b,_7c,_7d);
-},forceArray:function(_7e){
-var r=[];
-AJS.map(_7e,function(elm){
-r.push(elm);
-});
-return r;
-},update:function(l1,l2){
-for(var i in l2){
-l1[i]=l2[i];
-}
-return l1;
-},getBody:function(){
-return AJS.$bytc("body")[0];
-},HTML2DOM:function(_84,_85){
-var d=AJS.DIV();
-d.innerHTML=_84;
-if(_85){
-return d.childNodes[0];
-}else{
-return d;
-}
-},getElement:function(id){
-if(AJS.isString(id)||AJS.isNumber(id)){
-return document.getElementById(id);
-}else{
-return id;
-}
-},showElement:function(){
-var _88=AJS.forceArray(arguments);
-AJS.map(_88,function(elm){
-elm.style.display="";
-});
-},swapDOM:function(_8a,src){
-_8a=AJS.getElement(_8a);
-var _8c=_8a.parentNode;
-if(src){
-src=AJS.getElement(src);
-_8c.replaceChild(src,_8a);
-}else{
-_8c.removeChild(_8a);
-}
-return src;
-},isIn:function(elm,_8e){
-var i=AJS.getIndex(elm,_8e);
-if(i!=-1){
-return true;
-}else{
-return false;
-}
-}};
-AJS.$=AJS.getElement;
-AJS.$$=AJS.getElements;
-AJS.$f=AJS.getFormElement;
-AJS.$p=AJS.partial;
-AJS.$b=AJS.bind;
-AJS.$A=AJS.createArray;
-AJS.DI=AJS.documentInsert;
-AJS.ACN=AJS.appendChildNodes;
-AJS.RCN=AJS.replaceChildNodes;
-AJS.AEV=AJS.addEventListener;
-AJS.REV=AJS.removeEventListener;
-AJS.$bytc=AJS.getElementsByTagAndClassName;
-AJS.addEventListener(window,"unload",AJS._unloadListeners);
-AJS._createDomShortcuts();
-AJS.Class=function(_90){
-var fn=function(){
-if(arguments[0]!="no_init"){
-return this.init.apply(this,arguments);
-}
-};
-fn.prototype=_90;
-AJS.update(fn,AJS.Class.prototype);
-return fn;
-};
-AJS.Class.prototype={extend:function(_92){
-var _93=new this("no_init");
-for(k in _92){
-var _94=_93[k];
-var cur=_92[k];
-if(_94&&_94!=cur&&typeof cur=="function"){
-cur=this._parentize(cur,_94);
-}
-_93[k]=cur;
-}
-return new AJS.Class(_93);
-},implement:function(_96){
-AJS.update(this.prototype,_96);
-},_parentize:function(cur,_98){
-return function(){
-this.parent=_98;
-return cur.apply(this,arguments);
-};
-}};
-AJS.$=AJS.getElement;
-AJS.$$=AJS.getElements;
-AJS.$f=AJS.getFormElement;
-AJS.$b=AJS.bind;
-AJS.$p=AJS.partial;
-AJS.$FA=AJS.forceArray;
-AJS.$A=AJS.createArray;
-AJS.DI=AJS.documentInsert;
-AJS.ACN=AJS.appendChildNodes;
-AJS.RCN=AJS.replaceChildNodes;
-AJS.AEV=AJS.addEventListener;
-AJS.REV=AJS.removeEventListener;
-AJS.$bytc=AJS.getElementsByTagAndClassName;
-AJSDeferred=function(req){
-this.callbacks=[];
-this.errbacks=[];
-this.req=req;
-};
-AJSDeferred.prototype={excCallbackSeq:function(req,_9b){
-var _9c=req.responseText;
-while(_9b.length>0){
-var fn=_9b.pop();
-var _9e=fn(_9c,req);
-if(_9e){
-_9c=_9e;
-}
-}
-},callback:function(){
-this.excCallbackSeq(this.req,this.callbacks);
-},errback:function(){
-if(this.errbacks.length==0){
-alert("Error encountered:\n"+this.req.responseText);
-}
-this.excCallbackSeq(this.req,this.errbacks);
-},addErrback:function(fn){
-this.errbacks.unshift(fn);
-},addCallback:function(fn){
-this.callbacks.unshift(fn);
-},addCallbacks:function(fn1,fn2){
-this.addCallback(fn1);
-this.addErrback(fn2);
-},sendReq:function(_a3){
-if(AJS.isObject(_a3)){
-this.req.send(AJS.queryArguments(_a3));
-}else{
-if(AJS.isDefined(_a3)){
-this.req.send(_a3);
-}else{
-this.req.send("");
-}
-}
-}};
-script_loaded=true;
-
-
-script_loaded=true;
\ No newline at end of file
+++ /dev/null
-AJS.fx={_shades:{0:"ffffff",1:"ffffee",2:"ffffdd",3:"ffffcc",4:"ffffbb",5:"ffffaa",6:"ffff99"},highlight:function(_1,_2){
-var _3=new AJS.fx.Base();
-_3.elm=AJS.$(_1);
-_3.setOptions(_2);
-_3.options.duration=600;
-AJS.update(_3,{increase:function(){
-if(this.now==7){
-_1.style.backgroundColor="transparent";
-}else{
-_1.style.backgroundColor="#"+AJS.fx._shades[Math.floor(this.now)];
-}
-}});
-return _3.custom(6,0);
-},fadeIn:function(_4,_5){
-_5=_5||{};
-if(!_5.from){
-_5.from=0;
-AJS.setOpacity(_4,0);
-}
-if(!_5.to){
-_5.to=1;
-}
-var s=new AJS.fx.Style(_4,"opacity",_5);
-return s.custom(_5.from,_5.to);
-},fadeOut:function(_7,_8){
-_8=_8||{};
-if(!_8.from){
-_8.from=1;
-}
-if(!_8.to){
-_8.to=0;
-}
-_8.duration=300;
-var s=new AJS.fx.Style(_7,"opacity",_8);
-return s.custom(_8.from,_8.to);
-},setWidth:function(_a,_b){
-var s=new AJS.fx.Style(_a,"width",_b);
-return s.custom(_b.from,_b.to);
-},setHeight:function(_d,_e){
-var s=new AJS.fx.Style(_d,"height",_e);
-return s.custom(_e.from,_e.to);
-}};
-AJS.fx.Base=new AJS.Class({init:function(){
-AJS.bindMethods(this);
-},setOptions:function(_10){
-this.options=AJS.update({onStart:function(){
-},onComplete:function(){
-},transition:AJS.fx.Transitions.sineInOut,duration:500,wait:true,fps:50},_10||{});
-},step:function(){
-var _11=new Date().getTime();
-if(_11<this.time+this.options.duration){
-this.cTime=_11-this.time;
-this.setNow();
-}else{
-setTimeout(AJS.$b(this.options.onComplete,this,[this.elm]),10);
-this.clearTimer();
-this.now=this.to;
-}
-this.increase();
-},setNow:function(){
-this.now=this.compute(this.from,this.to);
-},compute:function(_12,to){
-var _14=to-_12;
-return this.options.transition(this.cTime,_12,_14,this.options.duration);
-},clearTimer:function(){
-clearInterval(this.timer);
-this.timer=null;
-return this;
-},_start:function(_15,to){
-if(!this.options.wait){
-this.clearTimer();
-}
-if(this.timer){
-return;
-}
-setTimeout(AJS.$p(this.options.onStart,this.elm),10);
-this.from=_15;
-this.to=to;
-this.time=new Date().getTime();
-this.timer=setInterval(this.step,Math.round(1000/this.options.fps));
-return this;
-},custom:function(_17,to){
-return this._start(_17,to);
-},set:function(to){
-this.now=to;
-this.increase();
-return this;
-},setStyle:function(elm,_1b,val){
-if(this.property=="opacity"){
-AJS.setOpacity(elm,val);
-}else{
-AJS.setStyle(elm,_1b,val);
-}
-}});
-AJS.fx.Style=AJS.fx.Base.extend({init:function(elm,_1e,_1f){
-this.parent();
-this.elm=elm;
-this.setOptions(_1f);
-this.property=_1e;
-},increase:function(){
-this.setStyle(this.elm,this.property,this.now);
-}});
-AJS.fx.Styles=AJS.fx.Base.extend({init:function(elm,_21){
-this.parent();
-this.elm=AJS.$(elm);
-this.setOptions(_21);
-this.now={};
-},setNow:function(){
-for(p in this.from){
-this.now[p]=this.compute(this.from[p],this.to[p]);
-}
-},custom:function(obj){
-if(this.timer&&this.options.wait){
-return;
-}
-var _23={};
-var to={};
-for(p in obj){
-_23[p]=obj[p][0];
-to[p]=obj[p][1];
-}
-return this._start(_23,to);
-},increase:function(){
-for(var p in this.now){
-this.setStyle(this.elm,p,this.now[p]);
-}
-}});
-AJS.fx.Transitions={linear:function(t,b,c,d){
-return c*t/d+b;
-},sineInOut:function(t,b,c,d){
-return -c/2*(Math.cos(Math.PI*t/d)-1)+b;
-}};
-script_loaded=true;
-
-
-script_loaded=true;
\ No newline at end of file
+++ /dev/null
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-\f
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard. To achieve this, non-free programs must be
-allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-\f
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-\f
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-\f
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-\f
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-\f
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-\f
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded. In such case, this License incorporates the limitation as if
-written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-\f
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-\f
- How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
- To apply these terms, attach the following notices to the library. It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
- <one line to give the library's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
-
-
+++ /dev/null
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
-<head>
- <title>GreyBox - About</title>
-
- <script type="text/javascript">
- var GB_ROOT_DIR = "./greybox/";
- </script>
-
- <script type="text/javascript" src="greybox/AJS.js"></script>
- <script type="text/javascript" src="greybox/AJS_fx.js"></script>
- <script type="text/javascript" src="greybox/gb_scripts.js"></script>
- <link href="greybox/gb_styles.css" rel="stylesheet" type="text/css" media="all" />
-
- <script type="text/javascript" src="static_files/help.js"></script>
- <link href="static_files/help.css" rel="stylesheet" type="text/css" media="all" />
-</head>
-
-<body>
-
-<script>
- insertHeader();
- insertMenu('about');
-</script>
-
-<p>
-GreyBox is copyrighted work by <a href="http://amix.dk/">Amir Salihefendic</a>.
-</p>
-
-<p>
-It is based on <a href="http://orangoo.com/labs/AJS/">AJS</a> JavaScript library.
-</p>
-
-<p>
-It is realesed under <a href="LGPL.txt">LGPL</a>.
-</p>
-
-<h3>Links</h3>
-<ul>
- <li> <a href="http://orangoo.com/labs/GreyBox/">GreyBox official site</a> </li>
-</ul>
-
-<h3>Need help?</h3>
-<ul>
- <li><a href="http://groups.google.com/group/greybox">GreyBox Google group</a> - A group where you can ask questions and get answers</li>
- <li><a href="http://orangoo.com/labs/GreyBox/FAQ/">GreyBox FAQ</a> -Frequently Asked Questions about GreyBox</li>
-</ul>
-
-</body>
-</html>
+++ /dev/null
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
-<head>
- <title>GreyBox - Advance usage</title>
-
- <script type="text/javascript">
- var GB_ROOT_DIR = "./greybox/";
- </script>
-
- <script type="text/javascript" src="greybox/AJS.js"></script>
- <script type="text/javascript" src="greybox/AJS_fx.js"></script>
- <script type="text/javascript" src="greybox/gb_scripts.js"></script>
- <link href="greybox/gb_styles.css" rel="stylesheet" type="text/css" media="all" />
-
- <script type="text/javascript" src="static_files/help.js"></script>
- <link href="static_files/help.css" rel="stylesheet" type="text/css" media="all" />
-</head>
-<body>
-
-<script>
-insertHeader();
-insertMenu('adv_usage');
-</script>
-
-<h2>Methods for showing windows</h2>
-
-<h3 class="first">GB_show</h3>
-
-<h4>Signature:</h4>
-<script>
-insertCode(
- 'GB_show(caption, url, /*optional*/ height, width, callback_fn)'
-);
-</script>
-
-<h4>Example:</h4>
-<script>
-insertCode(
- '<a href="http://google.com/" onclick="return GB_show(\'Google\', this.href)">Visit Google</a>'
-);
-</script>
-
-<h4>Example rendered:</h4>
-<a href="http://google.com/" onclick="return GB_show('Google', this.href)">Visit Google</a>
-
-
-<h3>GB_showCenter</h3>
-
-<h4>Signature:</h4>
-<script>
-insertCode(
- 'GB_showCenter(caption, url, /* optional */ height, width, callback_fn)'
-);
-</script>
-
-<h4>Example:</h4>
-<script>
-insertCode(
- '<a href="http://google.com/" onclick="return GB_showCenter(\'Google\', this.href)">Visit Google</a>'
-);
-</script>
-
-<h4>Example rendered:</h4>
-<a href="http://google.com/" onclick="return GB_showCenter('Google', this.href)">Visit Google</a>
-
-
-<h3>GB_showFullScreen</h3>
-
-<h4>Signature:</h4>
-<script>
-insertCode(
- 'GB_showFullScreen(caption, url, callback_fn)'
-);
-</script>
-
-<h4>Example:</h4>
-<script>
-insertCode(
- '<a href="http://google.com/" onclick="return GB_showFullScreen(\'Google\', this.href)">Visit Google</a>'
-);
-</script>
-
-<h4>Example rendered:</h4>
-<a href="http://google.com/" onclick="return GB_showFullScreen('Google', this.href)">Visit Google</a>
-
-<h2>Methods for showing overlays</h2>
-
-<h3 class="first">GB_showImage</h3>
-<h4>Signature:</h4>
-<script>
-insertCode(
- 'GB_showImage(caption, url, callback_fn)'
-);
-</script>
-
-<h4>Example:</h4>
-<script>
-insertCode(
- '<a href="http://static.flickr.com/119/294309231_a3d2a339b9.jpg"\n'+
- 'onclick="return GB_showImage(\'Flower\', this.href)">A flower in my hand</a>'
-);
-</script>
-
-<h4>Example rendered:</h4>
-<a href="http://static.flickr.com/119/294309231_a3d2a339b9.jpg" onclick="return GB_showImage('Flower', this.href)">A flower in my hand</a>
-
-<h3>GB_showPage</h3>
-<h4>Signature:</h4>
-<script>
-insertCode(
- 'GB_showPage(caption, url, callback_fn)'
-);
-</script>
-
-<h4>Example:</h4>
-<script>
-insertCode(
- '<a href="http://google.com" onclick="return GB_showPage(\'Google\', this.href)">Show Google in another layout</a>'
-);
-</script>
-
-<h4>Example rendered:</h4>
-<a href="http://google.com" onclick="return GB_showPage('Google', this.href)">Show Google in another layout</a>
-
-
-<h2>Methods for showing sets</h2>
-
-<h3 class="first">GB_showFullScreenSet</h3>
-<h4>Signature:</h4>
-<script>
-insertCode(
- 'GB_showFullScreenSet(set, start_index, callback_fn)'
-);
-</script>
-
-<h4>Example:</h4>
-<script>
-insertCode(
- "<script>",
- "var page_set = [{'caption': 'Google', 'url': 'http://google.com/'},",
- " {'caption': 'Yahoo', 'url': 'http://yahoo.com/'}];",
- "<\/script>",
- '<a href="#" onclick="return GB_showFullScreenSet(page_set, 1)">Show first page in page_set</a>'
-);
-</script>
-
-<h4>Example rendered:</h4>
-<script>
-var page_set = [{'caption': 'Google', 'url': 'http://google.com/'},
- {'caption': 'Yahoo', 'url': 'http://yahoo.com/'}];
-</script>
-<a href="#" onclick="return GB_showFullScreenSet(page_set, 1)">Show first page in page_set</a>
-
-<h3>GB_showImageSet</h3>
-<h4>Signature:</h4>
-<script>
-insertCode(
- 'GB_showImageSet(set, start_index, callback_fn)'
-);
-</script>
-
-<h4>Example:</h4>
-<script>
-insertCode(
- "<script>",
- "var image_set = [{'caption': 'Flower', 'url': 'http://static.flickr.com/119/294309231_a3d2a339b9.jpg'},",
- " {'caption': 'Nice waterfall', 'url': 'http://www.widerange.org/images/large/plitvicka.jpg'}];",
- "<\/script>",
- '<a href="#" onclick="return GB_showImageSet(image_set, 1)">Show first picture in image_set</a>'
-);
-</script>
-
-<h4>Example rendered:</h4>
-<script>
-var image_set = [{'caption': 'Flower', 'url': 'http://static.flickr.com/119/294309231_a3d2a339b9.jpg'},
- {'caption': 'Nice waterfall', 'url': 'http://www.widerange.org/images/large/plitvicka.jpg'}];
-</script>
-<a href="#" onclick="return GB_showImageSet(image_set, 1)">Show first picture in image_set</a>
-
-
-</body>
-</html>
+++ /dev/null
-#!/usr/bin/env python
-"""
-Used to combine the different parts of GreyBox.
-- Python 2.4 required
-- Java 1.4+ required
-- Dojo's JavaScript compressor (http://dojotoolkit.org/docs/compressor_system.html). Place it under compression_lib/custom_rhino.jar
-"""
-import os, sys, shutil
-from compression_lib import AJS_minify
-
-
-if __name__ == '__main__':
- args = sys.argv
-
- if len(args) < 2:
- print """
-Usage is:
- python combiner.py [full|gallery|window]
-Example usage:
- python combiner.py full
-The files will be store in greybox_dist/* depending on the dist. type
-"""
- sys.exit(0)
-
- type = args[1]
- output_dir = 'greybox'
-
- ##
- # Config file list
- #
- js = []
- css = []
- static = []
-
- append = lambda l, x: l.append('greybox_source/%s' % x)
-
- def appendBase():
- append(js, 'base/base.js')
- append(js, 'auto_deco.js')
- append(css, 'base/base.css')
- append(static, 'base/indicator.gif')
- append(static, 'base/loader_frame.html')
-
- def appendSet():
- append(js, 'set/set.js')
- append(css, 'set/set.css')
- append(static, 'set/next.gif')
- append(static, 'set/prev.gif')
-
- def appendGallery():
- append(js, 'gallery/gallery.js')
- append(css, 'gallery/gallery.css')
- append(static, 'gallery/g_close.gif')
-
- def appendWindow():
- append(js, 'window/window.js')
- append(css, 'window/window.css')
- append(static, 'window/header_bg.gif')
- append(static, 'window/w_close.gif')
-
- appendBase()
-
- if type == 'full':
- appendGallery()
- appendSet()
- appendWindow()
- elif type == 'gallery':
- appendGallery()
- appendSet()
- elif type == 'window':
- appendWindow()
- else:
- sys.exit('Uknown type')
-
- print 'Follwoing styles are used:'
- for style in css:
- print ' %s' % style
-
- print 'Follwoing JavaScript is used:'
- for script in js:
- print ' %s' % script
-
- ##
- # Copy the files
- #
- try:
- shutil.rmtree(output_dir)
- except:
- pass
- os.mkdir(output_dir)
-
- def concatFiles(f_list):
- data = []
- for f in f_list:
- data.append(open(f, 'r').read())
- return '\n\n'.join(data)
-
- def copyFiles(f_list):
- for f in f_list:
- shutil.copy(f, output_dir)
-
- copyFiles(static)
- fp = open('%s/%s' % (output_dir, 'gb_styles.css'), 'w')
- fp.write(concatFiles(css))
- fp.close()
- print 'Compressed styles in %s' % ('greybox/gb_styles.css')
-
- ##
- # Concat js
- #
- fp = open('%s/%s' % (output_dir, 'gb_scripts_tmp.js'), 'w')
- fp.write(concatFiles(js))
- fp.close()
-
- AJS_minify.AJS_SRC = 'greybox_source/base/AJS.js'
- AJS_minify.AJS_MINI_SRC = 'greybox/AJS_tmp.js'
- files = ['greybox/gb_scripts_tmp.js', 'greybox_source/base/AJS_fx.js', 'static_files/help.js']
- code_analyzer = AJS_minify.ExternalCodeAnalyzer(files)
- composer = AJS_minify.AjsComposer(code_analyzer.findFunctions())
- composer.writeToOutput()
-
- os.popen('java -jar compression_lib/custom_rhino.jar -c greybox/AJS_tmp.js > greybox/AJS.js')
- os.remove('greybox/AJS_tmp.js')
- os.popen('java -jar compression_lib/custom_rhino.jar -c greybox_source/base/AJS_fx.js > greybox/AJS_fx.js')
- print 'Compressed AJS.js and AJS.js into greybox/'
-
- os.popen('java -jar compression_lib/custom_rhino.jar -c greybox/gb_scripts_tmp.js > greybox/gb_scripts.js')
- os.remove('greybox/gb_scripts_tmp.js')
- print 'Compressed JavaScript in %s' % ('greybox/gb_scripts.css')
-
- #Append script_loaded
- open('greybox/AJS.js', 'a').write('\nscript_loaded=true;')
- open('greybox/AJS_fx.js', 'a').write('\nscript_loaded=true;')
- open('greybox/gb_scripts.js', 'a').write('\nscript_loaded=true;')
+++ /dev/null
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
-<head>
- <title>GreyBox - Compressing GreyBox</title>
-
- <script type="text/javascript">
- var GB_ROOT_DIR = "./greybox/";
- </script>
-
- <script type="text/javascript" src="greybox/AJS.js"></script>
- <script type="text/javascript" src="greybox/AJS_fx.js"></script>
- <script type="text/javascript" src="greybox/gb_scripts.js"></script>
- <link href="greybox/gb_styles.css" rel="stylesheet" type="text/css" media="all" />
-
- <script type="text/javascript" src="static_files/help.js"></script>
- <link href="static_files/help.css" rel="stylesheet" type="text/css" media="all" />
-</head>
-<body>
-
-<script>
-insertHeader();
-insertMenu('cmpr');
-</script>
-
-<h2>Code structure</h2>
-<ul>
- <li><b>greybox:</b> Generated and compressed JavaScript and CSS is located here</li>
- <li><b>greybox_source:</b> CSS and JavaScript structured in directories.</li>
-</ul>
-It's not recommend that you alter code in the <b>greybox</b> directory, since it's computer generated and very unreadable!
-
-
-<h2>Download Dojo ShrinkSafe</h2>
-To make the filesize as small as possible GreyBox JavaScript is compressed down using <a href="http://alex.dojotoolkit.org/shrinksafe/">Dojo ShrinkSafe</a>. This library requires <a href="http://www.java.com/getjava/">Java</a>, so make sure you got Java installed. Download following JAR file:
-<ul>
- <li><a href="http://svn.dojotoolkit.org/dojo/trunk/buildscripts/lib/custom_rhino.jar">custom_rhino.jar</a></li>
-</ul>
-Place <b>custom_rhino.jar</b> in GreyBox's <b>compression_lib</b> directory.
-
-
-<h2>Compressing GreyBox</h2>
-Now, you are ready to compress GreyBox. This is done by running a Python script called <b>combiner.py</b>. I.e. you need to download and install <a href="http://www.python.org/download/">Pyhton</a>.
-
-<p>
-You can run <b>combiner.py</b> in following ways:
-</p>
-
-<ul>
- <li><b>python combiner.py full:</b> Compress everything</li>
- <li><b>python combiner.py gallery:</b> Compress only gallery related CSS and JavaScript</li>
- <li><b>python combiner.py window:</b> Compress only window related CSS and JavaScript</li>
-</ul>
-
-</body>
-</html>
+++ /dev/null
-#!/usr/bin/env python
-#Last-update: 08/05/07 12:39:17
-import re
-import sys
-from sets import Set
-
-##
-# External files
-#
-AJS_SRC = 'AJS.js'
-AJS_MINI_SRC = 'AJS_compressed.js'
-
-
-##
-# Standard stuff that may change in the future
-#
-DOM_SHORTCUTS = [
- "ul", "li", "td", "tr", "th",
- "tbody", "table", "input", "span", "b",
- "a", "div", "img", "button", "h1",
- "h2", "h3", "br", "textarea", "form",
- "p", "select", "option", "iframe", "script",
- "center", "dl", "dt", "dd", "small",
- "pre", "tn"
-]
-
-FN_SHORTCUTS = {
- '$': 'getElement',
- '$$': 'getElements',
- '$f': 'getFormElement',
- '$b': 'bind',
- '$p': 'partial',
- '$A': 'createArray',
- 'DI': 'documentInsert',
- 'ACN': 'appendChildNodes',
- 'RCN': 'replaceChildNodes',
- 'AEV': 'addEventListener',
- 'REV': 'removeEventListener',
- '$bytc': 'getElementsByTagAndClassName'
-}
-
-AJS_TEMPLATE = """//AJS JavaScript library (minify'ed version)
-//Copyright (c) 2006 Amir Salihefendic. All rights reserved.
-//Copyright (c) 2005 Bob Ippolito. All rights reserved.
-//License: http://www.opensource.org/licenses/mit-license.php
-//Visit http://orangoo.com/AmiNation/AJS for full version.
-AJS = {
-BASE_URL: "",
-drag_obj: null,
-drag_elm: null,
-_drop_zones: [],
-_cur_pos: null,
-
-%(functions)s
-}
-
-AJS.$ = AJS.getElement;
-AJS.$$ = AJS.getElements;
-AJS.$f = AJS.getFormElement;
-AJS.$p = AJS.partial;
-AJS.$b = AJS.bind;
-AJS.$A = AJS.createArray;
-AJS.DI = AJS.documentInsert;
-AJS.ACN = AJS.appendChildNodes;
-AJS.RCN = AJS.replaceChildNodes;
-AJS.AEV = AJS.addEventListener;
-AJS.REV = AJS.removeEventListener;
-AJS.$bytc = AJS.getElementsByTagAndClassName;
-
-AJS.addEventListener(window, 'unload', AJS._unloadListeners);
-AJS._createDomShortcuts();
-
-%(AJSClass)s
-
-%(AJSDeferred)s
-script_loaded = true;
-"""
-
-
-def getAjsCode():
- return open(AJS_SRC).read()
-
-def writeAjsMini(code):
- open(AJS_MINI_SRC, "w").write(code)
-
-
-class AjsAnalyzer:
-
- def __init__(self):
- self.code = getAjsCode()
- self.ajs_fns = {}
- self.ajs_deps = {}
- self._parseAJS()
- self._findDeps()
-
- def _parseAJS(self):
- ajs_code = re.search("AJS =(.|\n)*\n}\n", self.code).group(0)
- fns = re.findall("\s+((\w*?):.*?{(.|\n)*?\n\s*})(,|\n+})\n", ajs_code)
- for f in fns:
- self.ajs_fns[f[1]] = f[0]
-
- def getFnCode(self, fn_name, caller=None):
- """
- Returns the code of function and it's dependencies as a list
- """
- fn_name = self._unfoldFn(fn_name)
- r = []
- if self.ajs_fns.get(fn_name):
- r.append(self.ajs_fns[fn_name])
- for dep_fn in self.ajs_deps[fn_name]:
- if fn_name != dep_fn and dep_fn != caller:
- r.extend(self.getFnCode(dep_fn, fn_name))
- elif fn_name not in ['listeners', 'Class']:
- print 'Could not find "%s"' % fn_name
- return r
-
- def getAjsClassCode(self):
- return re.search("AJS.Class =(.|\n)*\n};\n", self.code).group(0)
-
- def getAjsDeferredCode(self):
- return re.search("AJSDeferred =(.|\n)*\n};\n", self.code).group(0)
-
- def _findDeps(self):
- """
- Parses AJS and for every function it finds dependencies for the other functions.
- """
- for fn_name, fn_code in self.ajs_fns.items():
- self.ajs_deps[fn_name] = self._findFns(fn_code)
-
- def _findFns(self, inner):
- """
- Searches after AJS.fnX( in inner and returns all the fnX in a Set.
- """
- s = re.findall("AJS\.([\w_$]*?)(?:\(|,|\.)", inner)
- s = list(Set(s))
- return self._unfoldFns(s)
-
- def _unfoldFns(self, list):
- """
- Unfolds:
- AJS.B, AJS.H1 etc. to _createDomShortcuts
- AJS.$ to AJS.getElement etc.
- """
- return [self._unfoldFn(n) for n in list]
-
- def _unfoldFn(self, fn_name):
- if fn_name.lower() in DOM_SHORTCUTS:
- return "_createDomShortcuts"
- elif FN_SHORTCUTS.get(fn_name):
- return FN_SHORTCUTS[fn_name]
- else:
- return fn_name
-
-
-class ExternalCodeAnalyzer:
-
- def __init__(self, files):
- self.found_ajs_fns = []
- self.files = files
-
- def findFunctions(self):
- for f in self.files:
- self.found_ajs_fns.extend( self._parseFile(f) )
- return list(Set(self.found_ajs_fns))
-
- def _parseFile(self, f):
- """
- Parses the file, looks for AJS functions and returns all the found functions.
- """
- code = open(f).read()
- return re.findall("AJS\.([\w_$]*?)\(", code)
-
-
-
-class AjsComposer:
-
- def __init__(self, fn_list):
- self.code = getAjsCode()
- self.analyzer = AjsAnalyzer()
- self.fn_list = fn_list
-
- #Append standard functions
- req = ['_unloadListeners', 'createDOM', '_createDomShortcuts', 'log', 'addEventListener']
- self.fn_list.extend(req)
-
- #Append AJSDeferred only if needed
- in_list = lambda x: x in self.fn_list
- if in_list('getRequest') or in_list('loadJSONDoc'):
- self.deferred = self._minify(self.analyzer.getAjsDeferredCode())
- self.fn_list.append('isObject')
- else:
- self.deferred = ''
-
- def writeToOutput(self):
- fns = self._getFns()
- d = {}
- d['functions'] = ",\n".join(fns)
- d['AJSDeferred'] = self.deferred
- d['AJSClass'] = self.analyzer.getAjsClassCode()
-
- mini_code = AJS_TEMPLATE % d
- writeAjsMini(mini_code)
-
- def _minify(self, code):
- new_lines = []
- for l in code.split("\n"):
- if l not in ['\n', '']:
- new_lines.append(l.lstrip())
- return "\n".join(new_lines)
-
- def _getFns(self):
- """
- Returns a list with real code of functions
- """
- r = []
- for fn in self.fn_list:
- r.extend(self.analyzer.getFnCode(fn))
-
- r = list(Set(r))
- return [self._minify(fn) for fn in r]
-
-
-if __name__ == '__main__':
- args = sys.argv
-
- if len(args) < 3:
- print """Usage is:
- python AJS_minify.py [-o output_file] ajs_file js_file.js html_using_ajs.html ...
-Example usage:
- Using relative paths:
- python AJS_minify.py -o AJS_mini.js AJS.js test.js index.html
- This will create AJS_mini.js from test.js and index.html.
- Using absolute paths:
- python AJS_minify.py ~/Desktop/AJS/AJS.js ~/Desktop/GreyBox_v3_42/greybox/greybox.js
- This will create a new file called '%s' that has the needed AJS functions.""" % AJS_MINI_SRC
-
- sys.exit(0)
-
- if sys.argv[1] == '-o':
- AJS_MINI_SRC = sys.argv[2]
- AJS_SRC = sys.argv[3]
- FILES = sys.argv[4:]
- else:
- AJS_SRC = sys.argv[1]
- FILES = sys.argv[2:]
-
- print 'Parsing through:\n %s' % "\n ".join(FILES)
-
- code_analyzer = ExternalCodeAnalyzer(FILES)
- found_fns = code_analyzer.findFunctions()
- print 'Found following AJS functions:\n %s' % ("\n ".join(found_fns))
-
- composer = AjsComposer(found_fns)
- composer.writeToOutput()
- print "Written the minified code to '%s'" % AJS_MINI_SRC
+++ /dev/null
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
-<head>
- <title>GreyBox - Examples</title>
-
- <script type="text/javascript">
- var GB_ROOT_DIR = "./greybox/";
- </script>
-
- <script type="text/javascript" src="greybox/AJS.js"></script>
- <script type="text/javascript" src="greybox/AJS_fx.js"></script>
- <script type="text/javascript" src="greybox/gb_scripts.js"></script>
- <link href="greybox/gb_styles.css" rel="stylesheet" type="text/css" media="all" />
-
- <script type="text/javascript" src="static_files/help.js"></script>
- <link href="static_files/help.css" rel="stylesheet" type="text/css" media="all" />
-</head>
-<body>
-
-<script>
- insertHeader();
- insertMenu('examples');
-</script>
-
-
-<h3>One website</h3>
-<ul>
- <li>
- <a href="http://google.com/" title="Google" rel="gb_page_center[640, 480]">Launch google.com in a 640x480 window</a>
- </li>
- <li>
- <a href="http://google.com/" title="Google" rel="gb_page_fs[]">Launch google.com in fullscreen window</a>
- </li>
-</ul>
-
-<h3>Website gallery</h3>
-<ul>
- <li>
- <a href="http://google.com/" title="Google" rel="gb_pageset[search_sites]">Launch Google search</a>
- </li>
- <li>
- <a href="http://search.yahoo.com/" rel="gb_pageset[search_sites]">Launch Yahoo search</a>
- </li>
- <li>
- <a href="http://www.koders.com/" rel="gb_pageset[search_sites]">Launch Koders search</a>
- </li>
-</ul>
-
-<h3>Image gallery</h3>
-<script type="text/javascript">
-var image_set = [{'caption': 'Flower', 'url': 'http://static.flickr.com/119/294309231_a3d2a339b9.jpg'},
- {'caption': 'Nice waterfall', 'url': 'http://www.widerange.org/images/large/plitvicka.jpg'}];
-</script>
-
-<ul>
- <li>
- <a href="#" onclick="return GB_showImageSet(image_set, 1)">Launch gallery</a>
- </li>
-
- <li>
- <a href="static_files/night_valley.jpg" rel="gb_imageset[nice_pics]" title="Night valley">
- <img src="static_files/night_valley_thumb.jpg" />
- </a>
- </li>
-
- <li>
- <a href="static_files/salt.jpg" rel="gb_imageset[nice_pics]" title="Salt flats in Chile">
- <img src="static_files/salt_thumb.gif" />
- </a>
- </li>
-</ul>
-
-<h3>Without loading</h3>
-<script type="text/javascript">
-GB_myShow = function(caption, url, /* optional */ height, width, callback_fn) {
- var options = {
- caption: caption,
- height: height || 500,
- width: width || 500,
- fullscreen: false,
- show_loading: false,
- callback_fn: callback_fn
- }
- var win = new GB_Window(options);
- return win.show(url);
-}
-</script>
-<ul>
- <li>
- <a href="http://google.com/" onclick="return GB_myShow('Google', this.href)">Visit Google without loading</a>
- </li>
-</ul>
-
-</body>
-</html>
+++ /dev/null
-var GB_SETS = {};
-function decoGreyboxLinks() {
- var as = AJS.$bytc('a');
- AJS.map(as, function(a) {
- if(a.getAttribute('href') && a.getAttribute('rel')) {
- var rel = a.getAttribute('rel');
- if(rel.indexOf('gb_') == 0) {
- var name = rel.match(/\w+/)[0];
- var attrs = rel.match(/\[(.*)\]/)[1];
- var index = 0;
-
- var item = {
- 'caption': a.title || '',
- 'url': a.href
- }
-
- //Set up GB_SETS
- if(name == 'gb_pageset' || name == 'gb_imageset') {
- if(!GB_SETS[attrs]) { GB_SETS[attrs] = []; }
- GB_SETS[attrs].push(item);
- index = GB_SETS[attrs].length;
- }
-
- //Append onclick
- if(name == 'gb_pageset') {
- a.onclick = function() {
- GB_showFullScreenSet(GB_SETS[attrs], index);
- return false;
- };
- }
- if(name == 'gb_imageset') {
- a.onclick = function() {
- GB_showImageSet(GB_SETS[attrs], index);
- return false;
- };
- }
- if(name == 'gb_image') {
- a.onclick = function() {
- GB_showImage(item.caption, item.url);
- return false;
- };
- }
- if(name == 'gb_page') {
- a.onclick = function() {
- var sp = attrs.split(/, ?/);
- GB_show(item.caption, item.url, parseInt(sp[1]), parseInt(sp[0]));
- return false;
- };
- }
- if(name == 'gb_page_fs') {
- a.onclick = function() {
- GB_showFullScreen(item.caption, item.url);
- return false;
- };
- }
- if(name == 'gb_page_center') {
- a.onclick = function() {
- var sp = attrs.split(/, ?/);
- GB_showCenter(item.caption, item.url, parseInt(sp[1]), parseInt(sp[0]));
- return false;
- };
- }
- }
- }});
-}
-
-AJS.AEV(window, 'load', decoGreyboxLinks);
+++ /dev/null
-/*
-Last Modified: 29/01/07 14:16:09
-
-AJS JavaScript library
- A very small library with a lot of functionality
-AUTHOR
- 4mir Salihefendic (http://amix.dk) - amix@amix.dk
-LICENSE
- Copyright (c) 2006 Amir Salihefendic. All rights reserved.
- Copyright (c) 2005 Bob Ippolito. All rights reserved.
- http://www.opensource.org/licenses/mit-license.php
-VERSION
- 3.7
-SITE
- http://orangoo.com/AmiNation/AJS
-**/
-if(!AJS) {
-var AJS = {
- BASE_URL: "",
-
- drag_obj: null,
- drag_elm: null,
- _drop_zones: [],
- _drag_zones: [],
- _cur_pos: null,
-
- ajaxErrorHandler: null,
-
-////
-// General accessor functions
-////
- getQueryArgument: function(var_name) {
- var query = window.location.search.substring(1);
- var vars = query.split("&");
- for (var i=0;i<vars.length;i++) {
- var pair = vars[i].split("=");
- if (pair[0] == var_name) {
- return pair[1];
- }
- }
- return null;
- },
-
- isIe: function() {
- return (navigator.userAgent.toLowerCase().indexOf("msie") != -1 && navigator.userAgent.toLowerCase().indexOf("opera") == -1);
- },
- isNetscape7: function() {
- return (navigator.userAgent.toLowerCase().indexOf("netscape") != -1 && navigator.userAgent.toLowerCase().indexOf("7.") != -1);
- },
- isSafari: function() {
- return (navigator.userAgent.toLowerCase().indexOf("khtml") != -1);
- },
- isOpera: function() {
- return (navigator.userAgent.toLowerCase().indexOf("opera") != -1);
- },
- isMozilla: function() {
- return (navigator.userAgent.toLowerCase().indexOf("gecko") != -1 && navigator.productSub >= 20030210);
- },
-
-
-////
-// Array functions
-////
- //Shortcut: AJS.$A
- createArray: function(v) {
- if(AJS.isArray(v) && !AJS.isString(v))
- return v;
- else if(!v)
- return [];
- else
- return [v];
- },
-
- forceArray: function(args) {
- var r = [];
- AJS.map(args, function(elm) {
- r.push(elm);
- });
- return r;
- },
-
- join: function(delim, list) {
- try {
- return list.join(delim);
- }
- catch(e) {
- var r = list[0] || '';
- AJS.map(list, function(elm) {
- r += delim + elm;
- }, 1);
- return r + '';
- }
- },
-
- isIn: function(elm, list) {
- var i = AJS.getIndex(elm, list);
- if(i != -1)
- return true;
- else
- return false;
- },
-
- getIndex: function(elm, list/*optional*/, eval_fn) {
- for(var i=0; i < list.length; i++)
- if(eval_fn && eval_fn(list[i]) || elm == list[i])
- return i;
- return -1;
- },
-
- getFirst: function(list) {
- if(list.length > 0)
- return list[0];
- else
- return null;
- },
-
- getLast: function(list) {
- if(list.length > 0)
- return list[list.length-1];
- else
- return null;
- },
-
- update: function(l1, l2) {
- for(var i in l2)
- l1[i] = l2[i];
- return l1;
- },
-
- flattenList: function(list) {
- var r = [];
- var _flatten = function(r, l) {
- AJS.map(l, function(o) {
- if(o == null) {}
- else if (AJS.isArray(o))
- _flatten(r, o);
- else
- r.push(o);
- });
- }
- _flatten(r, list);
- return r;
- },
-
-
-////
-// Functional programming
-////
- map: function(list, fn,/*optional*/ start_index, end_index) {
- var i = 0, l = list.length;
- if(start_index)
- i = start_index;
- if(end_index)
- l = end_index;
- for(i; i < l; i++)
- fn.apply(null, [list[i], i]);
- },
-
- rmap: function(list, fn) {
- var i = list.length-1, l = 0;
- for(i; i >= l; i--)
- fn.apply(null, [list[i], i]);
- },
-
- filter: function(list, fn, /*optional*/ start_index, end_index) {
- var r = [];
- AJS.map(list, function(elm) {
- if(fn(elm))
- r.push(elm);
- }, start_index, end_index);
- return r;
- },
-
- partial: function(fn) {
- var args = AJS.forceArray(arguments);
- return AJS.$b(fn, null, args.slice(1, args.length).reverse(), false, true);
- },
-
-
-////
-// DOM functions
-////
- //Shortcut: AJS.$
- getElement: function(id) {
- if(AJS.isString(id) || AJS.isNumber(id))
- return document.getElementById(id);
- else
- return id;
- },
-
- //Shortcut: AJS.$$
- getElements: function(/*id1, id2, id3*/) {
- var args = AJS.forceArray(arguments);
- var elements = new Array();
- for (var i = 0; i < args.length; i++) {
- var element = AJS.getElement(args[i]);
- elements.push(element);
- }
- return elements;
- },
-
- //Shortcut: AJS.$bytc
- getElementsByTagAndClassName: function(tag_name, class_name, /*optional*/ parent) {
- var class_elements = [];
- if(!AJS.isDefined(parent))
- parent = document;
- if(!AJS.isDefined(tag_name))
- tag_name = '*';
-
- var els = parent.getElementsByTagName(tag_name);
- var els_len = els.length;
- var pattern = new RegExp("(^|\\s)" + class_name + "(\\s|$)");
-
- for (i = 0, j = 0; i < els_len; i++) {
- if ( pattern.test(els[i].className) || class_name == null ) {
- class_elements[j] = els[i];
- j++;
- }
- }
- return class_elements;
- },
-
- _nodeWalk: function(elm, tag_name, class_name, fn_next_elm) {
- var p = fn_next_elm(elm);
-
- var checkFn;
- if(tag_name && class_name) {
- checkFn = function(p) {
- return AJS.nodeName(p) == tag_name && AJS.hasClass(p, class_name);
- }
- }
- else if(tag_name) {
- checkFn = function(p) { return AJS.nodeName(p) == tag_name; }
- }
- else {
- checkFn = function(p) { return AJS.hasClass(p, class_name); }
- }
-
- while(p) {
- if(checkFn(p))
- return p;
- p = fn_next_elm(p);
- }
- return null;
- },
-
- getParentBytc: function(elm, tag_name, class_name) {
- return AJS._nodeWalk(elm, tag_name, class_name, function(m) { return m.parentNode; });
- },
-
- getPreviousSiblingBytc: function(elm, tag_name, class_name) {
- return AJS._nodeWalk(elm, tag_name, class_name, function(m) { return m.previousSibling; });
- },
-
- getNextSiblingBytc: function(elm, tag_name, class_name) {
- return AJS._nodeWalk(elm, tag_name, class_name, function(m) { return m.nextSibling; });
- },
-
- //Shortcut: AJS.$f
- getFormElement: function(form, name) {
- form = AJS.$(form);
- var r = null;
- AJS.map(form.elements, function(elm) {
- if(elm.name && elm.name == name)
- r = elm;
- });
- return r;
- },
-
- formContents: function(form) {
- var form = AJS.$(form);
- var r = {};
- var fn = function(elms) {
- AJS.map(elms, function(e) {
- if(e.name)
- r[e.name] = e.value || '';
- });
- }
- fn(AJS.$bytc('input', null, form));
- fn(AJS.$bytc('textarea', null, form));
- return r;
- },
-
- getBody: function() {
- return AJS.$bytc('body')[0]
- },
-
- nodeName: function(elm) {
- return elm.nodeName.toLowerCase();
- },
-
- hasParent: function(elm, parent_to_consider, max_look_up) {
- if(elm == parent_to_consider)
- return true;
- if(max_look_up == 0)
- return false;
- return AJS.hasParent(elm.parentNode, parent_to_consider, max_look_up-1);
- },
-
- isElementHidden: function(elm) {
- return elm.style.visibility == "hidden";
- },
-
- //Shortcut: AJS.DI
- documentInsert: function(elm) {
- if(typeof(elm) == 'string')
- elm = AJS.HTML2DOM(elm);
- document.write('<span id="dummy_holder"></span>');
- AJS.swapDOM(AJS.$('dummy_holder'), elm);
- },
-
- cloner: function(element) {
- return function() {
- return element.cloneNode(true);
- }
- },
-
- appendToTop: function(elm/*, elms...*/) {
- var args = AJS.forceArray(arguments).slice(1);
- if(args.length >= 1) {
- var first_child = elm.firstChild;
- if(first_child) {
- while(true) {
- var t_elm = args.shift();
- if(t_elm)
- AJS.insertBefore(t_elm, first_child);
- else
- break;
- }
- }
- else {
- AJS.ACN.apply(null, arguments);
- }
- }
- return elm;
- },
-
- //Shortcut: AJS.ACN
- appendChildNodes: function(elm/*, elms...*/) {
- if(arguments.length >= 2) {
- AJS.map(arguments, function(n) {
- if(AJS.isString(n))
- n = AJS.TN(n);
- if(AJS.isDefined(n))
- elm.appendChild(n);
- }, 1);
- }
- return elm;
- },
-
- //Shortcut: AJS.RCN
- replaceChildNodes: function(elm/*, elms...*/) {
- var child;
- while ((child = elm.firstChild))
- elm.removeChild(child);
- if (arguments.length < 2)
- return elm;
- else
- return AJS.appendChildNodes.apply(null, arguments);
- return elm;
- },
-
- insertAfter: function(elm, reference_elm) {
- reference_elm.parentNode.insertBefore(elm, reference_elm.nextSibling);
- return elm;
- },
-
- insertBefore: function(elm, reference_elm) {
- reference_elm.parentNode.insertBefore(elm, reference_elm);
- return elm;
- },
-
- showElement: function(/*elms...*/) {
- var args = AJS.forceArray(arguments);
- AJS.map(args, function(elm) { elm.style.display = ''});
- },
-
- hideElement: function(elm) {
- var args = AJS.forceArray(arguments);
- AJS.map(args, function(elm) { elm.style.display = 'none'});
- },
-
- swapDOM: function(dest, src) {
- dest = AJS.getElement(dest);
- var parent = dest.parentNode;
- if (src) {
- src = AJS.getElement(src);
- parent.replaceChild(src, dest);
- } else {
- parent.removeChild(dest);
- }
- return src;
- },
-
- removeElement: function(/*elm1, elm2...*/) {
- var args = AJS.forceArray(arguments);
- AJS.map(args, function(elm) { AJS.swapDOM(elm, null); });
- },
-
- createDOM: function(name, attrs) {
- var i=0, attr;
- elm = document.createElement(name);
-
- if(AJS.isDict(attrs[i])) {
- for(k in attrs[0]) {
- attr = attrs[0][k];
- if(k == "style")
- elm.style.cssText = attr;
- else if(k == "class" || k == 'className')
- elm.className = attr;
- else {
- elm.setAttribute(k, attr);
- }
- }
- i++;
- }
-
- if(attrs[0] == null)
- i = 1;
-
- AJS.map(attrs, function(n) {
- if(n) {
- if(AJS.isString(n) || AJS.isNumber(n))
- n = AJS.TN(n);
- elm.appendChild(n);
- }
- }, i);
- return elm;
- },
-
- _createDomShortcuts: function() {
- var elms = [
- "ul", "li", "td", "tr", "th",
- "tbody", "table", "input", "span", "b",
- "a", "div", "img", "button", "h1",
- "h2", "h3", "br", "textarea", "form",
- "p", "select", "option", "iframe", "script",
- "center", "dl", "dt", "dd", "small",
- "pre"
- ];
- var extends_ajs = function(elm) {
- var c_dom = "return AJS.createDOM.apply(null, ['" + elm + "', arguments]);";
- var c_fun_dom = 'function() { ' + c_dom + ' }';
- eval("AJS." + elm.toUpperCase() + "=" + c_fun_dom);
- }
- AJS.map(elms, extends_ajs);
- AJS.TN = function(text) { return document.createTextNode(text) };
- },
-
- getCssDim: function(dim) {
- if(AJS.isString(dim))
- return dim;
- else
- return dim + "px";
- },
- getCssProperty: function(elm, prop) {
- elm = AJS.$(elm);
- var y;
- if(elm.currentStyle)
- y = elm.currentStyle[prop];
- else if (window.getComputedStyle)
- y = document.defaultView.getComputedStyle(elm,null).getPropertyValue(prop);
- return y;
- },
-
- setStyle: function(/*elm1, elm2..., property, new_value*/) {
- var args = AJS.forceArray(arguments);
- var new_val = args.pop();
- var property = args.pop();
- AJS.map(args, function(elm) {
- elm.style[property] = AJS.getCssDim(new_val);
- });
- },
-
- setWidth: function(/*elm1, elm2..., width*/) {
- var args = AJS.forceArray(arguments);
- args.splice(args.length-1, 0, 'width');
- AJS.setStyle.apply(null, args);
- },
- setHeight: function(/*elm1, elm2..., height*/) {
- var args = AJS.forceArray(arguments);
- args.splice(args.length-1, 0, 'height');
- AJS.setStyle.apply(null, args);
- },
- setLeft: function(/*elm1, elm2..., left*/) {
- var args = AJS.forceArray(arguments);
- args.splice(args.length-1, 0, 'left');
- AJS.setStyle.apply(null, args);
- },
- setTop: function(/*elm1, elm2..., top*/) {
- var args = AJS.forceArray(arguments);
- args.splice(args.length-1, 0, 'top');
- AJS.setStyle.apply(null, args);
- },
- setClass: function(/*elm1, elm2..., className*/) {
- var args = AJS.forceArray(arguments);
- var c = args.pop();
- AJS.map(args, function(elm) { elm.className = c});
- },
- addClass: function(/*elm1, elm2..., className*/) {
- var args = AJS.forceArray(arguments);
- var cls = args.pop();
- var add_class = function(o) {
- if(!new RegExp("(^|\\s)" + cls + "(\\s|$)").test(o.className))
- o.className += (o.className ? " " : "") + cls;
- };
- AJS.map(args, function(elm) { add_class(elm); });
- },
- hasClass: function(elm, cls) {
- if(!elm.className)
- return false;
- return elm.className == cls ||
- elm.className.search(new RegExp(" " + cls)) != -1
- },
- removeClass: function(/*elm1, elm2..., className*/) {
- var args = AJS.forceArray(arguments);
- var cls = args.pop();
- var rm_class = function(o) {
- o.className = o.className.replace(new RegExp("\\s?" + cls, 'g'), "");
- };
- AJS.map(args, function(elm) { rm_class(elm); });
- },
-
- setHTML: function(elm, html) {
- elm.innerHTML = html;
- return elm;
- },
-
- RND: function(tmpl, ns, scope) {
- scope = scope || window;
- var fn = function(w, g) {
- g = g.split("|");
- var cnt = ns[g[0]];
- for(var i=1; i < g.length; i++)
- cnt = scope[g[i]](cnt);
- if(cnt == '')
- return '';
- if(cnt == 0 || cnt == -1)
- cnt += '';
- return cnt || w;
- };
- return tmpl.replace(/%\(([A-Za-z0-9_|.]*)\)/g, fn);
- },
-
- HTML2DOM: function(html,/*optional*/ first_child) {
- var d = AJS.DIV();
- d.innerHTML = html;
- if(first_child)
- return d.childNodes[0];
- else
- return d;
- },
-
- preloadImages: function(/*img_src1, ..., img_srcN*/) {
- AJS.AEV(window, 'load', AJS.$p(function(args) {
- AJS.map(args, function(src) {
- var pic = new Image();
- pic.src = src;
- });
- }, arguments));
- },
-
-
-////
-// Effects
-////
- setOpacity: function(elm, p) {
- elm.style.opacity = p;
- elm.style.filter = "alpha(opacity="+ p*100 +")";
- },
-
-
-////
-// Ajax functions
-////
- getXMLHttpRequest: function() {
- var try_these = [
- function () { return new XMLHttpRequest(); },
- function () { return new ActiveXObject('Msxml2.XMLHTTP'); },
- function () { return new ActiveXObject('Microsoft.XMLHTTP'); },
- function () { return new ActiveXObject('Msxml2.XMLHTTP.4.0'); },
- function () { throw "Browser does not support XMLHttpRequest"; }
- ];
- for (var i = 0; i < try_these.length; i++) {
- var func = try_these[i];
- try {
- return func();
- } catch (e) {
- }
- }
- },
-
- getRequest: function(url, data, type) {
- if(!type)
- type = "POST";
- var req = AJS.getXMLHttpRequest();
-
- if(url.indexOf("http://") == -1) {
- if(AJS.BASE_URL != '') {
- if(AJS.BASE_URL.lastIndexOf('/') != AJS.BASE_URL.length-1)
- AJS.BASE_URL += '/';
- url = AJS.BASE_URL + url;
- }
- else
- url = window.location + url;
- }
-
- req.open(type, url, true);
- if(type == "POST")
- req.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
- return AJS._sendXMLHttpRequest(req);
- },
-
- _sendXMLHttpRequest: function(req, data) {
- var d = new AJSDeferred(req);
-
- var onreadystatechange = function () {
- if (req.readyState == 4) {
- var status = '';
- try {
- status = req.status;
- }
- catch(e) {};
- if(status == 200 || status == 304 || req.responseText == null) {
- d.callback();
- }
- else {
- if(AJS.ajaxErrorHandler)
- AJS.ajaxErrorHandler(req.responseText, req);
- else
- d.errback();
- }
- }
- }
- req.onreadystatechange = onreadystatechange;
- return d;
- },
-
- _reprString: function(o) {
- return ('"' + o.replace(/(["\\])/g, '\\$1') + '"'
- ).replace(/[\f]/g, "\\f"
- ).replace(/[\b]/g, "\\b"
- ).replace(/[\n]/g, "\\n"
- ).replace(/[\t]/g, "\\t"
- ).replace(/[\r]/g, "\\r");
- },
-
- serializeJSON: function(o) {
- var objtype = typeof(o);
- if (objtype == "undefined") {
- return "undefined";
- } else if (objtype == "number" || objtype == "boolean") {
- return o + "";
- } else if (o === null) {
- return "null";
- }
- if (objtype == "string") {
- return AJS._reprString(o);
- }
- var me = arguments.callee;
- if (objtype != "function" && typeof(o.length) == "number") {
- var res = [];
- for (var i = 0; i < o.length; i++) {
- var val = me(o[i]);
- if (typeof(val) != "string") {
- val = "undefined";
- }
- res.push(val);
- }
- return "[" + res.join(",") + "]";
- }
- // it's a function with no adapter, bad
- if (objtype == "function")
- return null;
- res = [];
- for (var k in o) {
- var useKey;
- if (typeof(k) == "number") {
- useKey = '"' + k + '"';
- } else if (typeof(k) == "string") {
- useKey = AJS._reprString(k);
- } else {
- // skip non-string or number keys
- continue;
- }
- val = me(o[k]);
- if (typeof(val) != "string") {
- // skip non-serializable values
- continue;
- }
- res.push(useKey + ":" + val);
- }
- return "{" + res.join(",") + "}";
- },
-
- loadJSONDoc: function(url) {
- var d = AJS.getRequest(url);
- var eval_req = function(data, req) {
- var text = req.responseText;
- if(text == "Error")
- d.errback(req);
- else
- return AJS.evalTxt(text);
- };
- d.addCallback(eval_req);
- return d;
- },
-
- evalTxt: function(txt) {
- try {
- return eval('('+ txt + ')');
- }
- catch(e) {
- return eval(txt);
- }
- },
-
- evalScriptTags: function(html) {
- var script_data = html.match(/<script.*?>((\n|\r|.)*?)<\/script>/g);
- if(script_data != null) {
- for(var i=0; i < script_data.length; i++) {
- var script_only = script_data[i].replace(/<script.*?>/g, "");
- script_only = script_only.replace(/<\/script>/g, "");
- eval(script_only);
- }
- }
- },
-
- queryArguments: function(data) {
- var post_data = [];
- for(k in data)
- post_data.push(k + "=" + AJS.urlencode(data[k]));
- return post_data.join("&");
- },
-
-
-////
-// Position and size
-////
- getMousePos: function(e) {
- var posx = 0;
- var posy = 0;
- if (!e) var e = window.event;
- if (e.pageX || e.pageY)
- {
- posx = e.pageX;
- posy = e.pageY;
- }
- else if (e.clientX || e.clientY)
- {
- posx = e.clientX + document.body.scrollLeft;
- posy = e.clientY + document.body.scrollTop;
- }
- return {x: posx, y: posy};
- },
-
- getScrollTop: function() {
- //From: http://www.quirksmode.org/js/doctypes.html
- var t;
- if (document.documentElement && document.documentElement.scrollTop)
- t = document.documentElement.scrollTop;
- else if (document.body)
- t = document.body.scrollTop;
- return t;
- },
-
- absolutePosition: function(elm) {
- var posObj = {'x': elm.offsetLeft, 'y': elm.offsetTop};
- if(elm.offsetParent) {
- var temp_pos = AJS.absolutePosition(elm.offsetParent);
- posObj.x += temp_pos.x;
- posObj.y += temp_pos.y;
- }
- // safari bug
- if (AJS.isSafari() && elm.style.position == 'absolute' ) {
- posObj.x -= document.body.offsetLeft;
- posObj.y -= document.body.offsetTop;
- }
- return posObj;
- },
-
- getWindowSize: function(doc) {
- doc = doc || document;
- var win_w, win_h;
- if (self.innerHeight) {
- win_w = self.innerWidth;
- win_h = self.innerHeight;
- } else if (doc.documentElement && doc.documentElement.clientHeight) {
- win_w = doc.documentElement.clientWidth;
- win_h = doc.documentElement.clientHeight;
- } else if (doc.body) {
- win_w = doc.body.clientWidth;
- win_h = doc.body.clientHeight;
- }
- return {'w': win_w, 'h': win_h};
- },
-
- isOverlapping: function(elm1, elm2) {
- var pos_elm1 = AJS.absolutePosition(elm1);
- var pos_elm2 = AJS.absolutePosition(elm2);
-
- var top1 = pos_elm1.y;
- var left1 = pos_elm1.x;
- var right1 = left1 + elm1.offsetWidth;
- var bottom1 = top1 + elm1.offsetHeight;
- var top2 = pos_elm2.y;
- var left2 = pos_elm2.x;
- var right2 = left2 + elm2.offsetWidth;
- var bottom2 = top2 + elm2.offsetHeight;
- var getSign = function(v) {
- if(v > 0) return "+";
- else if(v < 0) return "-";
- else return 0;
- }
-
- if ((getSign(top1 - bottom2) != getSign(bottom1 - top2)) &&
- (getSign(left1 - right2) != getSign(right1 - left2)))
- return true;
- return false;
- },
-
-
-////
-// Events
-////
- getEventElm: function(e) {
- if(e && !e.type && !e.keyCode)
- return e
- var targ;
- if (!e) var e = window.event;
- if (e.target) targ = e.target;
- else if (e.srcElement) targ = e.srcElement;
- if (targ.nodeType == 3) // defeat Safari bug
- targ = targ.parentNode;
- return targ;
- },
-
- _getRealScope: function(fn, /*optional*/ extra_args, dont_send_event, rev_extra_args) {
- var scope = window;
- extra_args = AJS.$A(extra_args);
- if(fn._cscope)
- scope = fn._cscope;
-
- return function() {
- //Append all the orginal arguments + extra_args
- var args = [];
- var i = 0;
- if(dont_send_event)
- i = 1;
-
- AJS.map(arguments, function(arg) { args.push(arg) }, i);
- args = args.concat(extra_args);
- if(rev_extra_args)
- args = args.reverse();
- return fn.apply(scope, args);
- };
- },
-
- _unloadListeners: function() {
- if(AJS.listeners)
- AJS.map(AJS.listeners, function(elm, type, fn) { AJS.REV(elm, type, fn) });
- AJS.listeners = [];
- },
-
- setEventKey: function(e) {
- e.key = e.keyCode ? e.keyCode : e.charCode;
-
- if(window.event) {
- e.ctrl = window.event.ctrlKey;
- e.shift = window.event.shiftKey;
- }
- else {
- e.ctrl = e.ctrlKey;
- e.shift = e.shiftKey;
- }
- switch(e.key) {
- case 63232:
- e.key = 38;
- break;
- case 63233:
- e.key = 40;
- break;
- case 63235:
- e.key = 39;
- break;
- case 63234:
- e.key = 37;
- break;
- }
- },
-
- //Shortcut: AJS.AEV
- addEventListener: function(elm, type, fn, /*optional*/listen_once, cancle_bubble) {
- if(!cancle_bubble)
- cancle_bubble = false;
-
- var elms = AJS.$A(elm);
- AJS.map(elms, function(elmz) {
- if(listen_once)
- fn = AJS._listenOnce(elmz, type, fn);
-
- //Hack since it does not work in all browsers
- if(AJS.isIn(type, ['submit', 'load', 'scroll', 'resize'])) {
- var old = elm['on' + type];
- elm['on' + type] = function() {
- if(old) {
- fn(arguments);
- return old(arguments);
- }
- else
- return fn(arguments);
- };
- return;
- }
-
- //Fix keyCode
- if(AJS.isIn(type, ['keypress', 'keydown', 'keyup', 'click'])) {
- var old_fn = fn;
- fn = function(e) {
- AJS.setEventKey(e);
- return old_fn.apply(null, arguments);
- }
- }
-
- if (elmz.attachEvent) {
- //FIXME: We ignore cancle_bubble for IE... could be a problem?
- elmz.attachEvent("on" + type, fn);
- }
- else if(elmz.addEventListener)
- elmz.addEventListener(type, fn, cancle_bubble);
-
- AJS.listeners = AJS.$A(AJS.listeners);
- AJS.listeners.push([elmz, type, fn]);
- });
- },
-
- //Shortcut: AJS.REV
- removeEventListener: function(elm, type, fn, /*optional*/cancle_bubble) {
- if(!cancle_bubble)
- cancle_bubble = false;
- if(elm.removeEventListener) {
- elm.removeEventListener(type, fn, cancle_bubble);
- if(AJS.isOpera())
- elm.removeEventListener(type, fn, !cancle_bubble);
- }
- else if(elm.detachEvent)
- elm.detachEvent("on" + type, fn);
- },
-
- //Shortcut: AJS.$b
- bind: function(fn, scope, /*optional*/ extra_args, dont_send_event, rev_extra_args) {
- fn._cscope = scope;
- return AJS._getRealScope(fn, extra_args, dont_send_event, rev_extra_args);
- },
-
- bindMethods: function(self) {
- for (var k in self) {
- var func = self[k];
- if (typeof(func) == 'function') {
- self[k] = AJS.$b(func, self);
- }
- }
- },
-
- _listenOnce: function(elm, type, fn) {
- var r_fn = function() {
- AJS.removeEventListener(elm, type, r_fn);
- fn(arguments);
- }
- return r_fn;
- },
-
- callLater: function(fn, interval) {
- var fn_no_send = function() {
- fn();
- };
- window.setTimeout(fn_no_send, interval);
- },
-
- preventDefault: function(e) {
- if(AJS.isIe())
- window.event.returnValue = false;
- else
- e.preventDefault();
- },
-
-
-////
-// Drag and drop
-////
- dragAble: function(elm, /*optional*/ handler, args) {
- if(!args)
- args = {};
- if(!AJS.isDefined(args['move_x']))
- args['move_x'] = true;
- if(!AJS.isDefined(args['move_y']))
- args['move_y'] = true;
- if(!AJS.isDefined(args['moveable']))
- args['moveable'] = false;
- if(!AJS.isDefined(args['hide_on_move']))
- args['hide_on_move'] = true;
- if(!AJS.isDefined(args['on_mouse_up']))
- args['on_mouse_up'] = null;
- if(!AJS.isDefined(args['cursor']))
- args['cursor'] = 'move';
- if(!AJS.isDefined(args['max_move']))
- args['max_move'] = {'top': null, 'left': null};
-
- elm = AJS.$(elm);
-
- if(!handler)
- handler = elm;
-
- handler = AJS.$(handler);
- var old_cursor = handler.style.cursor;
- handler.style.cursor = args['cursor'];
- elm.style.position = 'relative';
-
- AJS.addClass(handler, '_ajs_handler');
- handler._args = args;
- handler._elm = elm;
- AJS.AEV(handler, 'mousedown', AJS._dragStart);
- },
-
- _dragStart: function(e) {
- var handler = AJS.getEventElm(e);
- if(!AJS.hasClass(handler, '_ajs_handler')) {
- handler = AJS.getParentBytc(handler, null, '_ajs_handler');
- }
- if(handler)
- AJS._dragInit(e, handler._elm, handler._args);
- },
-
- dropZone: function(elm, args) {
- elm = AJS.$(elm);
- var item = {elm: elm};
- AJS.update(item, args);
- AJS._drop_zones.push(item);
- },
-
- removeDragAble: function(elm) {
- AJS.REV(elm, 'mousedown', AJS._dragStart);
- elm.style.cursor = '';
- },
-
- removeDropZone: function(elm) {
- var i = AJS.getIndex(elm, AJS._drop_zones, function(item) {
- if(item.elm == elm) return true;
- });
- if(i != -1) {
- AJS._drop_zones.splice(i, 1);
- }
- },
-
- _dragInit: function(e, click_elm, args) {
- AJS.drag_obj = new Object();
- AJS.drag_obj.args = args;
-
- AJS.drag_obj.click_elm = click_elm;
- AJS.drag_obj.mouse_pos = AJS.getMousePos(e);
- AJS.drag_obj.click_elm_pos = AJS.absolutePosition(click_elm);
-
- AJS.AEV(document, 'mousemove', AJS._dragMove, false, true);
- AJS.AEV(document, 'mouseup', AJS._dragStop, false, true);
-
- if (AJS.isIe())
- window.event.cancelBubble = true;
- AJS.preventDefault(e);
- },
-
- _initDragElm: function(elm) {
- if(AJS.drag_elm && AJS.drag_elm.style.display == 'none')
- AJS.removeElement(AJS.drag_elm);
-
- if(!AJS.drag_elm) {
- AJS.drag_elm = AJS.DIV();
- var d = AJS.drag_elm;
- AJS.insertBefore(d, AJS.getBody().firstChild);
- AJS.setHTML(d, elm.innerHTML);
-
- d.className = elm.className;
- d.style.cssText = elm.style.cssText;
-
- d.style.position = 'absolute';
- d.style.zIndex = 10000;
-
- var t = AJS.absolutePosition(elm);
- AJS.setTop(d, t.y);
- AJS.setLeft(d, t.x);
-
- if(AJS.drag_obj.args.on_init) {
- AJS.drag_obj.args.on_init(elm);
- }
- }
- },
-
- _dragMove: function(e) {
- var drag_obj = AJS.drag_obj;
- var click_elm = drag_obj.click_elm;
-
- AJS._initDragElm(click_elm);
- var drag_elm = AJS.drag_elm;
-
- if(drag_obj.args['hide_on_move'])
- click_elm.style.visibility = 'hidden';
-
- var cur_pos = AJS.getMousePos(e);
-
- var mouse_pos = drag_obj.mouse_pos;
-
- var click_elm_pos = drag_obj.click_elm_pos;
-
- AJS.map(AJS._drop_zones, function(d_z) {
- if(AJS.isOverlapping(d_z['elm'], drag_elm)) {
- if(d_z['elm'] != drag_elm) {
- var on_hover = d_z['on_hover'];
- if(on_hover)
- on_hover(d_z['elm'], click_elm, drag_elm);
- }
- }
- });
-
- if(drag_obj.args['on_drag'])
- drag_obj.args['on_drag'](click_elm, e);
-
- var max_move_top = drag_obj.args['max_move']['top'];
- var max_move_left = drag_obj.args['max_move']['left'];
- var p;
- if(drag_obj.args['move_x']) {
- p = cur_pos.x - (mouse_pos.x - click_elm_pos.x);
- if(max_move_left == null || max_move_left <= p)
- AJS.setLeft(elm, p);
- }
-
- if(drag_obj.args['move_y']) {
- p = cur_pos.y - (mouse_pos.y - click_elm_pos.y);
- if(max_move_top == null || max_move_top <= p)
- AJS.setTop(elm, p);
- }
- if(AJS.isIe()) {
- window.event.cancelBubble = true;
- window.event.returnValue = false;
- }
- else
- e.preventDefault();
- },
-
- _dragStop: function(e) {
- var drag_obj = AJS.drag_obj;
- var drag_elm = AJS.drag_elm;
- var click_elm = drag_obj.click_elm;
-
- AJS.REV(document, "mousemove", AJS._dragMove, true);
- AJS.REV(document, "mouseup", AJS._dragStop, true);
-
- var dropped = false;
- AJS.map(AJS._drop_zones, function(d_z) {
- if(AJS.isOverlapping(d_z['elm'], click_elm)) {
- if(d_z['elm'] != click_elm) {
- var on_drop = d_z['on_drop'];
- if(on_drop) {
- dropped = true;
- on_drop(d_z['elm'], click_elm);
- }
- }
- }
- });
-
- if(drag_obj.args['moveable']) {
- var t = parseInt(click_elm.style.top) || 0;
- var l = parseInt(click_elm.style.left) || 0;
- var drag_elm_xy = AJS.absolutePosition(drag_elm);
- var click_elm_xy = AJS.absolutePosition(click_elm);
- AJS.setTop(click_elm, t + drag_elm_xy.y - click_elm_xy.y);
- AJS.setLeft(click_elm, l + drag_elm_xy.x - click_elm_xy.x);
- }
-
- if(!dropped && drag_obj.args['on_mouse_up'])
- drag_obj.args['on_mouse_up'](click_elm, e);
-
- if(drag_obj.args['hide_on_move'])
- drag_obj.click_elm.style.visibility = 'visible';
-
- if(drag_obj.args.on_end) {
- drag_obj.args.on_end(click_elm);
- }
-
- AJS._dragObj = null;
- if(drag_elm)
- AJS.hideElement(drag_elm);
- AJS.drag_elm = null;
- },
-
-
-////
-// Misc.
-////
- keys: function(obj) {
- var rval = [];
- for (var prop in obj) {
- rval.push(prop);
- }
- return rval;
- },
-
- values: function(obj) {
- var rval = [];
- for (var prop in obj) {
- rval.push(obj[prop]);
- }
- return rval;
- },
-
- urlencode: function(str) {
- return encodeURIComponent(str.toString());
- },
-
- isDefined: function(o) {
- return (o != "undefined" && o != null)
- },
-
- isArray: function(obj) {
- return obj instanceof Array;
- },
-
- isString: function(obj) {
- return (typeof obj == 'string');
- },
-
- isNumber: function(obj) {
- return (typeof obj == 'number');
- },
-
- isObject: function(obj) {
- return (typeof obj == 'object');
- },
-
- isFunction: function(obj) {
- return (typeof obj == 'function');
- },
-
- isDict: function(o) {
- var str_repr = String(o);
- return str_repr.indexOf(" Object") != -1;
- },
-
- exportToGlobalScope: function() {
- for(e in AJS)
- eval(e + " = AJS." + e);
- },
-
- log: function(o) {
- if(AJS.isMozilla())
- console.log(o);
- else {
- var div = AJS.DIV({'style': 'color: green'});
- AJS.ACN(AJS.getBody(), AJS.setHTML(div, ''+o));
- }
- }
-
-}
-
-AJS.Class = function(members) {
- var fn = function() {
- if(arguments[0] != 'no_init') {
- return this.init.apply(this, arguments);
- }
- }
- fn.prototype = members;
- AJS.update(fn, AJS.Class.prototype);
- return fn;
-}
-AJS.Class.prototype = {
- extend: function(members) {
- var parent = new this('no_init');
- for(k in members) {
- var prev = parent[k];
- var cur = members[k];
- if (prev && prev != cur && typeof cur == 'function') {
- cur = this._parentize(cur, prev);
- }
- parent[k] = cur;
- }
- return new AJS.Class(parent);
- },
-
- implement: function(members) {
- AJS.update(this.prototype, members);
- },
-
- _parentize: function(cur, prev) {
- return function(){
- this.parent = prev;
- return cur.apply(this, arguments);
- }
- }
-};
-
-//Shortcuts
-AJS.$ = AJS.getElement;
-AJS.$$ = AJS.getElements;
-AJS.$f = AJS.getFormElement;
-AJS.$b = AJS.bind;
-AJS.$p = AJS.partial;
-AJS.$FA = AJS.forceArray;
-AJS.$A = AJS.createArray;
-AJS.DI = AJS.documentInsert;
-AJS.ACN = AJS.appendChildNodes;
-AJS.RCN = AJS.replaceChildNodes;
-AJS.AEV = AJS.addEventListener;
-AJS.REV = AJS.removeEventListener;
-AJS.$bytc = AJS.getElementsByTagAndClassName;
-
-AJSDeferred = function(req) {
- this.callbacks = [];
- this.errbacks = [];
- this.req = req;
-}
-AJSDeferred.prototype = {
- excCallbackSeq: function(req, list) {
- var data = req.responseText;
- while (list.length > 0) {
- var fn = list.pop();
- var new_data = fn(data, req);
- if(new_data)
- data = new_data;
- }
- },
-
- callback: function () {
- this.excCallbackSeq(this.req, this.callbacks);
- },
-
- errback: function() {
- if(this.errbacks.length == 0)
- alert("Error encountered:\n" + this.req.responseText);
-
- this.excCallbackSeq(this.req, this.errbacks);
- },
-
- addErrback: function(fn) {
- this.errbacks.unshift(fn);
- },
-
- addCallback: function(fn) {
- this.callbacks.unshift(fn);
- },
-
- addCallbacks: function(fn1, fn2) {
- this.addCallback(fn1);
- this.addErrback(fn2);
- },
-
- sendReq: function(data) {
- if(AJS.isObject(data)) {
- this.req.send(AJS.queryArguments(data));
- }
- else if(AJS.isDefined(data))
- this.req.send(data);
- else {
- this.req.send("");
- }
- }
-};
-
-//Prevent memory-leaks
-AJS.addEventListener(window, 'unload', AJS._unloadListeners);
-AJS._createDomShortcuts()
-}
-
-script_loaded = true;
+++ /dev/null
-/*
-Last Modified: 25/12/06 18:26:30
-
-AJS effects
- A very small library with a lot of functionality
-AUTHOR
- 4mir Salihefendic (http://amix.dk) - amix@amix.dk
-LICENSE
- Copyright (c) 2006 Amir Salihefendic. All rights reserved.
- Copyright (c) 2005 Bob Ippolito. All rights reserved.
- Copyright (c) 2006 Valerio Proietti, http://www.mad4milk.net
- http://www.opensource.org/licenses/mit-license.php
-VERSION
- 3.6
-SITE
- http://orangoo.com/AmiNation/AJS
-**/
-AJS.fx = {
- _shades: {0: 'ffffff', 1: 'ffffee', 2: 'ffffdd',
- 3: 'ffffcc', 4: 'ffffbb', 5: 'ffffaa',
- 6: 'ffff99'},
-
- highlight: function(elm, options) {
- var base = new AJS.fx.Base();
- base.elm = AJS.$(elm);
- base.setOptions(options);
- base.options.duration = 600;
-
- AJS.update(base, {
- increase: function(){
- if(this.now == 7)
- elm.style.backgroundColor = 'transparent';
- else
- elm.style.backgroundColor = '#' + AJS.fx._shades[Math.floor(this.now)];
- }
- });
- return base.custom(6, 0);
- },
-
- fadeIn: function(elm, options) {
- options = options || {};
- if(!options.from) {
- options.from = 0;
- AJS.setOpacity(elm, 0);
- }
- if(!options.to) options.to = 1;
- var s = new AJS.fx.Style(elm, 'opacity', options);
- return s.custom(options.from, options.to);
- },
-
- fadeOut: function(elm, options) {
- options = options || {};
- if(!options.from) options.from = 1;
- if(!options.to) options.to = 0;
- options.duration = 300;
- var s = new AJS.fx.Style(elm, 'opacity', options);
- return s.custom(options.from, options.to);
- },
-
- setWidth: function(elm, options) {
- var s = new AJS.fx.Style(elm, 'width', options);
- return s.custom(options.from, options.to);
- },
-
- setHeight: function(elm, options) {
- var s = new AJS.fx.Style(elm, 'height', options);
- return s.custom(options.from, options.to);
- }
-}
-
-
-//From moo.fx
-AJS.fx.Base = new AJS.Class({
- init: function() {
- AJS.bindMethods(this);
- },
-
- setOptions: function(options){
- this.options = AJS.update({
- onStart: function(){},
- onComplete: function(){},
- transition: AJS.fx.Transitions.sineInOut,
- duration: 500,
- wait: true,
- fps: 50
- }, options || {});
- },
-
- step: function(){
- var time = new Date().getTime();
- if (time < this.time + this.options.duration){
- this.cTime = time - this.time;
- this.setNow();
- } else {
- setTimeout(AJS.$b(this.options.onComplete, this, [this.elm]), 10);
- this.clearTimer();
- this.now = this.to;
- }
- this.increase();
- },
-
- setNow: function(){
- this.now = this.compute(this.from, this.to);
- },
-
- compute: function(from, to){
- var change = to - from;
- return this.options.transition(this.cTime, from, change, this.options.duration);
- },
-
- clearTimer: function(){
- clearInterval(this.timer);
- this.timer = null;
- return this;
- },
-
- _start: function(from, to){
- if (!this.options.wait) this.clearTimer();
- if (this.timer) return;
- setTimeout(AJS.$p(this.options.onStart, this.elm), 10);
- this.from = from;
- this.to = to;
- this.time = new Date().getTime();
- this.timer = setInterval(this.step, Math.round(1000/this.options.fps));
- return this;
- },
-
- custom: function(from, to){
- return this._start(from, to);
- },
-
- set: function(to){
- this.now = to;
- this.increase();
- return this;
- },
-
- setStyle: function(elm, property, val) {
- if(this.property == 'opacity')
- AJS.setOpacity(elm, val);
- else
- AJS.setStyle(elm, property, val);
- }
-});
-
-AJS.fx.Style = AJS.fx.Base.extend({
- init: function(elm, property, options) {
- this.parent();
- this.elm = elm;
- this.setOptions(options);
- this.property = property;
- },
-
- increase: function(){
- this.setStyle(this.elm, this.property, this.now);
- }
-});
-
-AJS.fx.Styles = AJS.fx.Base.extend({
- init: function(elm, options){
- this.parent();
- this.elm = AJS.$(elm);
- this.setOptions(options);
- this.now = {};
- },
-
- setNow: function(){
- for (p in this.from)
- this.now[p] = this.compute(this.from[p], this.to[p]);
- },
-
- custom: function(obj){
- if (this.timer && this.options.wait) return;
- var from = {};
- var to = {};
- for (p in obj){
- from[p] = obj[p][0];
- to[p] = obj[p][1];
- }
- return this._start(from, to);
- },
-
- increase: function(){
- for (var p in this.now) this.setStyle(this.elm, p, this.now[p]);
- }
-});
-
-//Transitions (c) 2003 Robert Penner (http://www.robertpenner.com/easing/), BSD License.
-AJS.fx.Transitions = {
- linear: function(t, b, c, d) { return c*t/d + b; },
- sineInOut: function(t, b, c, d) { return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b; }
-};
-
-script_loaded = true;
+++ /dev/null
-/* Last-Modified: 28/06/06 00:08:22 */
-#GB_overlay {
- background-color: #000;
- position: absolute;
- margin: auto;
- top: 0;
- left: 0;
- z-index: 100;
-}
-
-#GB_window {
- left: 0;
- top: 0;
- font-size: 1px;
- position: absolute;
- overflow: visible;
- z-index: 150;
-}
-
-#GB_window .content {
- width: auto;
- margin: 0;
- padding: 0;
-}
-
-#GB_frame {
- border: 0;
- margin: 0;
- padding: 0;
- overflow: auto;
- white-space: nowrap;
-}
+++ /dev/null
-var GB_CURRENT = null;
-
-GB_hide = function() {
- GB_CURRENT.hide();
-}
-
-GreyBox = new AJS.Class({
- init: function(options) {
- this.use_fx = AJS.fx;
- this.type = "page";
- this.overlay_click_close = false;
- this.salt = 0;
- this.root_dir = GB_ROOT_DIR;
- this.callback_fns = [];
- this.reload_on_close = false;
- this.src_loader = this.root_dir + 'loader_frame.html';
-
- //Solve the www issue
- var h_www = window.location.hostname.indexOf('www');
- var src_www = this.src_loader.indexOf('www');
- if(h_www != -1 && src_www == -1)
- this.src_loader = this.src_loader.replace('://', '://www.');
-
- if(h_www == -1 && src_www != -1)
- this.src_loader = this.src_loader.replace('://www.', '://');
-
- this.show_loading = true;
- AJS.update(this, options);
- },
-
- addCallback: function(fn) {
- if(fn) this.callback_fns.push(fn);
- },
-
- show: function(url) {
- GB_CURRENT = this;
- this.url = url;
-
- var elms = [AJS.$bytc("object"), AJS.$bytc("select")];
- AJS.map(AJS.flattenList(elms), function(elm) {
- elm.style.visibility = "hidden";
- });
-
- this.createElements();
- return false;
- },
-
- hide: function() {
- var c_bs = this.callback_fns;
- if(c_bs != []) {
- AJS.map(c_bs, function(fn) {
- fn();
- });
- }
-
- this.onHide();
- if(this.use_fx) {
- var elm = this.overlay;
- AJS.fx.fadeOut(this.overlay, {
- onComplete: function() {
- AJS.removeElement(elm);
- elm = null;
- },
- duration: 300
- });
- AJS.removeElement(this.g_window);
- }
- else {
- AJS.removeElement(this.g_window, this.overlay);
- }
-
- this.removeFrame();
-
- AJS.REV(window, "scroll", _GB_setOverlayDimension);
- AJS.REV(window, "resize", _GB_update);
-
- var elms = [AJS.$bytc("object"), AJS.$bytc("select")];
- AJS.map(AJS.flattenList(elms), function(elm) {
- elm.style.visibility = "visible";
- });
-
- GB_CURRENT = null;
-
- if(this.reload_on_close)
- window.location.reload();
- },
-
- update: function() {
- this.setOverlayDimension();
- this.setFrameSize();
- this.setWindowPosition();
- },
-
- createElements: function() {
- this.initOverlay();
-
- this.g_window = AJS.DIV({'id': 'GB_window'});
- AJS.hideElement(this.g_window);
- AJS.getBody().insertBefore(this.g_window, this.overlay.nextSibling);
-
- this.initFrame();
- this.initHook();
- this.update();
-
- var me = this;
- if(this.use_fx) {
- AJS.fx.fadeIn(this.overlay, {
- duration: 300,
- to: 0.7,
- onComplete: function() {
- me.onShow();
- AJS.showElement(me.g_window);
- me.startLoading();
- }
- });
- }
- else {
- AJS.setOpacity(this.overlay, 0.7);
- AJS.showElement(this.g_window);
- this.onShow();
- this.startLoading();
- }
-
- AJS.AEV(window, "scroll", _GB_setOverlayDimension);
- AJS.AEV(window, "resize", _GB_update);
- },
-
- removeFrame: function() {
- try{ AJS.removeElement(this.iframe); }
- catch(e) {}
-
- this.iframe = null;
- },
-
- startLoading: function() {
- this.iframe.src = this.src_loader + '?s='+this.salt++;
- AJS.showElement(this.iframe);
- },
-
- setOverlayDimension: function() {
- var page_size = AJS.getWindowSize();
- if(AJS.isMozilla() || AJS.isOpera())
- AJS.setWidth(this.overlay, "100%");
- else
- AJS.setWidth(this.overlay, page_size.w);
-
- var max_height = Math.max(AJS.getScrollTop()+page_size.h, AJS.getScrollTop()+this.height);
-
- if(max_height < AJS.getScrollTop())
- AJS.setHeight(this.overlay, max_height);
- else
- AJS.setHeight(this.overlay, AJS.getScrollTop()+page_size.h);
- },
-
- initOverlay: function() {
- this.overlay = AJS.DIV({'id': 'GB_overlay'});
-
- if(this.overlay_click_close)
- AJS.AEV(this.overlay, "click", GB_hide);
-
- AJS.setOpacity(this.overlay, 0);
- AJS.getBody().insertBefore(this.overlay, AJS.getBody().firstChild);
- },
-
- initFrame: function() {
- if(!this.iframe) {
- var d = {'name': 'GB_frame', 'class': 'GB_frame', 'frameBorder': 0};
- this.iframe = AJS.IFRAME(d);
- this.middle_cnt = AJS.DIV({'class': 'content'}, this.iframe);
-
- this.top_cnt = AJS.DIV();
- this.bottom_cnt = AJS.DIV();
-
- AJS.ACN(this.g_window, this.top_cnt, this.middle_cnt, this.bottom_cnt);
- }
- },
-
- /* Can be implemented */
- onHide: function() {},
- onShow: function() {},
- setFrameSize: function() {},
- setWindowPosition: function() {},
- initHook: function() {}
-
-});
-
-_GB_update = function() { if(GB_CURRENT) GB_CURRENT.update(); }
-_GB_setOverlayDimension = function() { if(GB_CURRENT) GB_CURRENT.setOverlayDimension(); }
-
-AJS.preloadImages(GB_ROOT_DIR+'indicator.gif');
-
-script_loaded = true;
+++ /dev/null
-<!--
-Notice: I feel so dirty doing this, but its the only way to make it cross browser.
--->
-<html>
-<head>
- <script>
- var GB = parent.GB_CURRENT;
- document.write('<script type="text/javascript" src="AJS.js"><\/script>');
- if(GB.use_fx) {
- document.write('<script type="text/javascript" src="AJS_fx.js"><\/script>');
- }
- </script>
- <style>
- body {
- padding: 0;
- margin: 0;
- overflow: hidden;
- }
-
- #GB_frame {
- visibility: hidden;
- width: 100%;
- height: 100%;
- }
-
- #loading {
- padding-top: 50px;
- position: absolute;
- width: 100%;
- top: 0;
- text-align: center;
- vertical-align: middle;
- }
- </style>
-</head>
-<body>
-
-<div id="loading">
- <img src="indicator.gif">
-</div>
-
-<script>
-var loading = AJS.$('loading');
-var gb_type = GB.type;
-var gb_url = GB.url;
-
-//Start loading in the iframe
-if(gb_type == "page") {
- document.write('<iframe id="GB_frame" src="' + gb_url + '" frameborder="0"></iframe>');
-}
-else {
- var img_holder = new Image();
- img_holder.src = gb_url;
- document.write('<img id="GB_frame" src="' + gb_url + '">');
-}
-var frame = AJS.$('GB_frame');
-</script>
-
-</body>
-<script>
-function setupOuterGB() {
- frame.style.visibility = 'visible';
- GB.setFrameSize();
- GB.setWindowPosition();
-}
-
-function loaded() {
- AJS.removeElement(loading);
-
- GB.overlay.innerHTML += " "; //Safari bugfix
-
- if(gb_type == "image") {
- if(img_holder.width != 0 && img_holder.height != 0) {
- var width = img_holder.width;
- var height = img_holder.height;
-
- GB.width = width;
- GB.height = height;
-
- setupOuterGB();
-
- if(GB.use_fx) {
- AJS.setOpacity(frame, 0);
- AJS.fx.fadeIn(frame);
- }
- }
- }
- else {
- GB.width = frame.offsetWidth;
- GB.height = frame.offsetHeight;
- setupOuterGB();
- }
-}
-
-if(GB.show_loading) {
- AJS.AEV(window, 'load', function(e) {
- loaded();
- });
-}
-else {
- loaded();
-}
-</script>
-</html>
+++ /dev/null
-.GB_Gallery {
- margin: 0 22px 0 22px;
-}
-
-.GB_Gallery .content {
- background-color: #fff;
- border: 3px solid #ddd;
-}
-
-.GB_header {
- top: 10px;
- left: 0;
- margin: 0;
- z-index: 500;
- position: absolute;
- border-bottom: 2px solid #555;
- border-top: 2px solid #555;
-}
-
-.GB_header .inner {
- background-color: #333;
- font-family: Arial, Verdana, sans-serif;
- padding: 2px 20px 2px 20px;
-}
-
-.GB_header table {
- margin: 0;
- width: 100%;
- border-collapse: collapse;
-}
-
-.GB_header .caption {
- text-align: left;
- color: #eee;
- white-space: nowrap;
- font-size: 20px;
-}
-
-.GB_header .close {
- text-align: right;
-}
-
-.GB_header .close img {
- z-index: 500;
- cursor: pointer;
-}
-
-.GB_header .middle {
- white-space: nowrap;
- text-align: center;
-}
+++ /dev/null
-GB_showImage = function(caption, url, callback_fn) {
- var options = {
- width: 300,
- height: 300,
- type: 'image',
-
- fullscreen: false,
- center_win: true,
- caption: caption,
- callback_fn: callback_fn
- }
- var win = new GB_Gallery(options);
- return win.show(url);
-}
-
-GB_showPage = function(caption, url, callback_fn) {
- var options = {
- type: 'page',
-
- caption: caption,
- callback_fn: callback_fn,
- fullscreen: true,
- center_win: false
- }
- var win = new GB_Gallery(options);
- return win.show(url);
-}
-
-GB_Gallery = GreyBox.extend({
- init: function(options) {
- this.parent({});
- this.img_close = this.root_dir + 'g_close.gif';
- AJS.update(this, options);
- this.addCallback(this.callback_fn);
- },
-
- initHook: function() {
- AJS.addClass(this.g_window, 'GB_Gallery');
-
- var inner = AJS.DIV({'class': 'inner'});
- this.header = AJS.DIV({'class': 'GB_header'}, inner);
- AJS.setOpacity(this.header, 0);
- AJS.getBody().insertBefore(this.header, this.overlay.nextSibling);
-
- var td_caption = AJS.TD({'id': 'GB_caption', 'class': 'caption', 'width': '40%'}, this.caption);
- var td_middle = AJS.TD({'id': 'GB_middle', 'class': 'middle', 'width': '20%'});
-
- var img_close = AJS.IMG({'src': this.img_close});
- AJS.AEV(img_close, 'click', GB_hide);
- var td_close = AJS.TD({'class': 'close', 'width': '40%'}, img_close);
-
- var tbody = AJS.TBODY(AJS.TR(td_caption, td_middle, td_close));
-
- var table = AJS.TABLE({'cellspacing': '0', 'cellpadding': 0, 'border': 0}, tbody);
- AJS.ACN(inner, table);
-
- if(this.fullscreen)
- AJS.AEV(window, 'scroll', AJS.$b(this.setWindowPosition, this));
- else
- AJS.AEV(window, 'scroll', AJS.$b(this._setHeaderPos, this));
- },
-
- setFrameSize: function() {
- var overlay_w = this.overlay.offsetWidth;
- var page_size = AJS.getWindowSize();
-
- if(this.fullscreen) {
- this.width = overlay_w-40;
- this.height = page_size.h-80;
- }
- AJS.setWidth(this.iframe, this.width);
- AJS.setHeight(this.iframe, this.height);
-
- AJS.setWidth(this.header, overlay_w);
- },
-
- _setHeaderPos: function() {
- AJS.setTop(this.header, AJS.getScrollTop()+10);
- },
-
- setWindowPosition: function() {
- var overlay_w = this.overlay.offsetWidth;
- var page_size = AJS.getWindowSize();
- AJS.setLeft(this.g_window, ((overlay_w - 50 - this.width)/2));
-
- var header_top = AJS.getScrollTop()+55;
- if(!this.center_win) {
- AJS.setTop(this.g_window, header_top);
- }
- else {
- var fl = ((page_size.h - this.height) /2) + 20 + AJS.getScrollTop();
- if(fl < 0) fl = 0;
- if(header_top > fl) {
- fl = header_top;
- }
- AJS.setTop(this.g_window, fl);
- }
- this._setHeaderPos();
- },
-
- onHide: function() {
- AJS.removeElement(this.header);
- AJS.removeClass(this.g_window, 'GB_Gallery');
- },
-
- onShow: function() {
- if(this.use_fx)
- AJS.fx.fadeIn(this.header, {to: 1});
- else
- AJS.setOpacity(this.header, 1);
- }
-});
-
-AJS.preloadImages(GB_ROOT_DIR+'g_close.gif');
+++ /dev/null
-#GB_middle {
- color: #eee;
-}
-
-#GB_middle img {
- cursor: pointer;
- vertical-align: middle;
-}
-
-#GB_middle .disabled {
- cursor: default;
-}
-
-#GB_middle .left {
- padding-right: 10px;
-}
-
-#GB_middle .right {
- padding-left: 10px;
-}
+++ /dev/null
-GB_showFullScreenSet = function(set, start_index, callback_fn) {
- var options = {
- type: 'page',
- fullscreen: true,
- center_win: false
- }
- var gb_sets = new GB_Sets(options, set);
- gb_sets.addCallback(callback_fn);
- gb_sets.showSet(start_index-1);
- return false;
-}
-
-GB_showImageSet = function(set, start_index, callback_fn) {
- var options = {
- type: 'image',
- fullscreen: false,
- center_win: true,
- width: 300,
- height: 300
- }
- var gb_sets = new GB_Sets(options, set);
- gb_sets.addCallback(callback_fn);
- gb_sets.showSet(start_index-1);
- return false;
-}
-
-GB_Sets = GB_Gallery.extend({
- init: function(options, set) {
- this.parent(options);
- if(!this.img_next) this.img_next = this.root_dir + 'next.gif';
- if(!this.img_prev) this.img_prev = this.root_dir + 'prev.gif';
- this.current_set = set;
- },
-
- showSet: function(start_index) {
- this.current_index = start_index;
-
- var item = this.current_set[this.current_index];
- this.show(item.url);
- this._setCaption(item.caption);
-
- this.btn_prev = AJS.IMG({'class': 'left', src: this.img_prev});
- this.btn_next = AJS.IMG({'class': 'right', src: this.img_next});
-
- AJS.AEV(this.btn_prev, 'click', AJS.$b(this.switchPrev, this));
- AJS.AEV(this.btn_next, 'click', AJS.$b(this.switchNext, this));
-
- GB_STATUS = AJS.SPAN({'class': 'GB_navStatus'});
- AJS.ACN(AJS.$('GB_middle'), this.btn_prev, GB_STATUS, this.btn_next);
-
- this.updateStatus();
- },
-
- updateStatus: function() {
- AJS.setHTML(GB_STATUS, (this.current_index + 1) + ' / ' + this.current_set.length);
- if(this.current_index == 0) {
- AJS.addClass(this.btn_prev, 'disabled');
- }
- else {
- AJS.removeClass(this.btn_prev, 'disabled');
- }
-
- if(this.current_index == this.current_set.length-1) {
- AJS.addClass(this.btn_next, 'disabled');
- }
- else {
- AJS.removeClass(this.btn_next, 'disabled');
- }
- },
-
- _setCaption: function(caption) {
- AJS.setHTML(AJS.$('GB_caption'), caption);
- },
-
- updateFrame: function() {
- var item = this.current_set[this.current_index];
- this._setCaption(item.caption);
- this.url = item.url;
- this.startLoading();
- },
-
- switchPrev: function() {
- if(this.current_index != 0) {
- this.current_index--;
- this.updateFrame();
- this.updateStatus();
- }
- },
-
- switchNext: function() {
- if(this.current_index != this.current_set.length-1) {
- this.current_index++
- this.updateFrame();
- this.updateStatus();
- }
- }
-});
-
-AJS.AEV(window, 'load', function() {
- AJS.preloadImages(GB_ROOT_DIR+'next.gif', GB_ROOT_DIR+'prev.gif');
-});
+++ /dev/null
-.GB_Window .content {
- background-color: #fff;
- border: 3px solid #ccc;
- border-top: none;
-}
-
-.GB_Window .header {
- border-bottom: 1px solid #aaa;
- border-top: 1px solid #999;
- border-left: 3px solid #ccc;
- border-right: 3px solid #ccc;
- margin: 0;
-
- height: 22px;
- font-size: 12px;
- padding: 3px 0;
- color: #333;
-}
-
-.GB_Window .caption {
- font-size: 12px;
- text-align: left;
- font-weight: bold;
- white-space: nowrap;
- padding-right: 20px;
-}
-
-.GB_Window .close { text-align: right; }
-.GB_Window .close span {
- font-size: 12px;
- cursor: pointer;
-}
-.GB_Window .close img {
- cursor: pointer;
- padding: 0 3px 0 0;
-}
-
-.GB_Window .on { border-bottom: 1px solid #333; }
-.GB_Window .click { border-bottom: 1px solid red; }
+++ /dev/null
-GB_show = function(caption, url, /* optional */ height, width, callback_fn) {
- var options = {
- caption: caption,
- height: height || 500,
- width: width || 500,
- fullscreen: false,
- callback_fn: callback_fn
- }
- var win = new GB_Window(options);
- return win.show(url);
-}
-
-GB_showCenter = function(caption, url, /* optional */ height, width, callback_fn) {
- var options = {
- caption: caption,
- center_win: true,
- height: height || 500,
- width: width || 500,
- fullscreen: false,
- callback_fn: callback_fn
- }
- var win = new GB_Window(options);
- return win.show(url);
-}
-
-GB_showFullScreen = function(caption, url, callback_fn) {
- var options = {
- caption: caption,
- fullscreen: true,
- callback_fn: callback_fn
- }
- var win = new GB_Window(options);
- return win.show(url);
-}
-
-GB_Window = GreyBox.extend({
- init: function(options) {
- this.parent({});
- this.img_header = this.root_dir+"header_bg.gif";
- this.img_close = this.root_dir+"w_close.gif";
- this.show_close_img = true;
- AJS.update(this, options);
- this.addCallback(this.callback_fn);
- },
-
- initHook: function() {
- AJS.addClass(this.g_window, 'GB_Window');
-
- this.header = AJS.TABLE({'class': 'header'});
- this.header.style.backgroundImage = "url("+ this.img_header +")";
-
- var td_caption = AJS.TD({'class': 'caption'}, this.caption);
- var td_close = AJS.TD({'class': 'close'});
-
- if(this.show_close_img) {
- var img_close = AJS.IMG({'src': this.img_close});
- var span = AJS.SPAN('Close');
-
- var btn = AJS.DIV(img_close, span);
-
- AJS.AEV([img_close, span], 'mouseover', function() { AJS.addClass(span, 'on'); });
- AJS.AEV([img_close, span], 'mouseout', function() { AJS.removeClass(span, 'on'); });
- AJS.AEV([img_close, span], 'mousedown', function() { AJS.addClass(span, 'click'); });
- AJS.AEV([img_close, span], 'mouseup', function() { AJS.removeClass(span, 'click'); });
- AJS.AEV([img_close, span], 'click', GB_hide);
-
- AJS.ACN(td_close, btn);
- }
-
- tbody_header = AJS.TBODY();
- AJS.ACN(tbody_header, AJS.TR(td_caption, td_close));
-
- AJS.ACN(this.header, tbody_header);
- AJS.ACN(this.top_cnt, this.header);
-
- if(this.fullscreen)
- AJS.AEV(window, 'scroll', AJS.$b(this.setWindowPosition, this));
- },
-
- setFrameSize: function() {
- if(this.fullscreen) {
- var page_size = AJS.getWindowSize();
- overlay_h = page_size.h;
- this.width = Math.round(this.overlay.offsetWidth - (this.overlay.offsetWidth/100)*10);
- this.height = Math.round(overlay_h - (overlay_h/100)*10);
- }
-
- AJS.setWidth(this.header, this.width+6); //6 is for the left+right border
- AJS.setWidth(this.iframe, this.width);
- AJS.setHeight(this.iframe, this.height);
- },
-
- setWindowPosition: function() {
- var page_size = AJS.getWindowSize();
- AJS.setLeft(this.g_window, ((page_size.w - this.width)/2)-13);
-
- if(!this.center_win) {
- AJS.setTop(this.g_window, AJS.getScrollTop());
- }
- else {
- var fl = ((page_size.h - this.height) /2) - 20 + AJS.getScrollTop();
- if(fl < 0)
- fl = 0;
- AJS.setTop(this.g_window, fl);
- }
- }
-});
-
-AJS.preloadImages(GB_ROOT_DIR+'w_close.gif', GB_ROOT_DIR+'header_bg.gif');
+++ /dev/null
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
-<head>
- <title>GreyBox - Installation</title>
-
- <script type="text/javascript" src="greybox/AJS.js"></script>
-
- <script type="text/javascript" src="static_files/help.js"></script>
- <link href="static_files/help.css" rel="stylesheet" type="text/css" media="all" />
-</head>
-<body>
-
-<script>
- insertHeader();
- insertMenu('installation');
-</script>
-
-<ol>
-<li>
-Append following to your header section (in between <code><header>...</header></code>).
-<br />
-<span class="hl">GB_ROOT_DIR</span> is the URL where static files are located:
-<pre>
-<code><script type="text/javascript">
- var GB_ROOT_DIR = "http://mydomain.com/greybox/";
-</script></code>
-</pre>
-</li>
-GB_ROOT_DIR should be absolute.
-
-<li>
-Append also following scripts and one stylesheet:
-<pre>
-<code><script type="text/javascript" src="greybox/AJS.js"></script>
-<script type="text/javascript" src="greybox/AJS_fx.js"></script>
-<script type="text/javascript" src="greybox/gb_scripts.js"></script>
-<link href="greybox/gb_styles.css" rel="stylesheet" type="text/css" /></code>
-</pre>
-
-AJS_fx.js is optional, it's used for effects. If you don't wish effects, then don't include AJS_fx.js in your header section.
-</li>
-
-<li>
-That's it, you are now ready to use GreyBox!
-</li>
-</ol>
-
-</body>
-</html>
+++ /dev/null
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
-<head>
- <title>GreyBox - Normal usage</title>
-
- <script type="text/javascript">
- var GB_ROOT_DIR = "./greybox/";
- </script>
-
- <script type="text/javascript" src="greybox/AJS.js"></script>
- <script type="text/javascript" src="greybox/AJS_fx.js"></script>
- <script type="text/javascript" src="greybox/gb_scripts.js"></script>
- <link href="greybox/gb_styles.css" rel="stylesheet" type="text/css" media="all" />
-
- <script type="text/javascript" src="static_files/help.js"></script>
- <link href="static_files/help.css" rel="stylesheet" type="text/css" media="all" />
-</head>
-
-<body>
-
-<script>
- insertHeader();
- insertMenu('nrm_usage');
-</script>
-
-<h2>Showing images</h2>
-
-<h3 class="first">Showing one image:</h3>
-<h4>Syntax:</h4>
-<pre>
-<code><a href="URL" title="CAPTION" rel="gb_image[]">HTML</a></code>
-</pre>
-
-<h4>Example:</h4>
-<pre>
-<code><a href="http://static.flickr.com/119/294309231_a3d2a339b9.jpg" title="Flower" rel="gb_image[]">Show flower</a></code>
-</pre>
-
-<h4>Example rendered:</h4>
-<a href="http://static.flickr.com/119/294309231_a3d2a339b9.jpg" title="Flower" rel="gb_image[]">Show flower</a>
-
-
-<h3>Showing a group of images:</h3>
-<h4>Syntax:</h4>
-<pre>
-<code><a href="URL" title="CAPTION" rel="gb_imageset[NAME]">HTML</a></code>
-<code><a href="URL" title="CAPTION" rel="gb_imageset[NAME]">HTML</a></code>
-</pre>
-
-<h4>Example:</h4>
-<pre>
-<code><a href="static_files/salt.jpg" rel="gb_imageset[nice_pics]" title="Salt flats in Chile">Salt flats</a></code>
-<code><a href="static_files/night_valley.jpg" rel="gb_imageset[nice_pics]" title="Night valley">Night valley</a></code>
-</pre>
-
-<h4>Example rendered:</h4>
-<a href="static_files/salt.jpg" rel="gb_imageset[nice_pics]" title="Salt flats in Chile">Salt flats</a>
-<a href="static_files/night_valley.jpg" rel="gb_imageset[nice_pics]" title="Night valley">Night valley</a>
-
-
-<h2>Showing pages</h2>
-
-<h3>Showing one page:</h3>
-<h4>Syntax:</h4>
-<pre>
-<code><a href="URL" title="CAPTION" rel="gb_page[WIDTH, HEIGHT]">HTML</a></code>
-</pre>
-
-<h4>Example:</h4>
-<pre>
-<code><a href="http://google.com/" title="Google" rel="gb_page[500, 500]">Launch Google.com</a></code>
-</pre>
-
-<h4>Example rendered:</h4>
-<a href="http://google.com/" title="Google" rel="gb_page[500, 500]">Launch Google.com</a>
-
-
-<h3>Showing one page as center window:</h3>
-<h4>Syntax:</h4>
-<pre>
-<code><a href="URL" title="CAPTION" rel="gb_page_center[WIDTH, HEIGHT]">HTML</a></code>
-</pre>
-
-<h4>Example:</h4>
-<pre>
-<code><a href="http://google.com/" title="Google" rel="gb_page_center[500, 500]">Launch Google.com</a></code>
-</pre>
-
-<h4>Example rendered:</h4>
-<a href="http://google.com/" title="Google" rel="gb_page_center[500, 500]">Launch Google.com</a>
-
-
-<h3>Showing one page in fullscreen:</h3>
-<h4>Syntax:</h4>
-<pre>
-<code><a href="URL" title="CAPTION" rel="gb_page_fs[]">HTML</a></code>
-</pre>
-
-<h4>Example:</h4>
-<pre>
-<code><a href="http://google.com/" title="Google" rel="gb_page_fs[]">Launch Google.com</a></code>
-</pre>
-
-<h4>Example rendered:</h4>
-<a href="http://google.com/" title="Google" rel="gb_page_fs[]">Launch Google.com</a>
-
-<h3>Showing a group of pages:</h3>
-<h4>Syntax:</h4>
-<pre>
-<code><a href="URL" title="CAPTION" rel="gb_pageset[NAME]">HTML</a></code>
-<code><a href="URL" title="CAPTION" rel="gb_pageset[NAME]">HTML</a></code>
-</pre>
-
-<h4>Example:</h4>
-<pre>
-<code><a href="http://google.com/" title="Google" rel="gb_pageset[search_sites]">Launch Google search</a></code>
-<code><a href="http://search.yahoo.com/" rel="gb_pageset[search_sites]">Launch Yahoo search</a></code>
-</pre>
-
-<h4>Example rendered:</h4>
-<a href="http://google.com/" title="Google" rel="gb_pageset[search_sites]">Launch Google search</a>
-<a href="http://search.yahoo.com/" rel="gb_pageset[search_sites]">Launch Yahoo search</a>
-
-
-</body>
-</html>
+++ /dev/null
-body {
- font-family: helvetica, verdana, sans-serif;
- font-size: 12px;
- background-color: #fff;
- padding: 10px 35px 35px 35px;
- width: 800px;
- margin: auto;
-}
-
-#top {
- text-align: center;
-}
-
-h2 {
- font-size: 18px;
- color: #333;
- margin: 35px 0 10px 0;
-}
-
-h3 {
- color: #333;
- border-bottom: 1px solid #999;
- font-size: 15px;
- margin: 30px 0 3px 0;
-}
-
-.first {
- margin-top: 20px;
-}
-
-h4 {
- color: black;
- font-size: 13px;
- margin: 10px 0 5px 0;
-}
-
-pre {
- font-size: 11px;
- margin-top: 5px;
- padding: 4px;
- background-color: #e3e2c6;
- border: 1px solid #999;
-}
-
-.hl {
- background-color: #ffffcc;
-}
-
-ol {
- margin: 0;
- padding: 0 0px 0 20px;
-}
-
-li {
- padding: 5px 0 5px 0;
-}
-
-img {
- border: 0;
-}
-
-/*
- * Menu
- */
-#menu {
- border-bottom: 1px solid #999;
- margin: 20px 0px;
- padding: 10px 0pt 5px;
- text-align: center;
-}
-
-#menu li {
- display: inline;
- margin: 0px;
- padding: 0px;
-}
-
-#menu a {
- background: #ddd none repeat;
- border: 1px solid #999;
- margin: 0 5px 0 5px;
- padding: 5px;
-}
-
-#menu a.current {
- background: #fff none repeat;
- border-bottom: 1px solid #fff;
-}
-
-#menu a {
- color: black;
- text-decoration: none;
-}
+++ /dev/null
-var tmpl_header = AJS.join('', [
- '<div id="top"> <img src="static_files/logo.gif" alt="" /> <br />',
- '<span style="font-weight: bold; color: #333">A pop-up window that doesn\'t suck.</span>',
- '</div>'
-]);
-
-function insertHeader() {
- AJS.DI(tmpl_header);
-}
-
-var LINKS = {
- 'installation': 'installation.html',
- 'examples': 'examples.html',
- 'nrm_usage': 'normal_usage.html',
- 'adv_usage': 'advance_usage.html',
- 'cmpr': 'compressing_greybox.html',
- 'about': 'about.html'
-}
-
-function insertMenu(current_page) {
- var menu = AJS.UL({id: 'menu'});
- var create_item = function(cls, name) {
- var item = AJS.LI({'class': cls});
- AJS.ACN(item, AJS.A({href: LINKS[cls]}, name));
- return item;
- }
- var items = [
- create_item('installation', 'Installation'),
- create_item('examples', 'Examples'),
- create_item('nrm_usage', 'Normal usage'),
- create_item('adv_usage', 'Advance usage'),
- create_item('cmpr', 'Compressing GreyBox'),
- create_item('about', 'About')
- ];
-
- AJS.map(items, function(item) {
- if(item.className == current_page) {
- AJS.addClass(AJS.$bytc('a', null, item)[0], 'current');
- }
- AJS.ACN(menu, item);
- });
- AJS.DI(menu);
-}
-
-function insertCode() {
- var code = AJS.join('\n', arguments);
- var result = '<pre><code>';
- code = code.replace(/</g, '<').replace(/>/g, '>');
- result += code;
- result += '</code></pre>';
- document.write(result);
-}
+++ /dev/null
-var GB_CURRENT=null;
-GB_hide=function(){
-GB_CURRENT.hide();
-};
-GreyBox=new AJS.Class({init:function(_1){
-this.use_fx=AJS.fx;
-this.type="page";
-this.overlay_click_close=false;
-this.salt=0;
-this.root_dir=GB_ROOT_DIR;
-this.callback_fns=[];
-this.reload_on_close=false;
-this.src_loader=this.root_dir+"loader_frame.html";
-var _2=window.location.hostname.indexOf("www");
-var _3=this.src_loader.indexOf("www");
-if(_2!=-1&&_3==-1){
-this.src_loader=this.src_loader.replace("://","://www.");
-}
-if(_2==-1&&_3!=-1){
-this.src_loader=this.src_loader.replace("://www.","://");
-}
-this.show_loading=true;
-AJS.update(this,_1);
-},addCallback:function(fn){
-if(fn){
-this.callback_fns.push(fn);
-}
-},show:function(_5){
-GB_CURRENT=this;
-this.url=_5;
-var _6=[AJS.$bytc("object"),AJS.$bytc("select")];
-AJS.map(AJS.flattenList(_6),function(_7){
-_7.style.visibility="hidden";
-});
-this.createElements();
-return false;
-},hide:function(){
-var _8=this.callback_fns;
-if(_8!=[]){
-AJS.map(_8,function(fn){
-fn();
-});
-}
-this.onHide();
-if(this.use_fx){
-var _a=this.overlay;
-AJS.fx.fadeOut(this.overlay,{onComplete:function(){
-AJS.removeElement(_a);
-_a=null;
-},duration:300});
-AJS.removeElement(this.g_window);
-}else{
-AJS.removeElement(this.g_window,this.overlay);
-}
-this.removeFrame();
-AJS.REV(window,"scroll",_GB_setOverlayDimension);
-AJS.REV(window,"resize",_GB_update);
-var _b=[AJS.$bytc("object"),AJS.$bytc("select")];
-AJS.map(AJS.flattenList(_b),function(_c){
-_c.style.visibility="visible";
-});
-GB_CURRENT=null;
-if(this.reload_on_close){
-window.location.reload();
-}
-},update:function(){
-this.setOverlayDimension();
-this.setFrameSize();
-this.setWindowPosition();
-},createElements:function(){
-this.initOverlay();
-this.g_window=AJS.DIV({"id":"GB_window"});
-AJS.hideElement(this.g_window);
-AJS.getBody().insertBefore(this.g_window,this.overlay.nextSibling);
-this.initFrame();
-this.initHook();
-this.update();
-var me=this;
-if(this.use_fx){
-AJS.fx.fadeIn(this.overlay,{duration:300,to:0.7,onComplete:function(){
-me.onShow();
-AJS.showElement(me.g_window);
-me.startLoading();
-}});
-}else{
-AJS.setOpacity(this.overlay,0.7);
-AJS.showElement(this.g_window);
-this.onShow();
-this.startLoading();
-}
-AJS.AEV(window,"scroll",_GB_setOverlayDimension);
-AJS.AEV(window,"resize",_GB_update);
-},removeFrame:function(){
-try{
-AJS.removeElement(this.iframe);
-}
-catch(e){
-}
-this.iframe=null;
-},startLoading:function(){
-this.iframe.src=this.src_loader+"?s="+this.salt++;
-AJS.showElement(this.iframe);
-},setOverlayDimension:function(){
-var _e=AJS.getWindowSize();
-if(AJS.isMozilla()||AJS.isOpera()){
-AJS.setWidth(this.overlay,"100%");
-}else{
-AJS.setWidth(this.overlay,_e.w);
-}
-var _f=Math.max(AJS.getScrollTop()+_e.h,AJS.getScrollTop()+this.height);
-if(_f<AJS.getScrollTop()){
-AJS.setHeight(this.overlay,_f);
-}else{
-AJS.setHeight(this.overlay,AJS.getScrollTop()+_e.h);
-}
-},initOverlay:function(){
-this.overlay=AJS.DIV({"id":"GB_overlay"});
-if(this.overlay_click_close){
-AJS.AEV(this.overlay,"click",GB_hide);
-}
-AJS.setOpacity(this.overlay,0);
-AJS.getBody().insertBefore(this.overlay,AJS.getBody().firstChild);
-},initFrame:function(){
-if(!this.iframe){
-var d={"name":"GB_frame","class":"GB_frame","frameBorder":0};
-this.iframe=AJS.IFRAME(d);
-this.middle_cnt=AJS.DIV({"class":"content"},this.iframe);
-this.top_cnt=AJS.DIV();
-this.bottom_cnt=AJS.DIV();
-AJS.ACN(this.g_window,this.top_cnt,this.middle_cnt,this.bottom_cnt);
-}
-},onHide:function(){
-},onShow:function(){
-},setFrameSize:function(){
-},setWindowPosition:function(){
-},initHook:function(){
-}});
-_GB_update=function(){
-if(GB_CURRENT){
-GB_CURRENT.update();
-}
-};
-_GB_setOverlayDimension=function(){
-if(GB_CURRENT){
-GB_CURRENT.setOverlayDimension();
-}
-};
-AJS.preloadImages(GB_ROOT_DIR+"indicator.gif");
-script_loaded=true;
-var GB_SETS={};
-function decoGreyboxLinks(){
-var as=AJS.$bytc("a");
-AJS.map(as,function(a){
-if(a.getAttribute("href")&&a.getAttribute("rel")){
-var rel=a.getAttribute("rel");
-if(rel.indexOf("gb_")==0){
-var _14=rel.match(/\w+/)[0];
-var _15=rel.match(/\[(.*)\]/)[1];
-var _16=0;
-var _17={"caption":a.title||"","url":a.href};
-if(_14=="gb_pageset"||_14=="gb_imageset"){
-if(!GB_SETS[_15]){
-GB_SETS[_15]=[];
-}
-GB_SETS[_15].push(_17);
-_16=GB_SETS[_15].length;
-}
-if(_14=="gb_pageset"){
-a.onclick=function(){
-GB_showFullScreenSet(GB_SETS[_15],_16);
-return false;
-};
-}
-if(_14=="gb_imageset"){
-a.onclick=function(){
-GB_showImageSet(GB_SETS[_15],_16);
-return false;
-};
-}
-if(_14=="gb_image"){
-a.onclick=function(){
-GB_showImage(_17.caption,_17.url);
-return false;
-};
-}
-if(_14=="gb_page"){
-a.onclick=function(){
-var sp=_15.split(/, ?/);
-GB_show(_17.caption,_17.url,parseInt(sp[1]),parseInt(sp[0]));
-return false;
-};
-}
-if(_14=="gb_page_fs"){
-a.onclick=function(){
-GB_showFullScreen(_17.caption,_17.url);
-return false;
-};
-}
-if(_14=="gb_page_center"){
-a.onclick=function(){
-var sp=_15.split(/, ?/);
-GB_showCenter(_17.caption,_17.url,parseInt(sp[1]),parseInt(sp[0]));
-return false;
-};
-}
-}
-}
-});
-}
-AJS.AEV(window,"load",decoGreyboxLinks);
-GB_showImage=function(_1a,url,_1c){
-var _1d={width:300,height:300,type:"image",fullscreen:false,center_win:true,caption:_1a,callback_fn:_1c};
-var win=new GB_Gallery(_1d);
-return win.show(url);
-};
-GB_showPage=function(_1f,url,_21){
-var _22={type:"page",caption:_1f,callback_fn:_21,fullscreen:true,center_win:false};
-var win=new GB_Gallery(_22);
-return win.show(url);
-};
-GB_Gallery=GreyBox.extend({init:function(_24){
-this.parent({});
-this.img_close=this.root_dir+"g_close.gif";
-AJS.update(this,_24);
-this.addCallback(this.callback_fn);
-},initHook:function(){
-AJS.addClass(this.g_window,"GB_Gallery");
-var _25=AJS.DIV({"class":"inner"});
-this.header=AJS.DIV({"class":"GB_header"},_25);
-AJS.setOpacity(this.header,0);
-AJS.getBody().insertBefore(this.header,this.overlay.nextSibling);
-var _26=AJS.TD({"id":"GB_caption","class":"caption","width":"40%"},this.caption);
-var _27=AJS.TD({"id":"GB_middle","class":"middle","width":"20%"});
-var _28=AJS.IMG({"src":this.img_close});
-AJS.AEV(_28,"click",GB_hide);
-var _29=AJS.TD({"class":"close","width":"40%"},_28);
-var _2a=AJS.TBODY(AJS.TR(_26,_27,_29));
-var _2b=AJS.TABLE({"cellspacing":"0","cellpadding":0,"border":0},_2a);
-AJS.ACN(_25,_2b);
-if(this.fullscreen){
-AJS.AEV(window,"scroll",AJS.$b(this.setWindowPosition,this));
-}else{
-AJS.AEV(window,"scroll",AJS.$b(this._setHeaderPos,this));
-}
-},setFrameSize:function(){
-var _2c=this.overlay.offsetWidth;
-var _2d=AJS.getWindowSize();
-if(this.fullscreen){
-this.width=_2c-40;
-this.height=_2d.h-80;
-}
-AJS.setWidth(this.iframe,this.width);
-AJS.setHeight(this.iframe,this.height);
-AJS.setWidth(this.header,_2c);
-},_setHeaderPos:function(){
-AJS.setTop(this.header,AJS.getScrollTop()+10);
-},setWindowPosition:function(){
-var _2e=this.overlay.offsetWidth;
-var _2f=AJS.getWindowSize();
-AJS.setLeft(this.g_window,((_2e-50-this.width)/2));
-var _30=AJS.getScrollTop()+55;
-if(!this.center_win){
-AJS.setTop(this.g_window,_30);
-}else{
-var fl=((_2f.h-this.height)/2)+20+AJS.getScrollTop();
-if(fl<0){
-fl=0;
-}
-if(_30>fl){
-fl=_30;
-}
-AJS.setTop(this.g_window,fl);
-}
-this._setHeaderPos();
-},onHide:function(){
-AJS.removeElement(this.header);
-AJS.removeClass(this.g_window,"GB_Gallery");
-},onShow:function(){
-if(this.use_fx){
-AJS.fx.fadeIn(this.header,{to:1});
-}else{
-AJS.setOpacity(this.header,1);
-}
-}});
-AJS.preloadImages(GB_ROOT_DIR+"g_close.gif");
-GB_showFullScreenSet=function(set,_33,_34){
-var _35={type:"page",fullscreen:true,center_win:false};
-var _36=new GB_Sets(_35,set);
-_36.addCallback(_34);
-_36.showSet(_33-1);
-return false;
-};
-GB_showImageSet=function(set,_38,_39){
-var _3a={type:"image",fullscreen:false,center_win:true,width:300,height:300};
-var _3b=new GB_Sets(_3a,set);
-_3b.addCallback(_39);
-_3b.showSet(_38-1);
-return false;
-};
-GB_Sets=GB_Gallery.extend({init:function(_3c,set){
-this.parent(_3c);
-if(!this.img_next){
-this.img_next=this.root_dir+"next.gif";
-}
-if(!this.img_prev){
-this.img_prev=this.root_dir+"prev.gif";
-}
-this.current_set=set;
-},showSet:function(_3e){
-this.current_index=_3e;
-var _3f=this.current_set[this.current_index];
-this.show(_3f.url);
-this._setCaption(_3f.caption);
-this.btn_prev=AJS.IMG({"class":"left",src:this.img_prev});
-this.btn_next=AJS.IMG({"class":"right",src:this.img_next});
-AJS.AEV(this.btn_prev,"click",AJS.$b(this.switchPrev,this));
-AJS.AEV(this.btn_next,"click",AJS.$b(this.switchNext,this));
-GB_STATUS=AJS.SPAN({"class":"GB_navStatus"});
-AJS.ACN(AJS.$("GB_middle"),this.btn_prev,GB_STATUS,this.btn_next);
-this.updateStatus();
-},updateStatus:function(){
-AJS.setHTML(GB_STATUS,(this.current_index+1)+" / "+this.current_set.length);
-if(this.current_index==0){
-AJS.addClass(this.btn_prev,"disabled");
-}else{
-AJS.removeClass(this.btn_prev,"disabled");
-}
-if(this.current_index==this.current_set.length-1){
-AJS.addClass(this.btn_next,"disabled");
-}else{
-AJS.removeClass(this.btn_next,"disabled");
-}
-},_setCaption:function(_40){
-AJS.setHTML(AJS.$("GB_caption"),_40);
-},updateFrame:function(){
-var _41=this.current_set[this.current_index];
-this._setCaption(_41.caption);
-this.url=_41.url;
-this.startLoading();
-},switchPrev:function(){
-if(this.current_index!=0){
-this.current_index--;
-this.updateFrame();
-this.updateStatus();
-}
-},switchNext:function(){
-if(this.current_index!=this.current_set.length-1){
-this.current_index++;
-this.updateFrame();
-this.updateStatus();
-}
-}});
-AJS.AEV(window,"load",function(){
-AJS.preloadImages(GB_ROOT_DIR+"next.gif",GB_ROOT_DIR+"prev.gif");
-});
-GB_show=function(_42,url,_44,_45,_46){
-var _47={caption:_42,height:_44||500,width:_45||500,fullscreen:false,callback_fn:_46};
-var win=new GB_Window(_47);
-return win.show(url);
-};
-GB_showCenter=function(_49,url,_4b,_4c,_4d){
-var _4e={caption:_49,center_win:true,height:_4b||500,width:_4c||500,fullscreen:false,callback_fn:_4d};
-var win=new GB_Window(_4e);
-return win.show(url);
-};
-GB_showFullScreen=function(_50,url,_52){
-var _53={caption:_50,fullscreen:true,callback_fn:_52};
-var win=new GB_Window(_53);
-return win.show(url);
-};
-GB_Window=GreyBox.extend({init:function(_55){
-this.parent({});
-this.img_header=this.root_dir+"header_bg.gif";
-this.img_close=this.root_dir+"w_close.gif";
-this.show_close_img=true;
-AJS.update(this,_55);
-this.addCallback(this.callback_fn);
-},initHook:function(){
-AJS.addClass(this.g_window,"GB_Window");
-this.header=AJS.TABLE({"class":"header"});
-this.header.style.backgroundImage="url("+this.img_header+")";
-var _56=AJS.TD({"class":"caption"},this.caption);
-var _57=AJS.TD({"class":"close"});
-if(this.show_close_img){
-var _58=AJS.IMG({"src":this.img_close});
-var _59=AJS.SPAN("Close");
-var btn=AJS.DIV(_58,_59);
-AJS.AEV([_58,_59],"mouseover",function(){
-AJS.addClass(_59,"on");
-});
-AJS.AEV([_58,_59],"mouseout",function(){
-AJS.removeClass(_59,"on");
-});
-AJS.AEV([_58,_59],"mousedown",function(){
-AJS.addClass(_59,"click");
-});
-AJS.AEV([_58,_59],"mouseup",function(){
-AJS.removeClass(_59,"click");
-});
-AJS.AEV([_58,_59],"click",GB_hide);
-AJS.ACN(_57,btn);
-}
-tbody_header=AJS.TBODY();
-AJS.ACN(tbody_header,AJS.TR(_56,_57));
-AJS.ACN(this.header,tbody_header);
-AJS.ACN(this.top_cnt,this.header);
-if(this.fullscreen){
-AJS.AEV(window,"scroll",AJS.$b(this.setWindowPosition,this));
-}
-},setFrameSize:function(){
-if(this.fullscreen){
-var _5b=AJS.getWindowSize();
-overlay_h=_5b.h;
-this.width=Math.round(this.overlay.offsetWidth-(this.overlay.offsetWidth/100)*10);
-this.height=Math.round(overlay_h-(overlay_h/100)*10);
-}
-AJS.setWidth(this.header,this.width+6);
-AJS.setWidth(this.iframe,this.width);
-AJS.setHeight(this.iframe,this.height);
-},setWindowPosition:function(){
-var _5c=AJS.getWindowSize();
-AJS.setLeft(this.g_window,((_5c.w-this.width)/2)-13);
-if(!this.center_win){
-AJS.setTop(this.g_window,AJS.getScrollTop());
-}else{
-var fl=((_5c.h-this.height)/2)-20+AJS.getScrollTop();
-if(fl<0){
-fl=0;
-}
-AJS.setTop(this.g_window,fl);
-}
-}});
-AJS.preloadImages(GB_ROOT_DIR+"w_close.gif",GB_ROOT_DIR+"header_bg.gif");
-
-
-script_loaded=true;
\ No newline at end of file
+++ /dev/null
-/* Last-Modified: 28/06/06 00:08:22 */
-#GB_overlay {
- background-color: #000;
- position: absolute;
- margin: auto;
- top: 0;
- left: 0;
- z-index: 100;
-}
-
-#GB_window {
- left: 0;
- top: 0;
- font-size: 1px;
- position: absolute;
- overflow: visible;
- z-index: 150;
-}
-
-#GB_window .content {
- width: auto;
- margin: 0;
- padding: 0;
-}
-
-#GB_frame {
- border: 0;
- margin: 0;
- padding: 0;
- overflow: auto;
- white-space: nowrap;
-}
-
-
-.GB_Gallery {
- margin: 0 22px 0 22px;
-}
-
-.GB_Gallery .content {
- background-color: #fff;
- border: 3px solid #ddd;
-}
-
-.GB_header {
- top: 10px;
- left: 0;
- margin: 0;
- z-index: 500;
- position: absolute;
- border-bottom: 2px solid #555;
- border-top: 2px solid #555;
-}
-
-.GB_header .inner {
- background-color: #333;
- font-family: Arial, Verdana, sans-serif;
- padding: 2px 20px 2px 20px;
-}
-
-.GB_header table {
- margin: 0;
- width: 100%;
- border-collapse: separate;
- border-right: 0px;
- border-top: 0px;
-}
-
-.GB_header td {
- background-color: #333333;
- border-bottom: 0px;
- border-left: 0px;
- padding: 0em 0em;
-}
-
-.GB_header .caption {
- text-align: left;
- color: #eee;
- white-space: nowrap;
- font-size: 20px;
- border-collapse: separate;
-}
-
-.GB_header .close {
- text-align: right;
-}
-
-.GB_header .close img {
- z-index: 500;
- cursor: pointer;
-}
-
-.GB_header .middle {
- white-space: nowrap;
- text-align: center;
-}
-
-
-#GB_middle {
- color: #eee;
-}
-
-#GB_middle img {
- cursor: pointer;
- vertical-align: middle;
-}
-
-#GB_middle .disabled {
- cursor: default;
-}
-
-#GB_middle .left {
- padding-right: 10px;
-}
-
-#GB_middle .right {
- padding-left: 10px;
-}
-
-
-.GB_Window .content {
- background-color: #fff;
- border: 3px solid #ccc;
- border-top: none;
-}
-
-.GB_Window .header {
- border-bottom: 1px solid #aaa;
- border-top: 1px solid #999;
- border-left: 3px solid #ccc;
- border-right: 3px solid #ccc;
- margin: 0;
-
- height: 22px;
- font-size: 12px;
- padding: 3px 0;
- color: #333;
-}
-
-.GB_Window .caption {
- font-size: 12px;
- text-align: left;
- font-weight: bold;
- white-space: nowrap;
- padding-right: 20px;
-}
-
-.GB_Window .close { text-align: right; }
-.GB_Window .close span {
- font-size: 12px;
- cursor: pointer;
-}
-.GB_Window .close img {
- cursor: pointer;
- padding: 0 3px 0 0;
-}
-
-.GB_Window .on { border-bottom: 1px solid #333; }
-.GB_Window .click { border-bottom: 1px solid red; }
+++ /dev/null
-<!--
-Notice: I feel so dirty doing this, but its the only way to make it cross browser.
--->
-<html>
-<head>
- <script>
- var GB = parent.GB_CURRENT;
- document.write('<script type="text/javascript" src="AJS.js"><\/script>');
- if(GB.use_fx) {
- document.write('<script type="text/javascript" src="AJS_fx.js"><\/script>');
- }
- </script>
- <style>
- body {
- padding: 0;
- margin: 0;
- overflow: hidden;
- }
-
- #GB_frame {
- visibility: hidden;
- width: 100%;
- height: 100%;
- }
-
- #loading {
- padding-top: 50px;
- position: absolute;
- width: 100%;
- top: 0;
- text-align: center;
- vertical-align: middle;
- }
- </style>
-</head>
-<body>
-
-<div id="loading">
- <img src="indicator.gif">
-</div>
-
-<script>
-var loading = AJS.$('loading');
-var gb_type = GB.type;
-var gb_url = GB.url;
-
-//Start loading in the iframe
-if(gb_type == "page") {
- document.write('<iframe id="GB_frame" src="' + gb_url + '" frameborder="0"></iframe>');
-}
-else {
- var img_holder = new Image();
- img_holder.src = gb_url;
- document.write('<img id="GB_frame" src="' + gb_url + '">');
-}
-var frame = AJS.$('GB_frame');
-</script>
-
-</body>
-<script>
-function setupOuterGB() {
- frame.style.visibility = 'visible';
- GB.setFrameSize();
- GB.setWindowPosition();
-}
-
-function loaded() {
- AJS.removeElement(loading);
-
- GB.overlay.innerHTML += " "; //Safari bugfix
-
- if(gb_type == "image") {
- if(img_holder.width != 0 && img_holder.height != 0) {
- var width = img_holder.width;
- var height = img_holder.height;
-
- GB.width = width;
- GB.height = height;
-
- setupOuterGB();
-
- if(GB.use_fx) {
- AJS.setOpacity(frame, 0);
- AJS.fx.fadeIn(frame);
- }
- }
- }
- else {
- GB.width = frame.offsetWidth;
- GB.height = frame.offsetHeight;
- setupOuterGB();
- }
-}
-
-if(GB.show_loading) {
- AJS.AEV(window, 'load', function(e) {
- loaded();
- });
-}
-else {
- loaded();
-}
-</script>
-</html>