﻿// JScript 文件

function $(id)
{
    if ((id == "") || (id == undefined))
        return null;
        
    return document.getElementById(id);
}


function SwapCtrl(s,h)
{
   var o = $(s);
   if (o != null)
       o.style.display = "inline";

       o = $(h);
   if (o != null)
       o.style.display = "none";
}

function  unescapeHTML(html) 
{
    if (html == null || html == undefined)
        return html;
    
    var div = document.createElement('div');
    div.innerHTML = html.replace(/<\/?[^>]+>/gi, '');
    return div.childNodes[0] ? div.childNodes[0].nodeValue : '';
}

function   IsDate(s)   
{   
    var   re   =   /^(\d{4})(\/|-)(\d{1,2})\2(\d{1,2})$/   
    var   m   =   re.exec(s);   
    if   (m   ==   null)   return   false;   
    var   d   =   new   Date(m[1],m[3]-1,m[4]);   
    return   d.getFullYear()==m[1]   &&   d.getMonth()==(m[3]-1)   &&   d.getDate()==m[4];   
}   


String.prototype.trim = function()
{
    return this.replace(/(^s*)|(s*$)/g, '');
}



function loginFirst(page)
{
    var lp;
    if (page == null || page == undefined)
        lp = "/login.aspx";
    else
        lp = page;
    window.location.href = lp + "?ReturnUrl=" + escape(window.location.href);
}

function changePage(page)
{
   window.location.href = page;
}


function ShowAll(sid,hid)
{
    $(sid).className='';
    $(hid).className='hide';
}