

		//DEPENDS ON getDimensions, document.getElementById(), $document.getElementById(), ClassFX, AjaxFX

		//notes: add expiry and toggle status bar option - also maybe an external stylesheet?
		//add container for ajax request...?
		
		
		function interstate(ProgrenetorID, width, height, URIorElement, refresh, ToolbarID ) { //simple interstitial implementation
			
			var BodyID = 'view'; //id for body element: temp required
			
			if(ProgrenetorID>=0) { //check if this is valid index and return focus to existent interstitial
				if(!isNaN(ProgrenetorID)) {
					index=ProgrenetorID; //reload contents?
					if(!Planetary[index]) {
					} else {
						if(Planetary[index].interGalactic.parentNode) {
							for (a=0;a<Planetary.length;a++) {
								Planetary[a].interGalactic.style.zIndex-=10;
							}
							Planetary[index].interGalactic.style.zIndex+=10; //Planetary[index].centerPosition();
							if(refresh) {
								Planetary[index].refresh(URIorElement);
							}
							Planetary[index].show();
							Planetary[index].centerPosition(); //styles messing with positioning a bit
							return index;
						}
					}
				}
			} //

			var oContentElement = document.getElementById(URIorElement);
			
			//Get XMLHTTP response || Use Existing DOM Element
			if( !oContentElement ) { //accepts a url for ajax request...
				
				if( URIorElement.indexOf('/')>-1 ) { //url = XMLHTTPRequest
					oContentElement = document.createElement('div');
					var oLoadingAnimation = new loadingAnimation( 'large', false );
					oContentElement.appendChild( oLoadingAnimation.render() );
					ajaxEvent(URIorElement, oContentElement, false, true ); //load contents
					oLoadingAnimation.destroy();
				} else { //dom element, load pre-rendered contents
					oContentElement = document.createElement('div');
					oContentElement.innerHTML = 'The specified content element [' + URIorElement + '] does not exist.';
				} //
				
			} else {
				
				oContentElement = document.getElementById(URIorElement); //Get XMLHTTP response || Use Existing DOM Element
				if(!oContentElement) { //load pre-rendered contents
					oContentElement = document.createElement('div');
					oContentElement.innerHTML = 'The specified content element [' + URIorElement + '] does not exist.';
				} else {
					ClassFX.removeClass( oContentElement, 'none' );
					ClassFX.removeClass( oContentElement, 'hidden' );
					ClassFX.addClass( oContentElement, 'block' );
				}
				
			} //
			
			var iOffset = Planetary.length; //offset for stacked windows
			iOffset = iOffset*10;
			
			//new interstitial window added to global planetary collection
			Planetary.push(new interstitial(width, height, iOffset, iOffset, ToolbarID)); //create in global scope
			
			index = Planetary.length-1;
			oParentNode = document.getElementById(BodyID); //haxxing
			if(!typeof(oParentNode.appendChild)=="function"){ //hmmm @todo make a routine to get a valid top level parent node
				if (!oParentNode) {
					alert('unable to access the correct dom element for object placement, sorry.');
					return;
				}
			}
			oParentNode.appendChild(Planetary[index].render()); //add interstitial
			
			Planetary[index].interGalactic.appendChild(oContentElement); //oContentElement = either pre-rendered content or loading placeholder..
			if(oContentElement.id=='') {
				oContentElement.setAttribute('id', Planetary[index].interGalactic.id + '_catcher');
			};
							
			EventListener.addEvent( window, 'resize',
				function( ) {
					for (a=0;a<Planetary.length;a++) {
						Planetary[a].centerPosition();
					}
				}
			); //
			Planetary[index].centerPosition();
			Planetary[index].show();

			return index;
			
		}
		//*****************************************

		//INTERSTITIAL WINDOW
		//*****************************************
		function interstitial(width, height, iXOffset, iYOffset, sTitle) {
			
			var lsObjectID = 'planetary' + RID();
			var controls;
			
			this.interGalactic = document.createElement('div');
			this.interGalactic.setAttribute('id',lsObjectID);
			this.interGalactic.setAttribute('class',"intercontent");
			this.interGalactic.style.width=width + 'px';
			this.interGalactic.style.height=height + 'px';
			this.XOffset = iXOffset||0;
			this.YOffset = iYOffset||0;
			
			ClassFX.addClass(this.interGalactic,'interstitial'); //ClassFX.addClass(this.interGalactic,'default'); //DD behaviour

			this.toolbar = document.createElement('div'); //close link
			ClassFX.addClass(this.toolbar,'interstitial_toolbar');
			
			this.closeButton = document.createElement('a');
			this.closeButton.innerHTML = '<img src="/box/icons/crystal/16x16/actions/cancel.png" />'; 
			ClassFX.addClass(this.closeButton,'close_interstitial');
			this.closeButton.setAttribute('href','javascript://');
			this.closeButton.onclick = function () { //add refresh toggle

                if(typeof(ExecuteEventQueue) == 'function') {
                    ExecuteEventQueue();
                }
			
				ClassFX.removeClass(this.parentNode.parentNode,'visible');
				ClassFX.addClass(this.parentNode.parentNode,'hidden');
				ClassFX.addClass(this.parentNode.parentNode,'none');
			};
			this.toolbar.appendChild(this.closeButton);

			//temp **************************************** ****
				titlebar = document.getElementById(sTitle);
				if(titlebar) {
					titlebar = this.toolbar.appendChild(titlebar); //usurp reference
					ClassFX.removeClass(titlebar,'none');
				}
			//temp **************************************** ****

			this.interGalactic.appendChild(this.toolbar);

			Dimensions.refresh(); //get document settings

			this.centerPosition(); //set position (need to add fixed/cached coordinates and offsets for existing windows here.)

		} interstitial.prototype = {
			render:function () {
				return this.interGalactic;
			},
			refresh:function (uAjaxRequestOrElement) { //Refresh XMLHTTP contents only for now
				var oContentElement; 
				if(URIorElement.indexOf('/')>-1) { //url = XMLHTTPRequest
					oContentElement = document.getElementById(this.interGalactic.id+'_catcher');
					if(oContentElement) {
						var oLoadingAnimation = new loadingAnimation('large',false);
						oContentElement.appendChild(oLoadingAnimation.render());
						ajaxEvent(URIorElement,oContentElement,true,false); //load contents (append + asynchronous mode)
						oLoadingAnimation.destroy();
					}
				}//
			},
			show:function () {
				ClassFX.removeClass(this.interGalactic,'none');
				ClassFX.removeClass(this.interGalactic,'hidden');
				ClassFX.addClass(this.interGalactic,'visible');
			},
			hide:function () { 
				ClassFX.removeClass(this.interGalactic,'visible');
				ClassFX.addClass(this.interGalactic,'hidden');
				ClassFX.addClass(this.interGalactic,'none');
			},
			close:function () {
				this.interGalactic.parentNode.removeChild(this.interGalactic);
			},
			centerPosition:function () {
				Dimensions.refresh();
				this.iObjWidth = this.interGalactic.offsetWidth;
				this.iObjHeight = this.interGalactic.offsetHeight;
				this.iTop = (Dimensions.iDocHeight>this.iObjHeight) ? (Dimensions.iScrollTop+Dimensions.iDocHeight/2-this.iObjHeight/2+'px') : (Dimensions.iScrollTop+5+'px'); //Position interstitial box
				this.interGalactic.style.zIndex = 24000;
				this.interGalactic.style.left = this.XOffset + (Dimensions.iDocWidth/2-this.iObjWidth/2)+"px"; //Position interstitial box
				this.interGalactic.style.top = this.YOffset + Math.floor(parseInt(this.iTop))+"px";
			}
		} //*****************************************

		 //recycleable loading animated gif
		function loadingAnimation(sType,lsSource) {
			lsSystemPath = '/box/system/'; //defaults
			lsSystemPath += (sType=='large')?('loading.gif'):('loading-small.gif');
			lsSource=(lsSource||lsSystemPath);
			this.img=document.createElement('img');
			this.img.setAttribute('id','loading-' + RID() ); //attach random id
			ClassFX.addClass(this.img,'hidden');
			this.img.src=lsSource;
		} loadingAnimation.prototype = {
			render:function () {
				ClassFX.removeClass(this.img,'hidden');
				return this.img;
			},
			show:function () {
				this.img.style.visibility='visible';
			},
			hide:function () {
				this.img.style.visibility='hidden';
			},
			destroy:function () {
				if(this.img.parentNode) {
					return this.img.parentNode.removeChild(this.img);
				} else {
					this.img = null;
				}
			}
		} //*****************************************

 		//transparent grey overlay
		function cliche(lsID, width, height, lsClass) {
			this.element = document.createElement('DIV');
			this.element.id = lsID;
			this.element.width = width+'px';
			this.element.height = height+'px';
			this.element.className = lsClass;
			this.width = width;
			this.height = height;
		} cliche:prototype = {
			resize:function (width, height) {
				this.element.width = width+'px';
				this.element.height = height+'px';
			}
		}


