document.domain='nate.com';

function openWindow(pURL, pWinName, pWidth, pHeight)
{
	w = pWidth;
	h = pHeight;
	sx = (screen.width - w)/2;
	sy = (screen.height - h)/2;
	mywin = window.open(pURL,pWinName,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,resizable=yes,width='+w+',height='+h+',top='+sy+',left='+sx);
	mywin.focus();
}

function openWindow_noResizable(pURL, pWinName, pWidth, pHeight)
{
	w = pWidth;
	h = pHeight;
	sx = (screen.width - w)/2;
	sy = (screen.height - h)/2;
	mywin = window.open(pURL,pWinName,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=auto,resizable=no,width='+w+',height='+h+',top='+sy+',left='+sx);
	mywin.focus();
}

function openWindow_noScrollbars(pURL, pWinName, pWidth, pHeight)
{
	w = pWidth;
	h = pHeight;
	sx = (screen.width - w)/2;
	sy = (screen.height - h)/2 ;
	mywin = window.open(pURL,pWinName,'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width='+w+',height='+h+',top='+sy+',left='+sx);
	mywin.focus();
}

function openWindowToolbar(pURL, pWinName)
{
	mywin = window.open(pURL,pWinName);
	mywin.focus();
}

function goPage(pURL)
{
	document.location = pURL;
}

function isNumerics(pNum)
{
	return !pNum.match(/[^0-9]/i); 
}
	
function checkEngNum(pStr)
{
	var pattern = /^[a-zA-Z0-9]+$/;
	
	return pStr.match(pattern);
}

function validateEmail(pStr)
{
	s=pStr.value;
	
	if(s.search)
	{
		return (s.search(new RegExp("^([-!#$%&'*+./0-9=?A-Z^_`a-z{|}~])+@([-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+\\.)+[a-zA-Z]{2,4}$","gi"))>=0);
	}
	if(s.indexOf)
	{
		at_character=s.indexOf('@');
		
		if(at_character<=0 || at_character+4>s.length)
			return false;
	}
	
	if(s.length<6)
		return false;
	else
		return true;	
}

function checkBytes(pStr)
{
	var length = 0;
	
	for (var i=0; i<pStr.length; i++)
		length += (pStr.charCodeAt(i) > 128) ? 2 : 1;
		
	return length;
}

function getCheckedRadioValue(objName)
{
	var radioObject = document.all(objName);
	
	if(typeof(radioObject.length) == "undefined")
	{
		if(radioObject.checked)
		{
			return radioObject.value;
		}
	}
	
	for(i=0; i<radioObject.length; i++)
	{
		if(radioObject[i].checked)
		{
			return radioObject[i].value;
		}
	}	
}

function toggleDisplay(pElement)
{
	var element = document.getElementById(pElement);
	
	if(element.style.display == 'block')
		element.style.display = 'none';
	else
		element.style.display = 'block';
}