
function OpenPopup(pathName, width, height)
{	
	_left = (screen.width - width) / 2;
	_top = (screen.height - height) / 2;
	_popUp = window.open(
		pathName,
		'openpopup',
		'width=' + width + ',height=' + height + ',left=' + _left + ',top=' + _top + ',menubar=no,status=no,location=no,toolbar=no,scrollbars=yes,resizable=no');
}

function OpenResizeablePopup(pathName, width, height)
{	
	_left = (screen.width - width) / 2;
	_top = (screen.height - height) / 2;
	_popUp = window.open(
		pathName,
		'openpopup',
		'width=' + width + ',height=' + height + ',left=' + _left + ',top=' + _top + ',menubar=no,status=no,location=no,toolbar=no,scrollbars=yes,resizable=yes');
}

function SelectAllCheckboxes(spanChk)
{
	
	// Added as ASPX uses SPAN for checkbox 
	var oItem = spanChk.children;
	var theBox=oItem.item(0)
	xState=theBox.checked;	
	
		elm=theBox.form.elements;
		for(i=0;i<elm.length;i++)
		{
			if(elm[i].type=="checkbox" && elm[i].id!=theBox.id)
			{
				//elm[i].click();
				if(elm[i].checked!=xState)
					elm[i].click();
				//elm[i].checked=xState;
			}
		}
}


function HighlightRow(chkB)	
{
	var oItem = chkB.children;
	xState=oItem.item(0).checked;	
	if(xState)
		{chkB.parentElement.parentElement.style.backgroundColor='lightcoral';  // grdEmployees.SelectedItemStyle.BackColor
		 chkB.parentElement.parentElement.style.color='white'; // grdEmployees.SelectedItemStyle.ForeColor
		}else 
		{chkB.parentElement.parentElement.style.backgroundColor='white'; //grdEmployees.ItemStyle.BackColor
		 chkB.parentElement.parentElement.style.color='black'; //grdEmployees.ItemStyle.ForeColor
		}
}

function PutFocus(formInst, elementInst) 
{
	if (document.forms.length > 0) 
	{
		document.forms[formInst].elements[elementInst].focus();
	}
}

function ClearTxtBox(field) 
{
	if (field.value == "[Keywords]") 
	field.value = "";
}

function RefreshWindowOpener() 
{
	if( window.opener.document.getElementById("bRefresh") != null && 
		window.opener.document.getElementById("bRefresh").value == 1 )
	{
		window.opener.location = window.opener.location;
		window.opener.document.getElementById("bRefresh").value = 0;
	}
}

function SetRefreshParentFlag()
{
	if( window.opener.document.getElementById("bRefresh") != null )
	{
		window.opener.document.getElementById("bRefresh").value = 1;
	}
}

function RefreshWindow()
{
	window.location.reload( true );
}

function CloseWindow()
{
	self.close();
}

function PreventChars(e, inp) 
{
	// Clean off string \/:*?"<>|
	var isNS4 = (navigator.appName=="Netscape")?1:0;
	
	if(!isNS4)
	{
		if (e.keyCode == 92 || e.keyCode == 47 || e.keyCode == 58 || e.keyCode == 42 || e.keyCode == 63 || e.keyCode == 34 || e.keyCode == 60 || e.keyCode == 62 || e.keyCode == 124) 
			e.returnValue = false;
	}
	else
	{
		if (e.which == 92 || e.which == 47 || e.which == 58 || e.which == 42 || e.which == 63 || e.which == 34 || e.which == 60 || e.which == 62 || e.which == 124) 
			return false;
	}
}