function showbeetoolspopup(title, href, content, width, height, left, top, scrollbar)
{
	var thedate = new Date();
	
	var popupele = document.createElement('DIV');
	if (width != '')
	{
		popupele.style.width = (parseFloat(width) + 40) + 'px';
	}
	if (height != '')
	{
		popupele.style.height = (parseFloat(height) + 40) + 'px';
	}
	
	var uniqid = new Date().getMilliseconds();
	popupele.style.position = 'absolute';
	popupele.className = 'beetoolspopup';
	popupele.id = 'beetoolspopup' + uniqid;
		
	var popuptop = document.createElement('DIV');
	popuptop.className = 'top';
	popupele.appendChild(popuptop);
	
	var popuptopleft = document.createElement('DIV');
	popuptopleft.className = 'topleft';
	popuptop.appendChild(popuptopleft);
	
	var popuptopmiddle = document.createElement('DIV');
	popuptopmiddle.className = 'topmiddle';
	popuptop.appendChild(popuptopmiddle);
	
	var popuptopmiddlelbl = document.createElement('LABEL');
	popuptopmiddlelbl.className = 'topmiddlelbl';
	popuptopmiddle.appendChild(popuptopmiddlelbl);

	var popuptopmiddleinput = document.createElement('INPUT');
	popuptopmiddleinput.type = 'button'
	popuptopmiddleinput.value = ' ';
	popuptopmiddleinput.className = 'beetoolspopupclose';
	popuptopmiddleinput.id = 'beetoolspopupclose' + uniqid;
	popuptopmiddle.appendChild(popuptopmiddleinput);
	
	var popuptopright = document.createElement('DIV');
	popuptopright.className = 'topright';
	popuptop.appendChild(popuptopright);
	
	var popupmiddle = document.createElement('DIV');
	popupmiddle.className = 'middle';
	popupele.appendChild(popupmiddle);
	
	var popupmiddleleft = document.createElement('DIV');
	popupmiddleleft.className = 'middleleft';
	popupmiddle.appendChild(popupmiddleleft);

	var popupmiddlemiddle = document.createElement('DIV');
	popupmiddlemiddle.className = 'middlemiddle';
	popupmiddle.appendChild(popupmiddlemiddle);
	if (width != '')
	{
		popupmiddlemiddle.style.width = width + 'px';
	}
	if (height != '')
	{
		popupmiddlemiddle.style.height = height + 'px';
	}
	
	if (href != '')
	{
		var popupiframe = document.createElement('IFRAME');
		popupiframe.className = 'beetoolspopupiframe';
		if (width != '')
		{
			popupiframe.style.width = width + 'px';
		}
		if (height != '')
		{
			popupiframe.style.height = height + 'px';
		}
		popupiframe.style.borderStyle = 'none';
		popupiframe.style.borderWidth = '0px';
		popupiframe.frameBorder = '0';
		popupiframe.src = href;
		popupmiddlemiddle.appendChild(popupiframe);
	}
	else if (content != '')
	{
		var popupcontent = document.createElement('DIV');
		popupcontent.className = 'beetoolspopupcontent';
		popupcontent.innerHTML = content;
		popupmiddlemiddle.appendChild(popupcontent);
	}
	
	var popupmiddleright = document.createElement('DIV');
	popupmiddleright.className = 'middleright';
	popupmiddle.appendChild(popupmiddleright);
	
	var popupbottom = document.createElement('DIV');
	popupbottom.className = 'bottom';
	popupele.appendChild(popupbottom);
	
	var popupbottomleft = document.createElement('DIV');
	popupbottomleft.className = 'bottomleft';
	popupbottom.appendChild(popupbottomleft);
	
	var popupbottommiddle = document.createElement('DIV');
	popupbottommiddle.className = 'bottommiddle';
	popupbottom.appendChild(popupbottommiddle);
	
	var popupbottomright = document.createElement('DIV');
	popupbottomright.className = 'bottomright';
	popupbottom.appendChild(popupbottomright);
	
	document.getElementsByTagName('BODY')[0].appendChild(popupele);	
	
	arrayPageSize = getbeetoolsPageSize();
	arrayPageScroll = getbeetoolsPageScroll();

	document.getElementById('beetoolspopup' + uniqid).style.top = (arrayPageScroll[1] + ((arrayPageSize[3] - 35 - document.getElementById('beetoolspopup' + uniqid).offsetHeight) / 2) + 'px');
	document.getElementById('beetoolspopup' + uniqid).style.left = (((arrayPageSize[0] - 20 - document.getElementById('beetoolspopup' + uniqid).offsetWidth) / 2) + 'px');
	
	
	if (document.getElementById('beetoolspopupclose' + uniqid).attachEvent)
	{
		// Fuer Internet Explorer
		document.getElementById('beetoolspopupclose' + uniqid).attachEvent("onclick", closepopup);
	}
	else
	{
		document.getElementById('beetoolspopupclose' + uniqid).addEventListener("click", closepopup, true);
	}
}

function closepopup(e)
{
	if (e.srcElement)
	{
		// Fuer Internet Explorer
		var button = e.srcElement;
	}
	else
	{
		// Fuer Mozilla Firefox 
		var button = e.target;
	}
	
	button.parentNode.parentNode.parentNode.parentNode.removeChild(button.parentNode.parentNode.parentNode);
}

/**
 * Returns array with page width, height and window width, height
 * Core code from - quirksmode.org
 * Edit for Firefox by pHaez
 */
function getbeetoolsPageSize(){
	
	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;
}

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

	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;
}
