/* ================================================================ 
This copyright notice must be untouched at all times.

The original version of this script and the associated (x)html
is available at http://www.stunicholls.com/varous/solar_map.html
Copyright (c) 2005-2007 Stu Nicholls. All rights reserved.
This script and the associated (x)html may be modified in any 
way to fit your requirements.
=================================================================== */

clickMenu = function(menu) {
	var getEls = document.getElementById(menu).getElementsByTagName("LI");
	var getAgn = getEls;

	for (var i=0; i<getEls.length; i++) {
			getEls[i].onclick=function() {
				for (var x=0; x<getAgn.length; x++) {
				getAgn[x].className=getAgn[x].className.replace("unclick", "");
				getAgn[x].className=getAgn[x].className.replace("click", "unclick");
				}
			if ((this.className.indexOf('unclick'))!=-1) {
				this.className=this.className.replace("unclick", "");;
				}
				else {
				  var hasClickMap = document.getElementById("HasClickMap").value;
                 if (hasClickMap == 1) {
                   document.getElementById("HasClickMap").value = 0;                  
                 } else {
				    this.className+=" click"; 
                   document.getElementById("HasClickMap").value = 0;  
                 }
				}
			}
		}
	}

  // 左键点击首页的任何地方，都要把弹出的挂靠单位框隐藏掉。
  function ShowOrHideMap(e){
    e = e || window.event;    
    var leftClickValue = 1; // IE右键值
	 var isALink = false; // 判断点击是否为超链接，如果是则不过滤，直接响应链接操作
    if (navigator.userAgent.indexOf("Firefox")>0) {
       leftClickValue = 0;
	     isALink = e.target.tagName == "A";
	  } else {
		 isALink = e.srcElement.tagName == "A";
	  }
	
    // 鼠标左键操作
    if(e.button == leftClickValue && !isALink) {
      var map_div = document.getElementById("map");
      var map_li = map_div.getElementsByTagName("LI");
      var getAgn = map_li;
      var change = false;

      for (var x=0; x<getAgn.length; x++) {
         if ((getAgn[x].className.indexOf('click'))!=-1) {
           document.getElementById("HasClickMap").value = 1;
           change = true;
         }
		  getAgn[x].className=getAgn[x].className.replace(" click", "");
		}

      if (!change || change == "false") {
        document.getElementById("HasClickMap").value = 0;
      }
    }
  }













