function GetObj(objName){
	if(document.getElementById){
		return eval('document.getElementById("' + objName + '")');
	}else{
		return eval('document.all.' + objName);
	}
}
function Show_Sub(id_num,num){ //舌签功能
	for(var i = 0;i <= 9;i++){
		if(GetObj("S_Menu_" + id_num + i)){GetObj("S_Menu_" + id_num + i).className = '';}
		if(GetObj("S_Cont_" + id_num + i)){GetObj("S_Cont_" + id_num + i).style.display = 'none';}
	}
	if(GetObj("S_Menu_" + id_num + num)){GetObj("S_Menu_" + id_num + num).className = 'selectd';}
	if(GetObj("S_Cont_" + id_num + num)){GetObj("S_Cont_" + id_num + num).style.display = 'block';}
}


function Wa_SetImgAutoSize(obj)
{
var img=obj;//获取图片
var MaxWidth=660;//设置图片宽度界限
var MaxHeight=660;//设置图片高度界限
var HeightWidth=img.offsetHeight/img.offsetWidth;//设置高宽比
var WidthHeight=img.offsetWidth/img.offsetHeight;//设置宽高比
if(img.readyState!="complete")return false;//确保图片完全加载
if(img.offsetWidth>MaxWidth){
img.width=MaxWidth;
img.height=MaxWidth*HeightWidth;
}
if(img.offsetHeight>MaxHeight){
img.height=MaxHeight;
img.width=MaxHeight*WidthHeight;
}
}
function bookmarkit(url,title){
   window.external.addFavorite(url,title);
}


function shoucang(serverType)
{
	if(serverType)
	{
		switch(serverType)
		{
			case "yahoo":
				url = "http://myweb.cn.yahoo.com/popadd.html?url="+encodeURIComponent(document.location.href)+"&title="+encodeURIComponent(document.title);
				target="Yahoo";
				sFeatures = "scrollbars=yes,width=780,height=550,left=80,top=80,status=yes,resizable=yes";
				break;
			case "baidu":
				url = "http://cang.baidu.com/do/add?it="+encodeURIComponent(document.title.substring(0,76))+"&iu="+encodeURIComponent(location.href)+"&fr=ien#nw=1";
				target="_blank";
				sFeatures = "scrollbars=no,width=600,height=450,left=75,top=20,status=no,resizable=yes";
				break;
			case "qq":
				url = "http://shuqian.qq.com/post?from=3&title="+encodeURIComponent(document.title)+"&uri="+encodeURIComponent(document.location.href)+"&jumpback=2&noui=1";
				target="favit";
				sFeatures = "width=930,height=470,left=50,top=50,toolbar=no,menubar=no,location=no,scrollbars=yes,status=yes,resizable=yes";
				break;
			case "Fav":
				addToFav( document.location.href, document.title );
				break;

		}
	
		window.open(url,target,sFeatures);
	}
}
function addToFav(sURL, sTitle)
{
    try
    {
        window.external.addFavorite(sURL, sTitle);
    }
    catch (e)
    {
        try
        {
            window.sidebar.addPanel(sTitle, sURL, "");
        }
        catch (e)
        {
            alert("加入收藏失败，有劳您手动添加。");
        }
    }
}



