var registerwindow = 
{
	gradientshadow_depth:7, //Depth of shadow in pixels
	gradientshadow_glow:1,
	gradientshadow_containers:[],

	createRegisterTypeWindow:function()
	{
		this.divobj = document.getElementById('user_type');
	},

	gradientshadow_create:function()
	{
		if (this.divobj.className == "shadow") 
		{
			for (var x=0; x < this.gradientshadow_depth; x++)
			{
				var newSd = document.createElement("DIV")
				newSd.className = "shadow_inner"
				newSd.id="shadow"+this.gradientshadow_containers.length+"_"+x //Each shadow DIV has an id of "shadowL_X" (L=index of target element, X=index of shadow (depth) 
				if (this.divobj.getAttribute("rel"))
					newSd.style.background = this.divobj.getAttribute("rel")
				else
					newSd.style.background = "black" //default shadow color if none specified
				document.body.appendChild(newSd)
			}
			this.gradientshadow_containers[this.gradientshadow_containers.length]=this.divobj
		}

		if (this.gradientshadow_containers.length > 0)
		{
			for (var i=0; i < this.gradientshadow_containers.length; i++)
			{
				for (var x=0; x < this.gradientshadow_depth; x++)
				{
					var shadowdiv=document.getElementById("shadow"+i+"_"+x)
					shadowdiv.style.visibility = "hidden"
					shadowdiv.style.display = "none"
				}
			}
		}
	},
	
	gradientshadow_hide:function()
	{
		if (this.gradientshadow_containers.length > 0)
		{
			for (var i=0; i < this.gradientshadow_containers.length; i++)
			{
				for (var x=0; x < this.gradientshadow_depth; x++)
				{
					var shadowdiv=document.getElementById("shadow"+i+"_"+x)
					shadowdiv.style.visibility = "hidden"
					shadowdiv.style.display = "none"
				}
			}
		}
	},

	gradientshadow_position:function()
	{
		if (this.gradientshadow_containers.length > 0)
		{
			for (var i=0; i < this.gradientshadow_containers.length; i++)
			{
				for (var x=0; x < this.gradientshadow_depth; x++)
				{
					var shadowdiv=document.getElementById("shadow"+i+"_"+x)
					shadowdiv.style.visibility = "visible"
					shadowdiv.style.display = "block"
					shadowdiv.style.width = this.gradientshadow_containers[i].offsetWidth + "px"
					shadowdiv.style.height = this.gradientshadow_containers[i].offsetHeight + "px"
					shadowdiv.style.left = this.gradientshadow_containers[i].offsetLeft + x - this.gradientshadow_glow + "px"
					shadowdiv.style.top = this.gradientshadow_containers[i].offsetTop + x - this.gradientshadow_glow + "px"
				}
			}
		}
	},

	
	showRegisterTypeWindow:function()
	{
		this.centerRegisterTypeWindow();
		this.divobj.style.visibility = "visible";
	},

	hideRegisterTypeWindow:function()
	{
		registerwindow.gradientshadow_hide();
		registerwindow.divobj.style.visibility = "hidden";
	},
	
	centerRegisterTypeWindow:function()
	{
		if (registerwindow.divobj.style.visibility == 'visible')
		{
			this.gradientshadow_position();
		}
		scrollbarwidth = 0;
		standardbody=(document.compatMode=="CSS1Compat")? document.documentElement : document.body //create reference to common "body" across doctypes
		var ie=document.all && !window.opera
		var dom=document.getElementById
		var scroll_top=(ie)? standardbody.scrollTop : window.pageYOffset
		var scroll_left=(ie)? standardbody.scrollLeft : window.pageXOffset
		var docwidth=(ie)? standardbody.clientWidth : window.innerWidth-scrollbarwidth
		var docheight=(ie)? standardbody.clientHeight: window.innerHeight
		var docheightcomplete=(standardbody.offsetHeight>standardbody.scrollHeight)? standardbody.offsetHeight : standardbody.scrollHeight //Full scroll height of document
		var objwidth=this.divobj.offsetWidth //width of div element
		var objheight=registerwindow.divobj.offsetHeight //height of div element
		var topposition=(docheight>objheight)? scroll_top+docheight/2-objheight/2+"px" : scroll_top+10+"px" //Vertical position of div element: Either centered, or if 
	
//		alert(docwidth + ' | ' + objwidth);
		registerwindow.divobj.style.left=docwidth/2-objwidth/2+"px" //Center div element horizontally
//		registerwindow.divobj.style.left="100px" //Center div element horizontally
		registerwindow.divobj.style.top=Math.floor(parseInt(topposition)) + "px"
		window.setTimeout("registerwindow.centerRegisterTypeWindow()", 0);
	},
	
	init:function()
	{
		registerwindow.createRegisterTypeWindow();
		registerwindow.hideRegisterTypeWindow();
		registerwindow.gradientshadow_create();
	}

}

if (window.addEventListener)
{
	window.addEventListener("load", registerwindow.init, false);
}
else if (window.attachEvent)
{
	window.attachEvent("onload", registerwindow.init);
}
else if (document.getElementById)
{
	window.onload=registerwindow.init;
}
