function checkkeynumber()
{
	var LocKey					= window.event.keyCode;
	window.event.returnValue	=	true; 
	if ((LocKey < 48) || (LocKey > 57))
	{
		window.event.returnValue=	false; 
	} 
}

function checkemail(bEmail)
{
	//var emailPat	= /^(\".*\"|[A-Za-z]\w*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z]\w*(\.[A-Za-z]\w*)+)$/;
	var emailPat = "^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$";
	var matchArray	= bEmail.match(emailPat);
	if (matchArray == null)
	{
		alert("Your Email address seems incorrect. Please try again.");
		return false;
	}
	return true;
}

function CallPrint(strid)
{
	var prtContent	= document.getElementById(strid);
	var WinPrint	= window.open('','','left=0,top=0,width=1,height=1,toolbar=0,scrollbars=0,status=0');
	WinPrint.document.write("<LINK href='CSS/PathFinder_Print.css' type='text/css' rel='STYLESHEET'>" + prtContent.innerHTML);
	WinPrint.document.close();
	WinPrint.focus();
	WinPrint.print();
	WinPrint.close();
}

function SetFocus(ControlName)
{
	if (document.getElementById(ControlName) != null)
		document.getElementById(ControlName).focus();
}

// Key Down default handler
function KeyDownHandler(btn)
{
   // process only the Enter key
   if (event.keyCode == 13)
   {
      // cancel the default submit
      event.returnValue=false;
      event.cancel = true;
      // submit the form by programmatically clicking the specified button
      btn.click();
   }
 }
 //-------------------------------------------
 
function erascheckkeynumber()
{
	var LocObject = event.srcElement;
	if (LocObject.value.length > 2)
		window.event.returnValue =	false; 
	else 
	{
		var LocKey					= window.event.keyCode;
		window.event.returnValue	=	true; 
		if ((LocKey < 48) || (LocKey > 57))
		{
			window.event.returnValue=	false; 
		} 
	}	
}
 
function erascalculate(x)
{
	var LocElement = document.getElementById(x.substr(0, 21) + "Label");
		
	if (LocElement != null)
	{
		var bValue = 0;
		
		if (document.getElementById(x).value != "")
			bValue = parseInt(document.getElementById(x).value);
			
		var LocRet = 0; 
		
		try
		{	
			// Up to 10
			if (bValue >= 1)
				LocRet = 60;
			bValue = bValue - 10;

			// 11 - 20
			if (bValue >= 1)
			{
				if (bValue <= 10)
					LocRet = LocRet + bValue * 8;
				else 
					LocRet = LocRet + 80;

				bValue = bValue - 10;
			}

			// 21 - 30
			if (bValue >= 1)
			{
				if (bValue <= 10)
					LocRet = LocRet + bValue * 15;
				else 
					LocRet = LocRet + 150;

				bValue = bValue - 10;
			}

			// 31 -
			if (bValue >= 1)
				LocRet = LocRet + bValue * 25;
		}
		catch (err)
		{
			LocRet = 0;
		}	
	
		LocElement.innerHTML = "$" + LocRet + ".00";	
		
		bValue = 0;
		
		var LocNumber = 0;
		var LocElement1;
		
		for (var x = 2; x <= 20; x++)
		{
		    if (x < 10)
		        x = "0" + x;
		
			LocElement = document.getElementById("grdSpecialties_ctl" + x + "_Label");
			LocElement1 = document.getElementById("grdSpecialties$ctl" + x + "$Edit");
			
			if (LocElement != null && LocElement1 != null)
			{
				bValue = bValue + parseInt(LocElement.innerHTML.substring(1));
				
				if (LocElement1.value != "")
					LocNumber = LocNumber + parseInt(LocElement1.value);
			}
			else
				break;
		}
		
		LocElement = document.getElementById("lbNumber");
		
		if (LocElement != null)
			LocElement.innerHTML = LocNumber;
			
		LocElement = document.getElementById("lbTotal");
		
		if (LocElement != null)
			LocElement.innerHTML = "$" + bValue + ".00";
	}
}
//-------------------------------------------------


function eraslostfocus()
{
	var LocObject = event.srcElement;
	
	if (LocObject.value == "")
		LocObject.value = "0";
}
//-------------------------------------------------


