function InnerFrame(parentdesc, description, contentid, innerleft, innertop, innerwidth, innerheight, title, iconpath, iconifiable, iconified, iconleft, icontop, iconwidth, iconheight, alwaysOnTop, autoClose, resizable, closable, maximizable, maximized)
{
	this.parentdesc = parentdesc;
	this.description = description;
	this.contentid = contentid;
	this.innerleft = innerleft;
	this.innertop = innertop;
	this.innerwidth = innerwidth;
	this.innerheight = innerheight;
	this.title = title;
   	this.iconpath = iconpath;
   	this.iconifiable = iconifiable;
   	this.iconified = iconified;
      	this.iconleft = iconleft;
      	this.icontop = icontop;
      	this.iconwidth = iconwidth;
	this.iconheight = iconheight;	
	this.alwaysOnTop = alwaysOnTop;
	this.autoClose = autoClose;
      	this.resizable = resizable;
      	this.closable = closable;
      	this.maximizable = maximizable;
      	this.icondragbarconstant = 18;
      	this.toolbarheightconstant = 22;
      	this.toolbarbuttonwidthsconstant = 16;
      	this.maximized = maximized;
	
	InnerFrame.prototype.createNewPanel = function()
	{
		if(this.isIconified())
			this.createIconWindow();
		else
			this.createInnerFrameWindow();
		if(this.isMaximized())
		{
			this.maximized = false;
			this.maximize();
		}
	}
	
	InnerFrame.prototype.createIconWindow = function()
	{
		this.findContent();
		var par  = window.parent.ContentFrame.document.getElementById(this.parentdesc);
		var div  = window.parent.ContentFrame.document.getElementById(this.description);
		div  = window.parent.ContentFrame.document.createElement("div");
		window.parent.ContentFrame.document.body.appendChild(div);
		div.id = "innericon"
		div.className = "innerframeicon"
		this.InitInnerFrameEvents(div);
		div.style.visibility = "visible"
		div.style.position = "absolute";
		div.style.border = "thin solid rgb(238,238,238)";
		//create draggable bar
		div.style.backgroundImage = "URL('/als/images/pb/dragbarbackground.bmp')";
		var left = 0;
		var top = 0;
		if(par != null && window.parent.macapiframe.innerFrameParams == null)
		{	
			left += parseInt(getStyle(this.parentdesc, "left"));
			top += parseInt(getStyle(this.parentdesc, "top"));
			while(par != null)
			{
				par = par.parentNode;
				if(par != null)
				{
					if(par.id != null && par.id.length > 0)
					{
						if(!isNaN(parseInt(getStyle(par.id, "left"))))
							left += parseInt(getStyle(par.id, "left"));
						if(!isNaN(parseInt(getStyle(par.id, "top"))))
							top += parseInt(getStyle(par.id, "top"));
					}
				}
			}
			div.style.top = this.getIconTop() + top;
			div.style.left = this.getIconLeft() + left;
		}else
		{
			div.style.top = this.getIconTop();
			div.style.left = this.getIconLeft();
		}

		div.style.width = this.getIconWidth() +"px";
		div.style.height = this.getIconHeight() +"px";
		div.style.paddingLeft = this.icondragbarconstant +"px";
		var icon  = window.parent.ContentFrame.document.createElement("div");
		div.appendChild(icon);
		icon.style.backgroundColor = "rgb(195,214,233)";
		icon.style.postion = "relative";
		if(document.all)
			icon.style.width = this.getIconWidth() - this.icondragbarconstant +"px";
		
		icon.style.height = this.getIconHeight() + "px";
		icon.style.backgroundImage = "URL('" + window.parent.ContentFrame.base4xUrl + this.iconpath + "')"
		icon.style.backgroundRepeat =  "no-repeat";
		icon.style.backgroundPosition =  "center left";
		icon.style.paddingLeft = this.getIconWidth() +"px"; 
		if(document.all)
			icon.style.paddingTop = "7px";
		icon.style.overflow = "hidden";
		var title  = window.parent.ContentFrame.document.createElement("div");
		title.style.whiteSpace = "nowrap";
		
		icon.appendChild(title);
		title.innerHTML = this.getTitle();
		
		if(!document.all && !isSafari())
			icon.style.width = this.getIconWidth() - title.offsetWidth +"px";
		
		icon.onclick = window.parent.openwindow;
		title.onclick = window.parent.openwindow;
		this.icondiv = div;
		div.style.zIndex = 5000;
		div.innerframe = this;
		if(document.all)
			div.isIE = true;	
	}
	
	InnerFrame.prototype.createInnerFrameWindow = function()
	{
		var inner  = window.parent.ContentFrame.document.createElement("div");
		inner.id = "innerwindow"
		inner.className = "maininnerframewindow"
		this.InitInnerFrameEvents(inner);
		window.parent.ContentFrame.document.body.appendChild(inner);
		inner.style.position = "absolute";
		inner.style.top = this.getTop();
		inner.style.left = this.getLeft();
		inner.style.width = this.getWidth();
		inner.style.height = this.getHeight();
		inner.style.border = "thin solid rgb(238,238,238)";
		inner.style.backgroundColor = "rgb(238,238,238)";
		inner.style.visibility = "visible";
		inner.style.zIndex = 5000;
		inner.innerframe = this;
		this.ifwindowdiv = inner;
	
		var icon  = window.parent.ContentFrame.document.createElement("div");
		inner.appendChild(icon);
		icon.style.backgroundColor = "rgb(238,238,238)";
		icon.style.postion = "absolute";
		if(document.all)
			icon.style.width = this.getIconWidth() +"px";
		icon.style.height = this.toolbarheightconstant + "px";
		icon.style.backgroundImage = "URL('" + window.parent.ContentFrame.base4xUrl + this.iconpath + "')"
		icon.style.backgroundRepeat =  "no-repeat";
		icon.style.backgroundPosition =  "center left";
		icon.style.paddingLeft = this.getIconWidth()/1.5 +"px";
		icon.style.backgroundColor = "rgb(238,238,238)";
		if(document.all)
			icon.isIE = true;
		icon.id = "icon";	
		icon.className = "innerframewindow";
		
		var title  = window.parent.ContentFrame.document.createElement("div");
		icon.appendChild(title);
		title.style.whiteSpace = "nowrap";
		title.innerHTML = this.getTitle();
		title.style.backgroundColor = "rgb(238,238,238)";
		if(document.all)
			title.isIE = true;
		else
			title.style.position = "absolute";
		title.id = "title";
		title.className = "innerframewindow";
		
		//add dragbar
		var dragbar  = window.parent.ContentFrame.document.createElement("span");
		this.buttonwidths = this.toolbarbuttonwidthsconstant
		if(this.isMaximizable())
			this.buttonwidths += this.toolbarbuttonwidthsconstant;
		if(this.isClosable())
			this.buttonwidths += this.toolbarbuttonwidthsconstant;
		this.titlewidth = title.offsetWidth;
		dragbar.style.width = this.getWidth() - (this.getIconWidth()/1.5) - title.offsetWidth - this.buttonwidths + "px" 
		dragbar.style.height = this.getIconHeight()/2 + "px";
		dragbar.style.backgroundImage = "URL('/als/images/pb/horizdragbar.bmp')"; 
		dragbar.style.backgroundRrepeat = "repeat-x"; 
		dragbar.style.backgroundColor = "rgb(238,238,238)";
		title.appendChild(dragbar);
		if(document.all)
			dragbar.isIE = true;
		else
			dragbar.style.position = "absolute";
			
		dragbar.id = "dragbar";
		dragbar.className = "innerframewindow"
		
		//add minimize button
		var minbutton = window.parent.ContentFrame.document.createElement("span");
		title.appendChild(minbutton);
		minbutton.style.width = this.toolbarbuttonwidthsconstant + "px"; 
		minbutton.style.height = this.getIconHeight()/2 + "px";
		minbutton.style.backgroundImage = "URL('/als/images/pb/minbutton.bmp')"; 
		minbutton.style.backgroundRepeat = "no-repeat"; 
		minbutton.style.backgroundPosition = "top center";
		minbutton.onclick = window.parent.minimize;
		minbutton.id = "minbutton";
		if(!document.all)
		{
			minbutton.style.position = "absolute";
			minbutton.style.left = title.offsetWidth + dragbar.offsetWidth - this.toolbarbuttonwidthsconstant + "px";
		}

		if(this.isMaximizable())
		{
			var maxbutton = window.parent.ContentFrame.document.createElement("span");
			title.appendChild(maxbutton);
			maxbutton.style.width = this.toolbarbuttonwidthsconstant + "px";
			maxbutton.style.height = this.getIconHeight()/2 + "px";
			maxbutton.style.backgroundImage = "URL('/als/images/pb/maxbutton.bmp')"; 
			maxbutton.style.backgroundRepeat = "no-repeat"; 
			maxbutton.style.backgroundPosition = "top center";
			maxbutton.id = "maxbutton";
			maxbutton.onclick = window.parent.maximize;
			if(!document.all)
			{
				maxbutton.style.position = "absolute";
				maxbutton.style.left = parseInt(minbutton.style.left) + this.toolbarbuttonwidthsconstant + "px";
			}
		}

		if(this.isClosable())
		{
			var closebutton = window.parent.ContentFrame.document.createElement("span");
			title.appendChild(closebutton);
			closebutton.style.width = this.toolbarbuttonwidthsconstant + "px"; 
			closebutton.style.height = this.getIconHeight()/2 + "px";
			closebutton.style.backgroundImage = "URL('/als/images/pb/closebutton.bmp')"; 
			closebutton.style.backgroundRepeat = "no-repeat"; 
			closebutton.style.backgroundPosition = "top center";
			closebutton.id = "closebutton";
			closebutton.onclick = window.parent.closewindow;
			if(!document.all)
			{
				closebutton.style.position = "absolute";
				if(maxbutton != null)
					closebutton.style.left = parseInt(maxbutton.style.left) + this.toolbarbuttonwidthsconstant + "px";	
				else
					closebutton.style.left = parseInt(minbutton.style.left) + this.toolbarbuttonwidthsconstant + "px";	
			}
		}
		
		if(this.isResizable())
		{
			//Resize doesn't currently work for Netscape or Safari
			//Scott H.		
			
			var contentwindow  = window.parent.ContentFrame.document.createElement("div");
			inner.appendChild(contentwindow);
			contentwindow.style.whiteSpace = "nowrap";
			contentwindow.id = "contentwindow";
			contentwindow.style.backgroundColor = "rgb(238,238,238)"
						
			var leftresize  = window.parent.ContentFrame.document.createElement("span");
			contentwindow.appendChild(leftresize);
			leftresize.id = "leftresize";
			leftresize.style.width = "2px";
			leftresize.style.height = this.getHeight() + 4 +"px";
			leftresize.style.backgroundColor = "rgb(238,238,238)";
			leftresize.style.cursor = "e-resize";
			leftresize.onmousedown = resize;
			leftresize.onmouseup = stopresize;
			if(document.all)
				leftresize.isIE = true;
			
			var content = this.findContent();
			contentwindow.appendChild(content);
			content.id = "content";
			content.style.width =  inner.offsetWidth - 8 + "px" 
			content.style.height = this.getHeight() + "px";
			content.style.visibility = "visible" 
			content.style.backgroundColor = "white";
			
			if(document.all)
			{
				//The purpose of the this transparent div is to overlay the iframe.
				//Iframes don't have onmousemove events so when the mouse moved over 
				//the iframe it stoped moving the innerframe. The div does have mouseover
				//events so the innerframe still moves when the mouse is over it.
				var trans  = window.parent.ContentFrame.document.createElement("div");
				contentwindow.appendChild(trans);
				trans.id = "trans";
				trans.style.position = "absolute";
				trans.style.top = 22;
				trans.style.left = 2;
				trans.style.width =  inner.offsetWidth - 8 + "px"
				trans.style.height = this.getHeight() +"px";
				trans.style.backgroundColor = "transparent";
			}
		
			var rightresize  = window.parent.ContentFrame.document.createElement("span");
			contentwindow.appendChild(rightresize);
			rightresize.id = "rightresize";
			rightresize.style.width = "2px";
			rightresize.style.height = this.getHeight() + 4 +"px";
			rightresize.style.backgroundColor = "rgb(238,238,238)";
			rightresize.style.cursor = "e-resize";
			rightresize.onmousedown = resize;
			rightresize.onmouseup = stopresize;
			if(document.all)
				rightresize.isIE = true;			
			
			var bottomrow  = window.parent.ContentFrame.document.createElement("div");
			inner.appendChild(bottomrow);
			bottomrow.style.whiteSpace = "nowrap"
			bottomrow.style.maxHeight = "2px";
						
			var leftcorner  = window.parent.ContentFrame.document.createElement("span");
			bottomrow.appendChild(leftcorner);
			leftcorner.id = "leftcorner";
			leftcorner.style.width = "2px";
			leftcorner.style.height = "2px";
			leftcorner.style.backgroundColor = "rgb(238,238,238)";
			leftcorner.style.cursor = "sw-resize";
			window.parent.ContentFrame.document.onmousedown = resize;
			window.parent.ContentFrame.document.onmouseup = stopresize;
			if(document.all)
				leftcorner.isIE = true;
			
			var bottom  = window.parent.ContentFrame.document.createElement("span");
			bottomrow.appendChild(bottom);
			bottom.id = "bottom";
			bottom.style.width =  inner.offsetWidth - 8 + "px" 
			bottom.style.height = "2px";
			bottom.style.backgroundColor = "rgb(238,238,238)";
			bottom.style.cursor = "s-resize";
			window.parent.ContentFrame.document.onmousedown = resize;
			window.parent.ContentFrame.document.onmouseup = stopresize;
			if(document.all)
				bottom.isIE = true;
			
			var rightcorner  = window.parent.ContentFrame.document.createElement("span");
			bottomrow.appendChild(rightcorner);
			rightcorner.id = "rightcorner";
			rightcorner.style.width = "2px";
			rightcorner.style.height = "2px";
			rightcorner.style.backgroundColor = "rgb(238,238,238)";
			rightcorner.style.cursor = "se-resize";
			window.parent.ContentFrame.document.onmousedown = resize;
			window.parent.ContentFrame.document.onmouseup = stopresize;
			if(document.all)
				rightcorner.isIE = true;
		}else
		{
			var content = this.findContent();
			inner.appendChild(content);
			content.id = "content";
			content.style.width =  inner.offsetWidth - 4 + "px" 
			content.style.height = this.getHeight() +"px";
			content.style.visibility = "visible"
			if(document.all)
				content.isIE = true;
			content.className = "innerframewindow"
			content.style.backgroundColor = "white";
						
			if(document.all)
			{
				//The purpose of the this transparent div is to overlay the iframe.
				//Iframes don't have onmousemove events so when the mouse moved over 
				//the iframe it stoped moving the innerframe. The div does have mouseover
				//events so the innerframe still moves when the mouse is over it.
				var trans  = window.parent.ContentFrame.document.createElement("div");
				inner.appendChild(trans);
				trans.id = "trans";
				trans.style.position = "absolute";
				trans.style.top = 22;
				trans.style.left = 0;
				trans.style.width =  inner.offsetWidth - 4 + "px" 
				trans.style.height = this.getHeight() +"px";
				trans.style.backgroundColor = "transparent";	
				trans.onmouseup = cleanup;
			}
		}
	}

	InnerFrame.prototype.findContent = function() 
	{
		var content;
		var contentpar  = window.parent.ContentFrame.document.getElementById(this.contentid);
		if(contentpar != null && this.contentInnerHTML == null)
		{
			this.contentInnerHTML = contentpar.innerHTML
			if(contentpar.style.width.length < 1 )
			{
				content = contentpar.firstChild
				while(content.style == null || content.style.width.length < 1)
					content = content.nextSibling;
			}
			window.parent.macapiframe.content = content;
		}else
		{
			var framecontent = window.parent.macapiframe.content;
			if(document.all)
			{
				//I have to do this because IE won't let me access the content variable
				//in the macapiframe.
				var contenthtml;
				if(this.contentInnerHTML != null)
					contenthtml = this.contentInnerHTML
				else
					contenthtml = this.contentid
				content  = window.parent.ContentFrame.document.createElement("div");	
				content.innerHTML = contenthtml;
				content = content.firstChild
			}else if(framecontent != null)
				content = document.importNode(window.parent.macapiframe.content, true)
		}
		return content
	}
	
	InnerFrame.prototype.InitInnerFrameEvents = function(div) 
	{
		div.onmousedown = drag;
		div.onmouseup = cleanup;
	}	
	
	InnerFrame.prototype.getWidth = function()
	{
		return this.innerwidth
	}
	
	InnerFrame.prototype.getHeight = function()
	{
		return this.innerheight
	}
	
	InnerFrame.prototype.getDescription = function()
	{
		return this.description
	}
	
	InnerFrame.prototype.getParentDescription = function()
	{
		return this.parentdesc
	}	
	
	InnerFrame.prototype.getTitle = function()
	{
		return this.title
	}	
	
	InnerFrame.prototype.getTop = function()
	{
		return this.innertop
	}	
	
	InnerFrame.prototype.getLeft = function()
	{
		return this.innerleft
	}
	
	InnerFrame.prototype.getIconPath = function()
	{
		return this.iconpath
	}
	
	InnerFrame.prototype.getIconWidth = function()
	{
		return this.iconwidth
	}
	
	InnerFrame.prototype.getIconHeight = function()
	{
		return this.iconheight
	}
	
	InnerFrame.prototype.getIconTop = function()
	{
		return this.icontop
	}	
	
	InnerFrame.prototype.getIconLeft = function()
	{
		return this.iconleft
	}	
	
	InnerFrame.prototype.getIconDiv = function()
	{
		return this.icondiv
	}
	
	InnerFrame.prototype.getInnerFrameWindowDiv = function()
	{
		return this.ifwindowdiv
	}	
	
	InnerFrame.prototype.isAlwaysOnTop = function()
	{
		return this.alwaysOnTop
	}
	
	InnerFrame.prototype.isAutoClose = function()
	{
		return this.autoClose
	}
	
	InnerFrame.prototype.isResizable = function()
	{
		return this.resizable
	}
	
	InnerFrame.prototype.isClosable = function()
	{
		return this.closable
	}	
	
	InnerFrame.prototype.isMaximizable = function()
	{
		return this.maximizable
	}	
	
	InnerFrame.prototype.isIconifiable = function()
	{
		return this.iconifiable
	}
	
	InnerFrame.prototype.isIconified = function()
	{
		return this.iconified
	}
	
	InnerFrame.prototype.isMaximized = function()
	{
		if(this.maximized == null)
			return false;
		else
			return this.maximized
	}
	
	InnerFrame.prototype.setMaximized = function(bool)
	{
		this.maximized = bool;
	}
	
	InnerFrame.prototype.saveState = function()
	{
		var stateArray = new Array();
		stateArray[0] = this.getParentDescription();
		stateArray[1] = this.getDescription();
		if(this.contentInnerHTML != null && this.contentInnerHTML.length > 0)
			stateArray[2] = this.contentInnerHTML;
		else
			stateArray[2] = this.contentid
		if(this.getInnerFrameWindowDiv() == null || this.isMaximized())
		{
			stateArray[3] = this.getLeft();
			stateArray[4] = this.getTop();
			stateArray[5] = this.getWidth();
			stateArray[6] = this.getHeight();
		}else
		{
			stateArray[3] = parseInt(this.getInnerFrameWindowDiv().style.left);
			stateArray[4] = parseInt(this.getInnerFrameWindowDiv().style.top);
			stateArray[5] = parseInt(this.getInnerFrameWindowDiv().style.width);
			stateArray[6] = parseInt(this.getInnerFrameWindowDiv().style.height);
		}
		stateArray[7] = this.getTitle();
		stateArray[8] = this.getIconPath();
		stateArray[9] = this.isIconifiable();
		stateArray[10] = this.isIconified();
		if(this.getIconDiv() == null)
		{
			stateArray[11] = this.getIconLeft();
			stateArray[12] = this.getIconTop();
		}else
		{
			stateArray[11] = parseInt(this.getIconDiv().style.left);
			stateArray[12] = parseInt(this.getIconDiv().style.top);
		}
		stateArray[13] = this.getIconWidth();
		stateArray[14] = this.getIconHeight();
		stateArray[15] = this.isAlwaysOnTop();
		stateArray[16] = this.isAutoClose();
		stateArray[17] = this.isResizable();
		stateArray[18] = this.isClosable();
		stateArray[19] = this.isMaximizable();
		stateArray[20] = this.isMaximized();
		window.parent.macapiframe.innerFrameParams = stateArray;
	}	
	
	InnerFrame.prototype.maximize = function()
	{
		var obj = this.getInnerFrameWindowDiv();
		if(obj != null)
		{
			var maxbutton = window.parent.ContentFrame.document.getElementById("maxbutton")
			if(maxbutton != null)
			{
				var dragbar = window.parent.ContentFrame.document.getElementById("dragbar")
				var cnt = window.parent.ContentFrame.document.getElementById("content");
				var bottom = window.parent.ContentFrame.document.getElementById("bottom");
				var title = window.parent.ContentFrame.document.getElementById("title");
				var lft = window.parent.ContentFrame.document.getElementById("leftresize");
				var rgt = window.parent.ContentFrame.document.getElementById("rightresize");
				var trans = window.parent.ContentFrame.document.getElementById("trans");
				var bordersize = 0
				if(this.isResizable())
					bordersize = 2;
				if(this.isMaximized())
				{
					this.lockit=setInterval("window.parent.ContentFrame.scrollTo(0,0)",10);
					maxbutton.style.backgroundImage = "URL('/als/images/pb/maxbutton.bmp')";
					dragbar.style.width = this.getWidth() - (this.getIconWidth()/1.5) - this.titlewidth - this.buttonwidths + "px"
					cnt.style.width = this.getWidth() - (bordersize*2) - 1 ;
					if(trans != null)
						trans.style.width = this.getWidth() - (bordersize*2) - 1 ;
					if(bottom != null)
						bottom.style.width = this.getWidth() - (bordersize*2) - 1;
					obj.style.top = this.getTop();
					obj.style.left = this.getLeft();
					obj.style.width = this.getWidth();
					obj.style.height = this.getHeight();	
					if(lft != null)
						lft.style.height = this.getHeight();
					if(rgt != null)
						rgt.style.height = this.getHeight();
					cnt.style.height = this.getHeight();
					if(trans != null)
						trans.style.height = this.getHeight();
					this.setMaximized(false);
				}else
				{
					clearInterval(this.lockit);
					maxbutton.style.backgroundImage = "URL('/als/images/pb/maxminbutton.bmp')";
					this.scrollbarwidthconstant = 23
					dragbar.style.width = (screen.availWidth-this.scrollbarwidthconstant) - (this.getIconWidth()/1.5) - this.titlewidth - this.buttonwidths + "px" 
					cnt.style.width = screen.availWidth-this.scrollbarwidthconstant - (bordersize*2) -1 + "px"
					if(trans != null)
						trans.style.width = screen.availWidth-this.scrollbarwidthconstant - (bordersize*2) -1 + "px"
					if(bottom != null)
						bottom.style.width = screen.availWidth-this.scrollbarwidthconstant - (bordersize*2) - 1 + "px"
					obj.style.top = 0
					obj.style.left = 0
					obj.style.width = screen.availWidth - this.scrollbarwidthconstant +"px"
					if(lft != null)
						lft.style.height = screen.availHeight +"px"
					if(rgt != null)
						rgt.style.height = screen.availHeight +"px"
					cnt.style.height = screen.availHeight +"px"
					if(trans != null)
						trans.style.height = screen.availHeight +"px"
					obj.style.height = screen.availHeight +"px"
					this.setMaximized(true);
				}
				
				if(!document.all)
				{
					var minbutton = window.parent.ContentFrame.document.getElementById("minbutton");
					var maxbutton = window.parent.ContentFrame.document.getElementById("maxbutton");
					var closebutton = window.parent.ContentFrame.document.getElementById("closebutton");
					minbutton.style.left = title.offsetWidth + dragbar.offsetWidth - this.toolbarbuttonwidthsconstant + "px";
					maxbutton.style.left = parseInt(minbutton.style.left) + this.toolbarbuttonwidthsconstant + "px";
					if(closebutton != null)
						closebutton.style.left = parseInt(maxbutton.style.left) + this.toolbarbuttonwidthsconstant + "px";
				}
			}
		}

		
	}	
	
	InnerFrame.prototype.minimize = function()
	{
		var obj = this.getInnerFrameWindowDiv();
		if(obj != null)
		{
			obj.style.visibility = "hidden";
			window.parent.ContentFrame.document.getElementById("content").style.visibility = "hidden";
			if(this.getIconDiv() == null)
				this.createIconWindow();
			else
				this.getIconDiv().style.visibility = "visible";
			this.iconified = true;
			window.parent.ContentFrame.clearInterval(this.lockit);

		}

		
	}
	
	InnerFrame.prototype.openwindow = function()
	{
		var obj = this.getIconDiv();
		if(obj != null)
		{
			obj.style.visibility = "hidden";
			if(this.getInnerFrameWindowDiv() == null)
				this.createInnerFrameWindow();
			else
			{
				this.getInnerFrameWindowDiv().style.visibility = "visible";
				window.parent.ContentFrame.document.getElementById("content").style.visibility = "visible";
			}
			this.iconified = false;
			this.lockit=window.parent.ContentFrame.setInterval("window.parent.ContentFrame.scrollTo(0,0)",10);
		}
	}
	
	InnerFrame.prototype.closewindow = function()
	{
		this.getInnerFrameWindowDiv().style.visibility = "hidden";
		window.parent.ContentFrame.document.getElementById("content").style.visibility = "hidden";		
	}	
	
	this.createNewPanel();
}

var offsetX = 0;
var offsetY = 0;
var innerFrame = null;

function drag(event)
{
      var htype = '-moz-grabbing';
      if (event == null) 
      {
	event = window.parent.ContentFrame.event; 
	htype = 'move';
      }
      var target = event.target != null ? event.target : event.srcElement;
      if(target != null)
      {
	 var IE = target.isIE;
	 if (((IE && event.button <= 1) || (!IE && event.button == 0)) && (target.className == 'innerframeicon' || target.className == 'innerframewindow'))
	 {
		 if(target.className != 'innerframeicon')
		 {
		 	while(target.className != "maininnerframewindow")
			{
				target = target.parentNode;	
			} 
		 }
		 target.style.cursor=htype;
		 offsetX = event.clientX-parseInt(target.style.left);
		 offsetY = event.clientY-parseInt(target.style.top);
		 innerFrame = target;
	         window.parent.ContentFrame.document.onmousemove = move;
	         
		 // cancel out any text selections
		 if(IE)
		 {
		 	document.body.focus();

		 	// prevent text selection in IE
		 	document.onselectstart = function () { return false; };
		 	// prevent IE from trying to drag an image
		 	target.ondragstart = function() { return false; };
		 }else
		 {
		   	// prevent text selection (except IE)
		 	return false;		 
		 }	 
		
	 }
      }else
      	alert("drag target == null");
}

function cleanup()
{
    if (innerFrame != null)
    {
    	window.parent.ContentFrame.document.onmousemove = null;
	innerFrame.onselectstart = null;
	innerFrame.ondragstart = null;
	innerFrame.style.cursor = "default";
	innerFrame = null;
    }
}

function move(event)
{
	if (event == null) 
		event = window.parent.ContentFrame.event;  
	if(innerFrame != null)
	{
		innerFrame.style.left = event.clientX-offsetX+'px';
		innerFrame.style.top = event.clientY-offsetY+'px';
		return false;
	}
}

function openwindow(event)
{
      if (event == null) 
      	event = window.parent.ContentFrame.event; 
      var target = event.target != null ? event.target : event.srcElement;
      if(target != null)
      {
      	while(target.className != "innerframeicon")
      	{
      		target = target.parentNode;	
      	}
      	if(target.className == "innerframeicon")
		target.innerframe.openwindow();
      }
}

function minimize(event)
{
      if (event == null) 
      	event = window.parent.ContentFrame.event; 
      var target = event.target != null ? event.target : event.srcElement;
      if(target != null)
      {
      	while(target.className != "maininnerframewindow")
      	{
      		target = target.parentNode;	
      	}
      	if(target.className == "maininnerframewindow")
		target.innerframe.minimize();
      }

}

function maximize(event)
{
      if (event == null) 
      	event = window.parent.ContentFrame.event; 
      var target = event.target != null ? event.target : event.srcElement;
      if(target != null)
      {
      	while(target.className != "maininnerframewindow")
      	{
      		target = target.parentNode;	
      	}
      	if(target.className == "maininnerframewindow")
		target.innerframe.maximize();
      }
}

function closewindow(event)
{
      if (event == null) 
      	event = window.parent.ContentFrame.event; 
      var target = event.target != null ? event.target : event.srcElement;
      if(target != null)
      {
      	while(target.className != "maininnerframewindow")
      	{
      		target = target.parentNode;	
      	}
      	if(target.className == "maininnerframewindow")
		target.innerframe.closewindow();
      }
}

var resizeevent;
var resizetarget;
var resizetargetparent;
var dragbarWidth;
var contentWidth;
var bottomWidth;
var curPosX;
var curPosY;
var curHeight;
var curWidth;

function resize(event)
{
	if (event == null) 
		event = window.parent.ContentFrame.event; 

	var target = event.target != null ? event.target : event.srcElement;
	if(target != null)
	{
		var IE = target.isIE;
		if (((IE && event.button <= 1) || (!IE && event.button == 0)) && (target.id == "leftresize" || target.id == "rightresize" || target.id == "leftcorner" || target.id == "rightcorner" || target.id == "bottom"))
		{
			resizetarget = target;
			while(target.id != "innerwindow")
			{
				target = target.parentNode;	
			}
			resizetargetparent = target;
			//gets position of click 
			curPosX = event.clientX;
			curPosY = event.clientY;
			//height of the div 
			curHeight = parseInt(resizetargetparent.style.height)
			//width of the div 
			curWidth = parseInt(resizetargetparent.style.width)
			resizeevent = event;
			if(resizetarget.id == "leftresize" || resizetarget.id == "rightresize")
				window.parent.ContentFrame.document.onmousemove = leftRightMove
			else if(resizetarget.id == "bottom")
				window.parent.ContentFrame.document.onmousemove = bottomMove
			else if(resizetarget.id == "leftcorner" || resizetarget.id == "rightcorner")
				window.parent.ContentFrame.document.onmousemove = cornerMove	
		}
	}
}

function stopresize()
{
	if (resizetarget != null)
	{
		window.parent.ContentFrame.document.onmousemove = null;
		resizetarget.onselectstart = null;
		resizetarget.ondragstart = null;
		resizetarget = null;
		resizeevent = null;
		resizetargetparent = null
		dragbarWidth = null;
		contentWidth = null;
		bottomWidth = null;
		parentWidth = null;
		curPosX = null;
		curPosY = null;
		curHeight = null;
		curWidth = null;	
	}
}

function bottomMove(newPos, element)
{
	if(resizeevent!= null && resizetargetparent != null)
		DoHeight(resizeevent.clientY, resizetargetparent);
}

function leftRightMove()
{
	if(resizeevent!= null && resizetargetparent != null)
		DoWidth(resizeevent.clientX, resizetargetparent);
}

function cornerMove(newPos, element)
{
	if(resizeevent!= null && resizetargetparent != null)
	{
		DoHeight(resizeevent.clientY, resizetargetparent);
		DoWidth(resizeevent.clientX, resizetargetparent);
	}
}

function DoHeight(y, element)
{
	var lft = window.parent.ContentFrame.document.getElementById("leftresize");
	var cnt = window.parent.ContentFrame.document.getElementById("content");
	var rgt = window.parent.ContentFrame.document.getElementById("rightresize");
	var trans = window.parent.ContentFrame.document.getElementById("trans");

	//get new mouse position 
	var newPos=y
	//calculate movement 
	var pxMove = parseInt(newPos-curPosY) 
	//determine new height 
	var newHeight = parseInt(curHeight+pxMove) 
	if(newHeight > -1)
	{
		lft.style.height = newHeight + "px";
		cnt.style.height = newHeight + "px";
		if(trans != null)
			trans.style.height = newHeight + "px";
		rgt.style.height = newHeight + "px";
		element.style.height = newHeight + "px"; 
	}
}

function DoWidth(x, element)
{

	var dragbar = window.parent.ContentFrame.document.getElementById("dragbar");
	var cnt = window.parent.ContentFrame.document.getElementById("content");
	var bottom = window.parent.ContentFrame.document.getElementById("bottom");
	var trans = window.parent.ContentFrame.document.getElementById("trans");
	var min = window.parent.ContentFrame.document.getElementById("minbutton");
	var max = window.parent.ContentFrame.document.getElementById("maxbutton");
	var close = window.parent.ContentFrame.document.getElementById("closebutton");
	var rightresize = window.parent.ContentFrame.document.getElementById("rightresize");
  	

	if(dragbarWidth == null)
		dragbarWidth = parseInt(dragbar.style.width)
	if(contentWidth == null)
		contentWidth = parseInt(cnt.style.width)
	if(bottomWidth == null)
		bottomWidth = parseInt(bottom.style.width)
	if(resizetarget.id == "leftresize" || resizetarget.id == "leftcorner")
	{
		//get new mouse position 
		var newPos=x;
		//calculate movement 
		var pxMove = parseInt(newPos-curPosX) 
		//determine new width 
		var newWidth = parseInt(curWidth+(-pxMove))
		//determine new left 
		var leftMove = parseInt(curPosX+pxMove) 
		if(newWidth > -1 && (dragbarWidth + -pxMove) > -1)
		{
			element.style.left = leftMove - 2 + "px"; 	
			dragbar.style.width = dragbarWidth + -pxMove + "px";
			cnt.style.width = contentWidth + -pxMove + "px"; 
			if(trans != null)
				trans.style.width = contentWidth + -pxMove + "px"; 
			bottom.style.width = bottomWidth + -pxMove + "px"; 
			element.style.width = newWidth + "px";
		}
	}else if(resizetarget.id == "rightresize" || resizetarget.id == "rightcorner")
	{
		//get new mouse position 
		var newPos=x;
		//calculate movement
		var pxMove = parseInt(newPos-curPosX) 
		//determine new width 
		var newWidth = parseInt(curWidth+pxMove)
		if(newWidth > -1 && (dragbarWidth + pxMove) > -1)
		{
			dragbar.style.width = dragbarWidth + pxMove + "px";
			cnt.style.width = contentWidth + pxMove + "px"; 
			if(trans != null)
				trans.style.width = contentWidth + pxMove + "px"; 
			bottom.style.width = bottomWidth + pxMove + "px"; 
			element.style.width = newWidth + "px";
		}
	}
}

function isSafari()
{
	return navigator.userAgent.indexOf('Safari')>0
}
