//根据ID取得dom对象
function $(id) {
	return document.getElementById(id);
}

//显示隐藏内容
function ContentBodyShow(e,PostID){
	 e.className=(e.className=="Body_Limit")?"Body_Expand":"Body_Limit"
	 document.getElementById(PostID).style.display=(e.className=="Body_Limit")?"":"none"
}

//设置字体大小
function SetFont(id,size){
	document.getElementById(id).style.fontSize=size;
}

//工具箱伸缩
function BoxSwitch(boxid, imgid)
{
    var me = document.getElementById(boxid);
    var img = document.getElementById(imgid);
    if(me.style.display == "none")
    {
        //展开
        me.style.display = "";
        img.className = "SwitchIcon_Up";
    }
    else
    {
        //隐藏
        me.style.display = "none";
        img.className = "SwitchIcon_Down";
    }
}

function FindObject()
{
    var me = document.getElementById(id);
}
function ImageReload(ImageID, NewSrc)
{
}

//隐藏
function Hide(id)
{
    var me = document.getElementById(id);
    if(me.style.display == "none")
    {
        //展开
        me.style.display = "";
    }
    else
    {
        //隐藏
        me.style.display = "none";
    }
}

//带提示框的跳转
function ConfirmRedirect(text, url)
{ 
    if(confirm(text)){ 
      window.location = url; 
    }
} 

//反选所有
function checkAll(form)
{
	for (i = 0, n = form.elements.length; i < n; i++) {
		if(form.elements[i].type == "checkbox") {
			if(form.elements[i].checked == true)
				form.elements[i].checked = false;
			else
				form.elements[i].checked = true;
		}
	}
}

//
function RTrim(str)
{
    var whitespace = new String(" \t\n\r");

    var s = new String(str);

    if (whitespace.indexOf(s.charAt(s.length-1)) != -1)
    {

        var i = s.length - 1;

        while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)

        {

            i--;

        }

        s = s.substring(0, i+1);

    }

    return s;

}
//自动伸缩图片大小
function ImgAutoResize(obj,w, h){
	if((obj.width/obj.height) >(w/h)){
		if(obj.width>w) obj.style.width=w;
	}
	else {
		if(obj.height>h) obj.style.height=h;
	}
}
//复制网址到剪切板
function copyUrl(url, text){
	var ret = clipboardData.setData("Text",url);
	if(ret)
	{
	    if(text == null)
	    {
	        text = "本网址已经复制到剪贴板中"; 
	    }
		alert(text);
	}
}
//加入收藏夹
function AddFavorite(SiteName, SiteUrl)
{
    window.external.AddFavorite(SiteUrl,SiteName) 
}

//将指定对象变为滚动
function announcement(id) {
	$(id).innerHTML = '<marquee style="filter:progid:DXImageTransform.Microsoft.Alpha(startX=0, startY=0, finishX=10, finishY=100,style=1,opacity=0,finishOpacity=100); margin: 0px 8px" direction="left" scrollamount="2" scrolldelay="1" onMouseOver="this.stop();" onMouseOut="this.start();">' +
		$(id).innerHTML + '</marquee>';
	$(id).style.display = 'block';
}

