// JavaScript Document
//获取一个对象
function $(id) {
	if (document.getElementById) {
		return document.getElementById(id);
	} else if (document.all) {
		return document.all[id];
	} else if (document.layers) {
		return document.layers[id];
	} else {
		return null;
	}
}
//cookie操作
function setCookie(name,value)
{
    var Days = 30;
    var exp  = new Date();    //new Date("December 31, 9998");
        exp.setTime(exp.getTime() + Days*24*60*60*1000);
        document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
}
function getCookie(name)
{
    var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
        if(arr=document.cookie.match(reg)) return unescape(arr[2]);
        else return null;
}
function delCookie(name)
{
    var exp = new Date();
        exp.setTime(exp.getTime() - 1);
    var cval=getCookie(name);
        if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString();
}
// 缩放字体(两函数)
function setFontsSize(id){
	var cookiesize;
	var defaultsize="12";
	cookiesize=getCookie("nowsize");
	if(cookiesize!=null)
		$(id).style.fontSize=cookiesize+'px';
	else
		$(id).style.fontSize=defaultsize+'px';
}
function doZoom(size){
	$("content").style.fontSize=size+'px';
	setCookie("nowsize",size);
}


//选项卡通用函数
function nTabs(thisObj,Num){
if(thisObj.className == "active")return;
var tabObj = thisObj.parentNode.id;
var tabList = document.getElementById(tabObj).getElementsByTagName("li");
  for(i=0; i <tabList.length; i++){
    if (i == Num){
      thisObj.className = "active"; 
      document.getElementById(tabObj+"_Content"+i).className = "block";
    }else{
      tabList[i].className = "normal"; 
      document.getElementById(tabObj+"_Content"+i).className = "none";
    }
  } 
}

// 复制网址
function copyToClipBoard(){
	var clipBoardContent=''; 
	clipBoardContent+=document.title;
	clipBoardContent+='网址: ';
	clipBoardContent+=window.location.href;
	if(navigator.userAgent.toLowerCase().indexOf('ie') > -1) {
		clipboardData.setData('Text',document.title+":"+window.location.href);
		alert ("网址复制成功,使用Ctrl+V快捷键粘贴转给您的好友！");
	} else {
		prompt("请复制网站地址:",clipBoardContent); 
	}
}

function jngcopyToClipBoard(name){
	var clipBoardContent=''; 
	clipBoardContent+=name;
	clipBoardContent+='网上纪念馆: ';
	clipBoardContent+=window.location.href;
	if(navigator.userAgent.toLowerCase().indexOf('ie') > -1) {
		clipboardData.setData('Text',"这里是"+name+"网上纪念馆,请将馆址告诉您身边的好友一起来缅怀纪念:"+window.location.href);
		alert (clipBoardContent+"”\n\n馆址复制成功,使用Ctrl+V快捷键粘贴转给您的好友！");
	} else {
		prompt("请复制网站地址:",clipBoardContent); 
	}
}
function jrcopyToClipBoard(name){
	var clipBoardContent=''; 
	clipBoardContent+=document.title;
	clipBoardContent+='网址: ';
	clipBoardContent+=window.location.href;
	if(navigator.userAgent.toLowerCase().indexOf('ie') > -1) {
		clipboardData.setData('Text',name+"网址:"+window.location.href);
		alert (clipBoardContent+"”\n\n馆址复制成功,使用Ctrl+V快捷键粘贴转给您的好友！");
	} else {
		prompt("请复制网站地址:",clipBoardContent); 
	}
}

function copyToClipBoardvisit(){
	var clipBoardContent=''; 
	clipBoardContent+=document.title;
	clipBoardContent+='\r\n\n纪念馆地址: ';
	clipBoardContent+=window.location.href;
	if(navigator.userAgent.toLowerCase().indexOf('ie') > -1) {
		clipboardData.setData('Text',"我在祭拜网访问了xxx纪念馆，邀请您前往祭拜:"+window.location.href);
		alert (clipBoardContent+"”\n\n馆址复制成功,使用Ctrl+V快捷键粘贴转给您的亲友！");
	} else {
		prompt("请复制网站地址:",clipBoardContent); 
	}
}
// 加入收藏
function AddFavor(){
	if(navigator.userAgent.toLowerCase().indexOf('ie') > -1) {
		window.external.addFavorite(window.location.href,window.document.title)
	} else if (navigator.userAgent.toLowerCase().indexOf('opera') > -1) {
		alert ("请使用Ctrl+T将本页加入收藏夹");
	} else {
		alert ("请使用Ctrl+D将本页加入收藏夹");
	}
}
//关闭窗口IE7无提示
function CloseWin(){ 
	window.opener=null;
	window.open("","_self");
	window.close(); 
}

//向上滚动
function ScrollImgTop(){
	var speed=20
	var scroll_begin = document.getElementById("scroll_begin");
	var scroll_end = document.getElementById("scroll_end");
	var scroll_div = document.getElementById("scroll_div");
	scroll_end.innerHTML=scroll_begin.innerHTML
  function Marquee(){
    if(scroll_end.offsetTop-scroll_div.scrollTop<=0)
      scroll_div.scrollTop-=scroll_begin.offsetHeight
    else
      scroll_div.scrollTop++
  }
	var MyMar=setInterval(Marquee,speed)
  scroll_div.onmouseover=function() {clearInterval(MyMar)}
  scroll_div.onmouseout=function() {MyMar=setInterval(Marquee,speed)}
}
