﻿var curNav="";
var resizeTimer=null;
var OTimer=null;
var navCount=1;
var arrNav=new Array(); 
    for(var i=0;i<navCount;i++){ 
    arrNav[i]=new Array(); 
} 
arrNav[0][0]="<a href='#'>会员QQ群：12381111</a>";
arrNav[0][1]="<a href='http://bbs.fzhome.com/forum-1009-1.html' target='_blank'>影视论坛</a>";
arrNav[0][2]="<a href='http://blog.sina.com.cn/ihu9' target='_blank'>虎揪博客</a>";

function showNav(o,v){
   if($(curNav)){
        $(curNav).style.display="none";
    }
    if(OTimer){
        clearTimeout(OTimer);
    }
    if(resizeTimer){
        clearTimeout(resizeTimer);
    }
   var iNavId="ihu9Nav"+v;
   curNav=iNavId;
   if(!$(iNavId)){
        CreateMenu(o,iNavId);
        var MenuUl=$(iNavId).getElementsByTagName("ul")[0];
        MenuUl.innerHTML="";
        AddMenuLi(MenuUl,v);
   }
   else{
       $(iNavId).style.display="block";
   }
};

function CreateMenu(o,v){
    var MenuDiv=top.document.createElement("div");
    MenuDiv.id=v;
    var pos=divPosition(o);
    var styleStr="left:"+pos.left+"px;top:"+pos.top+"px;position:absolute;z-index:99999;display:block";
    MenuDiv.className="menuNav";
    MenuDiv.style.cssText=styleStr;
    MenuDiv.innerHTML="<ul></ul>";
    MenuDiv.onmouseout=MouseOut;
    MenuDiv.onmouseover=MouseOver;
    o.onmouseout=OMouseOut;
    top.document.body.appendChild(MenuDiv);
    document.body.onclick=MenuHide;
    top.document.body.onclick=MenuHide;
};

function AddMenuLi(o,v){
    for(var i=0;i<arrNav[v].length;i++){
        o.innerHTML+="<li>"+arrNav[v][i]+"</li>";
    }
};
function MouseOver(){
    if($(curNav)){
       $(curNav).style.display="block";
    }
    if(resizeTimer){
        clearTimeout(resizeTimer);
    }
    if(OTimer){
        clearTimeout(OTimer);
    }
};
function MouseOut(){
    resizeTimer= setTimeout("MenuHide()",500);
};
function OMouseOut(){
    OTimer=setTimeout("MenuHide()",0);
};
function MenuHide(){
    if($(curNav)){
        $(curNav).style.display="none";
    }
};
function divPosition(o){
	var l=0;		
	var t=0;		
	var e=o;
	var frameLeft=$("frameTop").offsetLeft;
	while(e.offsetParent){	
		l+=e.offsetLeft+(e.currentStyle?(parseInt(e.currentStyle.borderLeftWidth)).NaN0():0);			
		t+=e.offsetTop+(e.currentStyle?(parseInt(e.currentStyle.borderTopWidth)).NaN0():0);			
		e=e.offsetParent;				
	}
	l+=e.offsetLeft+(e.currentStyle?(parseInt(e.currentStyle.borderLeftWidth)).NaN0():0);		
	t+=e.offsetTop+(e.currentStyle?(parseInt(e.currentStyle.borderTopWidth)).NaN0():0);		
	t=t+34;	
	l=l+frameLeft;
	return {top:t,left:l}	
};
function $(id){
    if(id!=null){
        return top.document.getElementById(id);
    }
    else{
        return null;
    }
};
Number.prototype.NaN0=function ()
{
	return isNaN(this)?0:this;	
};
