﻿// JScript File

if (!window.DivBox)
	var DivBox = new Object();

DivBox.Functions = {
	_options: {
		title: "",                          // Title of the DivBox window
		width: 0,                         // Default width in px
		height: 0,                         // Default height in px
		overlayOpacity: .75,                // Default overlay opacity
		overlayDuration: .75,               // Default overlay fade in/out duration in seconds
		overlayColor: "#000",               //Default background Color = black
		overlayClose: true,                 // Close DivBox by clicking on overlay
		showDuration: .35,                  // Default DivBox appear slide down effect in seconds
		hideDuration: .5,                   // Default DivBox hiding slide up effect in seconds
		resizeDivBoxDuration: .35,          // Default resize duration seconds
		//inactiveFade: true,                 // Fades MB window on inactive state
		loadingString: "Please wait. Loading...", // Default loading string message
		closeString: "Close window",        // Default title attribute for close window link
    loadingImage: "images/popup/loading.gif", //Default loading animated gif
    closeButton: "images/popup/close_green.gif", //Default close button image
		//params: {},
		//method: 'get',                      // Default Ajax request method
		DivBoxAlign: "center",               // Default alignment position {center, centerTop, centerBottom, dynamic, etc...}
		captionHeight: 20,
		ScrollIFrame: false                  //default to not scrolling an iframe
	},
	options: new Object,

	setOptions: function(options) {
		Object.extend(this.options, options || {});
	},
	
	initOptions: function(options){
 		// Setting up original options with default options
		this.setOptions(this._options); 
 		// Add any additional specified options with default options
		this.setOptions(options);
	},
	
	 
  /*show()
   * Preloads images. Pleaces new image in lightbox then centers and displays.*/
  show: function(DisplayElement, options) 
  {
    if (!DisplayElement){ return; }
    //this.DisplayElement = $(DisplayElement);
 	  if(!this.initialized)               // Check for is already initialized
 	    {this.initLightbox(options); }      //   if not then initialize
 	  else                                // otherwise
 	    {this.initOptions(options);}             //   reset options  
 	  
 	 
// 	  if (this.visible == true){
// 	    //this.hide();
// 	    return this.resize(DisplayElement, options);
// 	  }
 	    
    //DisplayedObjectID = DisplayElement.id;
    /******************************/
    if (this.overlay.innerHTML == ""){
      this.loading = Builder.node("div", {
        id: "loadingImage", 
        style: "position: absolute; display: none; z-index:99" 
      });
    }

	  // prep objects
//	  var arrayPageSize = this.getPageSize();
//	  var arrayPageScroll = this.getPageScroll();
	  // center loadingImage if it exists
//	  if (objLoadingImage) {
//		  objLoadingImage.style.top = (arrayPageScroll[1] + ((arrayPageSize[3] - 35 - objLoadingImage.height) / 2) + 'px');
//		  objLoadingImage.style.left = (((arrayPageSize[0] - 40 - objLoadingImage.width) / 2) + 'px');
//	  }

	  // set height of Overlay to take up whole page and show
	  this.overlay.style.height = (arrayPageSize[1] + 'px');
	  /*When showing the box, set overlay opacity to 50% with a duration of 
	    2 seconds to gradually fade background into shadow*/
//    new Effect.Opacity(this.overlay,{ 
//      duration: this.options.overlayDuration, 
//      from: .0, to: this.options.overlayOpacity 
//    });
    this.overlay.style.backgroundColor = this.options.overlayColor;
    new Effect.Appear(this.overlay,{ 
      duration: this.options.overlayDuration, 
      from: .0, to: this.options.overlayOpacity 
    });
    //new Effect.Grow(this.window, {direction: 'center'});
//    new Effect.Opacity(this.window,{ 
//      duration: this.options.showDuration, 
//      from: .0, to: 1 
//    });
    new Effect.Appear(this.window,{ 
      duration: this.options.showDuration
    });
	  this.overlay.style.display = 'block';
	  this.window.style.display = 'block';

    //var DisplayDimensions = $(DisplayElement).getDimensions();
    var DisplayDimensions = this.resize($(DisplayElement));
    this.loadContent(DisplayElement);

//	  /* Size divbox */
//    if (DisplayElement.width){
//      this.window.style.width = DisplayElement.getWidth() + "px";
//      this.content.style.width = DisplayElement.getWidth() + "px";
//    }else{
//      this.window.style.width = this.options.width + "px";
//      this.content.style.width = this.options.width + "px";
//    }

//    if (DisplayElement.height){
//      this.window.style.height = DisplayElement.getHeight() + this.options.captionHeight + "px";
//      this.content.style.height = DisplayElement.getHeight() + "px";
//    }else{
//      this.window.style.height = this.options.height + "px";
//      this.content.style.height = this.options.height  - this.options.captionHeight + "px";
//    }
//    
      this.hAlign(DisplayDimensions, "center");
      this.vAlign(DisplayDimensions ,"middle");
//	  /* Size and center lightbox and make sure that the top and left values are not negative*/
//	  if (this.DisplayElement.height & this.DisplayElement.width) {
//	    var windowTop = arrayPageScroll[1] + ((arrayPageSize[3] - 35 - this.DisplayElement.height) / 2);
//	    var windowLeft = ((arrayPageSize[0] - 40 - this.DisplayElement.width) / 2);
//    }else{
//	    var windowTop = arrayPageScroll[1] + ((arrayPageSize[3] - 35 - this.options.height) / 2);
//	    var windowLeft = ((arrayPageSize[0] - 40 - this.options.width) / 2);
// 		}

//	  /* and the image placed outside the viewport*/
//	  this.window.style.top = (windowTop < 0) ? "0px" : windowTop + "px";
//	  this.window.style.left = (windowLeft < 0) ? "0px" : windowLeft + "px";

	  if (this.options.title.length > 0)
	    Element.update(this.title, this.options.title);
	  else if(this.DisplayElement.getAttribute('title'))
	    Element.update(this.title, this.DisplayElement.getAttribute('title'));
	  
		this.title.style.display = 'block';
//	  if this.title.innerHTML 
//		  this.title.innerHTML = this.DisplayElement.getAttribute('title');
//		  //objTitle.style.width = DisplayElement.width - objCloseButton.width  + 'px';
//	  } else {
//		  this.title.style.display = 'none';
//	  }
  	

    //Finally, add the display element 
    //this.content.style.verticalAlign = 'bottom';
    //$(this.content).replace();
    //this.DisplayElement.style.display = 'block';
    //this.content.innerHTML = this.DisplayElement.outerHTML;
    //this.window.cleanWhitespace
    
    /*Finally add the DisplayElement and set the display 
      style of the displayed element to block to show only the copy 
      placed in the content window.*/
    //this.content.appendChild(this.DisplayElement).style.display = 'block';

	  this.content.style.display = 'block';
    if (this.options.overlayClose)
      this.overlay.onclick = function () {DivBox.hide(); return false;};
    else
      this.overlay.onclick = function () {};
    
    $(this.window).down().show();
    this.visible = true;
	  return true;
  	
  },
  
  /*Since the window is already visible, we want to replace existing 
    content and resize the window to fit new content.*/
//  resize: function(DisplayElement, options){
//    // Setting up original options with default options
//    this.setOptions(this._options); 
//    // Add any additional specified options with default options
//    this.setOptions(options);
//    this.content.style.display = "none";
//	  /* Size divbox */
//    if (this.DisplayElement.width){
//      this.window.style.width = this.DisplayElement.getWidth() + "px";
//      this.content.style.width = this.DisplayElement.getWidth() + "px";
//    }else{
//      this.window.style.width = this.options.width + "px";
//      this.content.style.width = this.options.width + "px";
//    }

//    if (this.DisplayElement.height){
//      this.window.style.height = this.DisplayElement.getHeight() + this.options.captionHeight + "px";
//      this.content.style.height = this.DisplayElement.getHeight() + "px";
//    }else{
//      this.window.style.height = this.options.height + "px";
//      this.content.style.height = this.options.height  - this.options.captionHeight + "px";
//    }
//	  /* Size and center lightbox and make sure that the top and left values are not negative*/
//	  if (this.DisplayElement.height & this.DisplayElement.width) {
//	    var windowTop = arrayPageScroll[1] + ((arrayPageSize[3] - 35 - this.DisplayElement.height) / 2);
//	    var windowLeft = ((arrayPageSize[0] - 40 - this.DisplayElement.width) / 2);
//    }else{
//	    var windowTop = arrayPageScroll[1] + ((arrayPageSize[3] - 35 - this.options.height) / 2);
//	    var windowLeft = ((arrayPageSize[0] - 40 - this.options.width) / 2);
// 		}

//	  /* and the image placed outside the viewport*/
//	  this.window.style.top = (windowTop < 0) ? "0px" : windowTop + "px";
//	  this.window.style.left = (windowLeft < 0) ? "0px" : windowLeft + "px";

//	  if(this.DisplayElement.getAttribute('title')){
//		  this.title.style.display = 'block';
//		  this.title.innerHTML = this.DisplayElement.getAttribute('title');
//		  //objTitle.style.width = DisplayElement.width - objCloseButton.width  + 'px';
//	  } else {
//		  this.title.style.display = 'none';
//	  }
//  	
//    this.content.style.display = "block";   
//    //Clear current content
//   // this.content.innerhtml = "";
////    this.content.appendChild(this.DisplayElement).style.display = 'block';
//		//Element.update(this.content, "");
//  	$(this.content).extend;
//  	this.content.update("");
//    //this.content.update(this.DisplayElement).style.display = 'block';
//    this.content.appendChild(this.DisplayElement).style.display = 'block';

//    if (this.options.overlayClose)
//      this.overlay.onclick = function () {DivBox.hide(); return false;};
//    this.visible = true;

//    return false;
//},
  
  
  // hideLightbox()
  hide: function(UseHideEffect){
//	  // get objects
//	  objOverlay = document.getElementById('overlay');
//	  objDivboxContent = document.getElementById('divboxContent');

//	  // hide lightbox and overlay
//	  objOverlay.style.display = 'none';
//	  objDivboxContent.style.display = 'none';
	  this.overlay.style.display = 'none';
	  this.window.style.display = 'none';
	  var contentElement = this.content.firstDescendant();
	  if (contentElement.id){
	    contentElement.style.display = 'none';
	    document.body.appendChild(contentElement)
	  }else{
  	  this.content.update("");             //  Clear existing content
	  }
	 // if (this.DisplayElement) this.DisplayElement.style.display = 'none';
	  /*When hiding the box, set overlay opacity to zero with a duration of zero
	    to prevent black flicker*/
	  if (!UseHideEffect){
	    new Effect.Opacity(this.window,
        { duration: 0, from: 1, to: 0 });
      new Effect.Opacity(this.overlay,
        { duration: 0, from: this.options.overlayOpacity, to: 0 });
	  }else{
	    new Effect.Opacity(this.window,
        { duration: this.options.hideDuration, from: 1, to: 0 });
      new Effect.Opacity(this.overlay,
        { duration: this.options.hideDuration, from: this.options.overlayOpacity, to: 0 });
	  }
    var objBody = document.getElementsByTagName("body").item(0);
    objBody.onclick = function(){};
    this.visible = false;

  },
  
  
//  loadTitle: function(){
//	  if (this.options.title.length > 0)        //passed title overrides
//	    Element.update(this.title, this.options.title);
//	  else if(this.DisplayElement.getAttribute('title')){
//	    Element.update(this.title, this.DisplayElement.getAttribute('title'));

//  	if(this.DisplayElement.getAttribute('title')){
//		  this.title.style.display = 'block';
//		  this.title.innerHTML = this.DisplayElement.getAttribute('title');
//		  //objTitle.style.width = DisplayElement.width - objCloseButton.width  + 'px';
//	  } else {
//		  this.title.style.display = 'none';
//	  }
//  	
//  
//  },
  
  /*DisplayElement = the html element to display in the DivBox*/
  loadContent: function(DisplayElement){
    this.content.style.display = "none"; //Hide content
  	this.content.update("");             //  Clear existing content
  	DisplayElement = $(DisplayElement)
  	DisplayElement.style.display = "block";
  	if (DisplayElement.tagName.toLowerCase = "iframe" && this.options.ScrollIFrame == false){
  	  DisplayElement.style.overflow = "hidden";
  	}
	  this.content.appendChild(DisplayElement);
	  //this.content.down().show();         // Toggle visibility for hidden nodes
//  	if (DisplayElement.tagName.toLowerCase = "iframe"){
//		  //DisplayElement.id = "db_" + DisplayElement.id; // If clonable element has ID attribute defined, modifying it to prevent duplicates
//		  //this.content.update(DisplayElement.outerHTML);
//		  this.content.hide().appendChild(DisplayElement);
//		  this.content.down().show();         // Toggle visibility for hidden nodes
//  	}else{
//  	  var _DisplayElement = $(DisplayElement).cloneNode(true);
//		  _DisplayElement.id = "db_" + DisplayElement.id; // If clonable element has ID attribute defined, modifying it to prevent duplicates
//		  this.content.appendChild(_DisplayElement);
//		  this.content.hide().appendChild(_DisplayElement);
//		  this.content.down().show();         // Toggle visibility for hidden nodes
//    }	
  },

  /*dimensions = {height: Number, width: Number}*/
  resize: function(DisplayElement){
  	/* Size divbox */
    if (this.options.width == 0){
      this.options.width = DisplayElement.getWwidth();
    }
    this.window.style.width = this.options.width + 4 +"px";
    this.content.style.width = this.options.width  + "px";
    DisplayElement.style.width = this.options.width  + "px";

    if (this.options.height == 0){
      this.options.height = DisplayElement.getHeight() + this.options.captionHeight;
    }
    this.window.style.height = this.options.height + 4 + "px";
    this.content.style.height = this.options.height  - this.options.captionHeight + "px";
//     $(this.content).makePositioned();
//      this.content.style.top =  this.options.captionHeight + "px";
   DisplayElement.style.height = this.options.height  - this.options.captionHeight + "px";
    return {height: this.options.height, width:this.options.width}
  },
    
  /*set the DivBox window aignment as specified 
   *position = topLeft, topCenter, topRight, 
   *           middleLeft, middleCenter, middleRight,
   *           bottomLeft, bottomCenter, bottomRight
   */  
  hAlign: function(dimensions, position){
 	  var arrayPageSize = this.getPageSize();
	  var arrayPageScroll = this.getPageScroll();
    switch (position){
      case "left":
	      /* set top and left values to 0 */
	      var windowLeft = 0;
        break;
      case "center":
	      /* center window and make sure that the top is 0*/
	      if (dimensions.width > 0) {
	        var windowLeft = ((arrayPageSize[0] - dimensions.width) / 2);
        }else{
	        var windowLeft = ((arrayPageSize[0] - this.options.width) / 2);
 		    }
        break;
      case "right":
	      /* center window and make sure that the top and left values are not negative*/
	      if (dimensions.width > 0) {
 	        var windowLeft = (arrayPageSize[0] - dimensions.width);
        }else{
	        var windowLeft = (arrayPageSize[0] - this.options.width);
 		    }
        break;
      default:
        break;
    }
    /* make sure top and left values are not negative and the image placed outside the viewport*/
	  this.window.style.left = (windowLeft < 0) ? "0px" : windowLeft + "px";
  },
  
   /*set the DivBox window aignment as specified 
   *position = topLeft, topCenter, topRight, 
   *           middleLeft, middleCenter, middleRight,
   *           bottomLeft, bottomCenter, bottomRight
   */  
  vAlign: function(dimensions, position){
 	  var arrayPageSize = this.getPageSize();
	  var arrayPageScroll = this.getPageScroll();
    switch (position){
      case "top":
	      /* set top and left values to 0 */
  		  var windowTop = 0;
        break;
      case "middle":
	      /* center window and make sure that the top is 0*/
	      if (dimensions.height > 0) {
	        var windowTop = arrayPageScroll[1] + ((arrayPageSize[3] - 35 - dimensions.height) / 2);
        }else{
	        var windowTop = arrayPageScroll[1] + ((arrayPageSize[3] - 35 - this.options.height) / 2);
 		    }
        break;
      case "bottom":
	      /* center window and make sure that the top and left values are not negative*/
	      if (dimensions.height > 0) {
	        var windowTop = arrayPageScroll[1] + (arrayPageSize[3] - this.options.captionHeight - dimensions.height);
        }else{
	        var windowTop = arrayPageScroll[1] + (arrayPageSize[3] - this.options.captionHeight - this.options.height);
 		    }
        break;
      default:
        break;
    }
    /* make sure top and left values are not negative and the image placed outside the viewport*/
	  this.window.style.top = (windowTop < 0) ? "0px" : windowTop + "px";
    //this.content.style.top = this.window.style.top  - this.options.captionHeight + "px";
 },

  /* getPageScroll()
   * Returns array with x,y page scroll values.
   * Core code from - quirksmode.org*/
  getPageScroll: function(){

	  var yScroll;

	  if (self.pageYOffset) {
		  yScroll = self.pageYOffset;
	  } else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		  yScroll = document.documentElement.scrollTop;
	  } else if (document.body) {// all other Explorers
		  yScroll = document.body.scrollTop;
	  }

	  arrayPageScroll = new Array('',yScroll) 
	  return arrayPageScroll;
  },
  
  
  
   /* getPageSize()
   * Returns array with page width, height and window width, height
   * Core code from - quirksmode.org
   * Edit for Firefox by pHaez*/
  getPageSize: function(){
  	
	  var xScroll, yScroll;
  	
	  if (window.innerHeight && window.scrollMaxY) {	
		  xScroll = document.body.scrollWidth;
		  yScroll = window.innerHeight + window.scrollMaxY;
	  } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		  xScroll = document.body.scrollWidth;
		  yScroll = document.body.scrollHeight;
	  } else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		  xScroll = document.body.offsetWidth;
		  yScroll = document.body.offsetHeight;
	  }
  	
	  var windowWidth, windowHeight;
	  if (self.innerHeight) {	// all except Explorer
		  windowWidth = self.innerWidth;
		  windowHeight = self.innerHeight;
	  } else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		  windowWidth = document.documentElement.clientWidth;
		  windowHeight = document.documentElement.clientHeight;
	  } else if (document.body) { // other Explorers
		  windowWidth = document.body.clientWidth;
		  windowHeight = document.body.clientHeight;
	  }	
  	
	  // for small pages with total height less then height of the viewport
	  if(yScroll < windowHeight){
		  pageHeight = windowHeight;
	  } else { 
		  pageHeight = yScroll;
	  }

	  // for small pages with total width less then width of the viewport
	  if(xScroll < windowWidth){	
		  pageWidth = windowWidth;
	  } else {
		  pageWidth = xScroll;
	  }


	  arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	  return arrayPageSize;
  },



  /* pause(numberMillis)
   * Pauses code execution for specified time. Uses busy code, not good.
   * Code from http://www.faqts.com/knowledge_base/view.phtml/aid/1602*/
  pause: function(numberMillis) {
	  var now = new Date();
	  var exitTime = now.getTime() + numberMillis;
	  while (true) {
		  now = new Date();
		  if (now.getTime() > exitTime)
			  return;
	  }
   },
  
  /* initLightbox()
   * Function runs on window load, going through link tags looking for rel="lightbox".
   * These links receive onclick events that enable the lightbox display for their targets.
   * The function also inserts html markup at the top of the page which will be used as a
   * container for the overlay pattern and the inline image.
   
    <div id="db_overlay">
      <img id="loadingImage" />
    </div>
    <div id"db_window">
	    <div id="db_caption">
	      <div id="db_title"></div>
        <img id="db_closeButton" />
      </div>
      <div id"db_content">
	    <div id="lightboxCaption"></div>
    </div>
   
   
   */
  initLightbox: function(options)
  {
  	
	  if (!document.getElementsByTagName){ return; }
    this.initOptions(options); 	
	  // the rest of this code inserts html at the top (now bottom) of the page that looks like this:
	  //
  	
	  this.Body = document.getElementsByTagName("body").item(0);
  	
	  /*
	   * create overlay div and hardcode some functional styles (aesthetic styles are in CSS file)
     */
	  this.overlay = Builder.node("div", {
	    id: "overlay", 
	    style: "position: absolute; display: none; top:0px; left:0px; width:100%; z-index:90" 
	  });
//	  this.overlay = document.createElement("div");
//	  this.overlay.setAttribute('id','overlay');
//	  this.overlay.style.position = 'absolute';
//	  this.overlay.style.display = 'none';	// This breaks the animation
//	  this.overlay.style.top = '0';
//	  this.overlay.style.left = '0';
//	  this.overlay.style.zIndex = '90';
// 	  this.overlay.style.width = '100%';

	  this.Body.appendChild(this.overlay);
 	  new Effect.Appear(this.overlay, { 
 		  duration: 0.0, 
      from: 0, to: 0 
    });

	  var arrayPageSize = this.getPageSize();
	  var arrayPageScroll = this.getPageScroll();
  	
//  	this.ShowOverlay = Fx.Style(this.overlay, 'opacity', {duration: 0});
//  	this.ShowOverlay.hide();

//	  // preload and create loader image
//	  var imgPreloader = new Image();
//  	
//	  // if loader image found, create link to hide lightbox and create loadingimage
//	  imgPreloader.onload=DivBox.imgPreloader(this);

//	  imgPreloader.src = this.options.loadingImage;
    this.loading = Builder.node("img", {
      id: "loadingImage", 
      src: this.options.loadingImage,
      style: "position: absolute; display: none; z-index:99" 
    });
    this.overlay.appendChild(this.loading);
//		new Effect.Opacity(this.overlay, { 
//		  duration: 0.0, 
//      from: 0, to: 0.0 
//    });

	  // create divbox window div, same note about styles as above
	  this.window = Builder.node("div", {
	    id: "db_window", 
	    style: "position: absolute; display: none; z-index:100" 
	  });
//	  this.window = document.createElement("div");
//	  this.window.setAttribute('id','db_window');
//	  this.window.style.position = 'absolute';
//	  this.window.style.display = 'none';	
//	  this.window.style.zIndex = '100';
	  
	  this.Body.appendChild(this.window);
		new Effect.Appear(this.window, { 
		  duration: 0.0, 
      from: 0, to: 0 
    });

	  // preload and create close button image
  	
  	
	  // create caption
		this.caption = Builder.node("div", {
	    id: "db_caption", 
	    style: "top: 0px; left: 0px; width: 100%; vertical-align: top" 
	  });
	  this.window.appendChild(this.caption);
	  
	  // create Title div, same note about styles as above
		this.title = Builder.node("div", {
	    id: "db_title", 
	    style: "position: absolute; display: block; top: 3px; left: 5px; vertical-align: middle" 
	  });
	  this.caption.appendChild(this.title);
	  
	  /***********************/
	  //var imgPreloadCloseButton = new Image();
	  // imgPreloadCloseButton.src = this.options.closeButton;
	  //imgPreloadCloseButton.onload=function(){
      this.closeButton = Builder.node("img", {
        id: "db_closeButton", 
        src: this.options.closeButton,
        style: "position: absolute; display: block; top: 0px; right: 0px; border-style: none; cursor: pointer" 
      });
		  this.closeButton.onclick = function () {DivBox.hide(); return false;};
	    this.caption.appendChild(this.closeButton);
	    $(this.caption).extend;
		 // return false;
	  //}
	  //imgPreloadCloseButton.onload=function(){};
     
    this.content = Builder.node("div", {
	    id: "db_content",
	    style: "position: absolute; display: block; border-style: none; left: 0px; top:"+ this.options.captionHeight +"px;" 
    });
    $(this.content).extend;

	  this.window.appendChild(this.content);
	  this.initialized = true;
  }
  
//  imgPreloader: function(DivBox){
//    DivBox.loading = Builder.node("img", {
//      id: "loadingImage", 
//      src: this.loadingImage,
//      style: "position: absolute; display: none; z-index:99" 
//    });
//    DivBox.overlay.appendChild(DivBox.loading);
//	  imgPreloader.onload=function(){};	//	clear onLoad, as IE will flip out w/animated gifs
//	  return false;
//  }

}
Object.extend(DivBox, DivBox.Functions);

function closeDivBox(){
  DivBox.hide()
}

//  BuildLightbox: function(options)
//  {
//  	
//	  /* this code inserts html at the bottom of the page (body)*/
//  	
//	  this.Body = document.getElementsByTagName("body").item(0);
//  	
//	  /*
//	   * create overlay div and hardcode some functional styles (aesthetic styles are in CSS file)
//     */
//	  this.overlay = Builder.node("div", {
//	    id: "overlay", 
//	    style: "position: absolute; display: none; top:0px; left:0px; width:100%; z-index:90" 
//	  });

//	  this.Body.appendChild(this.overlay);
// 	  new Effect.Appear(this.overlay, { 
// 		  duration: 0.0, 
//      from: 0, to: 0 
//    });

//	  var arrayPageSize = this.getPageSize();
//	  var arrayPageScroll = this.getPageScroll();
//  	
////	  // preload and create loader image
////	  var imgPreloader = new Image();
////  	
////	  // if loader image found, create link to hide lightbox and create loadingimage
////	  imgPreloader.onload=DivBox.imgPreloader(this);

////	  imgPreloader.src = this.options.loadingImage;
//    this.loading = Builder.node("img", {
//      id: "loadingImage", 
//      src: this.options.loadingImage,
//      style: "position: absolute; display: none; z-index:99" 
//    });
//    this.overlay.appendChild(this.loading);


//    /*We will now build a table to control the appearance of the DivBox
//     *  <table>
//     *    <tr>  //Caption Row
//     *      <td>Title Cell</td><td>Close button</tr>
//     *    </tr>
//     *    <tr>
//     *      <td colspan=2>content body</td>
//     *    </tr>
//     */
//	  // create divbox window div, same note about styles as above
//	  this.window = Builder.node("div", {
//	    id: "db_window", 
//	    style: "position: absolute; display: none; z-index:100" 
//	  });
////	  this.window = document.createElement("div");
////	  this.window.setAttribute('id','db_window');
////	  this.window.style.position = 'absolute';
////	  this.window.style.display = 'none';	
////	  this.window.style.zIndex = '100';
//	  
//	  this.Body.appendChild(this.window);
//		new Effect.Appear(this.window, { 
//		  duration: 0.0, 
//      from: 0, to: 0 
//    });

//	  // preload and create close button image
//  	
//  	
//	  // create caption
//		this.caption = Builder.node("div", {
//	    id: "db_caption", 
//	    style: "top: 0px; left: 0px; width: 100%; vertical-align: top" 
//	  });
//	  this.window.appendChild(this.caption);
//	  
//	  // create Title div, same note about styles as above
//		this.title = Builder.node("div", {
//	    id: "db_title", 
//	    style: "position: absolute; display: block; top: 3px; left: 5px; vertical-align: middle" 
//	  });
//	  this.caption.appendChild(this.title);
//	  
//	  /***********************/
//	  //var imgPreloadCloseButton = new Image();
//	  // imgPreloadCloseButton.src = this.options.closeButton;
//	  //imgPreloadCloseButton.onload=function(){
//      this.closeButton = Builder.node("img", {
//        id: "db_closeButton", 
//        src: this.options.closeButton,
//        style: "position: absolute; display: block; top: 0px; right: 0px; border-style: none; cursor: pointer" 
//      });
//		  this.closeButton.onclick = function () {DivBox.hide(); return false;};
//	    this.caption.appendChild(this.closeButton);
//	    $(this.caption).extend;
//		 // return false;
//	  //}
//	  //imgPreloadCloseButton.onload=function(){};
//     
//    this.content = Builder.node("div", {
//	    id: "db_content",
//	    style: "position: absolute; display: block; border-style: none; left: 0px; top:"+ this.options.captionHeight +"px;" 
//    });
//    $(this.content).extend;

//	  this.window.appendChild(this.content);
//	  this.initialized = true;
//  }
//  
////  imgPreloader: function(DivBox){
////    DivBox.loading = Builder.node("img", {
////      id: "loadingImage", 
////      src: this.loadingImage,
////      style: "position: absolute; display: none; z-index:99" 
////    });
////    DivBox.overlay.appendChild(DivBox.loading);
////	  imgPreloader.onload=function(){};	//	clear onLoad, as IE will flip out w/animated gifs
////	  return false;
////  }

//}
