<!-- 在介绍JavaScript的书籍和平时的代码积累中总结出的实用性比较强的代码 -->
<!-- 以下代码的编码格式为 UTF-8 -->

<!-- 作者：李蒙 -->
<!-- 日期：2007-12-22 -->

<!--#########################-->
<!--- 摘自《JavaScript精粹》 ---!>

<!-- 根据浏览器判断加载方法。并且在页面打开的时候可以加载多个函数 第一章--!>
function public_addLoadListener(fn)
{<!-- 参数fn是需要加载的函数的名称，具体应用事例参考《JavaScript精粹》 -->
  if (typeof window.addEventListener!='undefined')
   {
     window.addEventListener('load',fn,false);
   }
  else if (typeof document.addEventListener!='undefined')
   {
     document.addEventListener('load',fn,false);
   }
  else if (typeof window.attachEvent!='undefined')
   {
     window.attachEvent('onload', fn);
   }
  else
   {
     var oldfn=window.onload;
	 if (typeof window.onload!='function')
	  {
        window.onload=fn;
	  }
	 else
	  {
        window.onload=fuction()
		 {
           oldfn();
		   fn();
		 };
	  }
   }
}//end function addLoadListener(fn)


<!-- 获得拥有特定属性值的所有元素 第五章 -->
function public_getElementsByAttribute(attribute,attributeValue)
{
  var elementArray  =  new Array();
  var matchedArray  =  new Array();
  
  if (document.all)
   {
     elementArray = document.all;
   }//end if
  else
   {
     elementArray = document.getElementsByTagName("*");
   }//end else
  
  for (var i=0;i<elementArray.length;i++)
   {
     if (attribute=="class")
	  {
	    var pattern = new RegExp("(^| )" + attributeValue + "( |$)");
		if (pattern.test(elementArray[i].className))
		 {
		   matchedArray[matchedArray.length] = elementArray[i];
		 }
	  }//end if (attribute=="class")
	  
	 else if (attribute=="for")
	  {
	    if (elementArray[i].getAttribute("htmlFor") || elementArray[i].getAttribute("for"))
		 {
		   if (elementArray[i].htmlFor==attributeValue)
		    {
			  matchedArray[matchedArray.length] = elementArray[i];
			}
		 }//end if (matchedArray[i].getAttribute("htmlFor") || elementArray[i].getArraybute("for"))
	  }//end else if (attribute=="for")
	 
	 else if (elementArray[i].getAttribute(attribute)==attributeValue)
	  {
	    matchedArray[matchedArray.length] = elementArray[i];
	  }
	 
   }//end for
   
  return matchedArray;
   
}//end function getElementsByAttribute()


<!-- 获取滚动位置 第七章 -->
function public_getScrollingPosition()
{
  var position = [0,0];
  if (typeof window.pageYOffset != "undefined")
   {
     position = [window.pageXOffset,window.pageYOffset];
   }//end if (typeof window.pageYOffset != "undefined")
  else if (typeof document.documentElement.scrollTop != "undefined" && document.documentElement.scrollTop>0)
   {
     position = [document.documentElement.scrollLeft,document.documentElement.scrollTop];
   }//end else if
  else if (typeof document.body.scrollTop != "undefined")
   {
     position = [document.body.scrollLeft,document.body.scrollTop];
   }//end else if
  
  return position;
}//end funciton


<!-- 识别特殊浏览器 第十一章 -->
function public_identifyBrowser()
{
  var agent = navigator.userAgent.toLowerCase();
  
  if (typeof navigator.vendor != "undefined" && navigator.vendor == "KDE" && typeof window.sidebar != "undefined")
   {
     return "kde";
   }//end if
  else if (typeof window.opera != "undefined")
   {
     var version = parseFloat(agent.replace(/.*opera[\/ ]([^ $]+).*/, "$1"));
	 
	 if (version >= 7)
	  {
        return "opera7";
	  }//end if
	 else if (version >= 5)
	  {
	    return "opera5";
	  }
	 
	 return false;
   }//end else if
  else if (typeof document.all != "undefined")
   {
	 if (typeof document.getElementById != "undefined")
	  {
	    var browser = agent.replace(/.*ms(ie[\/ ][^ $]+).*/, "$1").replace(/ /, "");
		if (typeof document.uniqueID != "undefined")
		 {
	       if (browser.indexOf("5.5") != -1)
		    {
		      return browser.replace(/(.*5\.5).*/, "$1");
			}//end if
		   else
		    {
			  return browser.replace(/(.*)\..*/, "$1");
			}//end else
		 }//end if
		else
		 {
	       return "ie5mac";
		 }//end else
	  }//end if
	  
	 return false;
   }//end else if
  else if (typeof document.getElementById != "undefined")
   {
     if (navigator.vendor.indexOf("Apple Computer, Inc.") != -1)
	  {
	    if (typeof window.XMLHttpRequest != "undefined")
		 {
	       return "safari1.2";
		 }//end if
		
		return "safari1";
	  }//end if
	 else if (agent.indexOf("gecko") != -1)
	  {
	    return "mozilla";
	  }//end else if
   }//end else if
   
  return false;
}//end function


<!-- 检测浏览器运行在什么操作系统下 第十一章 -->
function public_indetifyOS()
{
  var agent = navigator.userAgent.toLowerCase();

  if (agent.indexOf("win") != -1)
   {
     return "win";
   }//end if
  else if (agent.indexOf("mac"))
   {
     return "mac";
   }//end else if
  else
   {
     return "unix";
   }//end else
  
  return false;
}//end function


<!-- 禁止默认动作的发生 第十三章 -->
function public_stopDefaultAction(event)
{
  event.returnVaule = false;
  
  if (typeof event.preventDefault != "undefined")
   {
     event.preventDefault();
   }//end if
}//end function


<!-- 寻找最初分配事件监听者的元素 第十三章 -->
function public_getEventTarget(event)
{
  var targetElement = null;
  
  if (typeof event.target != "undefined")
   {
     targetElement = event.target;
   }//
  else
   {
     targetElement = event.srcElement;
   }
  
  while (targetElement.nodeType == 3 && targetElement.parentNode != null)
   {
     targetElement = targetElement.parentNode;
   }//end while
   
  return targetElement;
}//end function


<!-- W3C标准方法：使用事件监听者 第十三章 -->
<!-- 具体事例请参考《JavaScript精粹》第十四章 -->
function public_attachEventListener(target,eventType,functionRef,capture)
{
  if (typeof target.addEventListener != "undefined")
   {
     target.addEventListener(eventType,functionRef,capture);
   }//end if
  else if (typeof target.attachEvent != "undefined")
   {
	 var functionString = eventType + functionRef;
	 target["e" + functionString] = functionRef;

	 target[functionString] = function(event)
	  {
	    if (typeof event == "undefined")
		 {
	       event = window.event;
		 }//end if
		target["e" + functionString](event);
	  };//end function()
	 
     target.attachEvent("on"+eventType,target[functionString]);
   }//end else if
  else
   {
     eventType = "on"+eventType;
	 if (typeof target[eventType] == "function")
	  {
	    var oldListener = target[eventType];
		target[eventType] = function()
		 {
	       oldListener();
		   return functionRef();
		 };//end function()
	  }//end if
	 else
	  {
	    target[eventType] = functionRef;
	  }//end else
   }//end else
}//end function


<!-- W3C标准方法：去除事件监听者 第十三章 -->
<!-- 具体事例请参考《JavaScript精粹》第十四章 -->
function public_detachEventListener(target,eventType,functionRef,capture)
{
  if (typeof target.removeEventListener != "undefined")
   {
     target.removeEventListener(eventType,functionRef,capture);
   }//end if
  else if (typeof target.detachEvent != "undefined")
   {
	 var functionString = eventType + functionRef;
	 
	 target.detachEvent("on" + eventType,target[functionString]);
	 
	 target["e" + functionString] = null;
	 target[functionString] = null;
   }//end else if
  else
   {
     target["on" + eventType] = null;
   }
}//end function


<!-- W3C标准方法：终止监听事件 第十三章 -->
function public_stopEvent(event)
{
  if (typeof event.stopPropagation != "undefined")
   {
     event.stopPropagation();
   }//end if
  else
   {
	 event.cancelBubble = true;
   }//end else
}//end function


<!-- 获取元素的位置 第十三章 -->
function public_getPosition(theElement)
{
  var positionX = 0;
  var positionY = 0;
  
  while (theElement != null)
   {
     positionX += theElement.offsetLeft;
	 positionY += theElement.offsetTop;
	 theElement = theElement.offsetParent;
   }//end while
   
  return [positionX,positionY];
}//end function public_getPosition(theElement)


<!-- 检测鼠标光标的位置 第十三章 -->
function public_displayCursorPosition(event)
{
  if (typeof event == "undefined")
   {
     event = window.event;
   }//end if
  
  var scrollingPosition = public_getScrollingPosition();
  var cursorPosition = [0,0];
  
  if (typeof event.pageX != "undefined" && typeof event.x != "undefined")
   {
     cursorPosition[0] = event.pageX;
	 cursorPosition[1] = event.pageY;
   }//end if
  else
   {
     cursorPosition[0] = event.clientX + scrollingPosition[0];
     cursorPosition[1] = event.clientY + scrollingPosition[1];
   }//end else

  //var paragraph = document.getElementsByTagName("p")[0];
  //paragraph.replaceChild(document.createTextNode("your mouse is currently located at: " +cursorPosition[0] +","+ cursorPosition[1]),paragraph.firstChild)
  
  return cursorPosition;
}//end function public_displayCursorPosition(event)


<!-- 根据class属性得到标签 -->
function public_getElementsByClass(object, tag, className)
{
  var o = object.getElementsByTagName(tag);
  for ( var i = 0, n = o.length, ret = []; i < n; i++)
  {
	if (o[i].className == className) ret.push(o[i]);
  }
  if (ret.length == 1) ret = ret[0];
  return ret;
}


<!--得到HTML标签的元素的id-->
function public_getObject(objectId) {
if(document.getElementById && document.getElementById(objectId)) {
return document.getElementById(objectId);
} else if (document.all && document.all(objectId)) {
return document.all(objectId);
} else if (document.layers && document.layers[objectId]) {
return document.layers[objectId];
} else {
return false;
}
}//end function getObject(objectId)


 //** iframe自动适应页面 **//

 //输入你希望根据页面高度自动调整高度的iframe的名称的列表
 //用逗号把每个iframe的ID分隔. 例如: ["myframe1", "myframe2"]，可以只有一个窗体，则不用逗号。

 //定义iframe的ID  崔金峰添加goodsfileContent 葛瑞斌添加grb_iframeID
 var iframeids=["ifile","file","file1","file2","goodsfileContent","grb_iframeID","grb_softjieshao"]
//grb_iframeID企业介绍iframe ,grb_softjieshao软件下载iframe
 //如果用户的浏览器不支持iframe是否将iframe隐藏 yes 表示隐藏，no表示不隐藏
 var iframehide="yes"

 function dyniframesize() 
 {
  var dyniframe=new Array()
  for (var i=0; i<iframeids.length; i++)
  {//alert(document.getElementById(iframeids[i]).id);
   if (document.getElementById)
   {
    //自动调整iframe高度
    dyniframe[dyniframe.length] = document.getElementById(iframeids[i]);
    if (dyniframe[i] && !window.opera)
    {
     dyniframe[i].style.display="block"
     if (dyniframe[i].contentDocument && dyniframe[i].contentDocument.body.offsetHeight) //如果用户的浏览器是NetScape
      dyniframe[i].height = dyniframe[i].contentDocument.body.offsetHeight+20; 
     else if (dyniframe[i].Document && dyniframe[i].Document.body.scrollHeight) //如果用户的浏览器是IE
      dyniframe[i].height = dyniframe[i].Document.body.scrollHeight+20;
    }
   }
   //根据设定的参数来处理不支持iframe的浏览器的显示问题
   if ((document.all || document.getElementById) && iframehide=="no")
   {
    var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
    tempobj.style.display="block"
   }
  }
 }

 if (window.addEventListener)
 window.addEventListener("load", dyniframesize, false)
 else if (window.attachEvent)
 window.attachEvent("onload", dyniframesize)
 else
 window.onload=dyniframesize


<!--###############-->
<!--检查表单-->
function public_CheckForm(oForm)
{
var els = oForm.elements;
for(var i=0;i<els.length;i++)
{
if(els[i].check)
{
var sReg = els[i].check;
var sVal = GetValue(els[i]);
var reg = new RegExp(sReg,"i");
if(!reg.test(sVal))
{
alert(els[i].warning);
GoBack(els[i])
return false;
}
}
}
}
function GetValue(el)
{
var sType = el.type;
switch(sType)
{
case "text":
case "hidden":
case "password":
case "file":
case "textarea": return el.value;
case "checkbox":
case "radio": return GetValueChoose(el);
case "select-one":
case "select-multiple": return GetValueSel(el);
}
function GetValueChoose(el)
{
var sValue = "";
var tmpels = document.getElementsByName(el.name);
for(var i=0;i<tmpels.length;i++)
{
if(tmpels[i].checked)
{
sValue += "0";
}
}
return sValue;
}
function GetValueSel(el)
{
var sValue = "";
for(var i=0;i<el.options.length;i++)
{
if(el.options[i].selected && el.options[i].value!="")
{
sValue += "0";
}
}
return sValue;
}
}

function GoBack(el)
{
var sType = el.type;
switch(sType)
{
case "text":
case "hidden":
case "password":
case "file":
case "textarea": el.focus();var rng = el.createTextRange(); rng.collapse(false); rng.select();
case "checkbox":
case "radio": var els = document.getElementsByName(el.name);els[0].focus();
case "select-one":
case "select-multiple":el.focus();
}
}//function CheckForm(oForm)

<!--####################################################-->
<!--　AJAX -->
function public_InitAjax()
{
  var ajax=false; 
  try
  { 
    ajax = new ActiveXObject("Msxml2.XMLHTTP"); 
  }
  catch (e)
  { 
    try
    { 
      ajax = new ActiveXObject("Microsoft.XMLHTTP"); 
    }
    catch (E)
    { 
      ajax = false; 
    } 
  }
  if (!ajax && typeof XMLHttpRequest!='undefined')
  { 
    ajax = new XMLHttpRequest(); 
  } 
  return ajax;
} 


function getdiy(diyID)//AJAX用法示例
{
  if (typeof(diyID) == 'undefined')
  {
  　return false;
  }
  var url = "diypage.php?diyid="+ diyID;
  var show = document.getElementById("diy"); 
  //var show2= document.getElementById("ifile");alert(show2.id+'xxx');
  var ajax = public_InitAjax();
  ajax.open("GET", url, true); 
  ajax.onreadystatechange = function()
  { 
    if(ajax.readyState<4)
    {
      document.getElementById("diy").innerHTML = "正在加载....请稍等";
    }

    if (ajax.readyState == 4 && ajax.status == 200)
    { 
　    show.innerHTML = ajax.responseText;
      //document.getElementById("diy").innerHTML ="";
      //alert(ajax.responseText);
      //show2.setAttribute("src",ajax.responseText);
    } 
  }
  ajax.send(null); 
} //function getdiy(diyID)


<!--#####################-->
<!--另一个iframe自动适应页面的代码-->
var lastHeight;
function init() {
    autojudge();
    lastHeight= right.document.body.scrollHeight;
    setInterval(function(){
        if(right.document.body.scrollHeight!=lastHeight) {
            autojudge();
            lastHeight= right.document.body.scrollHeight;
            }
        },1);
}
function autojudge(){
    document.all('right').height=right.document.body.scrollHeight + 20;
    }
	
<!--#####################-->
<!--另一个iframe自动适应页面的代码，更简单。下面是例子：主要是onload后面的代码-->
<!-- 参数parent的作用是：如果引用该函数的位置在iframe的里面，需要把parent的值设置为'parent' -->
<!--<iframe name=\"file\" id=\"file\" border=0 frameborder=no  width=\"800\"  marginheight=0 marginwidth=0 scrolling=\"auto\" src=\" check/dateinterval_check.php\" allowTransparency=\"true\" onload='var f=document.all[\"file\"];   var   b=f.Document.body;   f.height=b.scrollHeight+10'></iframe>-->
function public_iframeAdapt(iframename, theparent)
{
  if (theparent == 'parent')
  {
   var f=parent.document.all[iframename];   
  }
  else
  {
   var f=document.all[iframename];   
  }
  
  //var f=public_getObject(iframename);   //alert(typeof f);
  var browser = public_identifyBrowser();
  //alert(browser);
  if (browser == "opera7")
  {  
    var b=f.document.body;
  }
  else if (browser == "mozilla")
  {
    var b=f.contentDocument.body;
  }
  else if (browser == 'safari1.2')
  {
    var b=f.contentDocument.body;
  }
  else
  {
    var b=f.Document.body;
  }
  
  //f.style.height=b.scrollHeight+20;
  f.style.height=b.scrollHeight;
  //alert("b.scrollHeight="+b.scrollHeight+"  f.height="+f.height);
}

<!-- 替换字符串中的&符号 -->
<!-- 从js中读取数据中用到，用ajax传递到服务器端用php的函数替换回去 -->
function public_SymbolANDEncode(string)
{
  var pattern = /&/g;
  var result = string.replace(pattern,'[@symbol_AND]');
  return result;
}//end function

<!-- 把字符串中的&amp;替换成& -->
function public_replaceSymbolAND(string)
{
  var pattern = /&amp;/g;
  var result = string.replace(pattern,'&');
  return result;
}//end function
<!-- 把字符串中的&替换成&amp; -->
function public_replaceSymbolAND2(string)
{
  var pattern = /&/g;
  var result = string.replace(pattern,'&amp;');
  return result;
}//end function

<!-- 简单实用的函数 -->
<!-- 显示id=getid的元素 -->
function public_displaySet(getid)
{
  public_getObject(getid).style.display = '';
}//end function
<!-- 隐藏id=getid的元素 -->
function public_hideSet(getid)
{
  public_getObject(getid).style.display = 'none';
}//end function
<!-- 隐藏id=getid的元素的另一种方法：把这个元素放到屏幕的外边 -->
function public_leaveSet(getid)
{
  public_getObject(getid).style.left = '-2000px';
}//end function

<!-- 字体加粗 -->
function public_fontBold(getid)
{
  public_getObject(getid).style.fontWeight = 'bold';
}//end function
<!-- 字体还原 -->
function public_fontNormal(getid)
{
  public_getObject(getid).style.fontWeight = 'normal';
}//end function
<!-- 背景图片变化 -->
function public_bgImageChange(getid,imgpath)
{
  if (imgpath == '' || imgpath == 'none')
  {
    return false;
  }
  
  public_getObject(getid).style.backgroundImage = 'url("'+ imgpath +'")';
}//end function


<!-- 显示购物车 -->
function lm_dispShoppingCart()
{
  var shoppingcart = public_getObject("floater");
  shoppingcart.style.display = "";
  shoppingcart.style.zIndex = 10;
  shoppingcart.style.position = "absolute";
}//end function
<!--空函数，自动隐藏购物车-->
function lm_undispShoppingCart()
{

}//end function


<!-- 屏蔽鼠标右键 -->
function lm_undispRightKey()
{
  return self.event.returnValue=false;//false是屏蔽 true是开启
}//end function


<!-- 屏蔽Ctrl+C Ctrl+V -->
function lm_undispRightKey2()
{
  return false;//false是屏蔽 true是开启
}//end function


<!--显示/隐藏电子地图 -->
function public_dispEmapOrNo(thisid,lang,src)
{
  if (thisid.checked)//显示电子地图（非电子地图页面点击，跳转到电子地图页面）
   {
	 window.location = "inner.php?funcsearch=emap&src=" + src + "&langcode="+ lang;
	 //public_getObject("checkbox_emap").checked = "checked";
   }
  else//隐藏电子地图，显示企业介绍，或者联系我们等其他页面
   {
	 window.location = "inner.php?funcsearch="+ src +"&langcode="+ lang;
	 //public_getObject("checkbox_emap").checked = "";
   }
}//end function




////////////////////////////////////////////////////////////////////////////////
//    自助前台的AJAX  本来不应该放在这里的  但是自助部分暂时没有办法增加新的文件了

<!-- 设置QQ MSN -->
function lm_setQQMSN()
{
　 var url = "ajax.php?set_qq_msn=ok";
　 var show = public_getObject("ins_qqmsn");
  //var show2= document.getElementById("ifile");alert(show2.id+'xxx');
　 var ajax = public_InitAjax();
　 ajax.open("GET", url, true); 
　 ajax.onreadystatechange = function() { 
//  if(ajax.readyState<4)
//  {
//    document.getElementById("diy").innerHTML = "正在加载....请稍等";
//  }

　　 if (ajax.readyState == 4 && ajax.status == 200) {
　　 　 show.innerHTML = ajax.responseText; 
      //document.getElementById("diy").innerHTML ="";
      //alert(ajax.responseText);
      //show2.setAttribute("src",ajax.responseText);
　　 } 
　 }
　 ajax.send(null); 
}//end function

//加载页面以后运行lm_setQQMSN()
public_addLoadListener(lm_setQQMSN);

//QQ MSN 显示模块结束
////////////////////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////////////////////////
//        自助前台二、三级导航条模块

<!-- 定义全局变量 -->
var lm_global_timeout;//用来存储隐藏二级导航条的setTimeout()
var lm_global_timeout3;//用来存储隐藏三级导航条的setTimeout()
var lm_global_dispthrnav = '';//存储当前显示在页面上的三级导航条框架（菜单）的navlink

<!-- 二级导航条显示模块，把鼠标放在一级导航条上，显示出二级导航条 -->
<!-- navlink是一级导航条的链接名，也是元素id的一部分 -->
function lm_displayChildNav(navlink)
{
  var getscreenwidth = parseInt(window.screen.width);//得到当前屏幕分辨率的宽度
  var getnavlink = 'hid_'+ navlink;
  var childnav = public_getObject(getnavlink);
  
  if (typeof childnav.id == 'undefined')
  {
    return false;
  }
  
  //鼠标定位，得到id='father_'+id的元素的位置
  var position = public_getPosition(public_getObject('father_'+ navlink));
  
  var cleft = position[0];
  if (getscreenwidth - cleft - childnav.clientWidth < 30)//990//cleft + 120 > (getscreenwidth-30)
  {
    cleft = getscreenwidth - childnav.clientWidth - 30;//880
  }//end if (cleft + 120 > 990)
  else
  {
	cleft = cleft - 10;
  }//end else
  
  var ctop  = position[1] + 16;
  
  //设置二级菜单的css属性
  childnav.style.top  = ctop;
  childnav.style.left = cleft;
  //alert(childnav.clientWidth);
  //显示二级菜单
  //李蒙取消使用display:none setTimeout('public_displaySet(\"' + getnavlink + '\")', 60);
}//end function

<!-- 一直显示二级导航条，修改全局变量 -->
function lm_dispChildNavSetGlobal()
{
  clearTimeout(lm_global_timeout);//显示
}//end function

<!-- 隐藏二级导航条 -->
<!-- 参数setflag =1 时，是离开一级导航条； =2 时，是离开二级导航容器 -->
function lm_hideChildDiv(navlink, setflag, event)
{
  var getnavlink = 'hid_'+ navlink;
  var childnav = public_getObject(getnavlink);
  
  if (typeof childnav.id == 'undefined')
  {
    return false;
  }
  
  if (setflag == 1)//离开一级导航
  {
    //李蒙取消使用display:none lm_global_timeout = setTimeout('public_hideSet(\"' + getnavlink + '\")', 600);
    lm_global_timeout = setTimeout('public_leaveSet(\"' + getnavlink + '\")', 600);
  }//end (setflag == 1)
  else if (setflag == 2)//离开二级导航
  {
    if (typeof event == "undefined")
    {
	  event = window.event;
	}//end if
	if (public_identifyBrowser() == 'mozilla')
	{
	  //李蒙取消使用display:none lm_global_timeout = setTimeout('public_hideSet(\"' + getnavlink + '\")', 600);
	  lm_global_timeout = setTimeout('public_leaveSet(\"' + getnavlink + '\")', 600);
	}//end if (public_identifyBrowser() == 'mozilla')
	else
	{
	  if ((event.toElement.id.indexOf('child_') == -1 && event.toElement.id.indexOf('font_') == -1 && event.toElement.id.indexOf('img_') == -1 && event.toElement.id.indexOf('hid3_') == -1))
	  {
	    //李蒙取消使用display:none lm_global_timeout = setTimeout('public_hideSet(\"' + getnavlink + '\")', 600);
	    lm_global_timeout = setTimeout('public_leaveSet(\"' + getnavlink + '\")', 600);
	  }//end if
	}//end else
  }//end else if (setflag == 2)
  
}//end function

<!-- 根据全局变量lm_branch的值来判断是否关闭导航条 -->
//function lm_hideChildDivOrNo(getid)
//{
//  if (lm_global_branch == 1)
//  {
//    public_hideSet(getid);
//  }//end if
//}//end function

<!-- 三级导航条显示模块，把鼠标放在二级导航条上，显示出三级导航条 -->
<!-- c_navlink是二级导航条的链接名，也是元素id的一部分 -->
function lm_displayChildNav3(c_navlink)
{
  var getscreenwidth = parseInt(window.screen.width);//得到当前屏幕分辨率的宽度
  var getnavlink = 'hid3_'+ c_navlink;
  var childnav = public_getObject(getnavlink);//三级导航条框架元素
  
  if (typeof childnav.id == 'undefined')
  {
    return false;
  }
  
  //把导航条名称加粗
  public_fontBold('child_'+ c_navlink);
  
  //鼠标定位，得到id='img_'+id的元素的位置（有下属三级导航条的二级导航条旁边的图标）
  var position = public_getPosition(public_getObject('img_'+ c_navlink));
  
  var cleft = position[0];
  if (getscreenwidth - cleft <150)//(cleft + 120 > (getscreenwidth-30))
  {
    cleft = cleft - 215;
  }//end if (cleft + 120 > 990)
  else
  {
	cleft = cleft + 3;
  }//end else
  
  var ctop  = position[1] - 6;

  //隐藏所有的三级导航条
  lm_traversalAndHideSet();
  
  //设置三级菜单的css属性
  childnav.style.top  = ctop;
  childnav.style.left = cleft;

  //显示三级菜单
  //setTimeout('public_displaySet(\"' + getnavlink + '\")', 100);
  
  //把信息写进lm_global_dispthrnav
  //lm_global_dispthrnav = c_navlink;
}//end function

<!-- 三级导航条隐藏模块 -->
<!-- 参数setflag=2时，离开二级导航条；setflag=3是离开三级导航条；//setflag=200是离开没有下属三级导航条的二级导航条 -->
function lm_hideChildDiv3(c_navlink, setflag, event)
{
//  //首先判断是否是没有下属三级导航条的二级导航条
//  if (setflag == 200)
//  {
//    //隐藏所有的三级导航条
//    lm_traversalAndHideSet();
//	//把二级导航条名称字体取消加粗
//	public_fontNormal('child_'+ c_navlink);
//    return false;
//  }//end if
  
  var getnavlink3 = 'hid3_'+ c_navlink;
  var childnav3 = public_getObject(getnavlink3);

  if (typeof childnav3.id == 'undefined')
  {
    return false;
  }

  if (setflag == 2)//从二级导航条离开
  {
    if (typeof event == "undefined")
    {
	  event = window.event;
	}//end if
	
	//把二级导航条名称字体取消加粗
	public_fontNormal('child_'+ c_navlink);
	
	if (public_identifyBrowser() == 'mozilla')
	{
	  setTimeout('public_leaveSet(\"' + getnavlink3 + '\")', 600);
	}//end if (public_identifyBrowser() == 'mozilla')
	else
	{
	  if ((event.toElement.id.indexOf('child_') == -1 && event.toElement.id.indexOf('font_') == -1 && event.toElement.id.indexOf('img_') == -1 && event.toElement.id.indexOf('hid3_') == -1))
	  {
	    setTimeout('public_leaveSet(\"' + getnavlink3 + '\")', 600);
	  }//end if
	}//end else
  }//end if (setflag == 2)
  else if (setflag == 3)//从三级导航条离开
  {
    lm_global_timeout3 = setTimeout('public_leaveSet(\"' + getnavlink3 + '\")', 600);
  }//end else if (setflag == 3)
  
}//end function

<!-- 一直显示三级导航条，修改全局变量 -->
function lm_dispChildNavSetGlobal3()
{
  clearTimeout(lm_global_timeout);//显示二级导航条
  clearTimeout(lm_global_timeout3);//显示三级导航条
}//end function

<!-- 隐藏所有三级导航条菜单 -->
function lm_traversalAndHideSet()
{
  var thediv = document.getElementsByTagName('div');
  var thelength = thediv.length;
  
  //遍历页面中的所有div
  for (var i=0; i<thelength; i++)
  {
    //判断是否是三级导航条
	if (thediv[i].id.indexOf('hid3_') != -1)//是三级导航条
	{
      //隐藏该导航条
	  public_leaveSet(thediv[i].id);
	}//end if//是三级导航条
  }//end for
  
}//end function

<!-- 当鼠标进入没有下属三级导航条的二级导航条 -->
<!-- 参数theid是鼠标进入的div元素的id -->
function lm_mouseoverNoNav3Nav2(theid)
{
  lm_traversalAndHideSet();//隐藏所有三级导航条
  public_fontBold(theid);//加粗导航条名称
}

<!-- 当鼠标离开三级导航条菜单 -->
function lm_mouseoutNav3(navlink,c_navlink,event)
{
  lm_hideChildDiv3(c_navlink, 3, event);//隐藏三级导航条
  lm_hideChildDiv(navlink, 2, event)//隐藏二级导航条（从二级导航条离开隐藏二级导航条函数）
}

//前台二、三级导航条模块结束
/////////////////////////////////////////////////////////////////////////////////////


/////////////////////////////////////////////////////////////////////////////////////
//        自助后台公共开通和关闭 功能 模块

function public_openOrclosefuntion($thisPage,$func)
{
	//alert("ss");
	var ajax  = public_InitAjax();
	var str = public_getObject("publicShow");
	if(str.style.display=='none')
	{
		var $value= 'Y';
		public_getObject("OPFun").innerHTML="关闭";
		str.style.display='';
		public_iframeAdapt("meizz","parent");
	}
	else
	{
		var $value = 'N';
		public_getObject("OPFun").innerHTML="开通";
		str.style.display='none';
	}
	var url = $thisPage+"?flag=openF&getfuncname="+$func+"&getvalue="+$value+"&sid="+Math.random();
	ajax.open("GET",url,true);
	ajax.onreadystatechange = function() { 
　		if (ajax.readyState == 4 && ajax.status == 200) {
　　			
		//str.innerHTML=ajax.responseText; 
		//alert(str.style.display);
      //document.getElementById("diy").innerHTML ="";
      //alert(ajax.responseText);
      //show2.setAttribute("src",ajax.responseText);
　		} 
　	}
	ajax.send(null);
}


//        自助后台公共开通和关闭 功能 模块  结束
/////////////////////////////////////////////////////////////////////////////////////



///////////  从其他的页面移过来的js代码  ////////////

<!--控制iframe上下自动伸缩的js函数，从smerpsclient\news\frontpages\frontnewsfunctions.php中移动过来 不好使了，先屏蔽-->
//function reinitIframe()
//  {
//    var iframe = document.getElementById("showzipfile");
//    try
//	{
//     var bHeight = iframe.contentWindow.document.body.scrollHeight;
//     var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
//     var height = Math.max(bHeight, dHeight);
//     iframe.height =  height;
//    }
//	catch (ex)
//	{
//	  clearInterval(lmgetinterval);
//	}
//  }//end function
//  var lmgetinterval = window.setInterval("reinitIframe()", 200);

<!-- notice/function.php中的js函数 -->
function zgz_show(id)
{
	document.getElementById(id).style.display = '';
}
function zgz_hidden(id)
{
	document.getElementById(id).style.display = 'none';
}

