
var Window_PopORGWindow = null
function Jtrim(str)
{

        var i = 0;
        var len = str.length;
        if ( str == "" ) return( str );
        j = len -1;
        flagbegin = true;
        flagend = true;
        while ( flagbegin == true && i< len)
        {
           if ( str.charAt(i) == " " )
                {
                  i=i+1;
                  flagbegin=true;
                }
                else
                {
                        flagbegin=false;
                }
        }

        while  (flagend== true && j>=0)
        {
            if (str.charAt(j)==" ")
                {
                        j=j-1;
                        flagend=true;
                }
                else
                {
                        flagend=false;
                }
        }

        if ( i > j ) return ("")

        trimstr = str.substring(i,j+1);
        return trimstr;
}

	function ShowHideSearchRegion(trObject,SelfObject)
	{
		if(trObject.style.display == "none")
		{
			trObject.style.display = ""
			SelfObject.innerHTML = "<img border=\"0\" src=\"../images/1.gif\">"
			
		}
		else
		{
			trObject.style.display = "none"
			SelfObject.innerHTML = "<img border=\"0\" src=\"../images/SearchDown.gif\">"
		}
	}

	function PopOrgWindowByParam(strSelMode,strIDName,strDescName,strCurrentSelected)
	{
		var sFeature = "directories=no,height=500,width=400,left=200,top=20,status=yes,toolbar=no,menubar=no,scrollbars=yes,status=no,resizable=yes "
		var sUrl = "../public/PopOrganizationList.asp?SelectMode=" + strSelMode + "&TrigerRelation=0&CurrentSelectedID=" + strCurrentSelected + "&IDElementName=" + strIDName + "&DescriptElementName=" + strDescName
		if (Window_PopORGWindow == null)
			Window_PopORGWindow = window.parent.open(sUrl,"PopORGWindow", sFeature);
		else
		{
			if (Window_PopORGWindow.closed)
				Window_PopORGWindow = window.parent.open(sUrl,"PopORGWindow",sFeature)
			else
				Window_PopORGWindow.focus()
		}
	}

	function IsNumber(dateStr)
	{
		var datePat = /^\d*$/;
		var matchArray = dateStr.match(datePat);
		if(matchArray == null)
			return false
		else
			return true
	}

	function SMSMobileCheck(dateStr)
	{
		if(dateStr != "")
		{
			var datePat = /^(\d{1,12})$|^(\d{1,12}(([,]|[£¬]|[;])\d{1,12})*)$/;
			var matchArray = dateStr.match(datePat);
			if(matchArray == null)
				return false
			else
				return true
		}
		else
			return true
	}

	function AppEnNameCheck(dateStr)
	{
		var datePat = /^\w{1,15}$/;
		var matchArray = dateStr.match(datePat);
		if(matchArray == null)
			return false
		else
			return true
	}
