function formatField(objField, strFormat)
{
	if(document.all)
	{
		if(event.keyCode == 46 | event.keyCode == 8) return
		if(document.selection.createRange().offsetLeft < objField.createTextRange().boundingWidth) return
	}
	for( i = 0 ; i < strFormat.length ; i++)
	{
		if(strFormat.charAt(i) == "#") // the current character must be a digit
		{
			if(objField.value.length > i )
			{
				if(isNaN(objField.value.charAt(i)) || objField.value.charAt(i) == " ") // if its not a number, it's erased and the loop is set back one
				{
					objField.value = objField.value.substring(0,i) + objField.value.substring(i + 1,objField.value.length)
					i--
				}
			}
		}
		else if(strFormat.charAt(i) == "a") // the current character must be a letter (case insensitive)
		{
			if(objField.value.length > i )
			{
				// if its not a letter, it's erased
				if(objField.value.charAt(i).toUpperCase() < "A" || objField.value.charAt(i).toUpperCase() > "Z" )
				{
					objField.value = objField.value.substring(0,i) + objField.value.substring(i + 1,objField.value.length)
					i--
				}
			}
		}
		else if(strFormat.charAt(i) == "A") // the current character must be an uppercase letter
		{
			if(objField.value.length > i )
			{
				// if its not a letter, it's removed
				if(objField.value.charAt(i).toUpperCase() < "A" || objField.value.charAt(i).toUpperCase() > "Z" )
				{
					objField.value = objField.value.substring(0,i) + objField.value.substring(i + 1,objField.value.length)
					i--
				}
				else // otherwise, it is set to uppercase
				{
					objField.value = objField.value.substring(0,i) + objField.value.charAt(i).toUpperCase() + objField.value.substring(i + 1,objField.value.length)
				}
			}
		}
		else // the current character must be the same as the one in the format string
		{
			if(objField.value.length > i )
			{
				// if it isn't already the correct character, insert the character
				if(objField.value.charAt(i) != strFormat.charAt(i))
				{
					objField.value = objField.value.substring(0,i) + strFormat.charAt(i) + objField.value.substring(i,objField.value.length)
				}
			}
		}
	}
	if(objField.value.length > strFormat.length)
	{
		objField.value = objField.value.substring(0,strFormat.length)
	}
}

function getposOffset(overlay, offsettype){
var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
var parentEl=overlay.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function overlay(curobj, subobj){
if (document.getElementById){
var subobj=document.getElementById(subobj)
subobj.style.left=getposOffset(curobj, "left")+"px"
subobj.style.top=getposOffset(curobj, "top")+"px"
subobj.style.display="block"
return false
}
else
return true
}

function overlayclose(subobj){
document.getElementById(subobj).style.display="none"
}

var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
win=window.open(mypage,myname,settings);}

