/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;
--- a/koha-tmpl/opac-tmpl/lib/greybox/GreyBox_v5_5/greybox_source/base/AJS_fx.js
+++ a/koha-tmpl/opac-tmpl/lib/greybox/GreyBox_v5_5/greybox_source/base/AJS_fx.js
@@ -0,0 +1,194 @@
+/*
+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;
--- a/koha-tmpl/opac-tmpl/lib/greybox/GreyBox_v5_5/greybox_source/base/base.css
+++ a/koha-tmpl/opac-tmpl/lib/greybox/GreyBox_v5_5/greybox_source/base/base.css
@@ -0,0 +1,32 @@
+/* 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;
+}
--- a/koha-tmpl/opac-tmpl/lib/greybox/GreyBox_v5_5/greybox_source/base/base.js
+++ a/koha-tmpl/opac-tmpl/lib/greybox/GreyBox_v5_5/greybox_source/base/base.js
@@ -0,0 +1,192 @@
+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;
--- a/koha-tmpl/opac-tmpl/lib/greybox/GreyBox_v5_5/greybox_source/base/loader_frame.html
+++ a/koha-tmpl/opac-tmpl/lib/greybox/GreyBox_v5_5/greybox_source/base/loader_frame.html
@@ -0,0 +1,104 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- a/koha-tmpl/opac-tmpl/lib/greybox/GreyBox_v5_5/greybox_source/gallery/gallery.css
+++ a/koha-tmpl/opac-tmpl/lib/greybox/GreyBox_v5_5/greybox_source/gallery/gallery.css
@@ -0,0 +1,51 @@
+.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;
+}
--- a/koha-tmpl/opac-tmpl/lib/greybox/GreyBox_v5_5/greybox_source/gallery/gallery.js
+++ a/koha-tmpl/opac-tmpl/lib/greybox/GreyBox_v5_5/greybox_source/gallery/gallery.js
@@ -0,0 +1,114 @@
+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');
--- a/koha-tmpl/opac-tmpl/lib/greybox/GreyBox_v5_5/greybox_source/set/set.css
+++ a/koha-tmpl/opac-tmpl/lib/greybox/GreyBox_v5_5/greybox_source/set/set.css
@@ -0,0 +1,20 @@
+#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;
+}
--- a/koha-tmpl/opac-tmpl/lib/greybox/GreyBox_v5_5/greybox_source/set/set.js
+++ a/koha-tmpl/opac-tmpl/lib/greybox/GreyBox_v5_5/greybox_source/set/set.js
@@ -0,0 +1,101 @@
+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');
+});
--- a/koha-tmpl/opac-tmpl/lib/greybox/GreyBox_v5_5/greybox_source/window/window.css
+++ a/koha-tmpl/opac-tmpl/lib/greybox/GreyBox_v5_5/greybox_source/window/window.css
@@ -0,0 +1,39 @@
+.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; }
--- a/koha-tmpl/opac-tmpl/lib/greybox/GreyBox_v5_5/greybox_source/window/window.js
+++ a/koha-tmpl/opac-tmpl/lib/greybox/GreyBox_v5_5/greybox_source/window/window.js
@@ -0,0 +1,109 @@
+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');
--- a/koha-tmpl/opac-tmpl/lib/greybox/GreyBox_v5_5/installation.html
+++ a/koha-tmpl/opac-tmpl/lib/greybox/GreyBox_v5_5/installation.html
@@ -0,0 +1,49 @@
+
+
+
+ GreyBox - Installation
+
+
+
+
+
+
+
+
+
+
+
+
+Append following to your header section (in between <header>...</header>
).
+
+GB_ROOT_DIR is the URL where static files are located:
+
+<script type="text/javascript">
+ var GB_ROOT_DIR = "http://mydomain.com/greybox/";
+</script>
+
+
+GB_ROOT_DIR should be absolute.
+
+
+Append also following scripts and one stylesheet:
+
+<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" />
+
+
+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.
+
+
+
+That's it, you are now ready to use GreyBox!
+
+
+
+
+
--- a/koha-tmpl/opac-tmpl/lib/greybox/GreyBox_v5_5/normal_usage.html
+++ a/koha-tmpl/opac-tmpl/lib/greybox/GreyBox_v5_5/normal_usage.html
@@ -0,0 +1,126 @@
+
+
+
+ GreyBox - Normal usage
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+Showing images
+
+Showing one image:
+Syntax:
+
+<a href="URL" title="CAPTION" rel="gb_image[]">HTML</a>
+
+
+Example:
+
+<a href="http://static.flickr.com/119/294309231_a3d2a339b9.jpg" title="Flower" rel="gb_image[]">Show flower</a>
+
+
+Example rendered:
+Show flower
+
+
+Showing a group of images:
+Syntax:
+
+<a href="URL" title="CAPTION" rel="gb_imageset[NAME]">HTML</a>
+<a href="URL" title="CAPTION" rel="gb_imageset[NAME]">HTML</a>
+
+
+Example:
+
+<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>
+
+
+Example rendered:
+Salt flats
+Night valley
+
+
+Showing pages
+
+Showing one page:
+Syntax:
+
+<a href="URL" title="CAPTION" rel="gb_page[WIDTH, HEIGHT]">HTML</a>
+
+
+Example:
+
+<a href="http://google.com/" title="Google" rel="gb_page[500, 500]">Launch Google.com</a>
+
+
+Example rendered:
+Launch Google.com
+
+
+Showing one page as center window:
+Syntax:
+
+<a href="URL" title="CAPTION" rel="gb_page_center[WIDTH, HEIGHT]">HTML</a>
+
+
+Example:
+
+<a href="http://google.com/" title="Google" rel="gb_page_center[500, 500]">Launch Google.com</a>
+
+
+Example rendered:
+Launch Google.com
+
+
+Showing one page in fullscreen:
+Syntax:
+
+<a href="URL" title="CAPTION" rel="gb_page_fs[]">HTML</a>
+
+
+Example:
+
+<a href="http://google.com/" title="Google" rel="gb_page_fs[]">Launch Google.com</a>
+
+
+Example rendered:
+Launch Google.com
+
+Showing a group of pages:
+Syntax:
+
+<a href="URL" title="CAPTION" rel="gb_pageset[NAME]">HTML</a>
+<a href="URL" title="CAPTION" rel="gb_pageset[NAME]">HTML</a>
+
+
+Example:
+
+<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>
+
+
+Example rendered:
+Launch Google search
+Launch Yahoo search
+
+
+
+
--- a/koha-tmpl/opac-tmpl/lib/greybox/GreyBox_v5_5/static_files/help.css
+++ a/koha-tmpl/opac-tmpl/lib/greybox/GreyBox_v5_5/static_files/help.css
@@ -0,0 +1,93 @@
+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;
+}
--- a/koha-tmpl/opac-tmpl/lib/greybox/GreyBox_v5_5/static_files/help.js
+++ a/koha-tmpl/opac-tmpl/lib/greybox/GreyBox_v5_5/static_files/help.js
@@ -0,0 +1,52 @@
+var tmpl_header = AJS.join('', [
+ ' ',
+ '
A pop-up window that doesn\'t suck. ',
+ '
'
+]);
+
+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 = '';
+ code = code.replace(//g, '>');
+ result += code;
+ result += '
';
+ document.write(result);
+}
--- a/koha-tmpl/opac-tmpl/lib/greybox/gb_scripts.js
+++ a/koha-tmpl/opac-tmpl/lib/greybox/gb_scripts.js
@@ -0,0 +1,436 @@
+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(_ffl){
+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;
--- a/koha-tmpl/opac-tmpl/lib/greybox/gb_styles.css
+++ a/koha-tmpl/opac-tmpl/lib/greybox/gb_styles.css
@@ -0,0 +1,158 @@
+/* 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; }
--- a/koha-tmpl/opac-tmpl/lib/greybox/loader_frame.html
+++ a/koha-tmpl/opac-tmpl/lib/greybox/loader_frame.html
@@ -0,0 +1,104 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+