﻿var tabid=2;
var navauto=0;
function tabit(btn){
	var idname = new String(btn.id);
	var s = idname.indexOf("_");
	var e = idname.lastIndexOf("_")+1;
	var tabName = idname.substr(0, s);
	var id = parseInt(idname.substr(e, 3));
	var tabNumber = btn.parentNode.childNodes.length;
        var tabi_id;
	for(i=-1;i<tabNumber-1;i++){
                      tabi_id=document.getElementById(tabName+"_btn_"+i);
                      if(tabi_id){
			if(i==id)
			tabi_id.className = "curr";
			else
			tabi_id.className = "";
                      }
	};
};
function tabit1(btn){
	var idname = new String(btn.id);
	var s = idname.indexOf("_");
	var e = idname.lastIndexOf("_")+1;
	var tabName = idname.substr(0, s);
	var id = parseInt(idname.substr(e, 3));
	var tabNumber = btn.parentNode.childNodes.length;
	for(i=0;i<tabNumber;i++){
			if(i==id)
			document.getElementById(tabName+"_btn_"+i).className = "curr";
			else
			document.getElementById(tabName+"_btn_"+i).className = "";
	};
	if(id<1){
	    for(i=1;i<tabNumber;i++){
		    document.getElementById("submenu_"+i).style.display = "none";
		};
	}
	else{
	    for(i=1;i<tabNumber;i++){
			if(i==id)
			{document.getElementById("submenu_"+i).style.display = "";}
			else
			{document.getElementById("submenu_"+i).style.display = "none";}
		};
	}
	
};

function etabit(btn){
	var idname = new String(btn.id);
	var s = idname.indexOf("_");
	var e = idname.lastIndexOf("_")+1;
	var tabName = idname.substr(0, s);
	var id = parseInt(idname.substr(e, 1));
	var tabNumber = btn.parentNode.childNodes.length;
	for(i=0;i<tabNumber;i++){
			document.getElementById(tabName+"_div_"+i).style.display = "none";
			document.getElementById(tabName+"_btn_"+i).className = "";
		};
		document.getElementById(tabName+"_div_"+id).style.display = "block";
		btn.className = "curr";
};

function navtab(btn){
	stoptab();  
	var idname = new String(btn.id);
	var s = idname.indexOf("_");
	var e = idname.lastIndexOf("_")+1;
	var tabName = idname.substr(0, s);
	var id = parseInt(idname.substr(e, 3));
	for(i=1;i<=4;i++){
			if(i==id){
			document.getElementById(tabName+"_connect_"+i).className = "curr_connect";
			document.getElementById(tabName+"_content_"+i).style.display = "";
			}
			else
			{
			document.getElementById(tabName+"_connect_"+i).className = "";
			document.getElementById(tabName+"_content_"+i).style.display = "none";
			}
	};
};

function navautotab(){
	for(i=1;i<=4;i++){
			if(i==tabid){
			document.getElementById("park_connect_"+i).className = "curr_connect";
			document.getElementById("park_content_"+i).style.display = "";
			}
			else
			{
			document.getElementById("park_connect_"+i).className = "";
			document.getElementById("park_content_"+i).style.display = "none";
			}
	};
	tabid++;
	if(tabid>4){
	tabid=1;
	}
};

function starttab(){
	navauto=window.setInterval("navautotab()",5000);
};
function stoptab(){
	window.clearInterval(navauto);
};

function fontZoom(size)
{
 document.getElementById('text').style.fontSize=size+'px'
};

//视频播放	
function showVideo(videoUrl,playerid){
  document.getElementById("VideoPlay").innerHTML="";
  var width=566;
  var height=425;
  if(playerid==3){
     document.getElementById("VideoPlay").innerHTML='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+width+'" height="'+height+'"><param name="movie" value="'+videoUrl+'"><param name="quality" value="high"><embed src="'+videoUrl+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"></embed></object>';
  }
  else if(playerid==4){
	  videoUrl=encodeURI(videoUrl);
     document.getElementById("VideoPlay").innerHTML='<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="'+width+'" height="'+height+'"><param name="movie" value="/e/DownSys/play/images/flvplayer.swf?vcastr_file='+videoUrl+'&BarColor=0xFF6600&BarPosition=1&IsAutoPlay=1"><param name="quality" value="high"><param name="allowFullScreen" value="true" /><embed src="/e/DownSys/play/images/flvplayer.swf?vcastr_file='+videoUrl+'&BarColor=0xFF6600&BarPosition=1&IsAutoPlay=1&LogoText=www.huoshandao.com" allowFullScreen="true"  quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"></embed></object>';
  }
  else if(playerid==1){
	document.getElementById("VideoPlay").innerHTML='<object id=RVOCX1 classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="'+width+'" height="'+height+'"><PARAM NAME="SRC" VALUE="'+videoUrl+'"><param name="CONTROLS" value="ImageWindow"><param name="CONSOLE" value="clip1"><param name="autostart" value="true"><embed autostart="true" src="'+videoUrl+'" type="audio/x-pn-realaudio-plugin" width="'+width+'" height="'+height+'" controls="ImageWindow" console="clip1"></embed></OBJECT><br><object id=RVOCX2 classid="CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA"  width="'+width+'" height="50" ><param name="SRC" value="'+videoUrl+'"><param name="CONTROLS" value="StatusBar,ControlPanel"><param name="CONSOLE" value="clip1"><paramname="autostart"value="true"><embed src="'+videoUrl+'" type="audio/x-pn-realaudio-plugin" width="'+width+'" height="50" autostart="true" controls="StatusBar,ControlPanel" console="clip1" pluginspage="http://www.real.com/"></embed></object>';  
  }
  else if(playerid==2){
   document.getElementById("VideoPlay").innerHTML='<OBJECT  classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="'+width+'" height="'+height+'"><PARAM NAME="URL" value="'+videoUrl+'"><embed src="'+videoUrl+'" type="application/x-mplayer2" width="'+width+'" height="'+height+'" pluginspage="http://www.microsoft.com/Windows/MediaPlayer"></embed><param name="ShowStatusBar" value="-1"></OBJECT>';
  }
  else if(playerid==-1){
   document.getElementById("VideoPlay").innerHTML='由于播放器无法识别该视频或该视频存在版权问题，暂不支持该视频在本网站的在线播放！<br>请<a href="'+videoUrl+'" target="_blank">点此下载(右键另存为)到本地播放或新开窗口播放</a>。';
  }
}

function addCookie(){//加入收藏夹 
  if(document.all){
       window.external.addFavorite('http://www.huoshandao.com', '.漳州火山公园 - 中国唯一滨海火山公园');
  }
  else if(window.sidebar){
      window.sidebar.addPanel('.漳州火山公园 - 中国唯一滨海火山公园','http://www.huoshandao.com',"");
  }
}

function setHomepage(){//设置首页 
   if(document.all){
      document.body.style.behavior='url(#default#homepage)';
      document.body.setHomePage('http://www.huoshandao.com');
   }
   else if(window.sidebar){
        if(window.netscape){
             try{
                 netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
             }
             catch(e){
                 alert("您的浏览器未启用[设为首页]功能，开启方法：先在地址栏内输入about:config,然后将项 signed.applets.codebase_principal_support 值该为true即可");
             }
        }
        var prefs=Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);
        prefs.setCharPref('browser.startup.homepage','http://www.huoshandao.com');
   }
}

if(window.opera){
	  if(document.getElementById("pageAddCookie")){
		  alert("ddd");
		  document.getElementById("pageAddCookie").innerHTML="<a href='"+location.href+"' onClick='return false' title='"+document.title+"' rel=sidebar>添加到收藏夹</a>";
	  }
}
function addPageCookie(Id){//将页面加入收藏夹 
  if(document.all){
       window.external.addFavorite(location.href,document.title);
  }
  else if(window.sidebar){
      window.sidebar.addPanel(document.title,location.href,"");
  }
}

//以下代码将图片宽度控制在一定值内
var content_img_width = 566; //图片最大显示宽度
function set_img_size(obj, width)
{
	if (!obj) return ;
	if (!width) {
		width = obj.clientWidth * 0.9;
		if (width < 400) return;
	}
	img_items = obj.getElementsByTagName("img");
	if (img_items)	{
		for (i=0; i<img_items.length; i++) {
			var s_width = img_items[i].width;
			var s_height = img_items[i].height;
			if (s_width > width) {
				img_items[i].style.width = width + "px";
				if (s_height == img_items[i].height) {
					img_items[i].style.height = ((width / s_width) * img_items[i].height) + "px";
				}
			}
		}
	}
}

function selfadaptation_size() {
	if (typeof(content_img_width) == 'undefined')
		set_img_size(document.getElementById("text"));
	else
		set_img_size(document.getElementById("text"), content_img_width);

}

if (window.addEventListener)
	window.addEventListener("load", selfadaptation_size, false);
else if (window.attachEvent)
	window.attachEvent("onload", selfadaptation_size);
else
	window.onload = selfadaptation_size;