function popwin(URL,name,width,height) {
	HorizPos = 0;
	VertPos = 0;
	if(screen) {
		HorizPos = (screen.width-width) / 2;
		VertPos = (screen.height-height) / 2;
	}
	varPopupWin=window.open(URL, name,'width='+width+',height='+height+',left='+HorizPos+',top='+VertPos+',scrollbars=yes,toolbar=no,menubar=no,resizable=no');
	varPopupWin.focus(); 
}
var w = false;
var gOffsetLeft = 15;
var gOffsetTop = 15;
var theFloater  = false;
function addhovering(theE,theW) {
	if(e = document.getElementById(theE)) {
		theFloater = e;
		w = theW;
		document.onmousemove=followmouse;
		e.style.display='';
		
	}
}

function removehovering(theE) {
	if(e = document.getElementById(theE)) {
		document.onmousemove='';
		
		
		e.style.display='none';
	}
}

function followmouse(e){
	if (window.event) { // this is the IE case
		mx = window.event.clientX + document.documentElement.scrollLeft + document.body.scrollLeft;
		my = window.event.clientY + document.documentElement.scrollTop + document.body.scrollTop;
		mx = mx - w;
	}
	else { // this is the DOM Events case
		
		mx = e.clientX + window.scrollX;
		my = e.clientY + window.scrollY;
		mx = mx - w;
	}
	
	// set the top and left of the DIV
    theFloater.style.left = (mx+gOffsetLeft) + 'px';
    theFloater.style.top = (my+gOffsetTop) + 'px';
	
	// if the DIV is going to overflow the screen, then reposition it
   
	if (window.innerWidth) { // IE case
		if ((mx+w) > window.innerWidth) 
	        theFloater.style.left = (window.innerWidth - w - (gOffsetLeft/2)) + "px";
    }
    if (document.body.scrollWidth) { // NS case
		if ((mx+w) > document.body.scrollWidth)
	        theFloater.style.left = (document.body.scrollWidth - w - (gOffsetLeft/2)) + "px";
    }
	
}

function Revelate(theContainer) {
	this._objectId;
	this.theContainerID = theContainer;
	this._containerObj = false;
	this.closeAllVar = true;
	this.tagSwap = "<dd>";
	this.openTracker = new Array();
	this._debug = true;
	this._execute = true;
	this.hideClass = "hidden";
	this.moreClass = "more";
	this._constructor = function() { 
		if((this._containerObj = document.getElementById(this.theContainerID))==false) {
			this._execute = false;
			if(this._debug) {
				alert('could not detect the container in which you have instantiated this class!');
			}
		}
	}
	this.setDefault = function(theOpen) {
		this._objectId = theOpen;
		
		if(theObj = document.getElementById(this._objectId)) {
			
			this.trackOpen(theObj.className);
		}
	}
	this.show = function(theOpen,theTrigger,theClass) {
		this._objectId = theOpen;
		if(this._execute) {
			if(this.openTracker[theOpen]) {
				/*
				this.hide(theOpen);
				if((theTrigger!=false)&&(theClass!=false)) {
					theR = theTrigger.className;
					theClass = ' '+theClass;
					theR=theR.replace(theClass,'');
					theTrigger.className = theR;
					
				}
				*/
			} else {
				
				if(theObj = document.getElementById(this._objectId)) {
					
					
					
					if(this.closeAllVar==true) {
						
						this.closeAll(theClass);
					}
					this.trackOpen(theObj.className);
					tempS = theObj.className;
					tempS = tempS.replace(this.hideClass,"")
					theObj.className = this._trim(tempS);					
					
					if(edward = document.getElementById(this.moreClass)){
						edsClass = edward.className;						
						edsClass = edsClass.replace(this.moreClass,this.hideClass);
						edward.className = this._trim(edsClass);
					}
					if((theTrigger!=false)&&(theClass!=false)) {
						
						theTrigger.className += ' '+theClass;
						
					}
				} else if(this._debug) {
					alert('could not detect the object in which you wish to show!');
				}
			}
		}
	}
	this.trackOpen = function(theClassName) {
		this.openTracker[this._objectId] = theClassName;
	}
	this.closeAll = function(theClass) {
		for(openJ in this.openTracker) {
			if(theTempO = document.getElementById(openJ)) {
				if(this.openTracker[openJ].length>0) {
					theTempO.className = this.hideClass;
				} else {
					theTempO.className = " " + this.hideClass;
				}
				
				if(theTrigger=document.getElementById('link_'+theTempO.id)) {
					theR = theTrigger.className;
					theClass = ' '+theClass;
					theR=theR.replace(theClass,'');
					theTrigger.className = theR;
				}
				delete this.openTracker[openJ];
			}
			
		}
		if(edward = document.getElementById(this.moreClass)){
			edsClass = edward.className;						
			edsClass = edsClass.replace(this.hideClass,this.moreClass);
			edward.className = this._trim(edsClass);
			}
	}
	this.hide = function(theClose) {
		
		if(this.closeAll==true) {
			this.closeAll();
		}
		if(theTempO = document.getElementById(theClose)) {
			
			if(this.openTracker[theClose]) {
				theTempO.className = this.hideClass;
			} else {
				theTempO.className = " " + this.hideClass;
			}
			delete this.openTracker[theClose];
		}
	}
	this._trim = function(sInString) {
	  sInString = sInString.replace( /^\s+/g, "" );// strip leading
	  return sInString.replace( /\s+$/g, "" );// strip trailing
	}
}

