var var_global_full_screen_overlay_timeout;
var var_global_box_timeout;
var var_global_box_get_timeout;
var var_global_zIndex = 20;
arr_global_box_container = new Array();

function flyBox() {
	this.var_idName = 'fullScreenOverlay';
	this.var_objectOverlayId = 'objectOverlay';
	this.var_screenWidth = 0;
	this.var_screenHeight = 0;
	this.var_pageHeight = 0;
	this.var_maxHeight = 0;
	this.var_opacity = 50;
	this.var_current_opacity;
	this.var_intervalTimeout = 5;
	this.var_fade_step = 4;
	this.var_containerIdName;
	this.var_fade = 0;
	this.var_fade_container = 0;
	this.var_overlay_fullscreen = 0;
	this.var_clear_container;
	this.var_overlayObjectIdName;
	this.var_zIndex = 1;
	this.var_fixed_zIndex = 0;
	this.var_increased_zIndex = 0;
	this.var_increased_zIndex_amount = 50;
	
	this.var_positioned = 0;
	this.var_initObject = 0;
	
	this.var_createObject_idName;
	this.var_createObject_width;
	this.var_createObject_className;
	this.var_createObject_styles;
	
	this.var_object_position_id; 						// our object we want to position;
	this.var_object_position = "screen"; 				// can be: screen for visible display; window for entyre page; mouse wich means it follows the mouse; object (which requires also an object id) to position near or over an object
	this.var_object_position_object_id; 				// the id of the object where our object shoud be positioned to;
	this.var_object_position_vertical = 'center';		// top, center, bottom, inner_top, inner_bottom, auto(looks for best visible position around the object), inner_auto
	this.var_object_position_horizontal = 'center';		// right, center, left, inner_right, inner_left, auto(looks for best visible position around the object), inner_auto
	this.var_object_position_vertical_user_set = 'center';		// top, center, bottom, inner_top, inner_bottom, auto(looks for best visible position around the object), inner_auto
	this.var_object_position_horizontal_user_set = 'center';		// right, center, left, inner_right, inner_left, auto(looks for best visible position around the object), inner_auto
	this.var_object_position_offset_x = 0;				// the x-offset to the object it should be positioned to
	this.var_object_position_offset_y = 0;				// the y-offset to the object it should be positioned to
	this.var_object_position_innerHTML = '';			
	this.var_object_position_default_innerHTML = '<div class="infoBox" style="width: 24px; height: 24px; padding: 10px;"><img src="graphic/loadinfo.net.gif" alt="Loading" width="24" height="24" title="Loading..." /></div>';	
	this.var_object_position_top;						
	this.var_object_position_left;						
	
	var thisO = this; 									// this object itself
	
	this.setPosition = function(position) {
		if ( position == "screen" || position == "object" || position == "window" || position == "mouse"  ) {
			this.var_object_position = position;
		} else {
			this.var_object_position = "screen";
		}
	}
	
	this.setZIndex = function(index) {
		if ( typeof index == 'number' ) {
			this.var_zIndex = index;
		}
	}
	
	this.setIncreasedZIndex = function() {
		this.var_increased_zIndex = 1;
	}
	
	this.setNormalZIndex = function() {
		this.var_increased_zIndex = 0;
	}
	
	this.setIncreasedZIndexAmount = function(amount) {
		if ( typeof amount == 'number' ) {
			this.var_increased_zIndex_amount = amount;
		}
	}
	
	this.setFixedZIndex = function() {
		this.var_fixed_zIndex = 1;
	}
	
	this.setUnfixedZIndex = function() {
		this.var_fixed_zIndex = 0;
	}
	
	this.setPositionObjectId = function(id) {
		//if ( getObject(id) ) {
			this.var_object_position_object_id = id;
		//} else {
		//	alert("Trying to position container near an unexisting object (object id '" + id + "' not found)!");
		//}
	}
	
	this.positioned = function() {
		return this.var_positioned;
	}
	
	this.setPositionVertical = function(position) {
		if (position == 'top' || position == 'bottom' || position == 'inner_top' || position == 'inner_bottom' || position == 'pref_top' || position == 'pref_bottom' || position == 'pref_inner_top' || position == 'pref_inner_bottom' || position == 'center' || position == 'auto' || position == 'inner_auto' ) {
			this.var_object_position_vertical_user_set = position;
		} else {
			this.var_object_position_vertical_user_set = 'center';
		}
	}
	
	this.setPositionHorizontal = function(position) {
		if ( position == 'left' || position == 'right' || position == 'inner_left' || position == 'inner_right' || position == 'pref_left' || position == 'pref_right' || position == 'pref_inner_left' || position == 'pref_inner_right' || position == 'center' || position == 'auto' || position == 'inner_auto' ) {
			this.var_object_position_horizontal_user_set = position;
		} else {
			this.var_object_position_horizontal_user_set = 'center';
		}
	}
	
	this.setPositionOffsetX = function(offset) {
		if ( typeof offset == 'number' ) {
			this.var_object_position_offset_x = offset;
		} else {
			this.var_object_position_offset_x = 0;
		}
	}
	
	this.setPositionOffsetY = function(offset) {
		if ( typeof offset == 'number' ) {
			this.var_object_position_offset_y = offset;
		} else {
			this.var_object_position_offset_y = 0;
		}
	}
	
	this.setInnerHTML = function(inner_html) {
		this.var_object_position_innerHTML = inner_html;
		if ( this.var_initObject == 1 ) {
			getObject(this.var_object_position_id).innerHTML = inner_html;
			if ( this.positioned() ) {
				getStyleObject(this.var_object_position_id).visibility = 'hidden';
				var marginTop 	= this.getObjectPositionTop();
				var marginLeft 	= this.getObjectPositionLeft();
				getStyleObject(this.var_object_position_id).top = marginTop + "px";
				getStyleObject(this.var_object_position_id).left = marginLeft + "px";
				getStyleObject(this.var_object_position_id).visibility = 'visible';
			}
		}
	}
	
	this.getObjectPositionObjectId = function() {
		return this.var_object_position_object_id;
	}
	
	this.initObject = function() {
		if ( this.var_initObject == 0 ) {
			//if ( !getObject(this.var_object_position_id) ) {
				this.createObj(	this.var_createObject_idName, this.var_createObject_width, this.var_createObject_className, this.var_createObject_styles);
			//}
			getObject(this.var_object_position_id).innerHTML = this.var_object_position_innerHTML;
			this.var_initObject = 1;
		}
	}
	
	this.getObjectPositionTop = function() {
		this.initObject();
		if ( (this.var_object_position == 'object' || this.var_object_position == 'mouse' ) && (this.var_object_position_vertical_user_set == 'auto' || this.var_object_position_vertical_user_set == 'inner_auto' || this.var_object_position_vertical_user_set == 'pref_top' || this.var_object_position_vertical_user_set == 'pref_bottom' || this.var_object_position_vertical_user_set == 'pref_inner_top' || this.var_object_position_vertical_user_set == 'pref_inner_bottom') ) {
			arr_position = new Array();
			arr_position['auto_top'] = 'top';
			arr_position['auto_bottom'] = 'bottom';
			arr_position['inner_auto_top'] = 'inner_top';
			arr_position['inner_auto_top_n'] = 'inner_bottom';
			arr_position['inner_auto_bottom'] = 'inner_bottom';
			arr_position['inner_auto_bottom_n'] = 'inner_top';
			arr_position['pref_top'] = 'top';
			arr_position['pref_top_n'] = 'bottom';
			arr_position['pref_bottom'] = 'bottom';
			arr_position['pref_bottom_n'] = 'top';
			arr_position['pref_inner_top'] = 'inner_top';
			arr_position['pref_inner_top_n'] = 'inner_bottom';
			arr_position['pref_inner_bottom'] = 'inner_bottom';
			arr_position['pref_inner_bottom_n'] = 'inner_top';
			if ( this.var_object_position == 'mouse' ) {
				// NOT supported yet...
				this.var_object_position = 'screen';
				this.var_object_position_vertical = 'center';
				this.var_object_position_horizontal = 'center';
			} else if ( getObject(this.var_object_position_object_id) ) {
				var objectAlign = '';
				if ( ( this.var_object_position_vertical_user_set == 'auto' || this.var_object_position_vertical_user_set == 'inner_auto' ) && getElementTop(this.var_object_position_object_id) > this.getMaxHeight() - getElementTop(this.var_object_position_object_id) - getElementHeight(this.var_object_position_object_id) ) {
					objectAlign = '_top';
				} else if ( this.var_object_position_vertical_user_set == 'auto' || this.var_object_position_vertical_user_set == 'inner_auto' ) {
					objectAlign = '_bottom';
				}
				if ( this.var_object_position_vertical_user_set == 'inner_auto' && getElementHeight(this.var_object_position_object_id) < getElementHeight(this.var_object_position_id) ) {
					objectAlign = objectAlign + '_n';
				}
				if ( this.var_object_position_vertical_user_set == 'pref_top' && getElementTop(this.var_object_position_object_id) - getElementHeight(this.var_object_position_id) < 0 ) {
					objectAlign = "_n";
				}
				if ( this.var_object_position_vertical_user_set == 'pref_bottom' && getElementTop(this.var_object_position_object_id) + getElementHeight(this.var_object_position_object_id) + getElementHeight(this.var_object_position_id) > this.getMaxHeight() && getElementTop(this.var_object_position_object_id) - getElementHeight(this.var_object_position_id) > 0 ) {
					objectAlign = "_n";
				}
				if ( this.var_object_position_vertical_user_set == 'pref_inner_bottom' && getElementTop(this.var_object_position_object_id) + getElementHeight(this.var_object_position_object_id) + getElementHeight(this.var_object_position_id) > this.getMaxHeight() && getElementTop(this.var_object_position_object_id) + getElementHeight(this.var_object_position_object_id) - getElementHeight(this.var_object_position_id) > 0 ) {
					objectAlign = "_n";
				}
				if ( this.var_object_position_vertical_user_set == 'pref_inner_top' && getElementTop(this.var_object_position_object_id) + getElementHeight(this.var_object_position_id) > this.getMaxHeight() && getElementHeight(this.var_object_position_id) > getElementHeight(this.var_object_position_object_id) ) {
					objectAlign = "_n";
				}
				this.var_object_position_vertical = arr_position[this.var_object_position_vertical_user_set + objectAlign];
			} else {
				this.var_object_position = 'screen';
				this.var_object_position_vertical = 'center';
				this.var_object_position_horizontal = 'center';
			}
		} else {
			this.var_object_position_vertical = this.var_object_position_vertical_user_set;
			this.var_object_position_horizontal = this.var_object_position_horizontal_user_set;
		}
		
		if ( this.var_object_position == 'object' ) {
			if ( this.var_object_position_vertical == 'top' ) {
				this.var_object_position_top = getElementTop(this.var_object_position_object_id) - getElementHeight(this.var_object_position_id);
			} else if ( this.var_object_position_vertical == 'inner_top' ) {
				this.var_object_position_top = getElementTop(this.var_object_position_object_id);
			} else if ( this.var_object_position_vertical == 'bottom' ) {
				this.var_object_position_top = getElementTop(this.var_object_position_object_id) + getElementHeight(this.var_object_position_object_id);
			} else if ( this.var_object_position_vertical == 'inner_bottom' ) {
				this.var_object_position_top = getElementTop(this.var_object_position_object_id) + getElementHeight(this.var_object_position_object_id) - getElementHeight(this.var_object_position_id);
			} else if ( this.var_object_position_vertical == 'center' ) {
				this.var_object_position_top = getElementTop(this.var_object_position_object_id) + ( Math.ceil((getElementHeight(this.var_object_position_object_id) - getElementHeight(this.var_object_position_id))/2) );
			}
		} else if ( this.var_object_position == 'mouse' ) {
			// NOT supported yet...
			if ( this.var_object_position_vertical == 'top' ) {
				this.var_object_position_top = 0;
			} else if ( this.var_object_position_vertical == 'bottom' ) {
				this.var_object_position_top = getScreenHeight() - getElementHeight(this.var_object_position_id);
			} else if ( this.var_object_position_vertical == 'center' ) {
				this.var_object_position_top = Math.floor( (this.getScreenHeight() - getElementHeight(this.var_object_position_id) ) * 0.3 );
				if ( this.var_object_position_top < 0 ) {
					this.var_object_position_top = 0;
				}
			}
		} else if ( this.var_object_position == 'screen' ) {
			if ( this.var_object_position_vertical == 'top' ) {
				this.var_object_position_top = 0;
			} else if ( this.var_object_position_vertical == 'bottom' ) {
				this.var_object_position_top = getScreenHeight() - getElementHeight(this.var_object_position_id);
			} else if ( this.var_object_position_vertical == 'center' ) {
				this.var_object_position_top = Math.floor( (this.getScreenHeight() - getElementHeight(this.var_object_position_id) ) * 0.3 );
				if ( this.var_object_position_top < 0 ) {
					this.var_object_position_top = 0;
				}
			}
		} else if ( this.var_object_position == 'window' ) {
			if ( this.var_object_position_vertical == 'top' ) {
				this.var_object_position_top = 0;
			} else if ( this.var_object_position_vertical == 'bottom' ) {
				this.var_object_position_top = getScreenHeight() - getElementHeight(this.var_object_position_id);
			} else if ( this.var_object_position_vertical == 'center' ) {
				this.var_object_position_top = Math.floor( (this.getMaxHeight() - getElementHeight(this.var_object_position_id) ) * 0.5 );
				if ( this.var_object_position_top < 0 ) {
					this.var_object_position_top = 0;
				}
			}
		}
		this.var_object_position_top = this.var_object_position_top + this.var_object_position_offset_y;
		if ( this.var_object_position_top < 0 ) this.var_object_position_top = 0;
		return this.var_object_position_top;
	}
	
	this.getObjectPositionLeft = function() {
		this.initObject();
		if ( (this.var_object_position == 'object' || this.var_object_position == 'mouse' ) && (this.var_object_position_horizontal_user_set == 'auto' || this.var_object_position_horizontal_user_set == 'inner_auto' || this.var_object_position_horizontal_user_set == 'pref_left' || this.var_object_position_horizontal_user_set == 'pref_right' || this.var_object_position_horizontal_user_set == 'pref_inner_left' || this.var_object_position_horizontal_user_set == 'pref_inner_right') ) {
			arr_position = new Array();
			arr_position['auto_left'] = 'left';
			arr_position['auto_right'] = 'right';
			arr_position['inner_auto_left'] = 'inner_left';
			arr_position['inner_auto_right'] = 'inner_right';
			arr_position['inner_auto_left_n'] = 'inner_right';
			arr_position['inner_auto_right_n'] = 'inner_left';
			arr_position['pref_left'] = 'left';
			arr_position['pref_left_n'] = 'right';
			arr_position['pref_right'] = 'right';
			arr_position['pref_right_n'] = 'left';
			arr_position['pref_inner_left'] = 'inner_left';
			arr_position['pref_inner_left_n'] = 'inner_right';
			arr_position['pref_inner_right'] = 'inner_right';
			arr_position['pref_inner_right_n'] = 'inner_left';
			if ( this.var_object_position == 'mouse' ) {
				// NOT supported yet...
				this.var_object_position = 'screen';
				this.var_object_position_vertical = 'center';
				this.var_object_position_horizontal = 'center';
			} else if ( getObject(this.var_object_position_object_id) ) {
				var objectAlign = '';
				if ( ( this.var_object_position_horizontal_user_set == 'inner_auto' || this.var_object_position_horizontal_user_set == 'auto' ) && getElementLeft(this.var_object_position_object_id) > this.getScreenWidth() - getElementLeft(this.var_object_position_object_id) - getElementWidth(this.var_object_position_object_id) ) {
					objectAlign = '_left';
				} else if( this.var_object_position_horizontal_user_set == 'inner_auto' || this.var_object_position_horizontal_user_set == 'auto' ) {
					objectAlign = '_right';
				}
				if ( this.var_object_position_horizontal_user_set == 'inner_auto' && getElementWidth(this.var_object_position_object_id) < getElementWidth(this.var_object_position_id) ) {
					objectAlign = objectAlign + '_n';
				}
				if ( this.var_object_position_horizontal_user_set == 'pref_left' && getElementLeft(this.var_object_position_object_id) - getElementWidth(this.var_object_position_id) < 0 ) {
					objectAlign = "_n";
				}
				if ( this.var_object_position_horizontal_user_set == 'pref_right' 	&& getElementLeft(this.var_object_position_object_id) + getElementWidth(this.var_object_position_object_id) + getElementWidth(this.var_object_position_id) > this.getScreenWidth() && getElementLeft(this.var_object_position_object_id) - getElementWidth(this.var_object_position_id) > 0  ) {
					objectAlign = "_n";
				}
				if ( this.var_object_position_horizontal_user_set == 'pref_inner_right' && getElementLeft(this.var_object_position_object_id) + getElementWidth(this.var_object_position_object_id) - getElementWidth(this.var_object_position_id) < 0) {
					objectAlign = "_n";
				}
				if ( this.var_object_position_horizontal_user_set == 'pref_inner_left' && getElementLeft(this.var_object_position_object_id) + getElementWidth(this.var_object_position_id) > this.getScreenWidth() && getElementLeft(this.var_object_position_object_id) + getElementWidth(this.var_object_position_object_id) - getElementWidth(this.var_object_position_id) > 0 ) {
					objectAlign = "_n";
				}
				this.var_object_position_horizontal = arr_position[this.var_object_position_horizontal_user_set + objectAlign];
			} else {
				this.var_object_position = 'screen';
				this.var_object_position_vertical = 'center';
				this.var_object_position_horizontal = 'center';
			}
		}
		
		if ( this.var_object_position == 'object' ) {
			if ( this.var_object_position_horizontal == 'left' ) {
				this.var_object_position_left = getElementLeft(this.var_object_position_object_id) - getElementWidth(this.var_object_position_id);
			} else if ( this.var_object_position_horizontal == 'inner_left' ) {
				this.var_object_position_left = getElementLeft(this.var_object_position_object_id);
			} else if ( this.var_object_position_horizontal == 'right' ) {
				this.var_object_position_left = getElementLeft(this.var_object_position_object_id) + getElementWidth(this.var_object_position_object_id);
			} else if ( this.var_object_position_horizontal == 'inner_right' ) {
				this.var_object_position_left = getElementLeft(this.var_object_position_object_id) + getElementWidth(this.var_object_position_object_id) - getElementWidth(this.var_object_position_id);
			} else if ( this.var_object_position_horizontal == 'center' ) {
				this.var_object_position_left = getElementLeft(this.var_object_position_object_id) + ( Math.ceil((getElementWidth(this.var_object_position_object_id) - getElementWidth(this.var_object_position_id))/2) );
			}
		} else if ( this.var_object_position == 'mouse' ) {
			// NOT supported yet...
			if ( this.var_object_position_horizontal == 'left' ) {
				this.var_object_position_left = 0;
			} else if ( this.var_object_position_horizontal == 'right' ) {
				this.var_object_position_left = getScreenWidth() - getElementWidth(this.var_object_position_id);
			} else if ( this.var_object_position_horizontal == 'center' ) {
				this.var_object_position_left = Math.floor( (this.getScreenWidth() - getElementWidth(this.var_object_position_id) ) * 0.5 );
				if ( this.var_object_position_left < 0 ) {
					this.var_object_position_left = 0;
				}
			}
		} else if ( this.var_object_position == 'screen' ) {
			if ( this.var_object_position_horizontal == 'left' ) {
				this.var_object_position_left = 0;
			} else if ( this.var_object_position_horizontal == 'right' ) {
				this.var_object_position_left = getScreenWidth() - getElementWidth(this.var_object_position_id);
			} else if ( this.var_object_position_horizontal == 'center' ) {
				this.var_object_position_left = Math.floor( (this.getScreenWidth() - getElementWidth(this.var_object_position_id) ) * 0.5 );
				if ( this.var_object_position_left < 0 ) {
					this.var_object_position_left = 0;
				}
			}
		} else if ( this.var_object_position == 'window' ) {
			if ( this.var_object_position_horizontal == 'left' ) {
				this.var_object_position_left = 0;
			} else if ( this.var_object_position_horizontal == 'right' ) {
				this.var_object_position_left = getScreenWidth() - getElementWidth(this.var_object_position_id);
			} else if ( this.var_object_position_horizontal == 'center' ) {
				this.var_object_position_left = Math.floor( (this.getScreenWidth() - getElementWidth(this.var_object_position_id) ) * 0.5 );
				if ( this.var_object_position_left < 0 ) {
					this.var_object_position_left = 0;
				}
			}
		}
		this.var_object_position_left = this.var_object_position_left + this.var_object_position_offset_x;
		if ( this.var_object_position_left < 0 ) this.var_object_position_left = 0;
		return this.var_object_position_left;
	}
	
	this.createFullScreenOverlay = function() {
		this.createObj(this.var_idName, 0, null, {position: 'absolute', top: '0px', left: '0px', width: '0px', height: '0px', backgroundColor: 'rgb(51, 51, 51)'} );
		getObject(this.var_idName).style['opacity'] = this.getFFOpacity(this.var_opacity);
		getObject(this.var_idName).style['filter'] = "Alpha(opacity=" + this.getIEOpacity(this.var_opacity) + ")";
	}
	
	this.createObjectOverlay = function() {
		this.createObj(this.var_objectOverlayId, 0, '', {position: 'absolute', top: '0px', left: '0px', width: '0px', height: '0px', backgroundColor: 'rgb(51, 51, 51)'} );
		getObject(this.var_objectOverlayId).style['opacity'] = this.getFFOpacity(this.var_opacity);
		getObject(this.var_objectOverlayId).style['filter'] = "Alpha(opacity=" + this.getIEOpacity(this.var_opacity) + ")";
	}
	
	this.createObject = function(idName, width, className, styles) {
		this.var_createObject_idName = idName;
		this.var_createObject_width = width;
		this.var_createObject_className = className;
		this.var_createObject_styles = styles;
	}
	
	this.createObj = function(idName, width, className, styles) {
		if ( !getObject(idName) ) {
			if ( idName && idName != this.var_idName && idName != this.var_objectOverlayId) this.var_object_position_id = idName;
			
			var newElement = document.createElement('div');
			//newElement.style.backgroundColor = '#FFFFFF';
			
			if (idName) newElement.id = idName;
			if (width) newElement.style.width =  width + 'px';
			if (className) newElement.className =  className;
			if (styles) 
				for ( var x in styles ) {
					newElement.style[x] = styles[x];
				}
			document.getElementsByTagName("body")[0].appendChild(newElement);
		}
	}
	
	this.getScreenWidth = function() {
		this.var_screenWidth = document.getElementsByTagName('body')[0].offsetWidth;
		return this.var_screenWidth;
	}
	
	this.getScreenHeight = function() {
		this.var_screenHeight	= document.documentElement.clientHeight;
		return this.var_screenHeight;
	}
	
	this.getPageHeight = function() {
		this.var_pageHeight = document.getElementsByTagName('body')[0].offsetHeight;
		return this.var_pageHeight;
	}
	
	this.getMaxHeight = function() {
		if ( this.getPageHeight() < this.getScreenHeight() ) {
			this.var_maxHeight = this.getScreenHeight();
		} else {
			this.var_maxHeight = this.getPageHeight();
		}
		return this.var_maxHeight;
	}
	
	this.overlayFullScreen = function() {
		if ( !getObject(this.var_idName) ) {
			this.createFullScreenOverlay();
		}
		if ( this.fade ) {
			getObject(this.var_idName).style['opacity'] = "0.0";
			getObject(this.var_idName).style['filter'] = "Alpha(opacity=0)";
		}
		getStyleObject(this.var_idName).height = this.getMaxHeight() + "px";
		getStyleObject(this.var_idName).width = this.getScreenWidth() + "px";
	}
	
	this.alertAll = function() {
		alert(
		'id: ' + this.var_object_position_id + '\n' +
		'position: ' + this.var_object_position + '\n' +
		'object_id: ' + this.var_object_position_object_id + '\n' +
		'vertical: ' + this.var_object_position_vertical + '\n' +
		'horizontal: ' + this.var_object_position_horizontal + '\n' +
		'offset_x: ' + this.var_object_position_offset_x + '\n' +
		'offset_y: ' + this.var_object_position_offset_y + '\n' +
		'innerHTML: ' + this.var_object_position_innerHTML + '\n' +
		'top: ' + this.var_object_position_top + '\n' +
		'left: ' + this.var_object_position_left );
	}
	
	
	
	
	this.positionObject = function() {
		this.initObject();
		this.var_positioned = 1;
		if ( this.var_object_position_innerHTML == '' ) {
			getObject(this.var_object_position_id).innerHTML = this.var_object_position_default_innerHTML;
		}
		var marginTop 		= this.getObjectPositionTop();
		var marginLeft 		= this.getObjectPositionLeft();
		
		var temp_zIndex;
		
		if (this.var_fixed_zIndex) {
			temp_zIndex = this.var_zIndex;
		} else {
			var_global_zIndex++;
			temp_zIndex = var_global_zIndex;
		}
		if ( this.var_increased_zIndex ) {
			temp_zIndex += this.var_increased_zIndex_amount;
		}
		getStyleObject(this.var_object_position_id).zIndex = temp_zIndex;
		
		if ( marginTop == getElementTop(this.var_object_position_id) && marginLeft == getElementLeft(this.var_object_position_id) ) {
				getObject(this.var_object_position_id).style['opacity'] = "1.0";
				getObject(this.var_object_position_id).style['filter'] = "Alpha(opacity=100)";
		} else {
			if ( this.var_fade_container ) {
				getObject(this.var_object_position_id).style['opacity'] = "0.0";
				getObject(this.var_object_position_id).style['filter'] = "Alpha(opacity=0)";
			}
			getStyleObject(this.var_object_position_id).top = marginTop + "px";
			getStyleObject(this.var_object_position_id).left = marginLeft + "px";
			if ( this.var_overlay_fullscreen ) {
				if ( !getObject(this.var_idName) ) {
					this.createFullScreenOverlay();
				}
				if ( this.var_fade ) {
					getObject(this.var_idName).style['opacity'] = "0.0";
					getObject(this.var_idName).style['filter'] = "Alpha(opacity=0)";
				}
				this.overlayFullScreen();
			}
			if ( this.var_fade || this.var_fade_container ) {
				window.clearTimeout(var_global_full_screen_overlay_timeout);
				this.var_current_opacity = 0;
				this.fadeIn();
			}
		}
	}
	
	this.hideObject = function() {
		this.initObject();
		this.var_positioned = 0;
		if ( !this.var_fade_container ) {
			getStyleObject(this.var_object_position_id).top = "-1000px";
			getStyleObject(this.var_object_position_id).left = "-1000px";
		}
		if ( this.var_overlay_fullscreen && !this.var_fade ) {
			this.closeOverlay();
		}
		if ( this.var_fade_container || this.var_overlay_fullscreen ) {
			this.var_current_opacity = this.var_opacity;
			this.fadeOut();
		}
	}
	
	this.instantHideObject = function() {
		this.initObject();
		this.var_positioned = 0;
		getStyleObject(this.var_object_position_id).top = "-9999px";
		getStyleObject(this.var_object_position_id).left = "-9999px";
	}
	
	this.closeOverlay = function() {
		getStyleObject(this.var_idName).height = "0px";
		getStyleObject(this.var_idName).width = "0px";
	}
	
	this.setIntervalTimeout = function (new_interval) {
		this.var_intervalTimeout = new_interval;
	}
	
	this.setContainerIdName = function(id) {
		this.var_containerIdName = id;
	}
	
	this.setFade = function() {
		this.var_fade = 1;
	}
	
	this.setNoFade = function() {
		this.var_fade = 0;
	}
	
	this.setFadeObject = function() {
		this.var_fade_container = 1;
	}
	
	this.setNoFadeObject = function() {
		this.var_fade_container = 0;
	}
	
	this.setFullScreenOverlay = function() {
		this.var_overlay_fullscreen = 1;
	}
	
	this.setNoFullScreenOverlay = function() {
		this.var_overlay_fullscreen = 0;
	}
	
	this.setClearContainer = function(idName) {
		this.clearContainer = idName;
	}
	
	this.fadeIn = function() {
		this.initObject();
		this.var_current_opacity = this.var_current_opacity + this.var_fade_step;
		if ( this.var_current_opacity < this.var_opacity ) {
			if ( this.var_fade_container ) {
				var new_fade = Math.floor(this.var_current_opacity / (this.var_opacity / 100));
				getObject(this.var_object_position_id).style['opacity'] = this.getFFOpacity(new_fade);
				getObject(this.var_object_position_id).style['filter'] = "Alpha(opacity=" + this.getIEOpacity(new_fade) + ")";
			}
			if ( this.var_overlay_fullscreen && this.var_fade ) {
				getObject(this.var_idName).style['opacity'] = this.getFFOpacity(this.var_current_opacity);
				getObject(this.var_idName).style['filter'] = "Alpha(opacity=" + this.getIEOpacity(this.var_current_opacity) + ")";
			}
			//var_global_full_screen_overlay_timeout = window.setTimeout(function(){thisO.fadeIn();}, this.var_intervalTimeout);
			var_global_full_screen_overlay_timeout = window.setTimeout(function(){thisO.fadeIn();}, this.var_intervalTimeout);
		} else {
			if ( getObject(this.var_idName) ) {
				getObject(this.var_idName).style['opacity'] = this.getFFOpacity(this.var_opacity);
				getObject(this.var_idName).style['filter'] = "Alpha(opacity=" + this.getIEOpacity(this.var_opacity) + ")";
			}
			getObject(this.var_object_position_id).style['opacity'] = this.getFFOpacity(100);
			getObject(this.var_object_position_id).style['filter'] = "Alpha(opacity=" + this.getIEOpacity(100) + ")";
		}
	}
	
	this.fadeOut = function() {
		this.initObject();
		this.var_current_opacity = this.var_current_opacity - this.var_fade_step;
		if ( this.var_current_opacity > 0 ) {
			if ( this.var_fade_container ) {
				var new_fade = Math.floor(this.var_current_opacity / (this.var_opacity / 100));
				getObject(this.var_object_position_id).style['opacity'] = this.getFFOpacity(new_fade);
				getObject(this.var_object_position_id).style['filter'] = "Alpha(opacity=" + this.getIEOpacity(new_fade) + ")";
			}
			if ( this.var_overlay_fullscreen && this.var_fade ) {
				getObject(this.var_idName).style['opacity'] = this.getFFOpacity(this.var_current_opacity);
				getObject(this.var_idName).style['filter'] = "Alpha(opacity=" + this.getIEOpacity(this.var_current_opacity) + ")";
			}
			var_global_full_screen_overlay_timeout = window.setTimeout(function(){thisO.fadeOut();}, this.var_intervalTimeout);
		} else {
			if ( getObject(this.var_idName) ) {
				getObject(this.var_idName).style['opacity'] = this.getFFOpacity(0);
				getObject(this.var_idName).style['filter'] = "Alpha(opacity=" + this.getIEOpacity(0) + ")";
			}
			getStyleObject(this.var_object_position_id).top = "-1000px";
			getStyleObject(this.var_object_position_id).left = "-1000px";
			getObject(this.var_object_position_id).style['opacity'] = this.getFFOpacity(100);
			getObject(this.var_object_position_id).style['filter'] = "Alpha(opacity=" + this.getIEOpacity(100) + ")";
			this.closeOverlay();
		}
	}
	
	this.getFFOpacity = function(op) {
		if ( op < 0 ) {
			return "0.00";
		} else if ( op < 10 ) {
			return "0.0" + op;
		} else  if ( op >= 100 ) {
			return "1";
		} else {
			return "0." + op;
		}
	}
	
	this.getIEOpacity = function(op) {
		if ( op < 0 ) {
			return 0;
		} else if ( op < 10 ) {
			return "0" + op;
		} else {
			return op;
		}
	}
	
		
	this.overlayObject = function(objectId) {
		this.var_overlayObjectIdName = objectId;
		if ( getObject(this.var_overlayObjectIdName) ) {
			this.createObjectOverlay();
		}
		getStyleObject(this.var_objectOverlayIdName).height = getElementHeight(this.var_overlayObjectIdName) + "px";
		getStyleObject(this.var_objectOverlayIdName).width = getElementWidth(this.var_overlayObjectIdName) + "px";
		getStyleObject(this.var_objectOverlayIdName).top = getElementTop(this.var_overlayObjectIdName) + "px";
		getStyleObject(this.var_objectOverlayIdName).left = getElementLeft(this.var_overlayObjectIdName) + "px";
	}
	
	this.freeObject = function() {
		if ( getObject(this.var_overlayObjectIdName) ) {
			getStyleObject(this.var_objectOverlayIdName).height = "0px";
			getStyleObject(this.var_objectOverlayIdName).width = "0px";
			getStyleObject(this.var_objectOverlayIdName).top = "0px";
			getStyleObject(this.var_objectOverlayIdName).left = "0px";
		}
	}
}