function ResumeError(){return true;}window.onerror = ResumeError;
function DrawImage(ImgD,img_width,img_height){var image=new Image();image.src=ImgD.src;var img_width;var img_height;if(image.width>0 && image.height>0){flag=true;if(image.width/image.height>= img_width/img_height){if(image.width>img_width){ImgD.width=img_width;ImgD.height=(image.height*img_width)/image.width;}else{ ImgD.width=image.width;ImgD.height=image.height;}}else{if(image.height>img_height){ImgD.height=img_height;ImgD.width=(image.width*img_height)/image.height;}else{ImgD.width=image.width;ImgD.height=image.height;}}}}
function CallFlash(flashUrl,flashWidth,flashHeight,flashWmode,flashVersion){document.write('<object classid="clsid:D27CDB6E-AE6D-11CF-96B8-444553540000" id="flash" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+flashVersion+'" border="0" width="'+flashWidth+'" height="'+flashHeight+'">');document.write('<param name="movie" value="'+flashUrl+'">');document.write('<param name="quality" value="high"> ');document.write('<param name="wmode" value="'+flashWmode+'"> ');document.write('<param name="menu" value="false"> ');document.write('<embed src="'+flashUrl+'" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" name="FlashBanner" width="'+flashWidth+'" height="'+flashHeight+'" quality="High" wmode="transparent">');document.write('</embed>');document.write('</object>');}//normal version 8.0.24
function AddFavorite(sURL, sTitle)
{try{window.external.addFavorite(sURL, sTitle);}catch (e){try{window.sidebar.addPanel(sTitle, sURL, "");}catch (e){alert("加入收藏失败，请使用Ctrl+D进行添加");}}}
function SetHome(obj,vrl){try{obj.style.behavior='url(#default#homepage)';obj.setHomePage(vrl);}catch(e){if(window.netscape){try {netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");}catch (e){alert("此操作被浏览器拒绝!\n请在浏览器地址栏输入'about:config'并回车\n然后将 [signed.applets.codebase_principal_support]的值设置为'true',双击即可。");}var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch);prefs.setCharPref('browser.startup.homepage',vrl);}}}
function tabs(thisObj,Num){
if(thisObj.className == "current")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 = "current";document.getElementById(tabObj+"_content"+i).style.display = "block";}else{tabList[i].className = "normal";document.getElementById(tabObj+"_content"+i).style.display = "none";}
var linkItem=document.getElementById("linkImg");if (Num==0){linkItem.href='html.asp?type=4';}else if(Num==1){linkItem.href='html.asp?type=1';}
}}
function showLocale(objD){var str;var yy = objD.getYear();if(yy<1900) yy = yy+1900;var MM = objD.getMonth()+1;if(MM<10) MM = '0' + MM;var dd = objD.getDate();if(dd<10) dd = '0' + dd;var ww = objD.getDay();if  (ww==0)  ww="星期日";if  (ww==1)  ww="星期一";if  (ww==2)  ww="星期二";if  (ww==3)  ww="星期三";if  (ww==4)  ww="星期四";if  (ww==5)  ww="星期五";if  (ww==6)  ww="星期六";str =yy + "年" + MM + "月" + dd + "日  " + ww;return(str);}
function thisDay(){var today;today = new Date();document.write('今天是：'+showLocale(today));}

function goPageTop(acceleration, goPageTopTime){
acceleration = acceleration || 0.1;
goPageTopTime = goPageTopTime || 16;
var goPageTopX1 = 0;
var goPageTopY1 = 0;
var goPageTopX2 = 0;
var goPageTopY2 = 0;
var goPageTopX3 = 0;
var goPageTopY3 = 0;
if (document.documentElement){
	goPageTopX1 = document.documentElement.scrollLeft || 0;
	goPageTopY1 = document.documentElement.scrollTop || 0;
}
if (document.body){
	goPageTopX2 = document.body.scrollLeft || 0;
	goPageTopY2 = document.body.scrollTop || 0;
}
var goPageTopX3 = window.scrollX || 0;
var goPageTopY3 = window.scrollY || 0;
var goPageTopX = Math.max(goPageTopX1, Math.max(goPageTopX2, goPageTopX3));// 滚动条到页面顶部的水平距离
var goPageTopY = Math.max(goPageTopY1, Math.max(goPageTopY2, goPageTopY3));// 滚动条到页面顶部的垂直距离
var goPageTopSpeed = 1 + acceleration;// 滚动距离 = 目前距离 / 速度, 因为距离原来越小, 速度是大于 1 的数, 所以滚动距离会越来越小
window.scrollTo(Math.floor(goPageTopX / goPageTopSpeed), Math.floor(goPageTopY / goPageTopSpeed));
if(goPageTopX > 0 || goPageTopY > 0){// 如果距离不为零, 继续调用迭代本函数
	var invokeFunction = "goPageTop(" + acceleration + ", " + goPageTopTime + ")";
	window.setTimeout(invokeFunction, goPageTopTime);
	}
}

//correctly handle PNG transparency in Win IE 5.5 & 6. 
function correctPNG(){var arVersion = navigator.appVersion.split("MSIE");var version = parseFloat(arVersion[1]);if ((version >= 5.5) && (document.body.filters)){for(var j=0; j<document.images.length; j++){ var img = document.images[j];var imgName = img.src.toUpperCase();if (imgName.substring(imgName.length-3, imgName.length) == "PNG"){var imgID = (img.id) ? "id='" + img.id + "' " : "" 
	var imgClass = (img.className) ? "class='" + img.className + "' " : "" 
	var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' " 
	var imgStyle = "display:inline-block;" + img.style.cssText 
	if (img.align == "left") imgStyle = "float:left;" + imgStyle 
	if (img.align == "right") imgStyle = "float:right;" + imgStyle 
	if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle 
	var strNewHTML = "<span " + imgID + imgClass + imgTitle 
	+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" 
	+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" 
	+ "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
	img.outerHTML = strNewHTML;j = j-1 }}}}
window.attachEvent("onload", correctPNG); 

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).style.display = "block";
		}else{
		tabList[i].className = "normal";
		document.getElementById(tabObj+"_Content"+i).style.display = "none";
		}
	}
	var lk=document.getElementById("link");
	if (Num==0)
	{
		lk.href='html.asp?type=32';
	}else if(Num==1)
	{
		lk.href='html.asp?type=10';
	}else if(Num==2)
	{
		lk.href='html.asp?type=33';
	}else if(Num==3)
	{
		lk.href='html.asp?type=66';
	}else if(Num==4)
	{
		lk.href='html.asp?type=13';
	}
}

function nTabs1(thisObj,Num){
if(thisObj.className == "active1")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 = "active1";
			document.getElementById(tabObj+"_Content"+i).style.display = "block";
		}else{
		tabList[i].className = "normal1";
		document.getElementById(tabObj+"_Content"+i).style.display = "none";
		}
	}
	var lk=document.getElementById("link1");
	if (Num==0)
	{
		lk.href='html.asp?type=25';
	}else if(Num==1)
	{
		lk.href='html.asp?type=4';
	}
}

function nTabs2(thisObj,Num){
if(thisObj.className == "active2")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 = "active2";
			document.getElementById(tabObj+"_Content"+i).style.display = "block";
		}else{
		tabList[i].className = "normal2";
		document.getElementById(tabObj+"_Content"+i).style.display = "none";
		}
	}
	var lk=document.getElementById("link2");
	if (Num==0)
	{
		lk.href='html.asp?type=26';
	}else if(Num==1)
	{
		lk.href='html.asp?type=27';
	}
}
$.fn.extend({
	myMenu: function() {
		$(this).children('ul').children('li').hover(
			function() {
				if(!$(this).children('ul').hasClass('focus')) {
					$(this).addClass('focus');
					$(this).children('ul:first').stop(true, true).animate({ height:'show' }, 'fast');
				}
			},
			function() {
				$(this).removeClass('focus');
				$(this).children('ul:first').stop(true, true).animate({height:'hide', opacity:'hide'}, 'slow');
			}
		);
		$(this).children('ul').children('li').children('ul').hover(
			function() {
				$(this).addClass('focus');
			},
			function() {
				$(this).removeClass('focus');
			}
		);
	}
});
$(document).ready(function() {
	$('#nav').myMenu();
});

function SDMenu(id) {
	if (!document.getElementById || !document.getElementsByTagName)
		return false;
	this.menu = document.getElementById(id);
	this.submenus = this.menu.getElementsByTagName("div");
	this.remember = true;
	this.speed = 3;
	this.markCurrent = true;
	this.oneSmOnly = false;
}
SDMenu.prototype.init = function() {
	var mainInstance = this;
	for (var i = 0; i < this.submenus.length; i++)
		this.submenus[i].getElementsByTagName("span")[0].onclick = function() {
			mainInstance.toggleMenu(this.parentNode);
		};
	if (this.markCurrent) {
		var links = this.menu.getElementsByTagName("a");
		for (var i = 0; i < links.length; i++)
			if (links[i].href == document.location.href) {
				links[i].className = "current";
				break;
			}
	}
	if (this.remember) {
		var regex = new RegExp("sdmenu_" + encodeURIComponent(this.menu.id) + "=([01]+)");
		var match = regex.exec(document.cookie);
		if (match) {
			var states = match[1].split("");
			for (var i = 0; i < states.length; i++)
				this.submenus[i].className = (states[i] == 0 ? "collapsed" : "");
		}
	}
};
SDMenu.prototype.toggleMenu = function(submenu) {
	if (submenu.className == "collapsed")
		this.expandMenu(submenu);
	else
		this.collapseMenu(submenu);
};
SDMenu.prototype.expandMenu = function(submenu) {
	var fullHeight = submenu.getElementsByTagName("span")[0].offsetHeight;
	var links = submenu.getElementsByTagName("a");
	for (var i = 0; i < links.length; i++)
		fullHeight += links[i].offsetHeight;
	var moveBy = Math.round(this.speed * links.length);
	
	var mainInstance = this;
	var intId = setInterval(function() {
		var curHeight = submenu.offsetHeight;
		var newHeight = curHeight + moveBy;
		if (newHeight < fullHeight)
			submenu.style.height = newHeight + "px";
		else {
			clearInterval(intId);
			submenu.style.height = "";
			submenu.className = "";
			mainInstance.memorize();
		}
	}, 30);
	this.collapseOthers(submenu);
};
SDMenu.prototype.collapseMenu = function(submenu) {
	var minHeight = submenu.getElementsByTagName("span")[0].offsetHeight;
	var moveBy = Math.round(this.speed * submenu.getElementsByTagName("a").length);
	var mainInstance = this;
	var intId = setInterval(function() {
		var curHeight = submenu.offsetHeight;
		var newHeight = curHeight - moveBy;
		if (newHeight > minHeight)
			submenu.style.height = newHeight + "px";
		else {
			clearInterval(intId);
			submenu.style.height = "";
			submenu.className = "collapsed";
			mainInstance.memorize();
		}
	}, 30);
};
SDMenu.prototype.collapseOthers = function(submenu) {
	if (this.oneSmOnly) {
		for (var i = 0; i < this.submenus.length; i++)
			if (this.submenus[i] != submenu && this.submenus[i].className != "collapsed")
				this.collapseMenu(this.submenus[i]);
	}
};
SDMenu.prototype.expandAll = function() {
	var oldOneSmOnly = this.oneSmOnly;
	this.oneSmOnly = false;
	for (var i = 0; i < this.submenus.length; i++)
		if (this.submenus[i].className == "collapsed")
			this.expandMenu(this.submenus[i]);
	this.oneSmOnly = oldOneSmOnly;
};
SDMenu.prototype.collapseAll = function() {
	for (var i = 0; i < this.submenus.length; i++)
		if (this.submenus[i].className != "collapsed")
			this.collapseMenu(this.submenus[i]);
};
SDMenu.prototype.memorize = function() {
	if (this.remember) {
		var states = new Array();
		for (var i = 0; i < this.submenus.length; i++)
			states.push(this.submenus[i].className == "collapsed" ? 0 : 1);
		var d = new Date();
		d.setTime(d.getTime() + (30 * 24 * 60 * 60 * 1000));
		document.cookie = "sdmenu_" + encodeURIComponent(this.menu.id) + "=" + states.join("") + "; expires=" + d.toGMTString() + "; path=/";
	}
};
var mySideMenu;
window.onload = function() {
	mySideMenu = new SDMenu("mySideMenu");
	mySideMenu.init();
};
