
var ids;
var menuVis;
var displayed;
displayed=false;
menuVis=false;

	function curTop(obj){
	actb_toreturn = 0;
	while(obj){
		actb_toreturn += obj.offsetTop;
		obj = obj.offsetParent;
	}
	return actb_toreturn;
	}
	function curLeft(obj){
		actb_toreturn = 0;
		while(obj){
			actb_toreturn += obj.offsetLeft;
			obj = obj.offsetParent;
		}
		return actb_toreturn;
	}
	
	function shw(obj,id_){
	ids=id_;	
	var card=document.getElementById('sailorcard');
	var X=curLeft(obj)+10;
	if(self.screen.availWidth<X+420)X=X-420;	
		btn.style.top = eval(curTop(obj) + obj.offsetHeight-8) + "px";
		btn.style.left= curLeft(obj);

        if(!displayed){
		card.style.top=btn.style.top;
		card.style.left=(X) + "px";
		
		btn.style.display='';
		btn.style.display='';
		}
	}

	
	function off(){
	menuVis=false;
	setTimeout("hideall()",200);
	}

	function on(){
	menuVis=true;
	}
	
	function hideall(){
	if(!menuVis)btn.style.display='none';
	}
	

	
		function closeCard(){
		document.getElementById('sailorcard').style.display='none';
		}
		
		function showCard(id_,cntrl){
		if(id_){shw(cntrl,id_);
		}
		document.all.frm.src='/sailcard.aspx?idn='+ids+"&ses=1";
		if(document.getElementById('btn')!=null){document.getElementById('btn').style.display='none';}
		document.getElementById('sailorcard').style.display='';
		displayed=true;
		}

		
		function closeCard(){
		document.getElementById('sailorcard').style.display='none';
		document.all.frm.src='/wait.htm';
		displayed=false;
		}
		
		
		
		function showandopen(obj,id_,pm){
		
		ids=id_;	
	    var card=document.getElementById('sailorcard');
	    var X=curLeft(obj);
	    if(self.screen.availWidth<X+420)X=X-420;
        
		card.style.top=eval(curTop(obj) ) + "px";
		card.style.left=(X) + "px";		
		
		showCard(pm)
		}