function win_Mail(src)
{ 
	window.showModalDialog(src,window,"center:yes;status:no;scroll:no;help:0;dialogWidth:300px;dialogHeight:330px");
}

function show_time(ctrlobj)
{
	showx = event.screenX - event.offsetX - 4 - 210 ; // + deltaX;
	showy = event.screenY - event.offsetY + 18; // + deltaY;
	newWINwidth = 210 + 4 + 18;

	retval = window.showModalDialog("/js/CalendarDlg.htm", "", "dialogWidth:300px; dialogHeight:210px; dialogLeft:"+showx+"px; dialogTop:"+showy+"px; status:no; directories:yes;scrollbars:no;Resizable=no; "  );
	if( retval != null ) ctrlobj.value = retval;
}

function tourl(form,url)
{
	if ((window.event.srcElement.value == "Del") && (window.event.srcElement.value == "Delete"))
	{
		if (confirm("Are You Sure To Delete It?"))
		{
			form.action=url;
			form.submit()
		}
	}
}

function BrushOffAll() 
{
	for (var i=0;i<Page_Validators.length;i++)
		ValidatorEnable(Page_Validators[i],false);
}

function BrushOnAll() 
{
	for (var i=0;i<Page_Validators.length;i++)
		ValidatorEnable(Page_Validators[i],true);
}

function SummaryOffAll() 
{
	for (var sums = 0; sums < Page_ValidationSummaries.length; sums++)
			Page_ValidationSummaries[sums].showmessagebox = "False";
}

function SummaryOnAll() 
{
	for (var sums = 0; sums < Page_ValidationSummaries.length; sums++)
			Page_ValidationSummaries[sums].showmessagebox = "True";
}

function SummaryEnable(val,enable) 
{
	val.showmessagebox = enable ? "True" : "Flase";
}

function PageSelf() 
{
	for (var i=0;i<document.links.length;i++)
		if ((document.links[i].innerText == "Prev") || (document.links[i].innerText == "Next") || (document.links[i].innerText == "First") || (document.links[i].innerText == "Last")) document.links[i].href="javascript:document.forms[0].target='_self';"+document.links[i].href.substring(11);
	for (var m=0;m<document.forms[0].elements.length;m++)
	{
		if (document.forms[0].elements[m].type == "submit")
		{
			if (document.forms[0].elements[m].onclick != null)
				document.forms[0].elements[m].onclick += new Function("document.forms[0].target='_self'")
			else
				document.forms[0].elements[m].onclick = new Function("document.forms[0].target='_self'")
		}
	}
}

function AllSelect(type)
{
	if (window.event.srcElement.n == "1")
	{
		for (var i = 0 ; i < document.forms[0].elements.length ; i++)
			if (document.forms[0].elements[i].type=="checkbox") document.forms[0].elements[i].checked = true;
		switch (type)
		{
			case "text":
				window.event.srcElement.innerText = "全不选";
				break;
			case "image":
				window.event.srcElement.src = "";
				break;
			case "button":
				window.event.srcElement.value = "全不选";
				break;
		}
		window.event.srcElement.n = "0";
	}
	else
	{
		for (var i = 0 ; i < document.forms[0].elements.length ; i++)
			if (document.forms[0].elements[i].type=="checkbox") document.forms[0].elements[i].checked = false;
		switch (type)
		{
			case "text":
				window.event.srcElement.innerText = "全选";
				break;
			case "image":
				window.event.srcElement.src = "";
				break;
			case "button":
				window.event.srcElement.value = "全选";
				break;
		}
		window.event.srcElement.n = "1";
	}
}

function AntiSelect()
{
	for (var i = 0 ; i < document.forms[0].elements.length ; i++)
	{
		if (document.forms[0].elements[i].type=="checkbox")
			document.forms[0].elements[i].checked == true ? document.forms[0].elements[i].checked = false : document.forms[0].elements[i].checked = true;
	}
}

function AllSelect1(type)
{
	if (window.event.srcElement.n == "1")
	{
		for (var i = 0 ; i < document.forms[0].elements.length ; i++)
		{
			if (document.forms[0].elements[i].type=="checkbox")
			{
				if (document.forms[0].elements[i].id!="Long_term")
					document.forms[0].elements[i].checked = true;
			}
		}
		switch (type)
		{
			case "text":
				window.event.srcElement.innerText = "全不选";
				break;
			case "image":
				window.event.srcElement.src = "";
				break;
			case "button":
				window.event.srcElement.value = "全不选";
				break;
		}
		window.event.srcElement.n = "0";
	}
	else
	{
		for (var i = 0 ; i < document.forms[0].elements.length ; i++)
		{
			if (document.forms[0].elements[i].type=="checkbox")
			{
				if (document.forms[0].elements[i].id!="Long_term")
					document.forms[0].elements[i].checked = false;
			}
		}
		switch (type)
		{
			case "text":
				window.event.srcElement.innerText = "全选";
				break;
			case "image":
				window.event.srcElement.src = "";
				break;
			case "button":
				window.event.srcElement.value = "全选";
				break;
		}
		window.event.srcElement.n = "1";
	}
}

function AntiSelect1()
{
	for (var i = 0 ; i < document.forms[0].elements.length ; i++)
	{
		if (document.forms[0].elements[i].type=="checkbox")
		{
			if (document.forms[0].elements[i].id!="Long_term")
				document.forms[0].elements[i].checked == true ? document.forms[0].elements[i].checked = false : document.forms[0].elements[i].checked = true;
		}
	}
}

function GetLength(str)
{
	var l=str.length;
	var n=l
	for (var i=0;i<l;i++)
	{
		if (str.charCodeAt(i)<0||str.charCodeAt(i)>255) n++;
	}
	return n;
}

function CheckLength4_14(source, arguments)
{
	if ((GetLength(arguments.Value)<=3) || (GetLength(arguments.Value)>14)) arguments.IsValid = false; else arguments.IsValid = true;
}

function CheckLength1_10(source, arguments)
{
	if ((GetLength(arguments.Value)<=0) || (GetLength(arguments.Value)>10)) arguments.IsValid = false; else arguments.IsValid = true;
}

function CheckLength1_50(source, arguments)
{
	if ((GetLength(arguments.Value)<=0) || (GetLength(arguments.Value)>50)) arguments.IsValid = false; else arguments.IsValid = true;
}

function CheckLength1_15(source, arguments)
{
	if ((GetLength(arguments.Value)<=0) || (GetLength(arguments.Value)>15)) arguments.IsValid = false; else arguments.IsValid = true;
}
function CheckLength1_20(source, arguments)
{
	if ((GetLength(arguments.Value)<=0) || (GetLength(arguments.Value)>20)) arguments.IsValid = false; else arguments.IsValid = true;
}
function CheckLength1_100(source, arguments)
{
	if ((GetLength(arguments.Value)<=0) || (GetLength(arguments.Value)>100)) arguments.IsValid = false; else arguments.IsValid = true;
}
function CheckLength1_200(source, arguments)
{
	if ((GetLength(arguments.Value)<=0) || (GetLength(arguments.Value)>200)) arguments.IsValid = false; else arguments.IsValid = true;
}
function CheckLength1_300(source, arguments)
{
	if ((GetLength(arguments.Value)<=0) || (GetLength(arguments.Value)>300)) arguments.IsValid = false; else arguments.IsValid = true;
}

function CheckLength1_500(source, arguments)
{
	if ((GetLength(arguments.Value)<=0) || (GetLength(arguments.Value)>500)) arguments.IsValid = false; else arguments.IsValid = true;
}

function CheckLength1_1000(source, arguments)
{
	if ((GetLength(arguments.Value)<=0) || (GetLength(arguments.Value)>1000)) arguments.IsValid = false; else arguments.IsValid = true;
}

function CheckLength1_5000(source, arguments)
{
	if ((GetLength(arguments.Value)<=0) || (GetLength(arguments.Value)>5000)) arguments.IsValid = false; else arguments.IsValid = true;
}