function DoConfirm(strMsg)
{
	if(confirm(strMsg))
		return true;
	else
		return false;
}

function Go(strURL)
{
	location=strURL;
}

function ChkStrLen(objStr,iLen)
{
	if(objStr.value.length > iLen)
	{
		alert("Too many character£¬in"+ iLen + ".");
		objStr.focus();
	}		
}

var _ShowStrLenTimer;
function ShowStrLen(objShow,objStr)
{
	document.getElementById(objShow).innerHTML = "Characters:"+ document.getElementById(objStr).value.length;
	if (_ShowStrLenTimer) {
		window.clearTimeout(_ShowStrLenTimer);
	}
	_ShowStrLenTimer = window.setTimeout("ShowStrLen('"+objShow+"','"+objStr+"')", 1000);
}

function ChkSelected(Obj,Val)
{
	if (Obj)
	{
	for (i=0;i<Obj.length;i++){
		if (Obj.options[i].value==Val){
		Obj.options[i].selected=true;
		break;
		}
	}
	}
}

function ChkRadio(Obj,Val)
{
	if (Obj)
	{
	for (i=0;i<Obj.length;i++){
		if (Obj[i].value==Val){
		Obj[i].checked=true;
		break;
		}
	}
	}
}

function ChkAllSelected(Obj,Val)
{
	if (Obj.length!=null) 
	{
		for (i=0;i<Obj.length;i++)
			Obj[i].checked=Val;
	}
	else
	{
		Obj.checked=Val;
	}

}

function ChkSelectedOne(Obj,strMsg)
{
	var flag = false;
	
	if (Obj.length!=null) 
	{
		for (i=0;i<Obj.length;i++)
			if(Obj[i].checked==true)
			{
				flag = true;			
				break;
			}
	}
	else
	{
		if(Obj.checked==true)
		{
			flag = true;			
		}
	}
	
	if (flag==false)
	{
		alert(strMsg);
	}
	
	return flag;
}

function NewOpen(strURL)
{
	window.open(strURL,"newwindow","top=50,left=50,width=400,height=300,scrollbars=yes,resizable=yes");
}

function NewClose()
{
	window.close();
}

function OpenCalender(objName){
	var myDate;
	myDate = showModalDialog('../htmleditor/Dialog/calendar.htm', null, 'dialogWidth: 200px; dialogHeight: 220px; center: yes; resizable: no; scroll: yes; status: no;')

	if(myDate){
		objName.value=myDate;
	}
}

function ChkImgSize(strImg,iWidth,iHeight)
{

	imgObj = new Image();
	imgObj.src = strImg;
	

	if (imgObj.width <= imgObj.height)
	{
		document.write("<img src='"+ strImg +"' height='"+ iHeight +"' border=0>");
	}
	else
	{
		document.write("<img src='"+ strImg +"' width='"+ iWidth +"' border=0>");
	}
	
}

function ChkEmail(email){

	if(email.length!=0)
	  {
		if (email.charAt(0)=="." ||        
			 email.charAt(0)=="@"||       
			 email.indexOf('@', 0) == -1 || 
			 email.indexOf('.', 0) == -1 || 
			 email.lastIndexOf("@")==email.length-1 || 
			 email.lastIndexOf(".")==email.length-1)
		 {
		  return false;
		  }
	   }
	 else
	  {
	   return false;
	   }

	return true;
}