function cmsmenu(){
	var menuItems = $$('#cmsmenu LI A');
	for(var i=0; i<menuItems.length; i++){if(menuItems[i].href==document.location.href){menuItems[i].addClassName('current')}}
}
if(document.location.href.indexOf('tools')>0){Event.observe(window, 'load', function() { cmsmenu() });}

var overlay = {
	container: null,
	windowClass: 'dialog',
	windowWidth: '40%',
	windowHeight: '400px',
	create: function(contents) {
		if(document.getElementById('overlay')){document.getElementsByTagName("body")[0].removeChild(document.getElementById('overlay'))}
		this.container			= document.createElement("div");
		this.height				= document.documentElement.clientHeight;
		this.width				= document.documentElement.clientWidth;
		this.container.id		= 'overlay';
		if(contents)
		{//contents = contents.replace("'","\'");
			this.container.innerHTML	= '<div class="' + this.windowClass + '" style="width:' + this.windowWidth + ';height:' + this.windowHeight + '">' + contents + '</div>';
		}
		// add the newly created element and it's content into the DOM
		if(document.getElementsByTagName("body")[0]) {
			document.getElementsByTagName("body")[0].appendChild(this.container);
		} else {
			document.write(this.container);
		}
	},
	toggle: function() {
		if (!this.container) {
			this.create()
		}
		el	=$("overlay");
		if(el.style.visibility == "visible") {
			el.style.visibility		= "hidden"
		} else {	
			el.style.width			= this.width;
			el.style.height			= this.height;
			el.style.visibility		= "visible"
		}
	}
};

var popupWindow = 
	{
		modal: 1,
		width: '650px',
		height: '440px',
		center: 1,
		url:	'',
		rValue: '',
		parameters: '',
		open: function()
		{
			if(this.modal)
			{
				//document.getElementsByTagName("body")[0].appendChild(ScreenDim.on());
				this.rValue = window.showModalDialog(this.url, this.parameters, 'dialogHeight:'+this.height+'; dialogWidth:'+this.width+'; center:'+this.center+';')
			}
			else
			{
				this.rValue = window.open(this.url,this.parameters,"toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, scroll=no, resizable=no, copyhistory=no, width="+this.width+", height="+this.height);
			}
			return this.rValue;
		}
	}
