/*******************************************************************************
 * 功能：格式化日期
 * 调用说明：date_obj为时间对象，date_templet为返回的日期格式模版（如：date_obj为“2006-9-23
 * 12:34:10”；date_templet为“yy年mm月”，返回：“06年9月”）
 ******************************************************************************/
function getFormatDate(dataStr, date_templet) {
	var year, month, day, hour, minutes, seconds, short_year, full_month, full_day, full_day, full_hour, full_minutes, full_seconds;
	if (!date_templet)
		date_templet = "yyyy-mm-dd hh:ii:ss";
	year = dataStr.substring(0, 4);
	full_month=dataStr.substring(5,7);
	full_day = dataStr.substring(8, 10);
	
	full_hour = dataStr.substring(12, 14);
	full_minutes = dataStr.substring(16, 18);
	full_seconds = dataStr.substring(19, 21);
	return date_templet.replace("yyyy", year).replace("mm", full_month)
			.replace("dd", full_day).replace("hh", full_hour).replace(
					"ii", full_minutes).replace("ss", full_seconds);
}


function dbToHtml(oStr){
	if(oStr==null)  return ;
	return oStr.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,"'").replace(/&amp;nbsp;/g,"&nbsp;");
}

/********************************************************************************
*功能，iframe自适应高度
*
********************************************************************************/
    function iframeAutoFit(iframeName)
    {
    		
        try
        {
            if(window!=parent)
            {
                var a = parent.document.getElementsByTagName("IFRAME");
                for(var i=0; i<a.length; i++)
                {
                    if(a[i].contentWindow==window)
                    {
                        var h1=0, h2=0, d=document, dd=d.documentElement;
                        a[i].parentNode.style.height = a[i].offsetHeight +"px";
                        a[i].style.height = "10px";

                        if(dd && dd.scrollHeight) h1=dd.scrollHeight;
                        if(d.body) h2=d.body.scrollHeight;
                        var h=Math.max(h1, h2);

                        if(document.all) {h += 4;}
                        if(window.opera) {h += 1;}
                        a[i].style.height = a[i].parentNode.style.height = h +"px";
                    }
                }
            }
        }
        catch (ex){}
    }
    if(window.attachEvent)
    {
        window.attachEvent("onload",  iframeAutoFit);
    }
    else if(window.addEventListener)
    {
        window.addEventListener('load',  iframeAutoFit,  false);
    }
