﻿//*************************FrameCate*****************************
//FileName:     Base.js
//Description:  脚本基础函数
//Assembly:     V1.1.0.0
//CreateDate:   2009-04-06
//Change: 
//Intend: 
//***************************************************************

/***************************************
 *
 *获取对象
 *
 **************************************/
function $(obj)
{
    return document.getElementById(obj);
}


/***************************************
 *
 *将html格式字符编码，转换成文本
 *
 *注：此编码去掉了回车转<br />
 **************************************/
function HtmlEncode(str)
{
	return str.replace(/\"/g,"&quot;").replace(/\t/g,"    ").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/ /g,"&nbsp;");
	//.replace(/\r\n/g,"<br />").replace(/\n/g,"<br />");
}
/***************************************
 *
 *将html格式字符解码，
 *
 **************************************/
function HtmlDecode(str)
{
	return str.replace(/    /g,"\t").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&nbsp;/g," ").replace(/<br \/>/g,"\r\n").replace(/&quot;/g,"\"");
}


/***************************************
 *
 *获取当前时间
 *
 **************************************/
function getNow()
{
    today=new Date();
    intYear=today.getFullYear();
    intMonth=today.getMonth()+1;
    intDate=today.getDate();
    if(intMonth<10)
    {
        intMonth="0"+intMonth;  
    } 
    if(intDate<10)
    {
        intDate="0"+intDate;  
    } 
    today=intYear+"-"+intMonth+"-"+intDate;
    return today;
}



/************************************************************
 *
 *添加trim()属性
 *
 ************************************************************/
String.prototype.trim = function()
{ 
 	return this.replace(/(^\s*)|(\s*$)/g, "");
}



  	/***************************************
 *
 *判断是否为空，或者空格
 *
 **************************************/
function isNull(objValue)
{
    if(objValue == null || objValue.trim() == "" ) //objValue.replace(/ /g,"") == "" )
    {
        return true;
    }
    return false;
}