var domainName="www.txt7.com.cn";


function setCookie(name,value,days) {
	if(days) {
  		var exp = new Date(); 
  		exp.setTime(exp.getTime() + days*24*60*60*1000);
	  	document.cookie = name + "="+ escape(value) +";expires="+ exp.toGMTString()+";path=/;domain=" + domainName;
	} else {
		document.cookie = name + "="+ escape(value)+";path=/;domain=" + domainName;
	}
}

function setBackground(color) {
	setCookie("color", color, 30);
	document.bgColor = "#" + color;
}

/*
 * 添加到收藏夹，跨浏览器
**/
var address = function (obj, url, title) {
    var e = window.event || arguments.callee.caller.arguments[0];    
    var B = {
        IE : /MSIE/.test(window.navigator.userAgent) && !window.opera
        , FF : /Firefox/.test(window.navigator.userAgent)
        , OP : !!window.opera
    };

    obj.onmousedown = null;
    
    if (B.IE) {
        obj.attachEvent("onmouseup", function () {
            try {
                window.external.AddFavorite(url, title);
                window.event.returnValue = false;
            } catch (exp) {}
        });
    } else {
        if (B.FF || obj.nodeName.toLowerCase() == "a") {
            obj.setAttribute("rel", "sidebar"), obj.title = title, obj.href = url;
        } else if (B.OP) {
            var a = document.createElement("a");
            a.rel = "sidebar", a.title = title, a.href = url;
            obj.parentNode.insertBefore(a, obj);
            a.appendChild(obj);
            a = null;
        }
    }
};


//热门文章、最新点评、编辑推荐
function switchTab(id){
dom1 = document.getElementById("switchTitle").getElementsByTagName("li");
dom2 = document.getElementById("switchNewsInfo").getElementsByTagName("span");
for(var i=0; i<dom1.length; i++){dom1[i].className='';dom2[i].style.display='none';}
dom1[id].className='switchcur';dom2[id].style.display='';
}

//字号
try{
function SetCookie(name,value)
{
    var Days = 30*12*100; 
    var exp  = new Date();
    exp.setTime(exp.getTime() + Days*24*60*60*1000);
    document.cookie = name + "="+ escape(value) + ";expires=" + exp.toGMTString()+";path=/;domain=.txt7.com.cn";
}
function getCookie(name)//取cookies函数        
{
     var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
     if(arr != null) return unescape(arr[2]);
	return null;

}

function doZoom(size)
{
	document.getElementById('the_content').style.fontSize=size+'px';
	SetCookie("FontSizeCookie",size);
}

if(getCookie("FontSizeCookie") != null){
document.getElementById('the_content').style.fontSize=getCookie("FontSizeCookie")+'px';
}
}catch(e){}

//显示隐藏
function showFloatDiv(id){
dom1=document.getElementById(id);	
dom1.style.display="block";
	}
function hideFloatDiv(id){
dom1=document.getElementById(id);	
dom1.style.display="none";
	}

//复制url功能
function copyToClipBoard(a){
	var myHerf = top.location.href;
	var title  = document.title;
	if(window.clipboardData){
    if(a==1){var tempCurLink = title + myHerf;}
	if(a==2){var tempCurLink =myHerf;}
	if(a==3){var tempCurLink =VideoUrl;}
	var ok = window.clipboardData.setData("Text",tempCurLink);
	if(ok) alert("按Ctrl + V ,粘贴到MSN上发给你的好友们吧 ！");
	}else{
		alert("对不起，目前此功能只支持IE，请直接复制地址栏的地址！");
}} 





