function NewWindow(mypage,myname,w,h,scroll)
{
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings =
	'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable';
	window.open(mypage,myname,settings);
}
function AttachEvent(obj, eventName, eventHandler)
{
	if(obj) 
	{
		if(eventName.substring(0, 2) == "on")
		{
			eventName = eventName.substring(2,eventName.length);
		}
		if(obj.addEventListener)
		{
			obj.addEventListener(eventName, eventHandler, false);
		}
		else if(obj.attachEvent)
		{
			obj.attachEvent('on'+eventName, eventHandler);
		}
	}
}
function Highlight()
{
	var el = document.getElementsByTagName('input');
	var focused = 0;
	for(var i=0;i<el.length;i++)
	{
		if(el[i].type == 'text'||el[i].type == 'password')
		{
			if(focused != 1)
			{
				el[i].focus();
				focused = 1;
			}
			el[i].onfocus = function()
			{
				this.style.borderColor = "#1E1ED2";
				this.style.backgroundColor = "#FFFFFF";
				this.style.color = "#000000";
			}
			el[i].onblur = function()
			{
				this.style.borderColor = "";
				this.style.backgroundColor = "";
				this.style.color = "";
			}
		}
	}
}
function CheckAll(trgt,state)
{
	var Inputs		= document.getElementsByTagName('input');
	var checked = false;
	if(state == true)
	{
		checked = true;
	}
	for (var i =0; i < Inputs.length; i++)
	{
		if(Inputs[i].type.toLowerCase() == 'checkbox')
		{
			if(trgt == 0 || trgt == '' || typeof trgt == 'undefined')
			{
				Inputs[i].checked = checked;
			}
			else
			{
				if(Inputs[i].name == trgt)
				{
					Inputs[i].checked = checked;
				}
			}
		}
	}
}
function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{
	var arVersion = navigator.appVersion.split("MSIE")
	var version = parseFloat(arVersion[1])
	if ((version >= 5.5) && (document.body.filters)) 
	{
		for(var i=0; i<document.images.length; i++)
		{
			var img = document.images[i]
			var imgName = img.src.toUpperCase()
			if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
			{
				var imgID = (img.id) ? "id='" + img.id + "' " : ""
				var imgClass = (img.className) ? "class='" + img.className + "' " : ""
				var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
				var imgStyle = "display:inline-block;" + img.style.cssText 
				if (img.align == "left") imgStyle = "float:left;" + imgStyle
				if (img.align == "right") imgStyle = "float:right;" + imgStyle
				if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
				var strNewHTML = "<span " + imgID + imgClass + imgTitle
				+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
				+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
				+ "(src=\'" + img.src + "\', sizingMethod='scale'); cursor:hand;\"></span>" 
				img.outerHTML = strNewHTML
				i = i-1
			}
		}
	}    
}
