function $() {
  var elements = new Array();

  for (var i = 0; i < arguments.length; i++) {
    var element = arguments[i];
    if (typeof element == 'string')
      element = document.getElementById(element);

    if (arguments.length == 1)
      return element;

    elements.push(element);
  }
  return elements;
}

/*
function addAction(menu){
	if (menu.nodeType!=3){
	var temp=menu.firstChild;
		while(temp!=null){
			if(temp.nodeName=="TD"&&temp.clientWidth!=1){
				with(temp){
onmouseover=function(){this.className='Hover';};
onmouseout=function(){this.className='';};
				}
			}
			if(temp.nodeName!="A"&&temp.nodeName!="TABLE") addAction(temp);
		temp=temp.nextSibling;
		}
	}
}
*/

function addAction(menu){
	if (menu.nodeType!=3){
	var temp=menu.firstChild;
		while(temp!=null){
			if(temp.nodeName=="TD"){
				with(temp){
  if(lastChild&&lastChild.nodeName=='DIV') {
    onmouseover=function(){
    obj=this.lastChild;
    obj.style.position='absolute';
    obj.style.overflowY='hidden';
    obj.style.overflowX='hidden';
    this.className='Hover';
    heightSubBlock=obj.firstChild.clientHeight;
    if(!changePos[obj.id]) obj.firstChild.style.marginTop=-heightSubBlock+"px";
    changePos[obj.id]={'sHeight':heightSubBlock,'d':1};
    };
    onmouseout=function(){
    obj=this.lastChild;
    changePos[obj.id]={'sHeight':obj.firstChild.clientHeight,'d':-1};
    };
  }
				}
			}
			if(temp.nodeName!="A"&&temp.nodeName!="TABLE"&&temp.nodeName!="SPAN") addAction(temp);
		temp=temp.nextSibling;
		}
	}
}


var changePos={};

function eachInterval(){
	for(id in changePos){
		if(parseInt($(id).firstChild.style.marginTop)<0&&changePos[id]['d']>0){
		$(id).firstChild.style.marginTop=(parseInt($(id).firstChild.style.marginTop)+7)+"px";
			if(parseInt($(id).firstChild.style.marginTop)>=0){
			$(id).firstChild.style.marginTop="0px";
			continue;
			}
		}
		if(changePos[id]['d']<0){
		$(id).firstChild.style.marginTop=(parseInt($(id).firstChild.style.marginTop)-7)+"px";
			if(parseInt($(id).firstChild.style.marginTop)<=-changePos[id]['sHeight']){
			$(id).firstChild.style.marginTop=-changePos[id]['sHeight'];
			delete(changePos[id]);
			$(id).parentNode.className='';
			}
		}
	}
}
window.setInterval(eachInterval,10);


function viewContact(id,left,top){
document.getElementById("con_mn_"+current_id_cont).className="";
document.getElementById("con_mn_"+id).className="act";
document.getElementById('contact_city_bulit').style.marginTop=top;
document.getElementById('contact_city_bulit').style.marginLeft=left;
document.getElementById("con_txt_"+current_id_cont).style.display="none";
document.getElementById("con_txt_"+id).style.display="";
current_id_cont=id;	
}

function addLoadEvent(func) { 
var oldonload = window.onload; 
  if (typeof window.onload != 'function') { 
  window.onload = func; 
  } else { 
    window.onload = function() { 
      if (oldonload) { 
      oldonload(); 
      } 
    func(); 
    } 
  } 
} 
