	
	///http://www.youtube.com/watch?v=mDwNSnkkYao&NR=1
	///http://wasp.xssl.net

	var body;

	String.prototype.trim = function() { return this.replace(/^\s+|\s+$/, ''); };
	String.prototype.flip = function() { var i,ns='',lof=this.length-1;for(i=lof;i>=0;i--){ns+=this.charAt(i)};return ns;};
	String.prototype.pretrim = function() { return this.replace(/^\s+|\s+$/, '&nbsp;'); }; ///BADHACK:

	window.arrayContains = function( array, v, re ){
		if(re){
			for( var i = 0; i < array.length; i++ ){
				var nre = re.replace('__value__',array[i]);
				if( nre == re ) continue;
				nre = new RegExp(nre);
				if( v.match(nre) ){
					return true;
				}
			}
		}else{
			for( var i = 0; i < array.length; i++ ){
				if( array[i] === v ){
					return true;
				}
			}
		}
		return false;
	}

	window.listeners = [];
	window.removeListeners = function(){
		for( var i in window.listeners ){
			window.removeListener[window.listeners[i]];
		}
	}
	window.removeListener = function( ear ){

		var body = document.documentElement;

		for( var i in window.listeners ){ if( window.listeners[i] === ear ){ delete window.listeners[i]; } }

		if( window.detachEvent && document.detachEvent ){

			var k;

			for( var i in ear ){ 

				k = i.toLowerCase();

				switch( k ){
				case 'onmousedown':
				case 'onmouseover':
				case 'onmousemove':
				case 'onmouseout':
				case 'onmouseup':

					document.detachEvent( k, ear[i] );

				break;
				case 'onload':
				case 'onunload':
				case 'onresize':
				case 'onkeydown':
				case 'onkeyup':
				case 'onresize':

					window.detachEvent( k, ear[i] );

				break;
				case 'onscroll':

					///if( body ) body.detachEvent( ear[i] ); # seems not to work correctly in IE
					if( body ) body.onscroll = false;

				break;
				}
				
			}

		}else if( window.removeEventListener && document.removeEventListener ){

			var k;

			for( var i in ear ){ 

				k = i.toLowerCase();
				k = k.substring( 2, k.length );

				switch( k ){
				case 'mousedown':
				case 'mousemove':
				case 'mouseover':
				case 'mouseout':
				case 'mouseup':
				
					document.removeEventListener( k, ear[i], false );

				break;
				case 'load':
				case 'unload':
				case 'resize':
				case 'keydown':
				case 'keyup':
				case 'resize':

					window.removeEventListener( k, ear[i], false );

				break;
				case 'scroll':

					if( body ) body.removeEventListener( k, ear[i], false );

				break;
				}
				
			}

		}

	}

	window.fireEvent = function( name, a1,a2,a3,a4,a5,a6 ){
		if( typeof name == 'object' ){
			window.fireEvent( name.name, name.params );
		}else{
			for( var i in window.listeners ){
				if( window.listeners[i][name] ){
					window.listeners[i][name]( a1,a2,a3,a4,a5,a6 );
				}
			}
		}
	}

	window.addListener = function( ear ){
		var body = document.documentElement;
		window.listeners.push( ear );
		var wf, df;
		if( window.attachEvent && document.attachEvent ){
			var k;
			for( var i in ear ){
				k = i.toLowerCase();
				switch( k ){
				case 'onmousedown':
				case 'onmousemove':
				case 'onmouseover':
				case 'onmouseout':
				case 'onmouseup':
					document.attachEvent( k, ear[i] );
				break;
				case 'onload':
				case 'onunload':
				case 'onresize':
				case 'onkeydown':
				case 'onkeyup':
				case 'onresize':
					window.attachEvent( k, ear[i] );
				break;
				case 'onscroll':
					///if( body ) body.attachEvent( i, ear[i] ); # seems not to work correctly in IE
					if( body ) body.onscroll = ear[i];
				break;
				}
			}
		}else if( window.addEventListener && document.addEventListener ){
			var k;
			for( var i in ear ){ 
				k = i.toLowerCase();
				k = k.substring( 2, k.length );
				switch( k ){
				case 'mousedown':
				case 'mousemove':
				case 'mouseover':
				case 'mouseout':
				case 'mouseup':
					document.addEventListener( k, ear[i], false );
				break;
				case 'load':
				case 'unload':
				case 'resize':
				case 'keydown':
				case 'keyup':
				case 'resize':
					window.addEventListener( k, ear[i], false );
				break;
				case 'scroll':
					if( body ) body.addEventListener( k, ear[i], false );
				break;
				}
			}
		}
	}

	window.getCookieVal		= function(offset){ var endstr = document.cookie.indexOf (";", offset); if (endstr == -1) endstr = document.cookie.length; return unescape(document.cookie.substring(offset, endstr)); }
	window.getCookie		= function(name){ var arg = name + "="; var alen = arg.length; var clen = document.cookie.length; var i = 0, j = 0; while(i < clen){ j = i + alen; if(document.cookie.substring(i, j) == arg) return core.cookies.getCookieVal(j); if ((i = document.cookie.indexOf(" ", i) + 1) == 0) break; } return null; }
	window.setCookie		= function(name, value){var argv = core.cookies.setCookie.arguments;var argc = core.cookies.setCookie.arguments.length;var expires = (argc > 2) ? argv[2] : null;var path = (argc > 3) ? argv[3] : null;var domain = (argc > 4) ? argv[4] : null;var secure = (argc > 5) ? argv[5] : false;document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain)) + ((secure == true) ? "; secure" : ""); }
	window.deleteCookie		= function(name){ var exp = new Date(); exp.setTime (exp.getTime() - 1); var cval = core.cookies.getCookie(name); document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString(); }
	window.getScreenLeft = function( w ){
		if( ! w ) w = window;
		if( w && isNumber( w.screenLeft ) ){
			if( w.screenLeft > screen.width ){
				return w.screenLeft - (w.screenLeft % screen.width);
			}else{
				return w.screenLeft;
			}
		}else if( w && w.screen && isNumber( w.screen.availLeft ) ){
			return w.screen.availLeft;
		}
		return false;
	}

	window.getWindowWidth	= function(){

		if( window.innerWidth ){
			return window.innerWidth;
		}else if( document.body ){
			return document.body.clientWidth;
		}

		return 1;

	}

	window.getWindowHeight	= function(){

		if( window.innerHeight ){
			return window.innerHeight;
		}else if( document.body ){
			return document.body.clientHeight;
		}

		return 1;

	}

	window.getCenter = function( element ){

		var x = window.getLeft(element);
		var y = window.getTop(element);
		var w = window.getWidth(element);
		var h = window.getHeight(element);

		return {
			x: x+w/2,
			y: y+h/2
		}

	}

	window.getWidth = function( obj ){ return obj.offsetWidth; }
	window.getHeight = function( obj ){ return obj.offsetHeight; }

	window.getLeft = function( obj, includeMargin, localize ){

		if( ! obj ) return;
		var count = 0, border = 0, margin = 0, lastBorder = 0, cur = 0;

		if( includeMargin ){
			if( obj.currentStyle ){
				if( isNumber( margin = parseInt( obj.currentStyle.marginLeft ) ) ){ cur -= margin; }
			}else if( window.getComputedStyle ){
				if( isNumber( margin = parseInt( window.getComputedStyle( obj, null ).getPropertyValue( 'margin-left' ) ) ) ){ cur -= margin; }
			}
		}

		var p;

		while( obj ){
			//if( breakBeforeBody && obj.offsetParent && (obj.offsetParent.nodeName == 'BODY') ) break;
			if( obj.currentStyle ){
				if( count > 0 ){
					if( isNumber( border = parseInt( obj.currentStyle.borderLeftWidth ) ) ){ cur += border; }
				}
			}else if( window.getComputedStyle ){ 
				if( ! isNumber( border = parseInt( window.getComputedStyle( obj, null ).getPropertyValue( 'border-left-width' ) ) ) ){ border = 0; }
				if( count > 0 ){ cur += border + lastBorder; lastBorder = border; }else{ lastBorder = 0; }
			}
			if( obj.scrollLeft && ( count > 0 ) )	cur -= obj.scrollLeft;
			if( obj.offsetLeft )					cur += obj.offsetLeft;
			if( localize ){
				p = page.getPosition( obj );
				if( p == 'absolute' || p == 'relative' ) break;
			}
			obj = obj.offsetParent;
			count++;
		}

		return cur;

	}

	window.getTop = function( obj, includeMargin, localize ){

		if( ! obj ) return;
		var count = 0, border = 0, margin = 0, lastBorder = 0, cur = 0;

		if( includeMargin ){
			if( obj.currentStyle ){
				if( isNumber( margin = parseInt( obj.currentStyle.marginTop ) ) ){ cur -= margin; }
			}else if( window.getComputedStyle ){
				if( isNumber( margin = parseInt( window.getComputedStyle( obj, null ).getPropertyValue( 'margin-top' ) ) ) ){ cur -= margin; }
			}
		}

		var p;

		while( obj ){
			//if( breakBeforeBody && obj.offsetParent && (obj.offsetParent.nodeName == 'BODY') ) break;
			if( obj.currentStyle ){
				if( count > 0 ){
					if( isNumber( border = parseInt( obj.currentStyle.borderTopWidth ) ) ){ cur += border; }
				}
			}else if( window.getComputedStyle ){
				if( ! isNumber( border = parseInt( window.getComputedStyle( obj, null ).getPropertyValue( 'border-top-width' ) ) ) ){ border = 0; }
				if( count > 0 ){ cur += border + lastBorder; lastBorder = border; }else{ lastBorder = 0; }
			}
			if( obj.scrollTop && ( count > 0 ) )	cur -= obj.scrollTop;
			if( obj.offsetTop )						cur += obj.offsetTop;
			if( localize ){
				p = page.getPosition( obj );
				if( p == 'absolute' || p == 'relative' ) break;
			}
			obj = obj.offsetParent;
			count++;
		}

		return cur;

	}

	window.getElementsByAttr = function( element, attr, snowball ){
		if( ! element || element.nodeType != 1 ) return;
		if( ! snowball ) snowball = [];
		if( element.getAttribute && element.getAttribute(attr) ){
			snowball.push(element);
		}
		if( element.childNodes ){
			var i = 0, nof = element.childNodes.length, child;
			for( i = 0; i < nof; i++ ){
				if( ( child = element.childNodes[i] ) && ( child.nodeType == 1 ) ){
					window.getElementsByAttr( child, attr, snowball );
				}
			}
		}
		return snowball;
	}

	window.getElementsByNodeName = function( element, nodeName, snowball ){
		if( ! element || element.nodeType != 1 ) return;
		if( ! snowball ) snowball = [];
		if( element.nodeName && ( nodeName == element.nodeName ) ){
			snowball.push(element);
		}
		if( element.childNodes ){
			var i = 0, nof = element.childNodes.length, child;
			for( i = 0; i < nof; i++ ){
				if( ( child = element.childNodes[i] ) && ( child.nodeType == 1 ) ){
					window.getElementsByNodeName( child, nodeName, snowball );
				}
			}
		}
		return snowball;
	}

	window.getElementsByIdent = function( element, snowball ){
		if( ! element || element.nodeType != 1 ) return;
		if( ! snowball ) snowball = {};
		var a;
		if( element.getAttribute && ( a = element.getAttribute( 'ident' ) ) ){
			snowball[ a ] = element;
		}
		if( element.childNodes ){
			var i = 0, nof = element.childNodes.length, child;
			for( i = 0; i < nof; i++ ){
				if( ( child = element.childNodes[i] ) && ( child.nodeType == 1 ) ){
					window.getElementsByIdent( child, snowball );
				}
			}
		}
		return snowball;
	}

	window.Key = function(){

		var key = window.Key;
		var keys = [];

		key.CTRL = 17;
		key.SHIFT = 16;
		key.RETURN = key.ENTER = 13;
		key.RIGHT = 39;
		key.LEFT = 37;
		key.UP = 38;
		key.DOWN = 40;
		key.SPACE = 32;
		key.ESCAPE = key.ESC = 27;

		key.isDown = function(kc){
			if(keys[kc]) return true;
			return false;
		}
		key.setDown = function(kc){
			window.status = kc;
			keys[kc] = true;
		}
		key.setUp = function(kc){
			keys[kc] = false;
		}

	}

	try{if( prefs ){};}catch(ee){var prefs = {};}

	var isNumber		= function( v ){ return ( ! isNaN( v ) ); }
	var isFunction		= function( v ){ return typeof v == 'function'; }
	var alwaysNumber	= function( v ){ if( isNaN( v ) ){ return 0; }else{ return v; } }

	/// -----------------------------------------------------------------------------
	var icicle = function( prefs ){
	/// -----------------------------------------------------------------------------
	/// ICICLE:START
	/// -----------------------------------------------------------------------------

		var listeners = [];

		///var body;
		var myself			= this;
		var wraps			= [];
		var pageloads		= [];
		var preloads		= [];
		var register		= {};
		var nonopaques		= [];

		var prefs			= { source: prefs };
			prefs.IE		= ( typeof window.offscreenBuffering != 'undefined' ? true : false );
			prefs.MOZ		= ( window.Node ? true : false );
			prefs.OPERA		= ( window.opera ? true : false );
			prefs.SAFARI	= ( window.safari ? true : false ); /// this doesn't exist
			prefs.uniques	= [];

		var setup = function(){

			myself.body		= body = document.getElementsByTagName('BODY')[0];
			myself.docelm	= document.documentElement;

			parseDOM( body );
			preLoad(); preloads = [];

			if( pageloads.length ){
				var pl, _this;
				for( var i = 0; i < pageloads.length; i++ ){
					if( (pl = pageloads[i]) && ( _this = pl.node ) && ( pl.js ) ){
						try{ eval( pl.js ); }catch(ee){ alert( ( ee.description ? ee.description : ee ) ) };
					}
				}
				pageloads = null; delete pageloads;
			}

			window.fireEvent( 'onstart' );

		}

		var unsetup = function(){window.removeListeners();}
		var preLoad = function(){for( var i in preloads ){if( preloads[i] ){ var img = new Image(); img.src = preloads[i]; }}}

		var getEvent = function( e, cancelEvent ){
			if( e.src ) return e;
			var r = {};
			if( e && e.target ){
				r.src	= e.target;
				r.type	= e.type;
				r.kc	= e.keyCode;
				r.obj	= e;
				r.x		= e.clientX;
				r.y		= e.clientY;
				r.ox	= e.layerX;
				r.oy	= e.layerY;
				r.moz	= true;
			}else if( e = window.event ){
				r.src	= e.srcElement;
				r.type	= e.type;
				r.kc	= e.keyCode;
				r.obj	= e;
				r.x		= e.clientX;
				r.y		= e.clientY;
				r.ox	= e.offsetX;
				r.oy	= e.offsetY;
				r.but	= e.button;
				r.ie	= true;
			}else{ e = false; r = false; }
			if(cancelEvent){
				myself.cancelEvent(r.obj);
			}
			return r;
		}

		this.setIcicleType = function( element, type ){
			if( element && element.setAttribute ){
				element.setAttribute('icicletype',type);
			}
		}

		this.getIcicleType = function( element ){
			if( element && element.getAttribute ){
				return element.getAttribute('icicletype');
			}
		}

		this.appendElement = function( type, element, lookup ){

			var div = document.createElement('DIV');
			
			switch(type){
			case 'icicle:element:layer':
				div.setAttribute('panel','{width:'+Math.round((Math.random()*100)+100)+',height:'+Math.round((Math.random()*100)+100)+',anchor:body,position:\'dragdrop\',z:9999,draggable:true,promotable:true,template:\'templates/unabacus\',backgroundImage:\'\',backgroundColor:\'black\',border:1,borderColor:\'white\',ondblclick:\'icicle.panel.interact(element,init)\',layer:\''+lookup+'\'}');
				div.setAttribute('snaparea','{type:\'element\'}');
			break;
			case 'icicle:element:viewer':
				div.setAttribute('panel','{width:'+Math.round((Math.random()*100)+100)+',height:'+Math.round((Math.random()*100)+100)+',anchor:body,position:\'dragdrop\',z:9999,draggable:true,promotable:true,template:\'templates/unabacus\',backgroundImage:\'\',backgroundColor:\'transparent\',border:1,borderColor:\'white\'}');
				div.setAttribute('viewer','{}');
			break;
			}

			element.appendChild(div);
			parseDOM( div );
			return div;

		}

		this.castAs = function( value, castAs ){

			switch( castAs ){
			case 'integer':
				var v = parseInt(value);
				if(isNaN(v))v=0;
				return v;
			break;
			}

			return value;

		}

		this.getStyle = function( oElm, mozStyleProp, ieStyleProp, castAs ){

			try{
				if( !ieStyleProp ) ieStyleProp = mozStyleProp;
				if(oElm.substr){
					oElm = document.getElementById(oElm);
				}else{
					oElm = oElm;
				}
				if(window.getComputedStyle){
					var prop = window.getComputedStyle(oElm,null).getPropertyValue(mozStyleProp);
				}else if (oElm.currentStyle){
					var prop = eval('oElm.currentStyle.' + ieStyleProp);
				}
				if( castAs ){
					prop = myself.castAs( prop, castAs );
				}
				return prop;
			}catch(ee){
				return 0;
			}

		}

		this.setSelection = function( node, mode ){

			if( node && node.nodeName ){
				if( mode == 'off' ){
					myself.addClassName(node, 'no-select'); /// ff
					if( document && document.selection ){
						document.selection.empty(); // ie
						node.onselectstart = function(){return false;} // ie
					}else if( window.getSelection ){
						var selection = window.getSelection();
						selection.collapse(body,0);
					}
				}else{
					myself.removeClassName(node, 'no-select'); /// ff
					if( document && document.selection ){
						node.onselectstart = function(){} // ie
					}
				}
			}

		}

		this.E = getEvent;
		this.getEvent = getEvent;
		this.imageOver = function( img ){ var s = '' + img.src; s = s.replace('.png', '-o.png'); img.oldsrc = img.src; img.src = s; }
		this.imageOut = function( img ){ if( img.oldsrc ){ img.src = img.oldsrc; } }

		this.getLeft = window.getLeft;
		this.getTop = window.getTop;
		this.getWidth = window.getWidth;
		this.getHeight = window.getHeight;

		this.getCoordObject = function( element ){
			return {
				x: myself.getLeft(element),
				y: myself.getTop(element),
				w: myself.getWidth(element),
				h: myself.getHeight(element)
			}
		}

		this.notImplemented = function(){

			alert( "Sorry this feature isn't yet implemented" );

		}

		this.nonOpaque = function( flash ){

			if( flash.attachEvent && ( flash.nodeName == 'EMBED' ) ) return;
			if( !flash.attachEvent && ( flash.nodeName == 'OBJECT' ) ) return;

			nonopaques.push( flash );

		}

		this.nonOpaques = function( type ){

			for( var i in nonopaques ){

				nonopaques[i].style.visibility = ( type == 'hide' ? 'hidden' : 'visible' );

			}

		}

		this.appendURL = function( url, vars ){

			if( url.indexOf( '?' ) != -1 ){

				return url +'&'+vars;

			}else{

				return url +'?'+vars;

			}

		}

		this.UmbilicalLink = function( from, to ){

			var inserted = false;
			var e1 = document.createElement('DIV');
			var e2 = document.createElement('DIV');
			var e3 = document.createElement('DIV');
			e1.style.position = 'absolute'; e1.style.fontSize = '0px'; e1.style.background = 'white'; e1.style.visibility = 'visible';
			e2.style.position = 'absolute'; e2.style.fontSize = '0px'; e2.style.background = 'white'; e2.style.visibility = 'visible';
			e3.style.position = 'absolute'; e3.style.fontSize = '0px'; e3.style.background = 'white'; e3.style.visibility = 'visible';

			setInterval(function(){
				var p1 = window.getCenter( from );
				var p2 = window.getCenter( to );
				var dw = p2.x-p1.x;
				var dh = p2.y-p1.y;
				var w = Math.abs(dw);
				var h = Math.abs(dh);
				var w2,h2;

				if( (dw > 0) && (dh > 0) ){
					if( h > w ){
						p1.y += window.getHeight( from ) / 2;
						p2.y -= window.getHeight( to ) / 2;
						h = Math.abs(p2.y-p1.y);
						h2 = h/2;
						e1.style.left	= p1.x+'px';
						e1.style.top	= p1.y+'px';
						e1.style.height = h2+'px';
						e1.style.width	= '1px';
						e2.style.left	= p1.x+'px';
						e2.style.top	= (p1.y+h2)+'px';
						e2.style.height = '1px';
						e2.style.width	= w+'px';
						e3.style.left	= p2.x+'px';
						e3.style.top	= (p2.y-h2)+'px';
						e3.style.height = (h2)+'px';
						e3.style.width	= '1px';
					}else{
						p1.x += window.getWidth( from ) / 2;
						p2.x -= window.getWidth( to ) / 2;
						w = Math.abs(p2.x-p1.x);
						w2 = w/2;
						e1.style.left	= p1.x+'px';
						e1.style.top	= p1.y+'px';
						e1.style.width	= (w2)+'px';
						e1.style.height	= '1px';
						e2.style.left	= (p1.x+w2)+'px';
						e2.style.top	= p1.y+'px';
						e2.style.height = h+'px';
						e2.style.width	= '1px';
						e3.style.left	= (p2.x-w2)+'px';
						e3.style.top	= p2.y+'px';
						e3.style.height = '1px';
						e3.style.width	= (w2)+'px';
					}
				}else if( (dw > 0) && (dh < 0) ){
					if( h > w ){
						p1.y -= window.getHeight( from ) / 2;
						p2.y += window.getHeight( to ) / 2;
						h = Math.abs(p2.y-p1.y);
						h2 = h/2;
						e1.style.left	= p1.x+'px';
						e1.style.top	= (p1.y-h2)+'px';
						e1.style.height = h2+'px';
						e1.style.width	= '1px';
						e2.style.left	= p1.x+'px';
						e2.style.top	= (p2.y+h2)+'px';
						e2.style.height = '1px';
						e2.style.width	= w+'px';
						e3.style.left	= p2.x+'px';
						e3.style.top	= (p2.y)+'px';
						e3.style.height = (h2)+'px';
						e3.style.width	= '1px';
					}else{
						p1.x += window.getWidth( from ) / 2;
						p2.x -= window.getWidth( to ) / 2;
						w = Math.abs(p2.x-p1.x);
						w2 = w/2;
						e1.style.left	= p1.x+'px';
						e1.style.top	= p1.y+'px';
						e1.style.width	= (w2)+'px';
						e1.style.height	= '1px';
						e2.style.left	= (p1.x+w2)+'px';
						e2.style.top	= p2.y+'px';
						e2.style.height = h+'px';
						e2.style.width	= '1px';
						e3.style.left	= (p2.x-w2)+'px';
						e3.style.top	= p2.y+'px';
						e3.style.height = '1px';
						e3.style.width	= (w2)+'px';
					}
				}else if( (dw < 0) && (dh < 0) ){
					if( h > w ){
						p1.y -= window.getHeight( from ) / 2;
						p2.y += window.getHeight( to ) / 2;
						h = Math.abs(p2.y-p1.y);
						h2 = h/2;
						e1.style.left	= p1.x+'px';
						e1.style.top	= (p1.y-h2)+'px';
						e1.style.height = h2+'px';
						e1.style.width	= '1px';
						e2.style.left	= (p2.x)+'px';
						e2.style.top	= (p2.y+h2)+'px';
						e2.style.height = '1px';
						e2.style.width	= w+'px';
						e3.style.left	= p2.x+'px';
						e3.style.top	= (p2.y)+'px';
						e3.style.height = (h2)+'px';
						e3.style.width	= '1px';
					}else{
						p1.x -= window.getWidth( from ) / 2;
						p2.x += window.getWidth( to ) / 2;
						w = Math.abs(p2.x-p1.x);
						w2 = w/2;
						e1.style.left	= (p1.x-w2)+'px';
						e1.style.top	= p1.y+'px';
						e1.style.width	= (w2)+'px';
						e1.style.height	= '1px';
						e2.style.left	= (p1.x-w2)+'px';
						e2.style.top	= p2.y+'px';
						e2.style.height = h+'px';
						e2.style.width	= '1px';
						e3.style.left	= (p2.x)+'px';
						e3.style.top	= p2.y+'px';
						e3.style.height = '1px';
						e3.style.width	= (w2)+'px';
					}
				}else if( (dw < 0) && (dh > 0) ){
					if( h > w ){
						p1.y += window.getHeight( from ) / 2;
						p2.y -= window.getHeight( to ) / 2;
						h = Math.abs(p2.y-p1.y);
						h2 = h/2;
						e1.style.left	= p1.x+'px';
						e1.style.top	= p1.y+'px';
						e1.style.height = h2+'px';
						e1.style.width	= '1px';
						e2.style.left	= p2.x+'px';
						e2.style.top	= (p1.y+h2)+'px';
						e2.style.height = '1px';
						e2.style.width	= w+'px';
						e3.style.left	= p2.x+'px';
						e3.style.top	= (p2.y-h2)+'px';
						e3.style.height = (h2)+'px';
						e3.style.width	= '1px';
					}else{
						p1.x -= window.getWidth( from ) / 2;
						p2.x += window.getWidth( to ) / 2;
						w = Math.abs(p2.x-p1.x);
						w2 = w/2;
						e1.style.left	= (p1.x-w2)+'px';
						e1.style.top	= p1.y+'px';
						e1.style.width	= (w2)+'px';
						e1.style.height	= '1px';
						e2.style.left	= (p1.x-w2)+'px';
						e2.style.top	= p1.y+'px';
						e2.style.height = h+'px';
						e2.style.width	= '1px';
						e3.style.left	= (p2.x)+'px';
						e3.style.top	= p2.y+'px';
						e3.style.height = '1px';
						e3.style.width	= (w2)+'px';
					}
				}else{
					return;
				}

				if(!inserted){
					inserted = myself.realiseElement('unique(layers:admin)');
					if(inserted){
						inserted.appendChild(e1);
						inserted.appendChild(e2);
						inserted.appendChild(e3);
					}else{
						inserted = true;
					}
				}

			},100);

		}

		this.LinkPanel = function( element,w,h ){

			var div = document.createElement('DIV');
			var init = {
				width:(w?w:150),
				height:(h?h:150),
				anchor:body,
				position:'center',
				z:99999,
				draggable:true,
				promotable:true,
				shadow:true,
				template:'templates/unabacus',
				backgroundImage:'/images/panel-background.jpg',
				backgroundColor:'white',
				backgroundRepeat:'repeat-x',
				layer:'unique(layers:admin)'
			};

			includes.runFromAttribute(div,init,'panel');

			var ul = new myself.UmbilicalLink( element, div );

		}

		this.obscure = function( style, showLoadingIcon, onKill, zIndex, keepHidden ){

			var holder = document.createElement( 'DIV' );
			var _myself = this;

			this.kill = function(){
				if( holder && holder.parentNode ){
					holder.parentNode.removeChild( holder );
				}
			}

			if( onKill ){
				var kill = function(){ onKill( 'obscure', _myself ); }
			}else{
				var kill = this.kill;
			}

			var hide = this.hide = function(){
				holder.style.display = 'none';
				if( onKill ) onKill();
			}

			var show = this.show = function(){
				holder.style.display = 'block';
			}

			var alpha;

			holder.style.position	= 'absolute';
			holder.style.left		= '0px';
			holder.style.top		= '0px';
			holder.style.right		= '0px';
			holder.style.bottom		= '0px';

			if( style && style.indexOf(':') ){
				var parts = style.split(':');
				holder.style.background = parts[0];
				alpha = parseInt(parts[1]);
				holder.style.opacity = alpha/100;
			}else{
				holder.style.background = ( style == 'transparent' ? 'transparent' : 'black' );
				holder.style.opacity	= '0.5';
				alpha = 50;
			}
			holder.onclick			= kill;

			if(typeof zIndex != 'undefined') holder.style.zIndex = zIndex;

			if( myself.isIE() ){
				if( style == 'transparent' ) holder.style.background = 'url(images/pixel.gif)';
				holder.style.width	= '100%';
				holder.style.height = '100%';
				holder.style.filter = 'Alpha(opacity='+alpha+')';
			}

			if( showLoadingIcon ){
				holder.style.background = 'black url(/panel/images/loading-small-black-white.gif) no-repeat center center';
			}

			if( keepHidden ){
				holder.style.display = 'none';
			}else{
				holder.style.display = 'block';
			}

			myself.body.appendChild( holder );

		}

		this.getBorderWidth = function( obj ){

			if( ! obj ) return;

			if( obj.currentStyle ){

				return	alwaysNumber( parseInt( obj.currentStyle.borderLeftWidth ) ) +
						alwaysNumber( parseInt( obj.currentStyle.borderRightWidth ) );

			}else if( window.getComputedStyle ){

				return	alwaysNumber( parseInt( window.getComputedStyle( obj, null ).getPropertyValue( 'border-left-width' ) ) ) +
						alwaysNumber( parseInt( window.getComputedStyle( obj, null ).getPropertyValue( 'border-right-width' ) ) );

			}

		}

		this.getBorderHeight = function( obj ){

			if( ! obj ) return false;

			if( obj.currentStyle ){

				return	alwaysNumber( parseInt( obj.currentStyle.borderTopWidth ) ) +
						alwaysNumber( parseInt( obj.currentStyle.borderBottomWidth ) );

			}else if( window.getComputedStyle ){

				return	alwaysNumber( parseInt( window.getComputedStyle( obj, null ).getPropertyValue( 'border-top-width' ) ) ) +
						alwaysNumber( parseInt( window.getComputedStyle( obj, null ).getPropertyValue( 'border-bottom-width' ) ) );

			}

			return false;

		}

		this.getPosition = function(obj){

			if( ! obj ) return false;

			if( obj.currentStyle ){
				return	obj.currentStyle.position;
			}else if( window.getComputedStyle ){
				return	window.getComputedStyle( obj, null ).getPropertyValue( 'position' );
			}

			return false;

		}
		
		this.addEventHandler = this.setEventHandler = function( element, eventname, handler ){

			if( element.attachEvent ){

				element.attachEvent( 'on'+eventname, handler );

			}else if( element.addEventListener ){

				element.addEventListener( eventname, handler, true );

			}

		}

		this.removeEventHandler = function( element, eventname, handler ){

			if( element.detachEvent ){

				element.detachEvent( 'on'+eventname, handler );

			}else if( element.removeEventListener ){

				element.removeEventListener( eventname, handler, true );

			}

		}

		this.cancelEvent = function( e ){

			if( ! e ) e = window.event;
			if( e.obj ) e = e.obj;

			if( e.preventDefault ){

				e.preventDefault();
				e.stopPropagation();

			}else{

				e.cancelBubble	= true;
				e.returnFalse	= true;

			}

		}

		this.urlEncode = function( value ){

			if( window.encodeURIComponent ){

				return window.encodeURIComponent( value );

			}else{

				return escape( value );

			}

		}

		this.argsToPHP = function( args ){

			try{

				var php = new serializer();
				return php.serialize( args );

			}catch( ee ){

				return '';

			}

		}

		this.removeNode = function( node ){

			if( node && node.parentNode && node.parentNode.removeChild ){

				node.parentNode.removeChild( node );
				return true;

			}

			return false;

		}

		this.removeFromView = function( list ){

			var i, item;

			for( i in list ){

				if( item = myself.getByUnique( list[i] ) ){

					myself.removeNode( item );

				}

			}

		}

		this.getByUnique = function( uni ){

			if( uni && prefs.uniques ){

				return prefs.uniques[ uni ];

			}

			return false;

		}

		this.grabFile = function( unique ){

			if( ! window.inventory ) return;

			if( ! prefs.inventory ){

				prefs.inventory = new inventory( { name: 'main' } );

			}

			prefs.inventory.addItemByUnique( unique );

		}

		this.createFolder = function( unique ){

			if( page.nonOpaques ){ page.nonOpaques('hide'); }

			var ident = new Date().getTime();

			var menu = {};
				menu.panel = document.createElement('DIV');
				menu.panel.setAttribute('panel','{ width: 400, height: 200, position: \'center\', draggable: false, obscure: \'black\', ident: \''+ident+'\' }');
				menu.panel.innerHTML =	'<div style="position: relative;" xhttp="{ url: \'folder-create.php?unique='+page.urlEncode(unique)+'\', autoload: 1 }"></div>';

			page.body.appendChild( menu.panel );
			page.parseDOM( menu.panel );

		}

		this.selectFolder = function( unique, anchor, whenDone, obscureType ){

			if( page.nonOpaques ){ page.nonOpaques('hide'); }
			if( !obscureType ) obscureType = 'transparent';

			if( ! whenDone ){
				whenDone = function( selected ){
					for( var i in selected ){ 
						window.fireEvent('onFolderNavigatedELM',selected[i],false,false,'filelisting');
						break;
					}
				}
			}

			var ident = new Date().getTime();
			
			var menu = {};
				menu.panel = document.createElement('DIV');
				menu.panel.setAttribute('panel','{ width: 200, height: 300, anchor: \''+(anchor?anchor.id:'')+'\', draggable: false, obscure: \''+obscureType+'\', ident: \''+ident+'\' }');
				menu.panel.innerHTML =	'<div style="position: absolute; left: 0px; right: 0px; top: 0px; bottom: 40px; overflow: auto; *width:100%; *height: expression((this.parentNode.offsetHeight-40)+\'px\');" filelist="{ unique: \''+unique+'\', mode: \'selected\', filter: false, filetype: \'folder\', ident: \''+ident+'\', collation: \''+ident+'\' }" selectgroup="{ mode: \'single\', name: \''+ident+'\', \'css-selected\': \'fileitem-s\', \'css-normal\': \'fileitem\', \'css-hover\': \'fileitem-o\' }"></div>'+
										'<div style="position: absolute; left: 2px; bottom: 2px; width: 45%;"><button name="'+ident+'" ident="button_cancel" class="white-wide" onclick="window.fireEvent( \'onPanelClose\', \''+ident+'\' )"><img src="images/icons/closed.png" align="absmiddle" />&nbsp;Cancel</button></div>'+
										'<div style="position: absolute; right: 2px; bottom: 2px; width: 45%;"><button name="'+ident+'" ident="button_okay" class="white-wide" onclick="window.fireEvent(\'onFolderChosen\',selectgroups.getSelected(\''+ident+'\'),\''+ident+'\'); window.fireEvent( \'onPanelOkay\', \''+ident+'\' ); window.fireEvent( \'onPanelClose\', \''+ident+'\' );"><img src="images/icons/btn-check.png" align="absmiddle" />&nbsp;Ok</button></div>';

			var ear = {};
				ear.onFolderChosen = function(s,id){ if(id == ident){ whenDone(s); } }
				ear.onPanelClose = function(id){
					if(id == ident){
						window.fireEvent( 'onCCC', ident ); /// tidy collations up
						window.removeListener( ear );
						if( menu.panel && menu.panel.parentNode ) page.body.removeChild( menu.panel );
						menu = null;
					}
				}

			window.addListener( ear );

			page.body.appendChild( menu.panel );
			page.parseDOM( menu.panel );

		}

		this.renameFile = function( unique, currentName, newName ){

			if( newName ){

				/// if we have a name do the request

				page.request( 'rename', [ [unique], [newName], [currentName] ], function( res ){

					if( typeof res.success == 'undefined' ) return;
				
					if( res.allok ){

						var replacers = {};
							replacers[ res.success[ 0 ] ] = res.uniques[ 0 ];

						page.refreshPage( replacers );

					}else{

						alert('Rename Failed!');

					}
					
				});

			}else{

				if( page.nonOpaques ){ page.nonOpaques('hide'); }

				var ident = new Date().getTime();

				var menu = {};
					menu.panel = document.createElement('DIV');
					menu.panel.setAttribute('panel','{ width: 400, height: 200, position: \'center\', draggable: false, obscure: \'black\', ident: \''+ident+'\' }');
					menu.panel.innerHTML =	'<div style="position: relative;" xhttp="{ url: \'file-rename.php?unique='+page.urlEncode(unique)+'\', autoload: 1 }"></div>';

				page.body.appendChild( menu.panel );
				page.parseDOM( menu.panel );

			}

		}

		this.rotateFile = function( unique, angle ){

			window.fireEvent( 'onItemProcessing', unique );

			page.request( 'rotate', [ [unique], [angle] ], function( res ){

				if( typeof res.success == 'undefined' ) return;
			
				if( res.allok ){

					window.fireEvent( 'onItemUpdate', unique );

				}else{

					

				}
				
			});


		}

		this.lockFile = function( unique, confirm ){

			if( confirm ){

			}else{

				if( page.nonOpaques ){ page.nonOpaques('hide'); }

				var ident = new Date().getTime();

				var menu = {};
					menu.panel = document.createElement('DIV');
					menu.panel.setAttribute('panel','{ width: 400, height: 400, position: \'center\', draggable: false, obscure: \'black\', ident: \''+ident+'\' }');
					menu.panel.innerHTML =	'<div style="position: relative;" xhttp="{ url: \'file-lock.php?unique='+page.urlEncode(unique)+'\', autoload: 1 }"></div>';

				page.body.appendChild( menu.panel );
				page.parseDOM( menu.panel );

			}

		}

		this.moveFile = function( unique, confirm ){

			if( confirm ){

			}else{

				if( page.nonOpaques ){ page.nonOpaques('hide'); }

				var ident = new Date().getTime();

				var menu = {};
					menu.panel = document.createElement('DIV');
					menu.panel.setAttribute('panel','{ width: 400, height: 300, position: \'center\', draggable: false, obscure: \'black\', ident: \''+ident+'\' }');
					menu.panel.innerHTML =	'<div style="position: relative;" xhttp="{ url: \'file-move.php?unique='+page.urlEncode(unique)+'\', autoload: 1 }"></div>';

				page.body.appendChild( menu.panel );
				page.parseDOM( menu.panel );

			}

		}

		this.deleteFile = function( unique, confirm ){

			if( confirm ){

				page.request( 'delete', [ unique ], function( res ){

					if( typeof res.success == 'undefined' ) return;
				
					if( res.allok ){

						window.fireEvent( 'onItemUpdate', unique );

						if( res.success.length == 1 ){

							///alert('Item Deleted..!');

						}else{

							///alert('Items All Deleted...');

						}

					}else{

						if( res.success.length > 0 ){

							alert('Some Items were deleted, others failed :(');

						}else{

							alert('All items failed to be deleted... :(');

						}

					}

					if( res.success.length ){

						page.removeFromView( res.success );

					}
					
				});

			}else{

				if( page.nonOpaques ){ page.nonOpaques('hide'); }

				var ident = new Date().getTime();

				var menu = {};
					menu.panel = document.createElement('DIV');
					menu.panel.setAttribute('panel','{ width: 400, height: 200, position: \'center\', draggable: false, obscure: \'black\', ident: \''+ident+'\' }');
					menu.panel.innerHTML =	'<div style="position: relative;" xhttp="{ url: \'file-delete.php?unique='+page.urlEncode(unique)+'\', autoload: 1 }"></div>';

				page.body.appendChild( menu.panel );
				page.parseDOM( menu.panel );

			}

		}

		this.downloadFile = function( unique ){

			var ifr						= document.createElement( 'IFRAME' );
				ifr.id					= 'downloadIframe';
				ifr.src					= 'download.php?u='+myself.urlEncode(unique);
				ifr.style.position		= 'absolute';
				ifr.style.width			= '20px';
				ifr.style.height		= '20px';
				ifr.style.left			= '-200px';
				ifr.style.top			= '-200px';
				ifr.style.visibility	= 'hidden';

			document.documentElement.appendChild( ifr );

		}

		this.addFileToList = function( unique ){

			page.request( 'add-to-list', [ unique ] );

		}

		this.attachToMessage = function( unique ){

			page.notImplemented();

		}

		this.viewFileInfo = function( unique ){

			popover.page( 'photo-info.php?u='+myself.urlEncode(unique), 436, 330, page.parseDOM );

		}

		this.viewMessage = function( unique ){

			popover.page( 'message-view.php?u='+myself.urlEncode(unique), 600, 500, false );

		}

		this.refreshPage = function( replacers ){

			var str = ''+window.location;
			var i;

			for( i in replacers ){
				str = str.replace( new RegExp(i,'gi'), replacers[i] );
			}

			window.location = str;

		}

		this.requestResponse = function( res, type, wd ){

			if( ! res ) return;

			eval( 'res = '+res );

			switch( type ){
			case 'clear-list':
			case 'add-to-list':
			case 'get-list':

				window.fireEvent( 'onListChanged', res );

			break;
			case 'delete':

				window.fireEvent( 'onItemDeleted', res );

			break;
			}

			if( wd ) return wd( res );

		}

		this.request = function( type, args, wd ){

			var x = new window.xhttp();
				x.onresponse = function( res ){ myself.requestResponse( res, type, wd ); }
				x.call( 'request.php?type='+type+'&args='+myself.urlEncode( myself.argsToPHP( args ) ), 'POST' );

		}

		var viewPhoto = this.viewPhoto = function( args ){

			popover.photo( 'anyphoto.php?u='+myself.urlEncode(args[0]), 'anythumb.php?u='+myself.urlEncode(args[0]) );

		}

		this.selectPhoto = function( args, whenDone ){

			var url = 'modal-xhttp.php?nc='+( new Date().getTime() )+'&url='+myself.urlEncode( 'photos-find.php?args='+myself.urlEncode( myself.argsToPHP( args ) ) );

			popover.page( url, 400, 500, false, whenDone );

		}

		var blogEditor = function( type, args ){

			var url = 'modal-xhttp.php?nc='+( new Date().getTime() )+'&url='+myself.urlEncode( 'popup.php?type='+type+'&args='+myself.urlEncode( myself.argsToPHP( args ) ) );

			popover.page( url, 700, 500, false );

		}

		this.getContact = function( type, whenDone ){

			var url = 'modal-xhttp.php?nc='+( new Date().getTime() )+'&url='+myself.urlEncode( 'contacts-find.php?type='+type );

			popover.page( url, 650, 500, false, whenDone );

		}

		this.newFolder = function( type, args, whenDone ){

			var url = 'modal-xhttp.php?nc='+( new Date().getTime() )+'&url='+myself.urlEncode( 'popup.php?type='+type+'&args='+myself.urlEncode( myself.argsToPHP( args ) ) );

			popover.page( url, 380, 230, false, whenDone );

		}

		this.popup = function( type, args ){

			if( ! args ) args = {};

			if( type == 'view' ){

				return viewPhoto( args );

			}else if( type == 'new' || type == 'edit' ){

				return blogEditor( type, args );

			}else if( type == 'newfolder' ){

				return myself.newFolder( type, args );

			}else if( type == 'oversized' ){

				var url = 'modal-xhttp.php?nc='+( new Date().getTime() )+'&url='+myself.urlEncode( 'popup.php?type='+type+'&args='+myself.urlEncode( myself.argsToPHP( args ) ) );
				popover.page( url, 400, 400, false );
				return false;

			}else if( type == 'save' ){

				var url = 'modal-xhttp.php?nc='+( new Date().getTime() )+'&url='+myself.urlEncode( 'popup.php?type='+type+'&args='+myself.urlEncode( myself.argsToPHP( args ) ) );
				popover.page( url, 400, 400, false );
				return false;

			}

			var win, details = '', w,h, ob, isMozillaModal = false; // UniversalXPConnect UniversalFileRead
			var modal = true;

			if( window.netscape ){ try{netscape.security.PrivilegeManager.enablePrivilege( 'UniversalBrowserWrite' );isMozillaModal=true;}catch(ee){} }

			switch( type ){
			case 'newfolder':	w = 380; h = 230; details = 'width='+w+'px,height='+h+'px,resizable=yes,modal=yes,dependent=yes,dialog=yes,status=no,scrollbars=yes'; break;
			case 'view':		w = 790; h = 590; details = 'width='+w+'px,height='+h+'px,resizable=yes,modal=yes,dependent=yes,dialog=yes,status=no,scrollbars=yes,scroll=no,center=yes,dialogWidth='+w+'px,dialogHeight='+h+'px,location=no'; break;
			case 'edit':		w = 650; h = 500; details = 'width='+w+'px,height='+h+'px,resizable=yes,modal=yes,dependent=yes,dialog=yes,status=no,scrollbars=yes,scroll=no,center=yes,dialogWidth='+w+'px,dialogHeight='+h+'px,location=no'; break;
			case 'new':			w = 650; h = 500; details = 'width='+w+'px,height='+h+'px,resizable=yes,modal=yes,dependent=yes,dialog=yes,status=no,scrollbars=yes,scroll=no,center=yes,dialogWidth='+w+'px,dialogHeight='+h+'px,location=no'; break;
			case 'file':		w = 600; h = 500; details = 'width='+w+'px,height='+h+'px,resizable=yes,modal=yes,dependent=yes,dialog=yes,status=no,scrollbars=yes,scroll=no,center=yes,dialogWidth='+w+'px,dialogHeight='+h+'px,location=no'; break;
			case 'date':		w = 500; h = 450; details = 'width='+w+'px,height='+h+'px,resizable=yes,modal=yes,dependent=yes,dialog=yes,status=no,scrollbars=yes,scroll=no,center=yes,dialogWidth='+w+'px,dialogHeight='+h+'px,location=no'; break;
			case 'player':		w = 350; h = 250; details = 'width='+w+'px,height='+h+'px,resizable=yes,modal=no,dependent=yes,dialog=yes,status=no,scrollbars=yes,scroll=no,center=yes,dialogWidth='+w+'px,dialogHeight='+h+'px,location=no'; modal = false; break;
			default:			w = 400; h = 400; details = 'width='+w+'px,height='+h+'px,resizable=yes,modal=yes,dependent=yes,dialog=yes,status=no,scrollbars=yes'; break;
			}

			var url		= 'modal.php?nc='+( new Date().getTime() )+'&url='+myself.urlEncode( 'popup.php?type='+type+'&args='+myself.urlEncode( myself.argsToPHP( args ) ) );
			var holder	= document.getElementById( 'holder' );

			try{

				if( window.showModalDialog ){

					details = details.replace( new RegExp('=','gi'),':').replace(new RegExp(',','gi') ,';');

					if( modal ) ob = new page.obscure();

					if( page.nonOpaques ){ page.nonOpaques('hide'); }

					window.showModalDialog( url, null, details );

					if( page.nonOpaques ){ page.nonOpaques('show'); }
					
					if( modal ) ob.kill();

				}else if( isMozillaModal ){

					if( modal ) ob = new page.obscure();

					if( page.nonOpaques ){ page.nonOpaques('hide'); }

					window.open( url, 'popup'+type, details );

					if( page.nonOpaques ){ page.nonOpaques('show'); }

					if( modal ) ob.kill();

				}else{

					if( win	= window.open( url, 'popup'+type, details ) ){

						win.moveTo( screen.width * 0.5 - w * 0.5, screen.height * 0.5 - h * 0.5 )
						win.onload		= function(){ if( modal ) ob = new page.obscure(); if( page.nonOpaques ){ page.nonOpaques('hide'); } if( win.focus ) win.focus(); }
						win.onunload	= function(){ if( ob ) ob.kill(); }
						window.onunload = function(){ if( page.nonOpaques ){ page.nonOpaques('show'); }; if( win && !win.closed ){ win.close(); } }
						
					}

				}

			}catch(ee){}

		}

		this.findPositionedParent = function( element, includeSelf ){

			if( includeSelf && ( element.style.position == 'relative' || element.style.position == 'absolute' ) ) return element;

			var par = element;
			
			while( par = par.parentNode ){
			
				if( par.style && ( par.style.position == 'relative' || par.style.position == 'absolute' ) ) return par;

			};

			return false;

		}

		this.findParent = function( element, needle, attr ){

			if( ! attr ) attr = 'nodeName';

			if( ! element ) return false;
			if( element[ attr ] == needle ) return element;
			var par = element; while( par = par.parentNode ){ if( par[ attr ] == needle ){ return par; } };

			return false;

		}

		this.findParentWithIcicleType = function( element, includeSelf ){

			var par = element;
			if(!includeSelf) par = par.parentNode;
			do{if(page.getIcicleType(par)){return par;}}while( par = par.parentNode );

		}

		this.findNextNode = function( element ){

			if( !element ) return;

			while( element = element.nextSibling ){
				if( element.nodeType == 1 ){
					return element;
				}
			}

			return false;

		}

		this.findChild = function( element, needle ){

			if( ! element ) return false;
			if( element.nodeName == needle ) return element;

			if( element.childNodes ){

				var i, nof = element.childNodes.length, child, found;

				for( i = 0; i < nof; i++ ){

					if( child = element.childNodes[i] ){

						found = myself.findChild( child, needle );
						if( found ) return found;

					}

				}

			}

		}

		this.applyClassName = function( element, name ){

			if( name || name === '' ){

				element.className = name;

			}

		}

		this.addClassName = function( element, name ){

			var existing = ''+element.className;
			var re = new RegExp( '(^| )'+name+'( |$)', 'gi' );

			if( ! existing.match( re ) ){

				existing += ' '+name;

			}

			element.className = existing;

		}

		this.removeClassName = function( element, name ){

			var existing = ''+element.className;
			var re = new RegExp( '(^| )'+name+'( |$)', 'gi' );
			element.className = existing.replace( re, '' );

		}

		this.setWrapperObject = function( id, obj ){

			wraps[ id ] = obj;

		}

		this.getWrapperObject = function( id ){

			return wraps[ id ];

		}

		this.loading = function( type ){

			if( ! type ) type = 'image';

			if( ! myself.loading.counts[ type ] ){

				myself.loading.counts[ type ] = 0;

			}

			myself.loading.counts[ type ]++;

			var output = document.getElementById( 'padeLoadingOutput' );

			if( output ){

				if( myself.loading.totals['image'] ){

					output.innerHTML = '<font color="#94D555" size="1"><b>loading page</b> ::: '+Math.round( 100 / myself.loading.totals['image'] * myself.loading.counts['image'] )+'%</font>';

				}

			}

		}

		this.loading.setTotal = function( type, count ){

			myself.loading.totals[ type ] = count;

		}

		this.loading.counts = [];
		this.loading.totals = [];

		var handleScrollbars = function( element, init ){

			var getLeft					= window.getLeft;
			var getTop					= window.getTop;

			var prefs					= {};
				prefs.scrollbar			= {};
				prefs.scrollbar.mode	= 'vertical';
				prefs.target			= {};
				prefs.target.mode		= 'vertical';

			var getWidth	= function( obj ){ return obj.offsetWidth; }
			var getHeight	= function( obj ){ return obj.offsetHeight; }

			var scrollbar					= document.createElement( 'DIV' );
			var inner						= document.createElement( 'DIV' );

				scrollbar.style.position	= 'absolute';
				scrollbar.style.left		= '0px';
				scrollbar.style.top			= '0px';
				scrollbar.style.width		= '0px';
				scrollbar.style.height		= '0px';
				scrollbar.style.overflow	= 'auto';

				element.style.overflow		= 'hidden';
				element.onmousewheel		= function(){ /*TODO:*/ }
				element.scrollTop			= 0;
				element.scrollLeft			= 0;

				inner.innerHTML = '<img src="images/pixel.gif" width="1" height="1" style="display: none;" />';

				scrollbar.onscroll = function(){

					if( prefs.scrollbar.mode == 'vertical' ){

						setScroll( calcpercentage( getHeight( scrollbar ), scrollbar.scrollHeight, scrollbar.scrollTop ) )

					}else{

						setScroll( calcpercentage( getWidth( scrollbar ), scrollbar.scrollWidth, scrollbar.scrollLeft ) )

					}

				}

			var calcpercentage = function( view, total, offset ){

				var per = Math.round( 100 / (total-view) * offset );

				return per;

			}

			var setScroll = function( percent ){

				if( prefs.target.mode == 'vertical' ){

					var h	= getHeight( element );
					var ht	= element.scrollHeight;

					element.scrollTop = ( ( ht - h ) / 100 ) * percent;

				}else{

					var w	= getWidth( element );
					var wt	= element.scrollWidth;

					element.scrollLeft = ( ( wt - w ) / 100 ) * percent;

				}

			}

			var position = function(){

				switch( init.align ){
				case 'left':

					prefs.scrollbar.mode		= 'vertical';

					scrollbar.style.left		= getLeft( element ) - 1 + 'px';
					scrollbar.style.top			= getTop( element ) + 'px';
					scrollbar.style.width		= '17px';
					scrollbar.style.height		= getHeight( element ) + 'px';

					inner.style.width			= '1px';
					inner.style.height			= element.scrollHeight + 'px';

					element.style.paddingLeft	= ( 18 + init.paddingToText ) + 'px';

				break;
				case 'right':

					scrollbar.style.left		= getLeft( element ) + getWidth( element ) + 'px';
					scrollbar.style.top			= getTop( element ) + 'px';
					scrollbar.style.width		= '17px';
					scrollbar.style.height		= getHeight( element ) + 'px';

					inner.style.width			= '1px';
					inner.style.height			= element.scrollHeight + 'px';

					element.style.paddingRight	= ( 18 + init.paddingToText ) + 'px';

				break;
				case 'bottom':

					prefs.scrollbar.mode		= 'horizontal';

					scrollbar.style.left		= getLeft( element ) + 'px';
					scrollbar.style.top			= getTop( element ) + getHeight( element ) + init.paddingToText + 'px';

					scrollbar.style.width		= getWidth( element ) + 'px';
					scrollbar.style.height		= '17px';

					if( prefs.target.mode == 'vertical' ){
						inner.style.width			= element.scrollHeight + 'px';
						inner.style.height			= '1px';
					}else{
						inner.style.width			= element.scrollWidth + 'px';
						inner.style.height			= '1px';
					}

				break;
				case 'top':

					prefs.scrollbar.mode		= 'horizontal';

					scrollbar.style.left		= getLeft( element ) + 'px';
					scrollbar.style.top			= getTop( element ) + 'px';

					scrollbar.style.width		= getWidth( element ) + 'px';
					scrollbar.style.height		= '17px';

					if( prefs.target.mode == 'vertical' ){
						inner.style.width			= element.scrollHeight + 'px';
						inner.style.height			= '1px';
					}else{
						inner.style.width			= element.scrollWidth + 'px';
						inner.style.height			= '1px';
					}

					element.style.marginTop	= ( 32 + init.paddingToText ) + 'px';

				break;
				}

			}

			position();

			element.parentNode.appendChild( scrollbar );
			scrollbar.appendChild( inner );
			
			var slo = {};
				slo.onstart = function(){ position(); }
				slo.onresize = function(){ position(); }

			window.addListener( slo );

		}

		this.realiseElement = function(value){

			if(!myself.realiseElement.setup){
				myself.realiseElement.setup = true;
				myself.realiseElement.re = new RegExp('^([a-z]+)\\(([^\\)]+)\\)$','i');
			}

			switch( typeof value ){
			case 'string':
				var m;
				if( m = value.match(myself.realiseElement.re) ){
					switch(m[1].toLowerCase()){
					case 'unique':
						return myself.getByUnique(m[2]);
					break;
					case 'ident':
						return myself.getElementsByIdent(m[2]).pop();
					break;
					case 'id':
						return myself.getElementById(m[2]);
					break;
					case 'name':
						return myself.getElementsByName(m[2])[0];
					break;
					case 'eval':
						var o; eval('o = '+m[2]); return o;
					break;
					}
				}
			break;
			case 'object':
				if( value.nodeName ){
					return value;
				}
			break;
			}

			return false;

		}

		this.realise = function( a ){ try{ var v; eval( 'v = '+a ); return v; }catch( ee ){ return false; } }

		var registerElement = this.registerElement = function( element, type, index ){
			if( typeof index != 'undefined' ){
				if( typeof register[ type ] == 'undefined' ){
					register[ type ] = {};
					register[ type ][ index ] = element;
				}else{
					register[ type ][ index ] = element;
				}
			}else{
				if( typeof register[ type ] == 'undefined' ){
					register[ type ] = [ element ];
				}else{
					register[ type ].push( element );
				}
			}
		}

		var unregisterElement = this.unregisterElement = function( element, type, index ){
			if( typeof register[ type ] != 'array' ){
				register[ type ] = [];
			}else if( typeof register[ type ] != 'object' ){
				if( typeof index != 'undefined' ){
					delete register[ type ][ index ];
				}
			}
		}

		this.clearRegistered = function( type, removeHandlers ){
			if( typeof register[ type ] != 'array' ){
				if( removeHandlers ){
					for( var i in register[ type ] ){
						if( register[ type ][i] ){
							page.removeEventHandler( register[ type ][i], 'mousedown', selectHandler );
						}
					}
				}
				register[ type ] = [];
			}else if( typeof register[ type ] != 'object' ){
				if( removeHandlers ){
					for( var i in register[ type ] ){
						if( register[ type ][i] ){
							page.removeEventHandler( register[ type ][i], 'mousedown', selectHandler );
						}
					}
				}
				register[ type ] = {};
			}
		}

		this.getRegistered = function( type ){
			if( typeof register[ type ] != 'undefined' ){
				var ret = [];
				for( var i in register[ type ] ){
					if( register[ type ][i] ){
						ret.push( register[ type ][i] );
					}
				}
				return ret;
			}
			return false;
		}

		this.isRegistered = function( type, index ){
			if( typeof register[ type ] != 'undefined' ){
				return ( register[ type ][ index ] ? true : false );
			}
			return false;
		}

		var divineClassName = function( type, classType ){

			switch( type ){
			case 'recipient':
			case 'recipients':
			case 'recipientNoneFound':
			case 'contact':
			case 'contacts':
			case 'user':
			case 'users':

				if( classType == 'selected' ){

					return 'user-selected';

				}else{

					return 'user';

				}

			break;
			case 'message':
			case 'messages':

				if( classType == 'selected' ){

					return 'message-selected';

				}else{

					return 'message';

				}

			break;
			}

		}

		var selectHandler = function( e ){ e = getEvent( e ); if( ! e || ! e.src ) return;

			if( e.src.nodeName != 'A' ){

				e.src = page.findParent( e.src, 'A' );
				if( ! e.src ) return;

			}

			var group = e.src.getAttribute('selectgroup');
			var index = e.src.getAttribute('unique');

			if( group ){

				var items = page.getRegistered( group );
				var i;

				for( i in items ){

					if( items[ i ] ) items[ i ].className = divineClassName( group, 'normal' );

				}

				page.clearRegistered( group );

				registerElement( e.src, group, index );

				e.src.className = divineClassName( group, 'selected' );

			}

		}

		var createUnique = function(){
			var str = '';
			var time = ''+new Date().getTime();
			var lof = time.length;
			for( var i=0; i<lof; i++ ){
				str += String.fromCharCode(65 + Math.round(Math.random()*26));
				str += time.charAt(i);
			}
			return str;
		}

		var collate = function( obj, collationName ){

			if( typeof obj == 'object' ){

				obj['collation'] = collationName;

			}

		}

		var includes = {};
			includes.applicants = {};
			includes.addApplicant = function(attribute,onReady){
				if(!includes.applicants[attribute]){
					includes.applicants[attribute] = [];
				}
				includes.applicants[attribute].push(onReady);
			}
			includes.executeApplicants = function(attribute){
				try{
					if( includes.applicants[attribute] ){
						var i,lof = includes.applicants[attribute].length;
						for( i=0; i<lof; i++ ){
							if(includes.applicants[attribute][i]){
								includes.applicants[attribute][i]();
							}
						}
					}
				}catch(ee){
					alert(ee && ee.description?ee.description:ee);
				}
			}
			includes.getCode = function(attribute,whenDone,applicantList){

				if( window.location.host != 'www.unabacus.net' ){
					var script = document.createElement('SCRIPT');
						script.src = 'http://www.unabacus.net/icicle/scripts/icicle-'+attribute+'.js?nc='+(new Date().getTime());
					var timeID	= setTimeout(
												function(){
													clearInterval(interID);
													clearTimeout(timeID);
													window.status = 'ICICLE Request ('+attribute+') Timed Out';
												}, 30000
											);
					var interID = setInterval( 
												function(){
													if(icicle[attribute]){
														clearTimeout(timeID);
														clearInterval(interID);
														onload();
													}
												},100
											);
					var onload = function(){
						if( applicantList ){
							for( var i=0; i<applicantList.length; i++ ){
								includes.executeApplicants(applicantList[i]);
							}
						}else{
							includes.executeApplicants(attribute);
						}
						return whenDone();
					}
					body.appendChild(script);
				}else{

					var x = new window.xhttp();
						x.onresponse = function(res){
							try{
								eval(res);
								if( icicle[attribute] ){
									if( applicantList ){
										for( var i=0; i<applicantList.length; i++ ){
											includes.executeApplicants(applicantList[i]);
										}
									}else{
										includes.executeApplicants(attribute);
									}
									return whenDone();
								}
							}catch(ee){
								alert(ee && ee.description?ee.description:ee);
							}
						}
						x.call('scripts/icicle-'+attribute+'.js');

				}

			}
			includes.runFromAttribute = function(node,init,attribute,collation,childIndex,pass){

				if( r[attribute] ){
					r[attribute](node,init,attribute,collation,childIndex,pass);
				}

			}

		myself.includes = includes;

		var findLargestChild = function( element, snowball ){

			var area = element.offsetHeight * element.offsetWidth;
			var i, nof = element.childNodes.length, child;

			if(!snowball) snowball = {area:-1};

			if( area > snowball.area ){
				snowball.area = area;
				snowball.element = element;
			}

			for( i = 0; i < nof; i++ ){
				if((child = element.childNodes[i])&&(child.nodeType==1)){
					findLargestChild( child, snowball );
				}
			}

			return snowball.element;

		}

		var Loader = myself.Loader = function( node, timeout, obscureType ){

			var _myself = this;
			var elm = document.createElement('DIV');
				elm.style.position = 'absolute';

			var html = '';
			var timeid = false;
			var map = node;
			var ob = false;

			if( node.nodeName == 'BODY' ){
				elm.style.background = 'url(/icicle/templates/unabacus/images/black-50.png)';
				elm.style.zIndex = 1000;
				html = '<table width="100%" height="100%"><tr><td align="center" valign="middle"><div style="background: url(/icicle/templates/unabacus/images/loading-panel.png) no-repeat; width:171px; height:89px;"><center style="padding-top: 50px;"><img src="/icicle/templates/unabacus/images/loading-bar.gif?1" /></center></div></td></tr></table>';
				if( timeout ){
					html += '<div style="position: absolute; top: 15px; right: 15px; color: white;">Timeout in <span id="__timeout">'+(timeout/1000)+'</span></div>';
					timeid = setInterval( function(){ timeout -= 1000; var o = document.getElementById('__timeout'); o.innerHTML = timeout/1000; }, 1000 );
				}
			}else{
				map = findLargestChild(node);
				if( (map.nodeName == 'IMG') || (map.nodeName == 'A') ){
					elm.style.background = 'url(/icicle/templates/unabacus/images/black-25.png)';
					elm.style.border = '2px solid black';
					if(page.isIE()){
						elm.style.marginLeft = '0px';
						elm.style.marginTop = '0px';
					}else{
						elm.style.marginLeft = '-2px';
						elm.style.marginTop = '-2px';
					}
					elm.style.zIndex = 1000;
					html = '<div style="width: 100%; height: 100%; background: url(/icicle/templates/unabacus/images/loading-bar.gif) center center no-repeat;"></div>';
				}else{
					elm.style.background = 'url(/icicle/templates/unabacus/images/white-75.png)';
					elm.style.border = '1px dotted #357BC8';
					elm.style.zIndex = 1000;
					html = '<div style="width: 100%; height: 100%; background: url(/icicle/templates/unabacus/images/loading.gif) center center no-repeat;"></div>';
					if( timeout ){
						html += '<div style="position: absolute; top: 15px; right: 15px; color: black;">Timeout in <span id="__timeout">'+(timeout/1000)+'</span></div>';
						timeid = setInterval( function(){ timeout -= 1000; var o = document.getElementById('__timeout'); o.innerHTML = timeout/1000; }, 1000 );
					}
				}
			}

			elm.innerHTML = html;

			this.change = function( mode ){
				if( timeid ) clearInterval(timeid);
				if( node.nodeName == 'BODY' ){
					switch(mode){
					case 'busy':
						elm.innerHTML = '<table width="100%" height="100%"><tr><td align="center" valign="middle"><div style="background: url(/icicle/templates/unabacus/images/loading-panel-'+mode+'.png) no-repeat; width:171px; height:89px;">&nbsp;</div></td></tr></table>';
						setTimeout( function(){ _myself.kill() }, 2500 );
					break
					case 'serving':
						elm.innerHTML = '<table width="100%" height="100%"><tr><td align="center" valign="middle"><div style="background: url(/icicle/templates/unabacus/images/loading-panel-'+mode+'.png) no-repeat; width:171px; height:89px;"><center style="padding-top: 50px;"><img src="/icicle/templates/unabacus/images/loading-bar.gif?1" /></center></div></td></tr></table>';
					break;
					}
				}
			}

			this.kill = function( showError ){
				if( ob ) ob.kill();
				if( timeid ) clearInterval(timeid);
				if( showError ){
					if( node.nodeName == 'BODY' ){
						_myself.change(showError);
						return;
					}
				}
				window.removeListener(ear);
				if(elm && elm.parentNode){
					elm.parentNode.removeChild(elm);
				}
			}

			if( obscureType ){
				ob = new page.obscure(obscureType,false,_myself.kill,999);
			}

			body.appendChild(elm);

			var ear = {};
				ear.onresize = function(){
					elm.style.left = myself.getLeft(map)+'px';
					elm.style.top = myself.getTop(map)+'px';
					elm.style.width = myself.getWidth(map)+'px';
					elm.style.height = myself.getHeight(map)+'px';
				}
				ear.onresize();

			window.addListener(ear);

		}

		var simplex = function(obj,pre,post){
			if(!pre)pre='';
			if(!post)post='';
			var str = '';
			for( var i in obj ){
				str += (str?'&':'')+myself.urlEncode(pre+i+post)+'='+myself.urlEncode(obj[i]);
			}
			return str;
		}

		var r = {};
			r['serve'] = function(node,init,attribute,collation,childIndex,pass){
				if(!r['serve'].collation) r['serve'].collation = 1;
				var key = '__serve_'+r['serve'].collation;
				var ld = false;
				if( pass ){
					ld = pass.loader;
					ld.change('serving');
					pass.loader = false;
				}
				if( prefs.uniques[ key ] ){
					prefs.uniques[key].node = node;
					prefs.uniques[key].loader = ld;
					prefs.uniques[key].onAfterServe = init.onAfterServe;
					prefs.uniques[key].ident = init.ident;
					window.fam.gateway(init.media,init.user,key,simplex(init.args,'args[',']'),collation);
				}else{
					prefs.uniques[key]={ node: node, loader: ld, onAfterServe: init.onAfterServe, ident: init.ident, collation: collation };
					if( window.fam ){
						window.fam.gateway(init.media,init.user,key,simplex(init.args,'args[',']'),collation);
					}else{
						var head = document.getElementsByTagName('HEAD'); if(!head) return; head = head[0];
						var scr = document.createElement('script');
							scr.type = 'text/javascript';
							scr.src = 'http://www.familiarity.co.uk/panel/serve.php?response=js&media='+myself.urlEncode(init.media)+'&user='+myself.urlEncode(init.user)+'&track='+myself.urlEncode(key)+'&collation='+myself.urlEncode(collation)+'&'+simplex(init.args,'args[',']');
						head.appendChild(scr);
					}
				}
			}
			r['popoverapply'] = function(node,init,attribute,collation,childIndex,pass){
				var func = function(){return icicle['popover'].apply(node,init,collation,childIndex)};
				if( icicle['popover'] ){
					if( collation ) collate( init, collation );
					return func();
				}else if( icicle['popover'] === false ){
					includes.addApplicant(attribute,func);
					return true;
				}else{
					icicle['popover'] = false;
					includes.getCode('popover',func,['popoverapply','popover']);
					return true;
				}
			}
			r['popover'] = function(node,init,attribute,collation,childIndex,pass){
				var func = function(){return icicle['popover'](node,init,collation,childIndex)};
				if( icicle['popover'] ){
					if( collation ) collate( init, collation );
					return func();
				}else if( icicle['popover'] === false ){
					includes.addApplicant('popover',func);
					return true;
				}else{
					icicle['popover'] = false;
					includes.getCode('popover',func,['popoverapply','popover']);
					return true;
				}
			}
			r['pages'] = function(node,init,attribute,collation,childIndex){
				var func = function(){return icicle['pages'](node,init,collation)};
				if( icicle['pages'] ){
					includes.executeApplicants(attribute);
					if( collation ) collate( init, collation );
					return func();
				}else if( icicle['pages'] === false ){
					includes.addApplicant('pages',func);
					return true;
				}else{
					icicle['pages'] = false;
					includes.getCode('pages',func);
					return true;
				}
			}
			r['snaparea'] = function(node,init,attribute,collation,childIndex){
				var func = function(){return icicle['snaparea'](node,init,collation)};
				if( icicle['snaparea'] ){
					includes.executeApplicants(attribute);
					if( collation ) collate( init, collation );
					return func();
				}else if( icicle['snaparea'] === false ){
					includes.addApplicant('snaparea',func);
					return true;
				}else{
					icicle['snaparea'] = false;
					includes.getCode('snaparea',func);
					return true;
				}
			}
			r['viewer'] = function(node,init,attribute,collation,childIndex){
				var func = function(){return icicle['viewer'](node,init,collation)};
				if( icicle['viewer'] ){
					includes.executeApplicants(attribute);
					if( collation ) collate( init, collation );
					return func();
				}else if( icicle['viewer'] === false ){
					includes.addApplicant('viewer',func);
					return true;
				}else{
					icicle['viewer'] = false;
					includes.getCode('viewer',func);
					return true;
				}
			}
			r['draggable'] = function(node,init,attribute,collation,childIndex){
				var func = function(){return icicle['draggable'](node,init,collation)};
				if( icicle['draggable'] ){
					includes.executeApplicants(attribute);
					if( collation ) collate( init, collation );
					return func();
				}else if( icicle['draggable'] === false ){
					includes.addApplicant('draggable',func);
					return true;
				}else{
					icicle['draggable'] = false;
					includes.getCode('draggable',func);
					return true;
				}
			}
			r['droparea'] = function(node,init,attribute,collation,childIndex){
				var func = function(){return icicle['droparea'](node,init,collation)};
				if( icicle['droparea'] ){
					includes.executeApplicants(attribute);
					if( collation ) collate( init, collation );
					return func();
				}else if( icicle['droparea'] === false ){
					includes.addApplicant('droparea',func);
					return true;
				}else{
					icicle['droparea'] = false;
					includes.getCode('droparea',func);
					return true;
				}
			}
			r['panel'] = function(node,init,attribute,collation,childIndex){
				var func = function(){return icicle['panel'](node,init,collation)};
				if( icicle['panel'] ){
					includes.executeApplicants(attribute);
					if( collation ) collate( init, collation );
					return func();
				}else if( icicle['panel'] === false ){
					includes.addApplicant('panel',func);
					return true;
				}else{
					icicle['panel'] = false;
					includes.getCode('panel',func);
					return true;
				}
			}
			r['set']			= function(node,init){
				if( init.object && init.attribute ){
					var obj;
					eval('obj = '+init.object);
					if( obj[init.attribute] ){
						obj[init.attribute] = init.value;
					}
				}
			}
			r['inject']	= function(node,init,attribute,collation,childIndex,pass){
				var id = (typeof init.output == 'string'?init.output:'all');
				if( init.output && (typeof init.output == 'string') ){
					init.output = myself.getByUnique(init.output);
				}
				if( init.output && init.output.nodeName ){
					window.fireEvent('onCollationKill',id);
					init.output.innerHTML = '';
					var i, nof = node.childNodes.length, child;
					for(i=0;i<nof;i++){
						if(child=node.childNodes[0]){
							node.removeChild(child);
							init.output.appendChild(child);
						}
					}
					if(init.output && init.output.getAttribute && init.output.getAttribute('oninject')){
						eval(init.output.getAttribute('oninject'));
					}
					if(init.onInject){init.onInject(init);}
					parseDOM(init.output,true,id,false,pass);
				}
			}
			r['xlink']			= function(node,init,attribute,collation,childIndex,pass){
				if( init.output && (typeof init.output == 'string') ){
					init.output = myself.getByUnique(init.output);
				}else{
					init.output = document.createElement('DIV');
					init.output.style.display = 'none';
					init.outputIsTemporary = true;
					body.appendChild( init.output );
					childIndex.lof++;
				}

				if( init.output && init.output.nodeName ){

					if( !init.url ){
						if( node.href ){
							init.url = page.appendURL(''+node.href,'xlink=1');
						}
					}

					if( init.url ){
						var onclick = function(e){e=page.E(e,true);if(!e)return;
							var timeout = 20 * 1000;
							if(init.obscure == 'all'){
								var ld = new Loader( body, timeout );
							}else{
								var ld = new Loader( init.output, timeout );
							}
							var x = new window.xhttp();
								x.ontimeout = function(){
									ld.kill('busy');
								}
								x.onresponse = function(res){
									init.output.innerHTML = res;
									var pass = {loader:ld};
									parseDOM(init.output,true,false,false,pass);
									if(init.outputIsTemporary){
										init.output.innerHTML = '';
									}
									if(pass.loader){
										ld.kill();
									}
								}
								x.call(init.url,'post',true,false,true,timeout);
						}
						myself.addEventHandler( node, 'click', onclick );
					}
					
				}

			}
			r['isize']			= function(node,init){
				var w,h,l,r,t,b;
				if(myself.isIE()){
					if((w=init.w)||(w=init.width)){
						node.style.setExpression('width','('+w+')+"px"');
					}else if(((l=init.l)||(l=init.left)||(init.l===0))&&((r=init.r)||(r=init.right)||(init.r===0))){
						if(!l)l=0;if(!r)r=0;
						node.style.left = l+'px';
						node.style.setExpression('width','window.status=(this.parentNode.offsetWidth-'+l+'-'+r+')+"px"');
					}
					if((h=init.h)||(h=init.height)){
						node.style.setExpression('height','('+h+')+"px"');
					}else if(((t=init.t)||(t=init.top)||(init.t===0))&&((b=init.b)||(b=init.bottom)||(init.b===0))){
						if(!t)t=0;if(!b)b=0;
						node.style.top = t+'px';
						node.style.setExpression('height','window.status=(this.parentNode.offsetHeight-'+t+'-'+b+')+"px"');
					}
				}
			}
			r['ivisible']		= function(node){
				node.className = new String(node.className).replace('invisible','');
			}
			r['collapsible']	= function(node,init,attribute,collation,childIndex){
				var img				= document.createElement('IMG');
					img.className	= 'collapser';
					img.src			= 'images/icons/open.png';
				var open			= ( init.state == 'open' ? false : true );
				var buddy			= myself.findNextNode(node);
				if( buddy ){
					var norm = buddy.style.display;
					var func = function(){
						if(open){
							img.src	= 'images/icons/open.png';
							buddy.style.display = 'none';
							open = false;
						}else{
							img.src = 'images/icons/close.png';
							buddy.style.display = norm;
							open = true;
						}
					}
					func();
					myself.addEventHandler( img, 'click', func );
					myself.addEventHandler( node, 'click', func );
					img.style.cursor = 'pointer';
					node.style.cursor = 'pointer';
					childIndex.i++;
					childIndex.lof++;
					node.parentNode.insertBefore(img,node);
				}
				
			}
			r['ialign']			= function(node,init,attribute,collation){
				if( !collation ) collation = createUnique();
				if( collation ) collate( init, collation );
				var h,v,hc='',vc='',eo = {},p=node.parentNode,hc,vc;
				switch( init.onoverflow ){
				case 'pad':
					eo.ow = node.offsetWidth;
					eo.oh = node.offsetHeight;
					init.pad = (init.pad?init.pad:10);
					eo.overflow = function(node,o){
						var r = false;
						if(o.ll){
							if(o.l<0){
								node.style.width=(eo.ow+(o.l+o.l)-init.pad-init.pad)+'px';
								o.l=init.pad;
							}else if( node.offsetWidth<eo.ow ){
								var df = (eo.ow-node.offsetWidth)/2;
								node.style.width=eo.ow+'px';
							}
						}
						if(o.tt){
							if(o.t<0){
								node.style.height=(eo.oh+(o.t+o.t)-init.pad-init.pad)+'px';
								o.t=init.pad;
							}else if( node.offsetHeight<eo.oh ){
								var df = (eo.oh-node.offsetHeight)/2;
								node.style.height=eo.oh+'px';
							}
						}
						return o;
					}
					if((h=init.h)||(h=init.horizontal)){
						switch(h){
						case 'c':
						case 'center':
							hc = 'o.l = p.offsetWidth/2-eo.ow/2;o.ll=1;';
						break;
						}
					}
					if((v=init.v)||(v=init.vertical)){
						switch(v){
						case 'c':
						case 'center':
							vc = 'o.t = p.offsetHeight/2-eo.oh/2;o.tt=1;';
						break;
						}
					}
					eo.onDrag = function( element ){
						if(element.ialign == collation){
							node.style.left = node.style.marginLeft;
							node.style.top = node.style.marginTop;
							node.style.marginLeft = 0;
							node.style.marginTop = 0;
							node.style.width = eo.ow;
							node.style.height = eo.oh;
							window.removeListener(eo);
							eo = null;
							init = null;
						}
					}
				break;
				default:
					if( init.onoverflow ){
						eval('eo.overflow = '+init.onoverflow);
					}
					if((h=init.h)||(h=init.horizontal)){
						switch(h){
						case 'c':
						case 'center':
							hc = 'o.l = p.offsetWidth/2-node.offsetWidth/2;o.ll=1;';
						break;
						}
					}
					if((v=init.v)||(v=init.vertical)){
						switch(v){
						case 'c':
						case 'center':
							vc = 'o.t = p.offsetHeight/2-node.offsetHeight/2;o.tt=1;';
						break;
						}
					}
					eo.onDrag = function( element ){
						if(element.ialign == collation){
							node.style.marginLeft = 0;
							node.style.marginTop = 0;
							window.removeListener(eo);
							eo = null;
							init = null;
						}
					}
				break;
				}
				node.ialign = collation;
				eval('eo.onresize = function(){var o={},k;'+hc+vc+'if(eo.overflow){o=eo.overflow(node,o);};if(o){if(o.ll){node.style.marginLeft=o.l+"px"};if(o.tt){node.style.marginTop=o.t+"px"}}}');eo.onresize();
				window.addListener(eo);
			}
			r['unique']			= function(node,init,attribute,collation){prefs.uniques[init]=node;}
			r['applyimgover']	= function(node,init,attribute,collation){
				var c1 = (node.beforeFixSrc?''+node.beforeFixSrc:''+node.src);
				var c2 = init;
				preloads.push( c2 );
				if( node.attachEvent ){
					node.attachEvent( 'onmouseover', function(){ node.src = c2; } );
					node.attachEvent( 'onmouseout', function(){ node.src = c1; } );
				}else if( node.addEventListener ){
					node.addEventListener( 'mouseover', function(){ node.src = c2; }, false );
					node.addEventListener( 'mouseout', function(){ node.src = c1; }, false );
				}
			}
			r['applyrollover']	= function(node,init,attribute,collation){
				var c1 = node.className;
				var c2 = init;
				if( node.attachEvent ){
					node.attachEvent( 'onmouseover', function(){ if( node.className == c1 ) node.className = c2; } );
					node.attachEvent( 'onmouseout', function(){ if( node.className == c2 ) node.className = c1; } );
				}else if( node.addEventListener ){
					node.addEventListener( 'mouseover', function(){ if( node.className == c1 ) node.className = c2; }, false );
					node.addEventListener( 'mouseout', function(){ if( node.className == c2 ) node.className = c1; }, false );
				}
			}
			r['onenter'] = function(node,init,attribute,collation){
				var element = node;
				var _this = node;
				if( node.attachEvent ){
					node.attachEvent( 'onkeydown', function(){ if( window.event.keyCode == 13 ){ myself.cancelEvent(window.event); eval( jscode ); } } );
				}else if( node.addEventListener ){
					node.addEventListener( 'keydown', function( e ){ if( e.keyCode == 13 ){ myself.cancelEvent(e); eval( jscode ); } }, false );
				}
			}
			r['onparse'] = function(node,init,attribute,collation){
				var _this = node;
				try{
					eval(init);
				}catch(ee){
					alert((ee&&ee.description?ee.description:ee));
				}
			}
			r['defaultval']	= function(node,init,attribute,collation){
				var c2 = node.getAttribute('classdefault');
				var c1 = node.className;
				node.value		= init;
				node.className	= c2;
				node.defaulted	= true;
				node.fireFocus	= function(){ if( node.className == c2 ){ node.value = ''; node.className = c1; node.defaulted = false; } }
				node.onfocus	= node.fireFocus;
			}
			r['photoviewer'] = function(node,init,attribute,collation){
				if( collation ) collate( init, collation );
				return new icicle.photoviewer( node, init );
			}
			r['toolbar'] = function(node,init,attribute,collation){
				if( collation ) collate( init, collation );
				return new icicle.toolbar( node, init );
			}
			r['uploader'] = function(node,init,attribute,collation){
				if( collation ) collate( init, collation );
				return new uploader( node, init );
			}
			r['player'] = function(node,init,attribute,collation){
				switch( init.type ){
				case 'audio':
					if( icicle.audioPlayer ){
						window.player = new icicle.audioPlayer(node,init);
					}
				break;
				}
			}
			r['onpageloaded'] = function(node,init,attribute,collation){
				pageloads.push( { node: node, js: init } );
			}
			r['addlistener'] = function(node,init,attribute,collation){
				var tempear;
				eval('tempear='+init);
				if( collation ){
					tempear.onCCC = function( cname ){
						if( cname == collation ){
							window.removeListener( tempear, node );
						}
					}
				}
				window.addListener( tempear, node );
				node.removeAttribute('addlistener');
				if( tempear.onLoad )	tempear.onLoad();
				if( tempear.onload )	tempear.onload();
				if( tempear.onResize )	tempear.onResize();
				if( tempear.onresize )	tempear.onresize();
			}
			r['datasetviewer'] = function(node,init,attribute,collation){
				if(icicle.datasetViewer){
					return new icicle.datasetViewer(node,init);
				}
			}
			r['selectgroup'] = function(node,init,attribute,collation){
				if( window.selectgroups ){
					if( typeof init == 'object' ){
						if( !selectgroups.initiated ){ selectgroups(); }
						selectgroups.create(init,node);
					}else if( selectgroups && selectgroups.info && selectgroups.info[init] ){
						selectgroups.add(node,init);
					}else{
						page.addEventHandler(node,'mousedown',selectHandler);
					}
				}
			}
			r['editor'] = function(node,init,attribute,collation){
				if( window.editor ){
					new editor(node,init);
				}
			}
			r['calendar'] = function(node,init,attribute,collation){
				if( icicle.calendar ){
					new icicle.calendar(node,init);
				}
			}
			r['editable'] = function(node,init,attribute,collation){
				if( icicle.editable ){
					new icicle.editable(node,init);
				}
			}
			r['scrollbars'] = function(node,init,attribute,collation){
				return new icicle.scrollbars(node,init);
			}
			r['filelist'] = function(node,init,attribute,collation){
				if( init && init.unique ){
					if( collation ) collate(init,collation);
					return new icicle.filelist(node,init);
				}
			}
			r['compassmenu'] = function(node,init,attribute,collation){

				if( init.delay ){
					var timeID	= false;
					var down	= function( e ){ myself.cancelEvent( e ); timeID = setTimeout( fire, init.delay ); }
					var up		= function( e ){ clearTimeout( timeID ); }
					var fire	= function(){ new icicle.compassMenu( node, init ); }
				}else{
					var up		= false;
					var down	= function( e ){ myself.cancelEvent( e ); new icicle.compassMenu( node, init ); }
				}

				switch( a.trigger ){
				case 'mouseover':
					if( node.attachEvent ){
						if( down )	node.attachEvent( 'onmouseover', down );
						if( up )	node.attachEvent( 'onmouseout', up );
					}else if( node.addEventListener ){
						if( down )	node.addEventListener( 'mouseover', down, true );
						if( up )	node.addEventListener( 'mouseout', up, true );
					}
				break;
				default:
					if( node.attachEvent ){
						if( down )	node.attachEvent( 'onmousedown', down );
						if( up )	node.attachEvent( 'onmouseup', up );
					}else if( node.addEventListener ){
						if( down )	node.addEventListener( 'mousedown', down, true );
						if( up )	node.addEventListener( 'mouseup', up, true );
					}
				break;
				}

			}
			r['xhttp'] = function(node,init,attribute,collation){

				var xhttpobj = init;

				if( ! xhttpobj.element ) xhttpobj.element = node;

				if( ! node.collationName ){
					node.collationName = new Date().getTime();
				}

				var loading						= document.createElement( 'DIV' );
					loading.style.background	= 'white url(images/loading-small-green-quick.gif) no-repeat center center';
					loading.style.position		= 'absolute';
					loading.style.left			= '0px';
					loading.style.top			= '0px';
					loading.style.opacity		= '0.8';

				var func = function( queryVariables ){

					var element = ( typeof xhttpobj.element == 'string' ? document.getElementById( xhttpobj.element ) : xhttpobj.element );

					if( element ){

						var pp						= myself.findPositionedParent( element, true );
						var oldOverflow				= pp.style.overflow;
							pp.style.overflow		= 'hidden';
							loading.style.width		= pp.offsetWidth + 'px';
							loading.style.height	= pp.offsetHeight + 'px';

							pp.appendChild( loading );

						var x = new myself.xhttp();
							x.onresponse = function( res ){

								xhttpobj.value = res;

								try{ if( loading.parentNode ){ pp.removeChild( loading ); } }catch( ee ){}

								pp.style.overflow = oldOverflow;

								if( typeof xhttpobj.fireBefore == 'string' ){
									window.fireEvent( xhttpobj.fireBefore, xhttpobj );
								}else if( xhttpobj.fireBefore ){
									xhttpobj.fireBefore( xhttpobj );
								}

								window.fireEvent( 'onCCC', node.collationName );
								element.innerHTML = res;
								parseDOM( element, true, node.collationName );

								if( typeof xhttpobj.fireAfter == 'string' ){
									window.fireEvent( xhttpobj.fireAfter, xhttpobj );
								}else if( xhttpobj.fireAfter ){
									xhttpobj.fireAfter( xhttpobj );
								}

							}

						if( queryVariables ){
							var url = xhttpobj.url;
							if( xhttpobj.url.indexOf('{param}') ){
								url = url.replace('{param}',queryVariables);
							}else{
								url = myself.appendURL(url,queryVariables);
							}
							x.call( url, 'POST' );
						}else{
							x.call( xhttpobj.url, 'POST' );
						}

					}

				}

				if( xhttpobj.interval ){
					setInterval( func, xhttpobj.interval );
				}

				if( xhttpobj.event ){

					var ear = {};
						ear[ xhttpobj.event ] = func;

					window.addListener( ear );

				}

				if( xhttpobj.autoload ){
					func();
				}

			}
			r['contextmenu'] = function(node,init,attribute,collation){

				var func = function(){ var c = new icicle.contextMenu( node, a ); }
				if( node.attachEvent ){
					node.attachEvent( 'onclick', function( e ){ func( e ); } );
				}else if( node.addEventListener ){
					node.addEventListener( 'click', function( e ){ func( e ); }, false );
				}

			}
			r['setdimentions'] = function(node,init,attribute,collation){

				var w = node.getAttribute('setwidth');
				var h = node.getAttribute('setheight');

				node.removeAttribute('setwidth');
				node.removeAttribute('setheight');

				if( w ) eval('w='+w);
				if( h ) eval('h='+h);

				var ear = {};
					ear.onresize = function(){

						if( w ){

							var elm = document.getElementById( w.element );
							var x;

							if( elm ){

								x = parseInt( elm.offsetWidth );
								x -= parseInt( w.minus );

								if( x < 0 ) x = 0;

								node.style.width = x + 'px'

							}

						}

						if( h ){

							var elm = document.getElementById( h.element );
							var y;

							if( elm ){

								y = elm.offsetHeight;
								y -= parseInt( h.minus );

								if( y < 0 ) y = 0;

								node.style.height = y + 'px'

							}

						}

					}

				window.addListener( ear );
				ear.onresize();

			}
			r['maxwidth'] = function(node,init,attribute,collation){
				if(page.isIE()){
					if(init && init.chatAt && (init.chatAt(0)=='{')){

					}else{
						var num = parseInt(init);
						if(isNaN(num))return;
						if(node.offsetWidth > num){
							node.style.width = num+'px';
						}
					}
				}else if(page.isMOZ()){
					node.style.maxWidth = init+'px';
				}
			}
			r['unscramble'] = function(node,init,attribute,collation){
				var newstr = '',str = ''+node.innerHTML,lof,i=0,c1,c2;
				if(str){
					str = str.replace(/&lt;/g,'<');
					str = str.replace(/&gt;/g,'>');
					str = str.flip();
					lof=str.length;
					while((i+4)<=lof){i+=4;
						c1 = str.substr(i-4,2);
						c2 = str.substr(i-4+2,2);
						newstr += c2+c1;
					}
					newstr += str.substring(i,lof);
					newstr.pretrim();
					node.innerHTML = newstr;
				}
			}
			r['dragbackground'] = function(node,init,attribute,collation){

				var tempear = {};
				var drag = {};

				node.onmousedown = function( e ){ e = getEvent( e ); if( ! e || ! e.src ) return;

					if( ! e.src.unique ) return;

					if( e.src.isSameNode ){
						if( ! e.src.isSameNode( node ) ) return;
					}else if( e.src.uniqueID && (e.src.uniqueID != node.uniqueID) ){
						return;
					}

					drag.ox = e.x;
					drag.oy = e.y;

					node.style.cursor = 'move';

					if( node.unique != drag.unique ){

						drag.on = -1;

						var x = new page.xhttp();
							x.onresponse = function(res){
								eval( 'drag.dim = '+res );
								drag.x = ( node.offsetWidth/2 )-drag.dim.width / 2;
								drag.y = ( node.offsetHeight/2 )-drag.dim.height / 2;
								drag.orx = drag.x;
								drag.ory = drag.y;
								if( drag.on == -1 ){
									drag.on = true;
								}
							}
							x.call( 'photo-dim.php?u='+page.urlEncode( node.unique ) );

						drag.unique = node.unique;

					}else{

						drag.on = true;

					}

				}

				tempear.onmousemove = function( e ){ e = getEvent( e ); if( ! e || ! e.src ) return;

					if( ( drag.on === true ) && drag.dim ){

						if( drag.dim.width < node.offsetWidth ){
							var x = drag.orx;
						}else{
							var dx = e.x - drag.ox;
							var x = drag.x + dx;
							if( x < (-drag.dim.width+node.offsetWidth) ) x = -drag.dim.width+node.offsetWidth;
							if( x > (0) ) x = 0;
						}

						if( drag.dim.height < node.offsetHeight ){
							y = drag.ory;
						}else{
							var dy = e.y - drag.oy;
							var y = drag.y + dy;
							if( y < (-drag.dim.height+node.offsetHeight) ) y = -drag.dim.height+node.offsetHeight;
							if( y > (0) ) y = 0;
						}

						node.style.backgroundPosition = ( x )+'px '+( y )+'px';

					}

				}

				tempear.onmouseup = function( e ){ e = getEvent( e ); if( ! e || ! e.src ) return;

					if( ( drag.on ) ){

						drag.on = false;
						node.style.cursor = '';

						if( drag.dim ){

							if( drag.dim.width < node.offsetWidth ){
								var x = drag.orx;
							}else{
								var dx = e.x - drag.ox;
								var x = drag.x + dx;
								if( x < (-drag.dim.width+node.offsetWidth) ) x = -drag.dim.width+node.offsetWidth;
								if( x > (0) ) x = 0;
							}

							if( drag.dim.height < node.offsetHeight ){
								y = drag.ory;
							}else{
								var dy = e.y - drag.oy;
								var y = drag.y + dy;
								if( y < (-drag.dim.height+node.offsetHeight) ) y = -drag.dim.height+node.offsetHeight;
								if( y > (0) ) y = 0;
							}

						}

						drag.x = x;
						drag.y = y;

					}

				}

				tempear.onItemUpdate = function( unique ){
					if( drag.unique == unique ){
						drag.unique = false;
					}
				}

				window.addListener( tempear );


			}

		var realiseAttribute = function( attribute, node, collation, dontRealiseObject, childIndex, pass, dontRemoveAttr ){

			var a;
			if( a = node.getAttribute( attribute ) ){
				if( (a.charAt(0) == '{') && !dontRealiseObject ){try{eval('a='+a);}catch(ee){}}
				if(r[attribute]){
					r[attribute]( node,a,attribute,collation,childIndex,pass );
				}
				if(!dontRemoveAttr){
					node.removeAttribute(attribute);
				}
			}

		}

		var parseElement = myself.parseElement = window.parseElement = function( node, collationName, childIndex, pass ){
			if( node && node.getAttribute ){
				do{
					try{
						t = realiseAttribute( 'serve',			node, collationName, false, childIndex, pass ); if( t ) break;
						t = realiseAttribute( 'inject',			node, collationName, false, childIndex, pass );	if( t ) break;
						t = realiseAttribute( 'unique',			node, collationName );
						t = realiseAttribute( 'pages',			node, collationName );
						t = realiseAttribute( 'unscramble',		node, collationName, false, childIndex, pass );	if( t ) break;
						t = realiseAttribute( 'popover',		node, collationName, false, childIndex );
						t = realiseAttribute( 'popoverapply',	node, collationName, false, childIndex );
						t = realiseAttribute( 'viewer',			node, collationName, false, childIndex, pass, true );
						t = realiseAttribute( 'snaparea',		node, collationName, false, childIndex, pass, true );
						t = realiseAttribute( 'draggable',		node, collationName, false, childIndex );
						t = realiseAttribute( 'droparea',		node, collationName, false, childIndex );
						t = realiseAttribute( 'ialign',			node, collationName );
						t = realiseAttribute( 'maxwidth',		node, collationName );
						t = realiseAttribute( 'collapsible',	node, collationName, false, childIndex );
						t = realiseAttribute( 'ivisible',		node, collationName );
						t = realiseAttribute( 'set',			node, collationName );
						t = realiseAttribute( 'isize',			node, collationName );
						t = realiseAttribute( 'applyrollover',	node, collationName );
						t = realiseAttribute( 'applyimgover',	node, collationName );
						t = realiseAttribute( 'defaultval',		node, collationName );
						t = realiseAttribute( 'addlistener',	node, collationName );
						t = realiseAttribute( 'xhttp',			node, collationName );
						t = realiseAttribute( 'compassmenu',	node, collationName );
						t = realiseAttribute( 'contextmenu',	node, collationName );
						t = realiseAttribute( 'onenter',		node, collationName, true );
						t = realiseAttribute( 'onparse',		node, collationName, true );
						t = realiseAttribute( 'onpageloaded',	node, collationName );
						t = realiseAttribute( 'setwidth',		node, collationName );
						t = realiseAttribute( 'setheight',		node, collationName );
						t = realiseAttribute( 'selectgroup',	node, collationName );
						t = realiseAttribute( 'xlink',			node, collationName, false, childIndex );
						t = realiseAttribute( 'scrollbars',		node, collationName );	if( t ) break;
						t = realiseAttribute( 'player',			node, collationName );	if( t ) break;
						t = realiseAttribute( 'datasetviewer',	node, collationName );	if( t ) break;
						t = realiseAttribute( 'calendar',		node, collationName );	if( t ) break;
						t = realiseAttribute( 'filelist',		node, collationName );	if( t ) break;
						t = realiseAttribute( 'editor',			node, collationName );	if( t ) break;
						t = realiseAttribute( 'toolbar',		node, collationName );	if( t ) break;
						t = realiseAttribute( 'uploader',		node, collationName );	if( t ) break;
						t = realiseAttribute( 'panel',			node, collationName );	if( t ) break;
						t = realiseAttribute( 'dragbackground', node, collationName );	if( t ) break;
						t = realiseAttribute( 'photoviewer',	node, collationName );	if( t ) break;
					}catch(ee){
						alert(ee && ee.description?ee.description:ee);
					}
				}while(false)
			}
		}

		var parseDOM = myself.parseDOM = window.parseDOM = function( node, ignoreRoot, collationName, childIndex, pass ){

			var t,i={i:0},lof,child,co;

			if( !ignoreRoot ){
				parseElement(node,collationName,childIndex,pass);
			}

			if( node.childNodes && (i.lof=node.childNodes.length) ){
				for( i.i=0; i.i<i.lof; i.i++ ){
					if( (child=node.childNodes[i.i]) && (child.nodeType===1) ){
						parseDOM(child,false,collationName,i,pass);
					}
				}
			}

		}

		var onMouseOver = function( e ){

			e = getEvent( e ); if( ! e ) return;

			if( e.src && e.src.getAttribute ){

				var a = e.src.getAttribute( 'dropback' );

				if( a ){

					while( a-- ){ e.src = e.src.parentNode; }
					if( ! e.src ) return;
  
				}

				var a = e.src.getAttribute( 'classover' );

				if( a ){

					if( ! e.src.getAttribute( 'classout' ) ) e.src.setAttribute( 'classout', e.src.className );

					e.src.className = a;

				}

				var a = e.src.getAttribute( 'jsover' );

				if( a ){

					var element = e.src;

					eval( a );

				}

			}

		}

		var onMouseOut = function( e ){

			e = getEvent( e ); if( ! e ) return;

			if( e.src && e.src.getAttribute ){

				var a = e.src.getAttribute( 'dropback' );

				if( a ){

					while( a-- ){ e.src = e.src.parentNode; }
					if( ! e.src ) return;
  
				}

				var a = e.src.getAttribute( 'classout' );

				if( a ) e.src.className = a;

				var a = e.src.getAttribute( 'jsout' );

				if( a ){ var element = e.src; eval( a ); }

			}

		}

		this.isMOZ		= function(){ return prefs.MOZ; }
		this.isIE		= function(){ return prefs.IE; }
		this.isSafari	= function(){ return prefs.SAFARI; }
		this.isOpera	= function(){ return prefs.OPERA; }

		this.getSuper = function(){

			return {

				prefs: prefs,
				myself: myself

			};

		}

		/// -----------------------------------------------------------------------------
		/// XHTTP:START
		/// -----------------------------------------------------------------------------
		window.xhttp = myself.xhttp = function(){

			var xho;
			var myself_	= this;
			var setup	= function(){ xho = instance(); }
		
			var instance = function(){

				var obj = null, er = null;

				try{
					obj = new ActiveXObject('Msxml2.XMLHTTP');
				}catch(er){
					try{
						obj = new ActiveXObject('Microsoft.XMLHTTP');
					}catch(er){
						obj = null;
					}
				}

				if(!obj && typeof XMLHttpRequest != 'undefined'){
					obj = new XMLHttpRequest();
				}

				return obj;

			}

			var nocache = function xhttpNoCache( add, url ){

				var p = url.indexOf('?');
				if(p > -1){
					if(p == (url.length-1)){
						url += add;
					}else if(url.charAt(url.length - 1) == '&'){
						url += add;
					}else{
						url += '&' + add;
					}
				}else{
					url += '?'+add;
				}
				return url;

			}

			this.realise = myself.realise;

			var ready = function(){

				try{

				if( ( xho.readyState == 4 ) && ( typeof xho.responseText == 'string' )){

					if( myself_.aborted ){
						myself_.aborted = false;
						return;
					}

					if( myself_.timedOut ){
						return;
					}else if( myself_.timeID ){
						clearTimeout( myself_.timeID );
					}

					if( xho.status != '200' ){

						if( myself_.onhttperror ){
							 myself_.onhttperror( xho.status, xho.statusText, myself_.passObject );
						}else if( myself_.onerror ){
							myself_.onerror( 'http', xho.status+' '+xho.statusText, myself_.passObject );
						}else if( myself_.ontimeout ){
							myself_.ontimeout();
						}

						return;

					}

					if( myself_.onrawresponse )	return myself_.onrawresponse( xho, myself_.passObject );
					if( myself_.onresponse )	return myself_.onresponse( xho.responseText, myself_.passObject );

				}

				}catch(ee){
				}

			}

			this.urlEncode = function( value ){return (window.encodeURIComponent?window.encodeURIComponent( value ):escape( value ));}

			this.abort = function(){
				if( xho && ( xho.readyState != 0 ) && ( xho.readyState != 4 ) ){ 
					myself_.aborted = true;
					xho.abort();
					if( myself_.onabort ){
						myself_.onabort();
					}
				}
			}

			this.isBusy = function(){

				if( xho && ( xho.readyState != 0 ) && ( xho.readyState != 4 ) ){ 
					return true;
				}
				return false;

			}

			this.call = function( url, method, noCache, passObject, justAbort, timeOut ){

				var p, now;

				myself_.aborted = false;

				if( noCache == null) noCache = true;

				if( xho && ( xho.readyState != 0 ) && ( xho.readyState != 4 ) ){ 

					if( justAbort ){

						return 0;

					}else{

						var temp				= new myself_.xhttp();
							temp.onrawresponse	= myself_.onrawresponse;
							temp.onresponse		= myself_.onrepsonse;
							temp.call( url, method, noCache, passObject, true );

					}

				}

				if( !method ) method = ''; method = method.toUpperCase();

				if( method == 'POST' ){

					if( ( p = url.indexOf('?') ) > -1 ){

						this.data	= url.substring( p+1, url.length );
						this.URL	= url.substring( 0, p );

					}else{

						this.URL	= url;

					}

					this.method			= 'POST';
					this.contentType	= 'application/x-www-form-urlencoded; charset=UTF-8';

				}else{

					this.data			= '';
					this.URL			= url;
					this.method			= 'GET';
					this.contentType	= 'text/plain';

				}

				if( noCache && ( typeof Date != 'undefined' ) && ( now = new Date() ) && ( now.getTime ) ){

					this.URL = nocache( 'nocache=' + now.getTime(), this.URL );

				}

				try{

											this.passObject = passObject;
											this.lastURL	= this.URL;
					
											xho.open( this.method, this.URL, true );
											xho.onreadystatechange = ready;
					if(this.contentType)	xho.setRequestHeader( 'Content-Type', this.contentType );
					if(this.contentLength)	xho.setRequestHeader( 'Content-Length', this.contentLength );

					if( timeOut )			this.timeID = setTimeout( function(){ myself_.abort(); myself_.timedOut = true; if( myself_.ontimeout ){ myself_.ontimeout(); } }, timeOut );

											xho.send( this.data );

											this.data = '';

											return true;

				}catch( z ){

					if(z == 'Permission denied to call method XMLHttpRequest.open'){
						alert('Mozilla (Same Origin) Security Block!');
					}else{
						if(z.description){
							alert(z.description);
						}else{
							alert(z);
						}
					}

				}

				return false;

			}

			setup();

		};

		/// -----------------------------------------------------------------------------
		/// XHTTP:END
		/// -----------------------------------------------------------------------------

		this.ear				= {};
		this.ear.onload			= function(){ setup(); }
		this.ear.onunload		= function(){ unsetup(); }
		this.ear.onmouseover	= onMouseOver;
		this.ear.onmouseout		= onMouseOut;

		window.Key();

		this.ear.onkeydown = function(e){e=page.E(e);if(!e)return;
			window.Key.setDown( e.kc );
		}
		this.ear.onkeyup = function(e){e=page.E(e);if(!e)return;
			window.Key.setUp( e.kc );
		}

	}
	icicle.addImage = function( url ){preloads.push( url );}
	/// -----------------------------------------------------------------------------
	/// ICICLE:END
	/// -----------------------------------------------------------------------------

	var page = new icicle( prefs ); window.addListener( page.ear );
