window.onerror=function(a,b,c){return true;}

var openview=true;
var js_ver=false;//true;
//if (ScriptEngineMinorVersion()<5) js_ver=false;
//alert(ScriptEngineMajorVersion()+"."+ScriptEngineMinorVersion()+"."+ScriptEngineBuildVersion());

function $(id) {
	return document.getElementById(id);
}

function weatherLoad() {
	MiniSite.Weather.print("Wealth");
}


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("此操作被浏览器拒绝！请在浏览器地址栏输入“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',vrl);
		}
	}
}
function AddFavorite(sURL,sTitle) {
	try{
		window.external.addFavorite(sURL,sTitle);
	}catch(e) {
		try{
			window.sidebar.addPanel(sTitle,sURL,"");
		}catch(e) {
			alert("加入收藏失败，请使用Ctrl+D进行添加");
		}
	}
}


function setTab(name,cursel,n,t){
	for(var i=1;i<=n;i++){	
		var menu=document.getElementById(name+i);
		if(!menu){
			if (t==0)cursel++;
			continue;
		}
		var con=document.getElementById("con_"+name+"_"+i);
		menu.className=(i==cursel?"hover":"");
		con.style.display=(i==cursel?"block":"none");
	}
}




function bbs_load_online(fname)
{
var targetimg =eval("document.all.bbs_online_img");
var targetDivtr =eval("document.all.bbs_online_tr");
var targetDiv =eval("document.all.bbs_online");
 if (targetDivtr.style.display!="block")
{
document.all.bbs_online_var.innerHTML="关闭在线列表";
targetDivtr.style.display="block";
if (targetimg.loaded=="no")
{
targetimg.loaded=
document.frames["hiddenframe"].location.replace("Load.asp?action=online&fname="+fname);
}
}
else
 {
document.all.bbs_online_var.innerHTML="打开在线列表";
targetDivtr.style.display="none";
}
}




//滑动门
function ms_dispnav(){
     if(arguments.length < 2)return;
     var tell = arguments[0];
     for(var i = 1; i < arguments.length; i++){
         var nav = document.getElementById(arguments[i] + "_nav");
         var content = document.getElementById(arguments[i] + "_content");
         if(!nav || !content)continue;
         if(tell == i){
             nav.className = i == arguments.length - 1 ? "active end" : "active";
             content.style.display = "";
         }
         else{
             nav.className = i == arguments.length - 1 ? "normal end" : "normal";
             content.style.display = "none";
         }
     }
}





function imgzoom(img,maxsize){
	var a=new Image();
	a.src=img.src
	if(a.width > maxsize * 4)
	{
		img.style.width=maxsize;
	}
	else if(a.width >= maxsize)
	{
		img.style.width=Math.round(a.width * Math.floor(4 * maxsize / a.width) / 4);
	}
	return false;
}

//图片自动调整的模式，1为按比例调整 ，2 按大小调整。
var resizemode=1
function imgresize(o){
	 if (resizemode==2 || o.onmousewheel){
	 	if(o.width > 500 ){
				o.style.width='500px';
			}
			if(o.height > 800){
				o.style.height='800px';
			}
		}else{
		var parentNode=o.parentNode.parentNode
		if (parentNode){
		if (o.offsetWidth>=parentNode.offsetWidth) o.style.width='98%';
		}else{
		var parentNode=o.parentNode
		if (parentNode){
			if (o.offsetWidth>=parentNode.offsetWidth) o.style.width='98%';
			}
		}
	}
}

//表单检测相关
function checkPost(cmid){
	var form1=document.add_frm;
	if (cmid == 1){ 
	    if (form1.Topic.value==""){
		    alert("标题不能为空，请先填写！");
		    form1.Topic.focus();
		    return false;
	    }
	}
	else{
	    if (form1.name.value==""){
		    alert("标题或名称不能为空，请先填写！");
		    form1.name.focus();
		    return false;
	    }		
	}
	if (form1.ClassID.value==""){
		alert("请选择分类！\n\n若该分类含有下属分类，请选择其下属分类。");
		form1.ClassID.focus();
		return false;
	}
	if (form1.ClassID.value=="0"){
		alert("该分类是外部连接，不能添加内容！");
		form1.ClassID.focus();
		return false;
	}
	if (cmid==3){
	   if (form1.Brief.value==""){
		   alert("商品摘要不能为空，请先填写！");
		   form1.Brief.focus();
		   return false;
	   }
	   //isNaN(form1.Price.value) 表单已限制只可输入数字  
	   if (form1.Price.value==""||form1.Price_Original.value==""||form1.Price_Market.value==""){
		   alert("商品原价,当前价格，参考价格不能为空，且必须是数字！");
		   form1.Price.focus();
		   return false;
	   }
	   //还有错误，呆会儿修改
	   if (form1.is_emoney.checked==true){
	       if (form1.emoney.value==""||isNaN(form1.emoney.value)){
	          alert("你已选择可用虚拟货币购买，故虚拟货币不能为空，且必须是大于0的数字！");
	          form1.emoney.focus();
	   	    return false;
	       }
	   }	   
	}	
	if (Editor1.getHTML()==""){
		alert("正文内容不能为空，请先填写！");
		return false;
	}
	if (cmid==5){
	   if (form1.pic.value==""){
		   alert("缩略图地址不能为空，请先填写！");
		   form1.pic.focus();
		   return false;
	   }		
	}	
	if (chkdiv("CodeStr")){ 
	    if (form1.CodeStr.value==""){
		    alert("验证码还没有填写，请先填写！");
		    form1.CodeStr.focus();
		    return false;
		}
	}
	//验证码结束
	if (form1.readme.checked!=true){
		alert("请先同意发布声明后再发布，谢谢合作！");
		form1.readme.focus();
		return false;
	}	
	if (cmid==2||cmid==5||cmid==6){
	   //加载地址
	   PostUrl('add_frm','Url','Urls')
	   if (form1.Urls.value==""){
		   alert("相关地址不能为空，请先填写！");
		   form1.Url.focus();
		   return false;
	   }		
	}
	
}

function checkBlogPost(){
	var form1=document.write_frm;
	if (form1.wrtopic.value==""){
		alert("标题不能为空，请先填写！");
		form1.wrtopic.focus();
		return false;
	 }	
	if (chkdiv("wrpic")){ 
	    if (form1.wrpic.value==""){
		    alert("相片地址不能为空，请先填写！");
		    form1.wrpic.focus();
		    return false;
	    }
	}	 
	if (form1.wrword.value==""){
		alert("正文内容或简介不能为空，请先填写！");
		form1.wrword.focus();
		return false;
	 }	 
}

//检测是否有指定的对象
function chkdiv(divid){
var chkid=document.getElementById(divid);
if(chkid != null){return true; }
else {return false; }
}
//编辑器相关
function doPreview(objname,Wpath,Upath){
	var obj=document.getElementById(objname);
	if(obj.length==0) return false;
	var url=obj.value; 
	if (url){
		url = url.replace("{$web_dir}",Wpath);
		url = url.replace("{$download_dir}",Upath);
		var sExt=url.substr(url.lastIndexOf(".")+1);
		sExt=sExt.toUpperCase();
		var sHTML;
		switch(sExt){
		case "GIF":
		case "JPG":
		case "BMP":
		case "PNG":
			tdPreview.innerHTML = "<img border=0 src='" + url + "' width='170' height='140'>";
			document.add_frm.showuploadlist.checked = true;
			uploadlist.style.display = "";
			break;
		//case "SWF":
		//	sHTML = "<img border=0 src='" + url + "' width='170' height='140'>";
		//	break;
		default:
			tdPreview.innerHTML = "";
			break;
		}
		//tdPreview.innerHTML = sHTML;
	}else{
		tdPreview.innerHTML = "";
	}
}
//地址栏的图片预览
function doPreviews(objname,Wpath,Upath){
	var obj=document.getElementById(objname);
	if(obj.length==0) return false;
	var urls=obj.value; 
	if (urls){
		urls = urls.split("|");
		url = urls[1]
		url = url.replace("{$web_dir}",Wpath);
		url = url.replace("{$download_dir}",Upath);
		var sExt=url.substr(url.lastIndexOf(".")+1);
		sExt=sExt.toUpperCase();
		var sHTML;
		switch(sExt){
		case "GIF":
		case "JPG":
		case "BMP":
		case "PNG":
			tdPreview.innerHTML = "<img border=0 src='" + url + "' width='170' height='140'>";
			document.add_frm.showuploadlist.checked = true;
			uploadlist.style.display = "";
			break;
		//case "SWF":
		//	sHTML = "<img border=0 src='" + url + "' width='170' height='140'>";
		//	break;
		default:
			tdPreview.innerHTML = "";
			break;
		}
		//tdPreview.innerHTML = sHTML;
	}else{
		tdPreview.innerHTML = "";
	}
}
function InsertEditor(objname,Wpath,Upath)
{
	var obj=document.getElementById(objname);
	if(obj.length==0) return false;
	var url=obj.value;
		url = url.replace("{$web_dir}",Wpath);
		url = url.replace("{$download_dir}",Upath);
	var sFilePic = getFilePic(url);
    var sPicSrc = Wpath + "Images/FileType/"+sFilePic;
  	var sPicStr = ""
		switch(sFilePic){
		case "gif.gif":
		case "jpg.gif":
		case "bmp.gif":
		case "png.gif":
			sPicStr = "<img src='"+url+"' border='0'><br />" 
			break;
		//case "swf.gif":
		//	sPicStr = "<img src='"+url+"' border='0'><br />" 
		//	break;
		default:
			sPicStr = ""
			break;
		}
	var sFileName = url.substr(url.lastIndexOf("/")+1);
	eWebEditor1.eWebEditor.focus()
	eWebEditor1.insertHTML("<img border=0 src='"+sPicSrc+"'> <a href='"+url+"' target=_blank><b>"+sFileName+"</b></a><br />"+sPicStr);
}

function SetPicUrl(objname,Insobjname)
{
	var obj=document.getElementById(objname);
	if(obj.length==0) return false;
	document.getElementById(Insobjname).value=obj.value;
}


function getFilePic(url){
	var sExt;
	sExt=url.substr(url.lastIndexOf(".")+1);
	sExt=sExt.toUpperCase();
	var sPicName;
	switch(sExt){
	case "TXT":
		sPicName = "txt.gif";
		break;
	case "DOC":
		sPicName = "doc.gif";
		break;
	case "PDF":
		sPicName = "pdf.gif";
		break;
	case "MDB":
		sPicName = "mdb.gif";
		break;
	case "GIF":
		sPicName = "gif.gif";
		break;
	case "JPG":
		sPicName = "jpg.gif";
		break;
	case "BMP":
		sPicName = "bmp.gif";
		break;
	case "PNG":
		sPicName = "pic.gif";
		break;
	case "ASP":
	case "JSP":
	case "JS":
	case "PHP":
	case "PHP3":
	case "ASPX":
		sPicName = "code.gif";
		break;
	case "HTM":
	case "HTML":
	case "SHTML":
		sPicName = "htm.gif";
		break;
	case "ZIP":
		sPicName = "zip.gif";
		break;
	case "RAR":
		sPicName = "rar.gif";
		break;
	case "EXE":
		sPicName = "exe.gif";
		break;
	case "AVI":
		sPicName = "avi.gif";
		break;
	case "MPG":
	case "MPEG":
	case "ASF":
		sPicName = "mp.gif";
		break;
	case "RA":
	case "RM":
		sPicName = "rm.gif";
		break;
	case "MP3":
		sPicName = "mp3.gif";
		break;
	case "MID":
	case "MIDI":
		sPicName = "mid.gif";
		break;
	case "WAV":
		sPicName = "audio.gif";
		break;
	case "XLS":
		sPicName = "xls.gif";
		break;
	case "PPT":
	case "PPS":
		sPicName = "ppt.gif";
		break;
	case "SWF":
		sPicName = "swf.gif";
		break;
	default:
		sPicName = "unknow.gif";
		break;
	}
	return sPicName;
}
function PostUrl(strfrm,objname,objname2)
{
	var tmpobj=eval("document."+strfrm+"."+objname);
	var tmpobj2=eval("document."+strfrm+"."+objname2);
  for(var i=0;i<tmpobj.length;i++)
  {
    if (tmpobj2.value=='') 
    {
      tmpobj2.value=tmpobj.options[i].value;
    }
    else 
    {	
      tmpobj2.value+='@@@'+tmpobj.options[i].value;
    }
  }
}

function AddUrl(cname,objname){
  var obj=document.getElementById(objname);
  var thisurl=cname+(obj.length+1)+'|http://'; 
  var url=prompt('请输入'+cname+'和链接，中间用“|”隔开：',thisurl);
  if(url!=null&&url!=''){obj.options[obj.length]=new Option(url,url);}
}

function ModifyUrl(cname,objname){
  var obj=document.getElementById(objname);
  if(obj.length==0) return false;
  var thisurl=obj.value; 
  if (thisurl=='') {alert('请先选择一个'+cname+'，再点修改按钮！');return false;}
  var url=prompt('请输入'+cname+'和链接，中间用“|”隔开：',thisurl);
  if(url!=thisurl&&url!=null&&url!=''){obj.options[obj.selectedIndex]=new Option(url,url);}
}

function DelUrl(cname,objname){
  var obj=document.getElementById(objname);
  if(obj.length==0) return false;
  var thisurl=obj.value; 
  if (thisurl=='') {alert('请先选择一个'+cname+'，再点删除按钮！');return false;}
  if(obj.selectedIndex==0){alert('不能删除第一个'+cname+'！');return false;}
  obj.options[obj.selectedIndex]=null;
}

function UpUrl(cname,objname) {
	var obj=document.getElementById(objname);
	var nIndex = obj.selectedIndex;
	var nLen = obj.length;
	if ((nLen<1)||(nIndex==0)) return;
	if (nIndex<0) {
		alert("请选择一个要移动的"+cname+"！");
		return;
	}
	var sValue=obj.options[nIndex].value;
	var sValue2=obj.options[nIndex-1].value;
	//var sHTML=obj.options[nIndex].innerHTML;
	obj.options[nIndex]=new Option(sValue2,sValue2);
	obj.options[nIndex-1]=new Option(sValue,sValue);
	obj.selectedIndex=nIndex-1;
}

function DownUrl(cname,objname) {
	var obj=document.getElementById(objname);
	var nIndex = obj.selectedIndex;
	var nLen = obj.length;
	if ((nLen<1)||(nIndex==nLen-1)) return;
	if (nIndex<0) {
		alert("请选择一个要移动的"+cname+"！");
		return;
	}
	var sValue=obj.options[nIndex].value;
	var sValue2=obj.options[nIndex+1].value;
	obj.options[nIndex]=new Option(sValue2,sValue2);
	obj.options[nIndex+1]=new Option(sValue,sValue);
	obj.selectedIndex=nIndex+1;
}

function SelectFiles(sChannelID,type,objname,objname2)
{
  var arr=window.showModalDialog('../asaiadmin/AMH_UploadFiles.asp?FileType=select&cid='+sChannelID, '', 'dialogWidth:750px;dialogHeight:450px;help:no;scroll:yes;status:no;directories:yes;scrollbars:no;Resizable=no;');
	if(arr!=null)
	{
		var obj = document.getElementById(objname);
		var strT=arr.split('|');
		if (type=='1'){
			var url='下载地址'+(obj.length+1)+'|'+strT[0];
			obj.options[obj.length]=new Option(url,url);
		}
		else if (type=='2'){
			var url='图片名称'+(obj.length+1)+'|'+strT[0];
			obj.options[obj.length]=new Option(url,url);
		}
		else if (type=='3'){
			var url='影片名称'+(obj.length+1)+'|'+strT[0];
			obj.options[obj.length]=new Option(url,url);
		}
		else {
			obj.value=strT[0];
		}
		if (objname2!='') {document.getElementById(objname2).value=strT[1];}
	}
}
function SelectColor(tcstr)
{
  var c=window.showModalDialog("../Editor/Html/Dialog/Selcolor2.htm","s","dialogWidth=300px;dialogHeight=270px;status=0");
  var d=c;
  if (c && c!="")
  {
    if (d.length==7) { d=d.substr(1,d.length); }
    eval("window.document.all."+tcstr+".value=d;window.document.all."+tcstr+".style.backgroundColor=c;");
  }
}
function ClearColor(tcstr)
{
  eval("window.document.all."+tcstr+".value='';window.document.all."+tcstr+".style.backgroundColor='';");
}

//<input type=test name=tim value='2003-5-19' size=12 maxlength=10 readonly>
//<input type=button name=st_btn value="选择" onclick="javascript:select_time(tim);return false;">

function select_time(st_obj)
{
  var showx=event.screenX-event.offsetX-14;
  var showy=event.screenY-event.offsetY-168;
  var retval=window.showModalDialog("../asaiadmin/Include/AMH_Select_Data.asp?"+st_obj.value,"","dialogWidth:197px; dialogHeight:210px; dialogLeft:"+showx+"px; dialogTop:"+showy+"px; status:no; directories:yes;scrollbars:no;Resizable=no;");
  if( retval!=null ) { st_obj.value=retval; }
  //else { }
}
//运行代码
function runEx(cod1)  {
	 cod=document.getElementById(cod1)
	  var code=cod.value;
	  if (code!=""){
		  var newwin=window.open('','','');  
		  newwin.opener = null 
		  newwin.document.write(code);  
		  newwin.document.close();
	}
}
//复制代码
function doCopy(ID) { 
	if (document.all){
		 textRange = document.getElementById(ID).createTextRange(); 
		 textRange.execCommand("Copy"); 
	}
	else{
		 alert("此功能只能在IE上有效")
	}
}

//表单(post)操作
function post_value(post_now_frm,strer)
{
  if (strer!="")
  {
    if (strer=="_remark") strer="AsaiMHWord";
    if (strer=="_topic") strer="topic";
    return eval("document."+post_now_frm+"."+strer+".value;");
  }
}

function post_focus(post_now_frm,strer)
{
  if (strer!="")
  {
    if (strer=="_remark") strer="AsaiMHWord";
    if (strer=="_topic") strer="topic";
    return eval("document."+post_now_frm+"."+strer+".focus();");
  }
}

function post_preview(post_now_frm,post_now_topic,post_now_remark,strcode)
{
  if (strcode==null) strcode=1;
  eval("document.frm_preview.p_topic.value=document."+post_now_frm+"."+post_now_topic+".value");
  eval("document.frm_preview.p_mod.value=editorFrame.wysiwyg");
  eval("document.frm_preview.p_remark.value=editorFrame.getEditorContents()");
 //eval("document.frm_preview.p_remark.value=document."+post_now_frm+"."+post_now_remark+".value");
 // eval("document.frm_preview.p_code.value="+strcode);
  open_win('about:blank','win_preview',600,525,'yes');
  document.frm_preview.submit();
}

//字数检查
function post_check_length(post_now_frm,post_now_remark,post_now_maxlen)
{
  if (post_now_maxlen == 0) return;
  var postchars=eval("document."+post_now_frm+"."+post_now_remark+".value.length;");
  var post_1="您输入的贴子内容已经超过系统允许的最大值！\n请删减部分贴子内容！";
  var message="系统允许："+post_now_maxlen+"KB（约"+post_now_maxlen*1024+"个字符）";
  if (post_now_maxlen*1024>=postchars)
  {
    var postc=post_now_maxlen*1024-postchars;
    post_1="您还可以输入："+postc+"个字符（约"+Math.round(postc/1024)+"KB）";
  }
  alert("您输入的贴子内容的统计信息如下：\n\n当前长度："+postchars+"个字符（约"+Math.round(postchars/1024)+"KB）\n"+message+"\n"+post_1);
}

function post_check_length2(post_now_maxlen)
{
  if (post_now_maxlen == 0) return;
  var nowstr = editorFrame.getEditorContents();
  var postchars=nowstr.length;
  var post_1="您输入的贴子内容已经超过系统允许的最大值！\n请删减部分贴子内容！";
  var message="系统允许："+post_now_maxlen+"KB（约"+post_now_maxlen*1024+"个字符）";
  if (post_now_maxlen*1024>=postchars)
  {
    var postc=post_now_maxlen*1024-postchars;
    post_1="您还可以输入："+postc+"个字符（约"+Math.round(postc/1024)+"KB）";
  }
  alert("您输入的贴子内容的统计信息如下：\n\n当前长度："+postchars+"个字符（约"+Math.round(postchars/1024)+"KB）\n"+message+"\n"+post_1);
}

//表单锁定
function frm_submitonce(theform)
{
  if (document.all||document.getElementById)
  {
    for (i=0;i<theform.length;i++)
    {
      var tempobj=theform.elements[i]
      if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset") { tempobj.disabled=true; }
    }
  }
}


function click_return(cvar,ct)
{
  var nvar='';
  switch (ct)
  {
    case 1:
      nvar=cvar;
      break;
    default :
      nvar='您确定要'+cvar+'吗？\n\n执行该操作后将不可恢复！';
      break;
  }
  var cf=window.confirm(nvar);
  if (cf) { return true; }
  return false;
}

function note_emoney(nvar,nemoney,npower)
{
  if (nemoney==0) { return true; }
  var t1=window.confirm(nvar+" 将扣除你 "+nemoney+" 货币！\n\n1、如已扣除过将不再二次扣除；\n2、未过期的计时用户将不扣除；\n\n扣除后将不能恢复！ 你确定吗？");
  if (t1) { return true; }
  return false;
}

function login_true()
{
  if (document.login_frm.logininfo.value=="") { alert("请输入您在本站注册时的 用户名称 ！"); document.login_frm.logininfo.focus(); return false; }
  if (document.login_frm.password.value=="") { alert("请输入您在本站注册时的 登陆密码 ！"); document.login_frm.password.focus(); return false; }
  if (chkdiv("CodeStr")){ 
  if (document.login_frm.CodeStr.value=="") { alert("请输入系统提示的正确验证码信息 ！"); document.login_frm.password.focus(); return false; }
  }
}

function open_win(url,name,width,height,scroll)
{
  var Left_size = (screen.width) ? (screen.width-width)/2 : 0;
  var Top_size = (screen.height) ? (screen.height-height)/2 : 0;
  var open_win=window.open(url,name,'width=' + width + ',height=' + height + ',left=' + Left_size + ',top=' + Top_size + ',toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=' + scroll + ',resizable=no' );
}

function open_view(ourl,ot)
{
  if (openview==true)
  { window.open(ourl); }
  else
  { document.location.href=""+web_dir+ourl+""; }
}


var divTop,divLeft,divWidth,divHeight,docHeight,docWidth,objTimer,i = 0;
function getMsg()
{
	try{
	divTop = parseInt(document.getElementById("eMeng").style.top,10)
	divLeft = parseInt(document.getElementById("eMeng").style.left,10)
	divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10)
	divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10)
	docWidth = document.body.clientWidth;
	docHeight = document.body.clientHeight;
	document.getElementById("eMeng").style.top = parseInt(document.body.scrollTop,10) + docHeight + 10;//  divHeight
	document.getElementById("eMeng").style.left = parseInt(document.body.scrollLeft,10) + docWidth - divWidth
	document.getElementById("eMeng").style.visibility="visible"
	objTimer = window.setInterval("moveDiv()",10)
	}
	catch(e){}
}

function resizeDiv()
{
	i+=1
	if(i>1500) closeDiv()
	try{
	divHeight = parseInt(document.getElementById("eMeng").offsetHeight,10)
	divWidth = parseInt(document.getElementById("eMeng").offsetWidth,10)
	docWidth = document.body.clientWidth;
	docHeight = document.body.clientHeight;
	document.getElementById("eMeng").style.top = docHeight - divHeight + parseInt(document.body.scrollTop,10)
	document.getElementById("eMeng").style.left = docWidth - divWidth + parseInt(document.body.scrollLeft,10)
	}
	catch(e){}
}

function moveDiv()
{
	try
	{
	if(parseInt(document.getElementById("eMeng").style.top,10) <= (docHeight - divHeight + parseInt(document.body.scrollTop,10)))
	{
	window.clearInterval(objTimer)
	objTimer = window.setInterval("resizeDiv()",1)
	}
	divTop = parseInt(document.getElementById("eMeng").style.top,10)
	document.getElementById("eMeng").style.top = divTop - 1
	}
	catch(e){}
}
function closeDiv()
{
	document.getElementById('eMeng').style.visibility='hidden';
	if(objTimer) window.clearInterval(objTimer)
}

//window.onerror=function(a,b,c){return true;}

//浏览器类型变量
var InternetExplorer = navigator.appName.indexOf("Microsoft") != -1;

var client_browse="";
if (document.getElementById)	// IE5+,NN6+	document.getElementById("id");
{ client_browse="ie5"; }
else if (document.all)		// IE4		document.all("id");
{ client_browse="ie4"; }
else if (document.layers)	// NN4		document.layers["id"];
{ client_browse="ns4"; }

function get_id(strname)
{
  switch (client_browse)
  {
    case "ie5":
      return document.getElementById(strname);
      break;
    case "ns4":
      return document.layers[strname];
      break;
    default :	//"ie4"
      return document.all(strname);
      break;
  }
}

function insert_value(strinput,strvalue)
{
  var tmpstr="";
  switch (client_browse)
  {
    case "ie5":
      tmpstr="document.all."+strinput+".value='"+strvalue+"';";
      break;
    case "ns4":
      tmpstr="document.layers.[\""+strinput+"\"].value='"+strvalue+"';";
      break;
    default :	//"ie4"
      tmpstr="document.all."+strinput+".value='"+strvalue+"';";
      break;
  }
  if (tmpstr!="") eval(tmpstr);
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

//---------下拉菜单-------------------------------------------------------------------------------------------
var menuOffX=0	//菜单距连接文字最左端距离
var menuOffY=18	//菜单距连接文字顶端距离
var vBobjects = new Array();
var fo_shadows=new Array()
var linkset=new Array()
////No need to edit beyond here
var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1
var ns6=document.getElementById&&!document.all
var ns4=document.layers
function showmenu(e,vmenu,mod){
	if (!document.all&&!document.getElementById&&!document.layers)
		return
	which=vmenu
	clearhidemenu()
	ie_clearshadow()
	menuobj=ie4? document.all.popmenu : ns6? document.getElementById("popmenu") : ns4? document.popmenu : ""
	menuobj.thestyle=(ie4||ns6)? menuobj.style : menuobj
	
	if (ie4||ns6)
		menuobj.innerHTML=which
	else{
		menuobj.document.write('<layer name=gui bgColor=#E6E6E6 width=165 onmouseover="clearhidemenu()" onmouseout="hidemenu()">'+which+'</layer>')
		menuobj.document.close()
	}
	menuobj.contentwidth=(ie4||ns6)? menuobj.offsetWidth : menuobj.document.gui.document.width
	menuobj.contentheight=(ie4||ns6)? menuobj.offsetHeight : menuobj.document.gui.document.height
	
	eventX=ie4? event.clientX : ns6? e.clientX : e.x
	eventY=ie4? event.clientY : ns6? e.clientY : e.y
	
	var rightedge=ie4? document.body.clientWidth-eventX : window.innerWidth-eventX
	var bottomedge=ie4? document.body.clientHeight-eventY : window.innerHeight-eventY
		if (rightedge<menuobj.contentwidth)
			menuobj.thestyle.left=ie4? document.body.scrollLeft+eventX-menuobj.contentwidth+menuOffX : ns6? window.pageXOffset+eventX-menuobj.contentwidth : eventX-menuobj.contentwidth
		else
			menuobj.thestyle.left=ie4? ie_x(event.srcElement)+menuOffX : ns6? window.pageXOffset+eventX : eventX
		
		if (bottomedge<menuobj.contentheight&&mod!=0)
			menuobj.thestyle.top=ie4? document.body.scrollTop+eventY-menuobj.contentheight-event.offsetY+menuOffY-23 : ns6? window.pageYOffset+eventY-menuobj.contentheight-10 : eventY-menuobj.contentheight
		else
			menuobj.thestyle.top=ie4? ie_y(event.srcElement)+menuOffY : ns6? window.pageYOffset+eventY+10 : eventY
	menuobj.thestyle.visibility="visible"
	ie_dropshadow(menuobj,"#999999",3)
	return false
}

function ie_y(e){  
	var t=e.offsetTop;  
	while(e=e.offsetParent){  
		t+=e.offsetTop;  
	}  
	return t;  
}  
function ie_x(e){  
	var l=e.offsetLeft;  
	while(e=e.offsetParent){  
		l+=e.offsetLeft;  
	}  
	return l;  
}  
function ie_dropshadow(el, color, size)
{
	var i;
	for (i=size; i>0; i--)
	{
		var rect = document.createElement('div');
		var rs = rect.style
		rs.position = 'absolute';
		rs.left = (el.style.posLeft + i) + 'px';
		rs.top = (el.style.posTop + i) + 'px';
		rs.width = el.offsetWidth + 'px';
		rs.height = el.offsetHeight + 'px';
		rs.zIndex = el.style.zIndex - i;
		rs.backgroundColor = color;
		var opacity = 1 - i / (i + 1);
		rs.filter = 'alpha(opacity=' + (100 * opacity) + ')';
		//el.insertAdjacentElement('afterEnd', rect);
		fo_shadows[fo_shadows.length] = rect;
	}
}
function ie_clearshadow()
{
	for(var i=0;i<fo_shadows.length;i++)
	{
		if (fo_shadows[i])
			fo_shadows[i].style.display="none"
	}
	fo_shadows=new Array();
}


function contains_ns6(a, b) {
	while (b.parentNode)
		if ((b = b.parentNode) == a)
			return true;
	return false;
}

function hidemenu(){
	if (window.menuobj)
		menuobj.thestyle.visibility=(ie4||ns6)? "hidden" : "hide"
	ie_clearshadow()
}

function dynamichide(e){
	if (ie4&&!menuobj.contains(e.toElement))
		hidemenu()
	else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
		hidemenu()
}

function delayhidemenu(){
	if (ie4||ns6||ns4)
		delayhide=setTimeout("hidemenu()",500)
}

function clearhidemenu(){
	if (window.delayhide)
		clearTimeout(delayhide)
}

function highlightmenu(e,state){
	if (document.all)
		source_el=event.srcElement
	else if (document.getElementById)
		source_el=e.target
	if (source_el.className=="menuitems"){
		source_el.id=(state=="on")? "mouseoverstyle" : ""
	}
	else{
		while(source_el.id!="popmenu"){
			source_el=document.getElementById? source_el.parentNode : source_el.parentElement
			if (source_el.className=="menuitems"){
				source_el.id=(state=="on")? "mouseoverstyle" : ""
			}
		}
	}
}

if (ie4||ns6)
document.onclick=hidemenu


function shop_fucchecknum(num)
{
  var i,j,strTemp="0123456789";
  if (num.length== 0)
    return 0
  for (i=0;i<num.length;i++)
  {
    j=strTemp.indexOf(num.charAt(i));  
    if (j==-1)
      return 0;
  }
  return 1;
}

function shop_clear(){ 
  if (confirm("确定要清空购物车？"))
  { window.location.href="?action=clear"; }
}

function shop_checknum(num1,num2) 
{
  if ((shop_fucchecknum(num1.value)==0) )
  {  
    num1.value=num2.value;
    return false;
  }
}

function shop_checknumnull(num1)
{
  if (num1.value=="")
  {  
    alert("请填写购买产品的数量");
    theform.focus();
    return false;
  }
}
//#############################################################################
function ShowTime()
{
today= new Date();
var years=today.getYear();
var months=today.getMonth()+1;
var dates=today.getDate();
var hours=today.getHours();
var minutes=today.getMinutes();
var seconds=today.getSeconds();

if (eval(hours) <10) {hours="0"+hours;}
if (eval(minutes) < 10) {minutes="0"+minutes;}
if (seconds < 10) {seconds="0"+seconds;}

var step
if(eval(hours)<1)
{
step="午夜";
}
else if(eval(hours)<6)
{
step="凌晨";
}
else if(eval(hours)<9)
{
step="早上";
}
else if(eval(hours)<11)
{
step="上午";
}
else if(eval(hours)<14)
{
step="中午";
}
else if(eval(hours)<18)
{
step="下午";
}
else if(eval(hours)<23)
{
step="晚上";
}
else if(eval(hours)<24)
{
step="午夜";
}

//算农历日历////////////////////////////////////////////////////////////////////////////////////////
var bsYear;  
var bsDate;  
var bsWeek;  
var arrLen=9;	//数组长度
var sValue=0;	//当年的秒数
var dayiy=0;	//当年第几天
var miy=0;	//月份的下标
var iyear=0;	//年份标记
var dayim=0;	//当月第几天
var spd=86400;	//每天的秒数

var year1999="30;29;29;30;29;29;30;29;30;30;30;29";	//354
var year2000="30;30;29;29;30;29;29;30;29;30;30;29";	//354
var year2001="30;30;29;30;29;30;29;29;30;29;30;29;30";	//384
var year2002="30;30;29;30;29;30;29;29;30;29;30;29";	//354
var year2003="30;30;29;30;30;29;30;29;29;30;29;30";	//355
var year2004="29;30;29;30;30;29;30;29;30;29;30;29;30";	//384
var year2005="29;30;29;30;29;30;30;29;30;29;30;29";	//354
var year2006="30;29;30;29;30;29;30;29;30;30;29;30;30";
var year2007="29;29;30;29;29;30;29;30;30;30;29;30";//354

var month1999="正月;二月;三月;四月;五月;六月;七月;八月;九月;十月;十一月;十二月"
var month2001="正月;二月;三月;四月;闰四月;五月;六月;七月;八月;九月;十月;十一月;十二月"
var month2004="正月;二月;闰二月;三月;四月;五月;六月;七月;八月;九月;十月;十一月;十二月"
var month2006="正月;二月;三月;四月;五月;六月;七月;闰七月;八月;九月;十月;十一月;十二月"
var month2007="正月;二月;三月;四月;五月;六月;七月;八月;九月;十月;十一月;十二月"
var Dn="初一;初二;初三;初四;初五;初六;初七;初八;初九;初十;十一;十二;十三;十四;十五;十六;十七;十八;十九;二十;廿一;廿二;廿三;廿四;廿五;廿六;廿七;廿八;廿九;三十";

var Ys=new Array(arrLen);
Ys[0]=919094400;Ys[1]=949680000;Ys[2]=980265600;
Ys[3]=1013443200;Ys[4]=1044028800;Ys[5]=1074700800;
Ys[6]=1107878400;Ys[7]=1138464000;Ys[8]=1171728000;

var Yn=new Array(arrLen);   //农历年的名称
Yn[0]="己卯年";Yn[1]="庚辰年";Yn[2]="辛巳年";
Yn[3]="壬午年";Yn[4]="癸未年";Yn[5]="甲申年";
Yn[6]="乙酉年";Yn[7]="丙戌年";Yn[8]="丁亥年"; 
var D=new Date();
var yy=D.getYear();
var mm=D.getMonth()+1;
var dd=D.getDate();
var ww=D.getDay();
if (ww==0) ww="<font color=GREEN>星期日</font>";
if (ww==1) ww="星期一";
if (ww==2) ww="星期二";
if (ww==3) ww="星期三";
if (ww==4) ww="星期四";
if (ww==5) ww="星期五";
if (ww==6) ww="<font color=GREEN>星期六</font>";
ww=ww;
var ss=parseInt(D.getTime() / 1000);
if (yy<100) yy="19"+yy;

for (i=0;i<arrLen;i++)
	if (ss>=Ys[i]){
		iyear=i;
		sValue=ss-Ys[i];    //当年的秒数
		}
dayiy=parseInt(sValue/spd)+1;    //当年的天数

var dpm=year1999;
if (iyear==1) dpm=year2000;
if (iyear==2) dpm=year2001;
if (iyear==3) dpm=year2002;
if (iyear==4) dpm=year2003;
if (iyear==5) dpm=year2004;
if (iyear==6) dpm=year2005;
if (iyear==7) dpm=year2006;
if (iyear==8) dpm=year2007;
dpm=dpm.split(";");

//alert(iyear);
var Mn=month1999;
if (iyear==2) Mn=month2001;
if (iyear==5) Mn=month2004;
if (iyear==7) Mn=month2006;
if (iyear==8) Mn=month2007;
Mn=Mn.split(";");

var Dn="初一;初二;初三;初四;初五;初六;初七;初八;初九;初十;十一;十二;十三;十四;十五;十六;十七;十八;十九;二十;廿一;廿二;廿三;廿四;廿五;廿六;廿七;廿八;廿九;三十";
Dn=Dn.split(";");

dayim=dayiy;

var total=new Array(13);
total[0]=parseInt(dpm[0]);
for (i=1;i<dpm.length-1;i++) total[i]=parseInt(dpm[i])+total[i-1];
for (i=dpm.length-1;i>0;i--)
	if (dayim>total[i-1]){
		dayim=dayim-total[i-1];
		miy=i;
		}
bsWeek=ww;
bsDate=yy+"年"+mm+"月";
bsDate2=dd+"日";
bsYear="农历"+Yn[iyear];
bsYear2="农历"+Yn[iyear]+" "+Mn[miy]+Dn[dayim-1];
if (ss>=Ys[7]||ss<Ys[0]) bsYear=Yn[7];


//国历节日 *表示放假日
var sFtv = new Array(
"0101*元旦节",
"0214*情人节",
"0305*学雷锋纪念日",
"0308*妇女节",
"0312*植树节",
"0315*消费者权益日",
"0401*愚人节",
"0407*世界卫生日",
"0422*世界地球日",
"0501*劳动节",
"0502*劳动节",
"0503*劳动节",
"0504*青年节",
"0508*世界红十字日",
"0512*国际护士节",
"0515*国际家庭日",
"0517*国际电信日",
"0601*国际儿童节",
"0605*世界环境保护日",
"0606*全国爱眼日",
"0625*全国土地日",
"0626*国际禁毒日",
"0701*中共诞辰&香港回归日",
"0707*抗日战争纪念日",
"0801*建军节",
"0815*抗日战争胜利纪念",
"0909*毛泽东逝世纪念",
"0908*国际扫盲日",
"0910*中国教师节", 
"0927*世界旅游日",
"0928*孔子诞辰",
"1001*国庆节",
"1002*国庆节",
"1003*国庆节",
"1006*老人节",
"1009*世界邮政日",
"1014*世界标准日",
"1016*世界粮食日",
"1024*联合国日",
"1120*彝族年",
"1121*彝族年",
"1122*彝族年",
"1112*孙中山诞辰纪念",
"1205*国际志愿人员日",
"1220*澳门回归纪念",
"1225*圣诞节",
"1226*毛泽东诞辰纪念");

//农历节日 *表示放假日
var lFtv = new Array(
"0101*春节",
"0102*春节",
"0103*春节",
"0115*元宵节",
"0505*端午节",
"0624*火把节",
"0625*火把节",
"0626*火把节",
"0707*七夕情人节",
"0715*中元节",
"0815*中秋节",
"0909*重阳节",
"1208*腊八节",
"1224*小年",
"0100*除夕");
//判断国历节日
if(months<10&&dates<10)  {datenum="0"+months+"0"+dates;}
if(months<10&&dates>=10)  {datenum="0"+months+dates;}
if(months>=10&&dates>=10)  {datenum=months+dates;}
if(months>=10&&dates<10) {datenum=months+"0"+dates;}
if(miy<10&&dayim<10)  {datenum2="0"+miy+"0"+dayim;}
if(miy<10&&dayim>=10)  {datenum2="0"+miy+dayim;}
if(miy>=10&&dayim>=10)  {datenum2=miy+dayim;}
if(miy>=10&&dayim<10) {datenum2=miy+"0"+dayim;}
//format display
sl=sFtv.length;
for(i=0;i<sl;i++)
{
	Festv=sFtv[i].split("*");
	if(datenum==Festv[0])
	{
		Festvname=Festv[1]+"　";
		break;
	}	
	else
	{
		Festvname="";
	}
}
nl=lFtv.length;
for(i=0;i<nl;i++)
{
	Festv=lFtv[i].split("*");
	if(datenum2==Festv[0])
	{
		Festvname2 = "　"+Festv[1];
		break;
	}	
	else
	{
		Festvname2="";
	}
}
var Animals=new Array("鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪");
if (years<1900)	years+=1900;
var strYears = years+Animals[(years-4)%12]+"年 ";
thisdate = strYears+months+"月"+dates+"日";
thistime = hours+":"+minutes+":"+seconds;
document.getElementById("time").innerHTML="<div align=center>"+thisdate+" "+ww+"<br />"+step+"　"+thistime+"<br />"+Festvname+bsYear2+Festvname2+"</div>";
var timer=setTimeout("ShowTime()",1000);
}
function ShowTimeEn()
{
	today= new Date();
	var years=today.getYear();
	var months=today.getMonth()+1;
	var dates=today.getDate();
	var hours=today.getHours();
	var minutes=today.getMinutes();
	var seconds=today.getSeconds();
	
	var ww=today.getDay();
	if (ww==0) ww="Sunday";
	if (ww==1) ww="Monday";
	if (ww==2) ww="Tuesday";
	if (ww==3) ww="Wednesday";
	if (ww==4) ww="Thursday";
	if (ww==5) ww="Friday";
	if (ww==6) ww="Saturday";
	
	if (eval(hours) <10) {hours="0"+hours;}
	if (eval(minutes) < 10) {minutes="0"+minutes;}
	if (seconds < 10) {seconds="0"+seconds;}
	
	var step;
	if(eval(hours)<1)		step="Midnight";
	else if(eval(hours)<6)	step="Wee hours";
	else if(eval(hours)<9)	step="Morning";
	else if(eval(hours)<11)	step="Forenoon";
	else if(eval(hours)<14)	step="Noon";
	else if(eval(hours)<18)	step="Afternoon";
	else if(eval(hours)<23)	step="Night";
	else if(eval(hours)<24)	step="Midnight";
		
	thisdate = years+"."+months+"."+dates;
	thistime = hours+":"+minutes+":"+seconds;
	document.getElementById("time").innerHTML="<div align=center>"+thisdate+" "+ww+"<br />"+step+" "+thistime+"</div>";
	var timer=setTimeout("ShowTimeEn()",1000);
}
startclock(x,y,z)
var  timerID  =  null;
var  timerRunning  =  false;
function  showtime(x1,y1,z1)  {
var xx = x1;
var yx = y1;
var zx = z1;
Today  =  new  Date();
var  NowHour  =  Today.getHours();
var  NowMinute  =  Today.getMinutes();
var  NowMonth  =  Today.getMonth();
var  NowDate  =  Today.getDate();
var  NowYear  =  Today.getYear();
var  NowSecond  =  Today.getSeconds();
if  (NowYear  <2000)
NowYear=1900+NowYear;
Today  =  null;
Hourleft  =  23  -  NowHour
Minuteleft  =  59  -  NowMinute
Secondleft  =  59  -  NowSecond
Yearleft  =  xx  -  NowYear
Monthleft  =  yx  -  NowMonth  -  1
Dateleft  =  zx  -  NowDate
if  (Secondleft<0)
{
Secondleft=60+Secondleft;
Minuteleft=Minuteleft-1;
}
if  (Minuteleft<0)
{ 
Minuteleft=60+Minuteleft;
Hourleft=Hourleft-1;
}
if  (Hourleft<0)
{
Hourleft=24+Hourleft;
Dateleft=Dateleft-1;
}
if  (Dateleft<0)
{
Dateleft=31+Dateleft;
Monthleft=Monthleft-1;
}
if  (Monthleft<0)
{
Monthleft=12+Monthleft;
Yearleft=Yearleft-1;
}
ly_time.innerHTML="<align=center><font class=Gys>"+Monthleft+"月"+Dateleft+"天"+Hourleft+"小时"+Minuteleft+"分"+Secondleft+"秒"+"</font>";
timerID  =  setTimeout("showtime('"+xx+"','"+yx+"','"+zx+"')",1000);
timerRunning  =  false;
}
function  stopclock  ()  {
if(timerRunning)
clearTimeout(timerID);
timerRunning  =  true;
}
function startclock(x,y,z){
var x1 = x;
var y1 = y;
var z1 = z;
stopclock();
showtime(x1,y1,z1);
}
function CopyText(text){
	if(document.all){clipboardData.setData("text",text)}
	else{
		try{
			netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
		}catch(e){
			alert("被浏览器拒绝！\n请在浏览器地址栏输入'about:config'并回车\n然后将'signed.applets.codebase_principal_support'设置为'true'");
			return false
		};
		var clip=Components.classes["@mozilla.org/widget/clipboard;1"].createInstance(Components.interfaces.nsIClipboard);
		if(!clip)return false;
		var trans=Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);
		if(!trans)return false;
		trans.addDataFlavor("text/unicode");
		var str=Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
		str.data=text;
		trans.setTransferData("text/unicode",str,text.length*2);
		var clipid=Components.interfaces.nsIClipboard;
		if(!clip)return false;
		clip.setData(trans,null,clipid.kGlobalClipboard)
	};
	return true
}
function SetFontSize(size,i){ 
        document.getElementById('content'+i).style.fontSize=size+'px'
}
//#############################################################################
