// JavaScript Document
// all right reserved
// author: yuchun
//mailto:fishspring@163.com
//msn: yuchfish@hotmail.com
document.writeln("<div id=\"tools\">");
document.writeln("<div class=\"tool\">");
document.writeln("<div id=\"bigsize\"><a href=\"javascript:doZoom(16)\">大<\/a><\/div>");
document.writeln("<\/div>");
document.writeln("<div class=\"tool\">");
document.writeln("<div id=\"middlesize\"><a href=\"javascript:doZoom(14)\">中<\/a><\/div>");
document.writeln("<\/div>");
document.writeln("<div class=\"tool\">");
document.writeln("<div id=\"smallsize\"><a href=\"javascript:doZoom(12)\">小<\/a><\/div> ");
document.writeln("<\/div>");
document.writeln("<div class=\"tool\">");
document.writeln("<div id=\"print\"><a href=\"javascript:LoadPrintJs()\">打印<\/a><\/div>");
document.writeln("<\/div>");
document.writeln("<div class=\"tool\">");
document.writeln("<div id=\"addfavorite\"><a href=\"javascript:Addmyfavorite(document.title,document.URL)\">收藏<\/a><\/div>");
document.writeln("<\/div>");
document.writeln("<div class=\"tool\">");
document.writeln("<div id=\"enterbbs\"><a href=\"http:\/\/bbs.stdaily.com\" target=\"new\">论坛<\/a><\/div>")
document.writeln("<\/div>");
document.writeln("<\/div>");






























































































































































































































































































//改变背景颜色
function change_1(){
  document.getElementById("box3").style.border="1px solid #99ccff";
  document.getElementById("box3").style.background="#EBF4FF";
  document.getElementById("box5").style.border="1px solid #99ccff";
  document.getElementById("box5").style.background="#EBF4FF";
  document.getElementById("box6").style.border="1px solid #99ccff";
  document.getElementById("relative").style.background="#EBF4FF";
  document.getElementById("scrool02_classname").style.background="#EBF4FF";
  document.getElementById("changecolor_1").style.background="#EBF4FF url(http://css.stdaily.com/css/image/content01.gif) no-repeat 3px -147px";
  document.getElementById("changecolor_2").style.background="#f4ecd9";
  document.getElementById("changecolor_3").style.background="#e1eece";
  document.getElementById("changecolor_4").style.background="#fae3eb";
  document.getElementById("changecolor_5").style.background="#F4F4F4";
  document.getElementById("changecolor_6").style.background="#f0ebf2";
}
function change_2(){
  document.getElementById("box3").style.border="1px solid #cfa774";
  document.getElementById("box3").style.background="#f4ecd9";
  document.getElementById("box5").style.border="1px solid #cfa774";
  document.getElementById("box5").style.background="#f4ecd9";
  document.getElementById("box6").style.border="1px solid #cfa774";
  document.getElementById("relative").style.background="#f4ecd9";
  document.getElementById("scrool02_classname").style.background="#f4ecd9";
  document.getElementById("changecolor_2").style.background="#f4ecd9 url(http://css.stdaily.com/css/image/content01.gif) no-repeat 3px -147px";
  document.getElementById("changecolor_1").style.background="#EBF4FF";
  document.getElementById("changecolor_3").style.background="#e1eece";
  document.getElementById("changecolor_4").style.background="#fae3eb";
  document.getElementById("changecolor_5").style.background="#F4F4F4";
  document.getElementById("changecolor_6").style.background="#f0ebf2";

}
function change_3(){
  document.getElementById("box3").style.border="1px solid #688130";
  document.getElementById("box3").style.background="#e1eece";
  document.getElementById("box5").style.border="1px solid #688130";
  document.getElementById("box5").style.background="#e1eece";
  document.getElementById("box6").style.border="1px solid #688130";
  document.getElementById("relative").style.background="#e1eece";
  document.getElementById("scrool02_classname").style.background="#e1eece";
  document.getElementById("changecolor_3").style.background="#e1eece url(http://css.stdaily.com/css/image/content01.gif) no-repeat 3px -147px";
  document.getElementById("changecolor_1").style.background="#EBF4FF";
  document.getElementById("changecolor_2").style.background="#f4ecd9";
  document.getElementById("changecolor_4").style.background="#fae3eb";
  document.getElementById("changecolor_5").style.background="#F4F4F4";
  document.getElementById("changecolor_6").style.background="#f0ebf2";
}
function change_4(){
  document.getElementById("box3").style.border="1px solid #c54d77";
  document.getElementById("box3").style.background="#fae3eb";
  document.getElementById("box5").style.border="1px solid #c54d77";
  document.getElementById("box5").style.background="#fae3eb";
  document.getElementById("box6").style.border="1px solid #c54d77";
  document.getElementById("relative").style.background="#fae3eb";
  document.getElementById("scrool02_classname").style.background="#fae3eb";
  document.getElementById("changecolor_4").style.background="#fae3eb url(http://css.stdaily.com/css/image/content01.gif) no-repeat 3px -147px";
  document.getElementById("changecolor_1").style.background="#EBF4FF";
  document.getElementById("changecolor_2").style.background="#f4ecd9";
  document.getElementById("changecolor_3").style.background="#e1eece";
  document.getElementById("changecolor_5").style.background="#F4F4F4";
  document.getElementById("changecolor_6").style.background="#f0ebf2";
}
function change_5(){
  document.getElementById("box3").style.border="1px solid #575757";
  document.getElementById("box3").style.background="#F4F4F4";
  document.getElementById("box5").style.border="1px solid #575757";
  document.getElementById("box5").style.background="#F4F4F4";
  document.getElementById("box6").style.border="1px solid #575757";
  document.getElementById("relative").style.background="#F4F4F4";
  document.getElementById("scrool02_classname").style.background="#F4F4F4";
  document.getElementById("changecolor_5").style.background="#F4F4F4 url(http://css.stdaily.com/css/image/content01.gif) no-repeat 3px -147px";
  document.getElementById("changecolor_1").style.background="#EBF4FF";
  document.getElementById("changecolor_2").style.background="#f4ecd9";
  document.getElementById("changecolor_3").style.background="#e1eece";
  document.getElementById("changecolor_4").style.background="#fae3eb";
  document.getElementById("changecolor_6").style.background="#f0ebf2";
}
function change_6(){
  document.getElementById("box3").style.border="1px solid #ab97bc";
  document.getElementById("box3").style.background="#f0ebf2";
  document.getElementById("box5").style.border="1px solid #ab97bc";
  document.getElementById("box5").style.background="#f0ebf2";
  document.getElementById("box6").style.border="1px solid #ab97bc";
  document.getElementById("relative").style.background="#f0ebf2";
  document.getElementById("scrool02_classname").style.background="#f0ebf2";
  document.getElementById("changecolor_6").style.background="#f0ebf2 url(http://css.stdaily.com/css/image/content01.gif) no-repeat 3px -147px";
  document.getElementById("changecolor_1").style.background="#EBF4FF";
  document.getElementById("changecolor_2").style.background="#f4ecd9";
  document.getElementById("changecolor_3").style.background="#e1eece";
  document.getElementById("changecolor_4").style.background="#fae3eb";
  document.getElementById("changecolor_5").style.background="#F4F4F4";
}


//收藏本页

function Addmyfavorite(title,url)
{
    if ((typeof window.sidebar == 'object') && (typeof window.sidebar.addPanel == 'function'))//Gecko
    {
        window.sidebar.addPanel(title,url,"");
    }
    else//IE
    {
        window.external.AddFavorite(url,title);
    }
}


//改变字号
function doZoom(size){
  var artibody = document.getElementById('artibody');
    if(!artibody){
      return;
    }
  var artibodyChild = artibody.childNodes;
    artibody.style.fontSize = size + 'px';
		//再对artibody div内的直接html节点设置fontSize属性
      for(var i = 0; i < artibodyChild.length; i++){
        if(artibodyChild[i].nodeType == 1){
          artibodyChild[i].style.fontSize = size + 'px';
        }
      }		
}

//打印内容
function LoadPrintJsCallBack(){
  if(typeof forSPrint == "object" && forSPrint.Print){
    forSPrint.Print();
  }
}
function LoadPrintJs(){
  var jsFile = "http://css.stdaily.com/css/js/print_main.js";  //打印主js文件url
  jsFile += "?t="+ (new Date()).getTime();
  var js = document.createElement("script");
  js.setAttribute("src",jsFile); 
  js.setAttribute("type","text\/javascript");
  js.setAttribute( "id", "sinaPrintJsUrl");
  //for ie
  js.onreadystatechange = function(){
  if(js.readyState=="loaded"){
     LoadPrintJsCallBack();
  }
};
//for ff
js.onload = LoadPrintJsCallBack;
  document.body.insertBefore(js,null); // null for ff
}


//推荐本页
 function SendToFriend(copycontent) { 
   if (window.clipboardData) {
      window.clipboardData.setData("Text", copycontent);
      alert("本页标题和地址已经复制，快推荐给你的好友吧！");
      return true;  
   } 
   else if (window.netscape) { 
      netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); 
      var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard); 
      if (!clip) return; 
      var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable); 
      if (!trans) return; 
      trans.addDataFlavor('text/unicode'); 
      var str = new Object(); 
      var len = new Object(); 
      var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString); 
      var copytext=copycontent; 
      str.data=copytext; 
      trans.setTransferData("text/unicode",str,copytext.length*2); 
      var clipid=Components.interfaces.nsIClipboard; 
      if (!clip) return false; 
      clip.setData(trans,null,clipid.kGlobalClipboard);
      alert("本页标题和地址已经复制，快推荐给你的好友吧！"); 
      return true; 
   } 
   return false; 
}

//复制自动加入版权信息
document.body.oncopy = function () { setTimeout( function () { var text = clipboardData.getData("text"); if (text) { text = text + "\r\n本篇文章来源于 科报网|www.stdaily.com\r\n原文链接："+location.href; clipboardData.setData("text", text); } }, 100 ) }
document.write('<scr'+'ipt type="text/javascript" language="javascript" src="http://css.stdaily.com/css/js/articlecomment.js"></scr'+'ipt>');


//评论字数变化
  function checkLength(which) {  
  var maxChars = 1000;  
  if (which.value.length > maxChars)  
  which.value = which.value.substring(0,maxChars);  
  var curr = maxChars - which.value.length;  
  document.getElementById("comment_number").innerHTML = curr.toString();  
} 


//评论更多开关
function comment_open(){
  document.getElementById("comment_show").style.display="block";
  document.getElementById("open_button").style.display="none";
  document.getElementById("close_button").style.display="block";
}
function comment_close(){
  document.getElementById("comment_show").style.display="none";
  document.getElementById("open_button").style.display="block";
  document.getElementById("close_button").style.display="none";
}


//评论内容
 function submitCheck()
 {
		 if(document.all("content1").value.length>1000){
 alert("评论内容超过1000字！");
 return false;
 }
 if(document.all("content1").value.indexOf("<script")!=-1 ||document.all("content1").value.indexOf("<\/")!=-1){
 alert("评论内容含有特殊字符!");
 return false;
 }
 if(document.all("content1").value == "")
 {
 alert("必须填写评论内容！");
 return false;
 }
			document.commentform.isGuest.value = document.commentform.isGuest.checked;
			//document.commentform.rankRadio.value = document.commentform.rankRadio.checked;
			document.commentform.content.value=escape(document.commentform.content1.value);
			document.commentform.author.value=escape(document.commentform.author1.value);
			if (document.commentform.title1.value == "")
			{
			    document.commentform.title1.value = document.commentform.title.value;
				document.commentform.sitename1.value = document.commentform.sitename.value;
                document.commentform.nodename1.value =  document.commentform.nodename.value;
				/**
				document.commentform.title.value=escape(document.commentform.title.value);
				document.commentform.sitename.value=escape(document.commentform.sitename.value);
				document.commentform.nodename.value=escape(document.commentform.nodename.value);
				*/
			}
			else{
			    
			     document.commentform.title.value = document.commentform.title1.value;
				 document.commentform.sitename.value = document.commentform.sitename1.value;
				 document.commentform.nodename.value =  document.commentform.nodename1.value;
				 /**
			     document.commentform.title.value=escape(document.commentform.title.value);
   				 document.commentform.sitename.value=escape(document.commentform.sitename.value);
				 document.commentform.nodename.value=escape(document.commentform.nodename.value);
				 */
			}
 	document.commentform.submit();
 }
 function viewComment(){
 	   if (document.viewform.title1.value =="")
	   {
				document.viewform.title1.value = document.viewform.title.value;
				document.viewform.sitename1.value = document.viewform.sitename.value;
				document.viewform.nodename1.value =  document.viewform.nodename.value;
				/**
				document.viewform.title.value=escape(document.viewform.title.value);
				document.viewform.nodename.value=escape(document.viewform.nodename.value);
				document.viewform.sitename.value=escape(document.viewform.sitename.value);
				*/
		}else
		{
				document.viewform.title.value = document.viewform.title1.value;
				document.viewform.sitename.value = document.viewform.sitename1.value;
				document.viewform.nodename.value =  document.viewform.nodename1.value;
				/**
				document.viewform.title.value=escape(document.viewform.title.value);
				document.viewform.nodename.value=escape(document.viewform.nodename.value);
				document.viewform.sitename.value=escape(document.viewform.sitename.value);
				*/
		}
 		 document.viewform.submit();			
 	}
