Lib = {};

// error reporting


Lib.Error = {};
Lib.Error._errorEventsArray = 		[];
Lib.Error.callOnError = 		function(func){
							Lib.Error._errorEventsArray.push(func);
};
Lib.Error.throwError = 			function (e){
						for (var i=0; i<Lib.Error._errorEventsArray.length; i++){
						   Lib.Error._errorEventsArray[i](e);
						}
};
Lib.Error.getErrorDetails = 		function (e){
						var arr = [];
						for (params in e){
							arr.push(params+': '+e[params]);
						}
						return arr;
};
Lib.Error.Report = 			function (e){
						e.userAgent = navigator.userAgent;
						var errordetails = Lib.Error.getErrorDetails(e);
						
						var occdateobj= new Date()
						var theyear=occdateobj.getFullYear();
						var themonth=occdateobj.getMonth()+1;
						var thetoday=occdateobj.getDate();
						var thehours=occdateobj.getHours();
						var theminutes=occdateobj.getMinutes();
						
						var occdate = themonth+'/'+thetoday+'/'+theyear+' '+thehours+':'+theminutes;
						
						
						var poststr = 'siteUrl='+escape(window.location.href);
						poststr += '&errorUrl='+escape((e.fileName?e.fileName:window.location.href));
						poststr += '&errorName='+escape(e.name);
						poststr += '&errorMessage='+escape(errordetails.join(",\n"));
						poststr += '&occurenceTime='+escape(occdate);
						// ajax post error details
						alert(e.message);
						//console.log(errordetails);
					
}
Lib.Error.callOnError(Lib.Error.Report);

Lib.Browser = {};
Lib.Browser._get = 			null;
Lib.Browser.get	=			function () {
						
							if (Lib.Browser._get != null){
							 return Lib.Browser;
							}

							var ua, s, i;

							var isMSIE = /*@cc_on!@*/false;
							isNS    = false;
							version = null;

							ua = navigator.userAgent;

							s = "Netscape6/";
							if ((i = ua.indexOf(s)) >= 0) {
							 isNS = true;
							 version = parseFloat(ua.substr(i + s.length));
							}

							s = "Gecko";
							if ((i = ua.indexOf(s)) >= 0) {
							 isNS = true;
							 version = 6.1;
							}
							return Lib.Browser._get = {isIE:isMSIE, isNS:isNS, version:version};
}
Lib.Browser.dim =					function (){
								var bd = {};

								if (window.innerHeight && window.scrollMaxY) {	
									bd.xfull = document.body.scrollWidth;
									bd.yfull = window.innerHeight + window.scrollMaxY;
								} else if (document.body.scrollHeight > document.body.offsetHeight){

									bd.xfull = document.body.scrollWidth;
									bd.yfull = document.body.scrollHeight;
								} else {
									bd.xfull = document.body.offsetWidth;
									bd.yfull = document.body.offsetHeight;
								}
								
								if (self.innerHeight) {	// all except Explorer
									bd.xview = self.innerWidth;
									bd.yview = self.innerHeight;
								} else if (document.documentElement && document.documentElement.clientHeight) {
									bd.xview = document.documentElement.clientWidth;
									bd.yview = document.documentElement.clientHeight;
								} else if (document.body) { // other Explorers
									bd.xview = document.body.clientWidth;
									bd.yview = document.body.clientHeight;
								}	
								

								if(bd.yfull < bd.yview){
									bd.yfull = bd.yview;
								}

								
								if (self.pageYOffset) {
									bd.yscroll = self.pageYOffset;
								} else if (document.documentElement && document.documentElement.scrollTop){
									bd.yscroll = document.documentElement.scrollTop;
								} else if (document.body) {
									bd.yscroll = document.body.scrollTop;
								}
								return bd;
};

Lib.delegate =				function(that, thatMethod){
							var _params = [];
							for(var n = 2; n < arguments.length; n++) _params.push(arguments[n]);
							return function() {
						         var paramsToUse = [];
						         
						         for(var n = 0; n < arguments.length; n++) {
						         	paramsToUse.push(arguments[n]);
						         }
						         for(var n = 0; n < _params.length; n++) {
						         	paramsToUse.push(_params[n]);
						         }
							 try {
							  if (paramsToUse.length > 0){
							    return thatMethod.apply(that, paramsToUse)
							  }else {
							    return thatMethod.call(that)
							  }
							 }catch(e){
							  e.func = thatMethod;
							  e.params = _params.join(",");
							  Lib.Error.throwError(e);
							 };
							}
};
Lib.setTimeoutDelegate =		function(that, thatMethod){	
							var _params = [];
							for(var n = 2; n < arguments.length; n++) _params.push(arguments[n]);
							return function() {
							 try {
							  if (_params.length > 0){
							    return thatMethod.apply(that, _params)
							  }else {
							    return thatMethod.call(that)
							  }
							 }catch(e){
							  e.func = thatMethod;
							  e.params = _params.join(",");
							  Lib.Error.throwError(e);
							 };
							}							
};
Lib.Dom = {};
Lib.Dom.Elm = {};	
Lib.Dom.Elm.find = 			function(elm){
							if (typeof elm == "object"){
							 if (source = Lib.Dom.getEventSrc(elm)){
							  return source;
							 }else {
							  return elm;
							 }
							}else {
							  return document.getElementById(elm);
							}
};
Lib.Dom.Elm.first = 			function (elm, type){
							return elm.getElementsByTagName(type)[0];
}
Lib.Dom.Elm.create = 			function(type, styles){
							var elm = document.createElement(type);
							if (styles){
							  Lib.Dom.Elm.Style.add(elm, styles);
							}
							return elm;
};
Lib.Dom.Elm.Style = {};
Lib.Dom.Elm.Style.add = 		function(elm, styles){
							elm = $(elm);
							for (sty in styles){
							  elm.style[sty] = styles[sty];
							}
};

Lib.Dom.Elm.Style.changeStyle =		function (element, newStyleSuffix){
							if(null != element){
							  if (element.originalClass==null || element.originalClass.length==0){
							    if (element.className.length>0){
							      element.originalClass=element.className;
							    }else {
							      element.originalClass=" ";
							    }
							  }
							  if(element.originalClass.length>0 && element.originalClass != " "){
							    element.className = element.originalClass+" "+element.originalClass+newStyleSuffix;
							  }else {
							    element.className = newStyleSuffix;
							  }
							}
};
Lib.Dom.Elm.Style.revertToOriginalStyle = function (element){
							if(element != null && null != element.originalClass && element.originalClass.length>0){
								element.className =element.originalClass;
							}
};
Lib.Dom.Elm.Style.addClass = 		function (element, newStyleSuffix){

							if(null != element)
							{
							  element.originalClass = element.className;
							  if(element.className == null){
							    element.className = newStyleSuffix;
							  }else{
							    element.className += ' ' + newStyleSuffix;
							  }
							}
};
Lib.Dom.Elm.Style.removeClass = 	function (element, newStyleSuffix){
							if(element != null && element.className!=null){
							  if(element.className.indexOf(newStyleSuffix) != -1){
							    var n = element.className.indexOf(newStyleSuffix);
							    element.className = element.className.substr(0, n) + element.className.substr(n + newStyleSuffix.length);
							  }
							}
};

Lib.Dom.Elm.Opacity = {};
Lib.Dom.Elm.Opacity._tid = {};
Lib.Dom.Elm.Opacity.clearTimeouts = 	function(){
							for (id in Lib.Dom.Elm.Opacity._tid){
							 for (var a = 0; a<Lib.Dom.Elm.Opacity._tid[id].length; a++){
							   clearTimeout(Lib.Dom.Elm.Opacity._tid[id][a]);
							 }
							}
							Lib.Dom.Elm.Opacity._tid = {};
};
Lib.Dom.Elm.Opacity.opacity = 		function(id, opacStart, opacEnd, millisec) {
							var speed = Math.round(millisec / 100);
							var timer = 0;
							if (!opacStart){
							  opacStart = $(id).thisOpacity;
							}
							if (Lib.Dom.Elm.Opacity._tid[id] != null){
							 for (var a = 0; a<Lib.Dom.Elm.Opacity._tid[id].length; a++){
							   clearTimeout(Lib.Dom.Elm.Opacity._tid[id][a]);
							 }
							}
							Lib.Dom.Elm.Opacity._tid[id] = [];;
							if(opacStart > opacEnd) {
								for(i = opacStart; i >= opacEnd; i--) {
									Lib.Dom.Elm.Opacity._tid[id].push(setTimeout("Lib.Dom.Elm.Opacity.changeOpac(" + i + ",'" + id + "')",(timer * speed)));
									timer++;
								}
							} else if(opacStart < opacEnd) {
								for(i = opacStart; i <= opacEnd; i++)
									{
									Lib.Dom.Elm.Opacity._tid[id].push(setTimeout("Lib.Dom.Elm.Opacity.changeOpac(" + i + ",'" + id + "')",(timer * speed)));
									timer++;
								}
							}
};
Lib.Dom.Elm.Opacity.changeOpac = 	function(opacity, id) {
							var object = $(id); 

							Lib.Dom.Elm.Style.add (object, {
								opacity : (opacity / 100),
								MozOpacity : (opacity / 100),
								KhtmlOpacity : (opacity / 100),
								filter : "alpha(opacity=" + opacity + ")"
							});

							object.thisOpacity = opacity;
};

Lib.Dom.getEventSrc = 			function (e){
							if (typeof e == 'undefined') {
							 if (window.event){
							  var e = window.event;
							 }else {
							  return false;
							 }
							}
							return (typeof e.target != 'undefined'?source = e.target:source = e.srcElement);
};
Lib.Dom.getElementsByClassName = 	function (elm, tag, myclass, exact){

 							tags = tag.split("|");
 							
 							var allelms = [];
 							
 							for (var i=0; i<tags.length; i++){
 							 var tmp = (tags[i] == "*" && elm.all)? elm.all : elm.getElementsByTagName(tags[i]);
							 for (var a=0; a<tmp.length; a++){
							  allelms.push(tmp[a])
							 }
							}
							
							var returnelms = new Array();
							myclass = myclass.replace(/-/g, "\-");
							var regexp = new RegExp("(^|\s)" + myclass + "(\s|$)");
							var oElement;
							var classes;
							
							for(var i=0; i<allelms.length; i++){
								oElement = allelms[i];
								if (exact){
								 
								 if(regexp.test(oElement.className)){
								 
								  returnelms.push(oElement);
								 }
								}else {
								 classes = oElement.className.split(" ");
								 
								 var flag = false;
								 
								 for (var a=0; a<classes.length; a++){
								  if(regexp.test(classes[a])){
								   flag = true;	
								  }
								 }
								 if (flag){
								  returnelms.push(oElement);
								 }
								}
								
							}
							
							return returnelms;
};
/* events */

Lib.Dom.addEvent = 			function ( obj, type, fn ) { 
							if ( obj.attachEvent ) { 
							  obj['e'+type+fn] = fn; 
							  obj[type+fn] = function(){obj['e'+type+fn]( window.event );} 
							  
							  obj.attachEvent( 'on'+type, obj[type+fn] ); 
							} else {
							  obj.addEventListener( type, fn, false ); 
							}
} 
Lib.Dom.removeEvent = 			function (obj, eventName, dlg){	
							if ( obj.detachEvent ) { 
							  obj.detachEvent( 'on'+type, obj[type+fn] ); 
							  obj[type+fn] = null; 
							} else 
							  obj.removeEventListener( type, fn, false ); 
};
Lib.Dom._domLoadedFunctionList	=	[];
Lib.Dom._domLoaded =			false;
Lib.Dom.callWhenDOMLoaded = 		function (func) {

							if (Lib.Dom._domLoaded) {
								try {func();}catch(e){Lib.Error.throwError(e);}
							} else {
								Lib.Dom._domLoadedFunctionList.push(func);
							}
};
Lib.Dom._domLoadedEvent	=		function() {
							Lib.Dom._domLoaded=true;
							
							if (arguments.callee.done) return;
							
							arguments.callee.done = true;
							
							for (var i=0;i<Lib.Dom._domLoadedFunctionList.length;i++) {
							  try {Lib.Dom._domLoadedFunctionList[i]();}catch(e){Lib.Error.throwError(e);}
							}
};

Lib.Dom.LinkPanels = {};
/*

To initalise: 

callWhenDOMLoaded(Lib.Dom.LinkPanels.initialise);



<div class="linkpanel">
 <p>Other html tags</p>
 <a href="#">click for more info</a>
</div>


this will make the whole of 'linkpanel' a link.

Also works if you have multiple classes on the div. e.g.

<div class="sidepanel linkpanel">
 <p>Other html tags</p>
 <a href="#">click for more info</a>
</div>

*/
Lib.Dom.LinkPanels.getParentDiv = 	function (linkDivElement) {
							while ( (linkDivElement != null) && 
									(linkDivElement.clickhref==null)
								) { 
								linkDivElement=linkDivElement.parentNode;
							}
							return linkDivElement;
};
Lib.Dom.LinkPanels.click = 		function (e, eventObj) {

							var linkDivElement = $(eventObj);
							while ( (linkDivElement != null) 
								&& (linkDivElement.clickhref==null)
								&& (linkDivElement.tagName.toLowerCase() !='a')  ){
								linkDivElement=linkDivElement.parentNode;
							}
							if ( (linkDivElement != null) ) {
								window.location.href=linkDivElement.clickhref;
							}
};
Lib.Dom.LinkPanels.rollover = 		function (e, eventObj) {
							Lib.Dom.Elm.Style.addClass(Lib.Dom.LinkPanels.getParentDiv($(eventObj)),"Hover");
	
};
Lib.Dom.LinkPanels.rollout = 		function (e, eventObj) {
							Lib.Dom.Elm.Style.revertToOriginalStyle(Lib.Dom.LinkPanels.getParentDiv($(eventObj)));
};	

Lib.Dom.LinkPanels.initialise = 	function (container, tags) {
							var divList=Lib.Dom.getElementsByClassName($(container), tags, 'linkpanel');
						
							for (var i=0;i<divList.length;i++) {
								var divElement=divList[i];
									var atags=divElement.getElementsByTagName("a");
									if (atags.length>0) {
										divElement.clickhref=atags[0].getAttribute('href');
										Lib.Dom.Elm.Style.add(divElement, { 'cursor' : 'pointer'});
										Lib.Dom.addEvent(divElement, "click", Lib.delegate(this, Lib.Dom.LinkPanels.click, divElement));
										Lib.Dom.addEvent(divElement, "mouseover", Lib.delegate(this, Lib.Dom.LinkPanels.rollover, divElement));
										Lib.Dom.addEvent(divElement, "mouseout", Lib.delegate(this, Lib.Dom.LinkPanels.rollout, divElement));
									}
								
							}
};
//


Lib.Dom.Lightbox = Base.extend({
	constructor : 			function (color, opacity, preloader, closebutton){
							this.color = (color?color:'#ffffff');
							this.opacity = (opacity?opacity:50);
							this.loadingimg = 'loader.gif';
							if (preloader){
							 this.loadingimg = preloader;
							}
						    	this.closebutton = 'close.gif';
						    
						    	if (closebutton){
							  this.closebutton = closebutton;
							}
							
							this.loadingimgwidth = 16;
							this.loadingimgheight = 16;
							this.pagex = 400;
							this.pagey = 400;
							this.padding = [22, 10, 10, 10];
							callWhenDOMLoaded(Lib.delegate(this, this.initiate));
							
	},
	updateDim : 			function (){
							this.dim = Lib.Browser.dim();
	},
	initiate : 			function (a){
							var closebuttonimage = new Image();
							closebuttonimage.src = this.closebutton;
							
							var preloadimg = new Image();
							preloadimg.src = this.loadingimg;
							this.updateDim();
							this.body = Lib.Dom.Elm.first(document,'body');	
	
							var elms = Lib.Dom.getElementsByClassName(document, 'a' ,'lightbox');
							
							for (var i=0; i<elms.length; i++){
							  Lib.Dom.addEvent(elms[i], "click", Lib.delegate(this, this.open, elms[i]));
							  elms[i].link = elms[i].href;
							  elms[i].target = "_self";
							  elms[i].href = 'javascript:void(0);';
							}

							this.elmloadingimg = Lib.Dom.Elm.create("img", {
										'display'	: 'none',
										'top'		: '0px',
										'left'		: '0px',
										'width'		: this.loadingimgwidth + 'px',
										'height'	: this.loadingimgheight + 'px',
										'position'	: 'absolute',
										'zIndex'	: 1000001
											});
							this.elmloadingimg.src = this.loadingimg;
							this.body.appendChild(this.elmloadingimg);
							
	},
	create :			function (){
							
							this.fullscreen = Lib.Dom.Elm.create("div", {
											'display' : 'none'	
											});
							this.fullscreen.id = 'lightbox_fullscreen';
							this.contentviewer = Lib.Dom.Elm.create("div", {
											'display'		: 'none',
											'backgroundColor'	: '#FFFFFF',
											'position'		: 'absolute',
											'top'			: '0px',
											'left'			: '0px',
											'zIndex'		: '1000001'
											});
							this.innercontentviewer = Lib.Dom.Elm.create("div", {

											'paddingTop'		: this.padding[0]+'px',
											'paddingRight'		: this.padding[1]+'px',
											'paddingBottom'		: this.padding[2]+'px',
											'paddingLeft'		: this.padding[3]+'px'
							})
							this.ajaxholder = Lib.Dom.Elm.create("div", {
									'overflow' : 'auto',
									'display'  : 'none'
										});
							this.holderimage = Lib.Dom.Elm.create("img", {
											'display'		: 'none'
											});
							this.fullscreen.id = 'lightbox_content';
							this.createCloseButton();
							this.innercontentviewer.appendChild(this.holderimage);
							this.innercontentviewer.appendChild(this.ajaxholder);
							this.contentviewer.appendChild(this.innercontentviewer);
							Lib.Dom.Elm.Style.add(this.ajaxholder, {
											'overflow'		: 'auto'	
										});
							this.ajaxholder.id = 'ajaxholder';
							this.body.appendChild(this.contentviewer);
							this.body.appendChild(this.fullscreen);
	},
	showloader : 			function (){
							Lib.Dom.Elm.Style.add(this.elmloadingimg, {
											'display'		: 'block'
											});
							Lib.Dom.Elm.Style.add(this.elmloadingimg, {
											'left' 			: (this.dim.xfull/2)-(this.loadingimgwidth/2) + 'px',
											'top' 			: ((this.dim.yview/2)+this.dim.yscroll)-(this.loadingimgheight/2) + 'px'
											});
										
	},
	removeloader : 			function (){
							Lib.Dom.Elm.Style.add(this.elmloadingimg, {
											'display'		: 'none'
											});
	},
	open : 				function (e, elm){
	                        e = elm;
	                       
							this.updateDim();
							this.coverpage();
							this.showloader();
							
							var link = elm.link;
							link = link.split("?")[0];
							link = link.split("&")[0];
							this.dropDowns(false);
							
							var ext = (link.substring((link.lastIndexOf(".")+1))).toLowerCase();
							if (ext == "gif" || ext == "jpg" || ext == "jpeg" || ext == "png"){
							  this.callImage(elm);
							}else {
							  this.callPage(elm);
							}
							
	},
	close : 			function (){
							this.dropDowns(true);
							this.uncoverpage();
							this.closePage();
							this.hideCloseButton();
	},
	dropDowns : function (switchOn){
			var dropdowns = document.getElementsByTagName("select");
			for (var i=0; i<dropdowns.length; i++){
				Lib.Dom.Elm.Style.add(dropdowns[i], {
				    'display' : (switchOn?'block':'none')
				});
			}
			if (objects = document.getElementById("flashalign")){
				Lib.Dom.Elm.Style.add(objects, {
				    'display' : (switchOn?'block':'none')
				});
			}
	},
	coverpage : 			function (){
							if (!this.fullscreen){
								this.create();
							}
							Lib.Dom.Elm.Style.add(this.fullscreen, {
											'backgroundColor'	: this.color,
											'width'			: this.dim.xfull + 'px',
											'height'		: this.dim.yfull + 'px',
											'position'		: 'absolute',
											'top'			: '0px',
											'left'			: '0px',
											'display'		: 'block',
											'zIndex'		: '1000000'
											});
							Lib.Dom.Elm.Opacity.changeOpac(this.opacity, this.fullscreen);
	},
	uncoverpage : 			function (){
							Lib.Dom.Elm.Style.add(this.fullscreen, {
											'width'			: '200px',
											'height'		: '200px',
											'display'		: 'none'
											});
							
	},
	callImage : 			function (elm){
							var loadedimg = new Image();
							loadedimg.onload=Lib.delegate(this, this.recieveImage, elm.link);
							setTimeout(Lib.setTimeoutDelegate(this, this.loadImage,loadedimg, elm.link),100); 
							
							
	},
	loadImage : 			function (image, link){
							image.src = link;
	},
	recieveImage : 			function (uselink, link){
							
							if (link){
							 uselink = link;
							}
							this.holderimage.style.width = 'auto';
							this.holderimage.style.height = 'auto';
							Lib.Dom.Elm.Opacity.changeOpac(0, this.contentviewer);
							
							this.holderimage.src = uselink;
							this.updateDim();
							Lib.Dom.Elm.Style.add(this.contentviewer, {
									'display'	: 'block',
									'left'		: '-1000px',
									'top'		: '-1000px'
									});
							Lib.Dom.Elm.Style.add(this.holderimage, {
									'display'	: 'block'
									});
									
							Lib.Dom.Elm.Style.add(this.ajaxholder, {
									'display'	: 'none'
									});
									

							var width = this.holderimage.clientWidth;
							var height = this.holderimage.clientHeight;
							var ratio_orig = width/height;
							if (width > this.dim.xview || height > this.dim.yview){
							  if (this.dim.xview/this.dim.yview > ratio_orig) {
							    width = this.dim.yview*ratio_orig;
							    height = this.dim.yview;
							  }else {
							    height = this.dim.xview/ratio_orig;
							    width = this.dim.xview;
							  }
							  this.holderimage.style.width = width-this.padding[1]-this.padding[3] + 'px';
							  this.holderimage.style.height = height-this.padding[0]-this.padding[2] + 'px';
							}else {
							 this.holderimage.style.width = width+'px';
							 this.holderimage.style.height = height+'px';
							 width += this.padding[1]+this.padding[3];
							 height += this.padding[0]+this.padding[2];
							}
							this.updateDim();
							this.showPage(width, height);
							this.showCloseButton(width, height);
							this.removeloader();
							
														
	},
	callPage : 			function (elm){
							var sendpage = elm.link;
							sendpage += ((sendpage.indexOf("?") == -1?'?':'&')+'popup=1');
							this.ajax = new Lib.Ajax.HttpText(elm.link);
							this.ajax.onrecieve = Lib.delegate(this, this.recievePage);
							this.ajax.send();
	},
	recievePage : 			function (data){
	
							this.updateDim();
							this.removeloader();
							Lib.Dom.Elm.Style.add(this.ajaxholder, {
									'display' 	: 'block'
							});
							Lib.Dom.Elm.Style.add(this.holderimage, {
									'display'	: 'none'
									});
							this.showPage();
							this.showCloseButton();
							this.ajaxholder.scrollTop = 0;
							this.ajaxholder.innerHTML = data;
							
	},
	showPage : 			function(width, height){
	 
							if (!width || !height){
							  width = this.pagex;
							  height = this.pagey;
							}
							
							Lib.Dom.Elm.Style.add(this.contentviewer, {
									'display'		: 'block',
									'width'			: width+'px',
									'height'		: height+'px',
									'left' 			: (this.dim.xfull/2)-(width/2) + 'px',
									'top' 			: ((this.dim.yview/2)+this.dim.yscroll)-(height/2) + 'px'
								});
							
							Lib.Dom.Elm.Style.add(this.ajaxholder, {
									'height'		: height-(this.padding[0]+this.padding[2])+'px'
								});
								Lib.Dom.Elm.Opacity.changeOpac(100, this.contentviewer);

	
							
	},
	closePage : 			function (){
							this.ajaxholder.innerHTML = '';
							Lib.Dom.Elm.Style.add(this.ajaxholder, {
											'width'		: 'auto'
									});
							Lib.Dom.Elm.Style.add(this.contentviewer, {
											'display' 		: 'none',
											'width'			: '200px',
											'height'		: '200px',
											'left'			: '0px',
											'top'			: '0px'
								});
							Lib.Dom.Elm.Style.add(this.holderimage, {
									'display'	: 'none'
									});
							
	},
	createCloseButton : 		function (){
							this.closebutton = Lib.Dom.Elm.create("a", {
											'position'		: 'absolute',
											'display' 		: 'none',
											'width'			: '100px',
											'zIndex'		: '1000002'
							});
							
							this.closebutton.href = 'javascript:void(0);';
							Lib.Dom.addEvent(this.closebutton, 'click', Lib.delegate(this, this.close));
							this.closebutton.innerHTML = "<img src=\""+baseurl+"common/img/close.gif\" border=\"0\" />";
							this.closebutton.id = 'lightbox_close';
							this.body.appendChild(this.closebutton);
							
	},
	showCloseButton : 		function (width, height){
							if (!this.closebutton){
							  this.createCloseButton();
							}
							if (!width || !height){
							  width = this.pagex;
							  height = this.pagey;
							}
							Lib.Dom.Elm.Style.add(this.closebutton, {
											'position'		: 'absolute',
											'display' 		: 'block',
											'zIndex'		: '1000002',
											'textAlign'		: 'right',
											'left' 			: (this.dim.xfull/2)+(width/2)-100 + 'px',
											'top' 			: ((this.dim.yview/2)+this.dim.yscroll)-(height/2) + 'px'
							});
	},
	hideCloseButton : 		function (){
							Lib.Dom.Elm.Style.add(this.closebutton, {
											'display'		: 'none',
											'left'			: '0px',
											'top'			: '0px'
							
							});
	}
});
// shortcut to Lib.Dom.Elm.find()
$ = function (e){return Lib.Dom.Elm.find(e);};
// shortcut to call when dom loaded
callWhenDOMLoaded = function(a){return Lib.Dom.callWhenDOMLoaded(a);};
if (document.addEventListener) {
  document.addEventListener("DOMContentLoaded", Lib.Dom._domLoadedEvent, null);
}
window.onload = Lib.Dom._domLoadedEvent;

Lib.Dom.expandList = { /* expanding list - container: div.drop - header: h4 - dropped div: div.dropped e.g. <div class="drop"> <h4>header</h4> <div class="dropped"> this content will open when header is clicked </div> </div> this has lots of room for expansion. too much is hardcoded into this. - mikee */ 'initialise' : function (){ Lib.Dom.expandList.open = false; Lib.Dom.expandList.drops = Lib.Dom.getElementsByClassName(document, 'div', 'drop'); if (Lib.Dom.expandList.drops.length > 0){ Lib.Dom.expandList.dropped = []; for (var i=0; i<Lib.Dom.expandList.drops.length; i++){ Lib.Dom.expandList.dropped.push(Lib.Dom.Elm.first(Lib.Dom.expandList.drops[i], "div")); Lib.Dom.Elm.Style.add (Lib.Dom.expandList.dropped[Lib.Dom.expandList.dropped.length-1], {'display':'none'}); Lib.Dom.addEvent(Lib.Dom.Elm.first(Lib.Dom.expandList.drops[i], "h4"), "click", Lib.delegate(this, Lib.Dom.expandList.openSec, Lib.Dom.expandList.dropped[Lib.Dom.expandList.dropped.length-1])); } } }, 'closeSec' : function (){ if (Lib.Dom.expandList.open){ Lib.Dom.expandList.open.open = false; Lib.Dom.Elm.Style.revertToOriginalStyle(Lib.Dom.Elm.first(Lib.Dom.expandList.open.parentNode, "h4")); Lib.Dom.Elm.Style.add(Lib.Dom.expandList.open, {'display': 'none'}); } }, 'openSec' : function (e, i){ if (i.open != true){ Lib.Dom.expandList.closeSec(); Lib.Dom.expandList.open = i; i.open = true; Lib.Dom.Elm.Style.add(i, {'display':'block'}); Lib.Dom.Elm.Style.changeStyle(Lib.Dom.Elm.first(i.parentNode, "h4"), "Sel"); }else { Lib.Dom.expandList.open = i; Lib.Dom.expandList.open.open = true; Lib.Dom.expandList.closeSec(); } }, 'openLast' : function (){ Lib.Dom.expandList.openSec(false, Lib.Dom.expandList.dropped[Lib.Dom.expandList.dropped.length-1]); } }; 
