///<script language="javascript">
///<!--
/// Set the first control focus in the page
/// Use method:
/// step 1:
///		Excerpt this script file in head element. 
///		Example 1 : <SCRIPT SRC='js/JScript.js' language="JAVASCRIPT"></SCRIPT>
///		Example 2 : <%Response.WriteFile(ResolveUrl("~/js/JScript.js"));%>
///		Use example 1 must be set current relative path ins scr attribute,
///		If use this,Must be remove <script> and </script> in this file first and last.
///		Use example 2 should be add <script> and </script> in file first and last. 
///		But not set relative path.
///	step 2:
///		Add "onload='SetFirstControlFocus(document.forms[0]);'" in the body element.
///		Example 1 : <body onload="SetFirstControlFocus(document.forms[0]);">
function SetFirstControlFocus(form)
{	
	try
	{	
		for (var i=0;i<form.elements.length;i++)
		{
			var e = form.elements[i];
			
			if(e.type == "text")
			{
				e.focus();
				break;
			}
			else if(e.type == "select-one")
			{
				e.focus();
				break;
			}
			else if(e.type == "button")
			{
				e.focus();
				break;
			}
			else if(e.type == "checkbox")
			{
				e.focus();
				break;
			}
			else if(e.type == "submit")
			{
				e.focus();
				break;
			}
			else if(e.type == "radio")
			{
				e.focus();
				break;
			}
		}
	}
	catch(e)
	{}
}
function SetFirstControlFocus()
{	
	try
	{	
		for (var i=0;i<document.forms[0].elements.length;i++)
		{
			var e = document.forms[0].elements[i];
			
			if(e.type == "text")
			{
				e.focus();
				break;
			}
			else if(e.type == "select-one")
			{
				e.focus();
				break;
			}
			else if(e.type == "button")
			{
				e.focus();
				break;
			}
			else if(e.type == "checkbox")
			{
				e.focus();
				break;
			}
			else if(e.type == "submit")
			{
				e.focus();
				break;
			}
			else if(e.type == "radio")
			{
				e.focus();
				break;
			}
		}
	}
	catch(e)
	{}
}
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	}
	else {
		window.onload = function() {
			oldonload();
			func();
		}
	}
}

// cancel click
function CancelClick()
{
	if(confirm('Are you sure to cancel and reset this form?'))
	{
		return true;
	}
	else
		return false;
}
// cancel click
function DisplayDate()
{
var d=new Date()
var weekday=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var monthname=new Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
document.write(weekday[d.getDay()] + " ")
document.write(d.getDate() + ". ")
document.write(monthname[d.getMonth()] + " ")
document.write(d.getFullYear())
}

// tree


// -->
//</script>