function stopError() { return true;}
window.onerror = stopError;

var myRemote;
window.onunload=CloseRemote;

function CloseRemote()
{
	if (myRemote!=null) myRemote.close();
}

function ns_ShowWindowEx(i,newURL,x,y,w,h) {
	var NS6 = (navigator.vendor == ("Netscape6") || navigator.product == ("Gecko"));
	if (!NS6)
	{
		IE = (document.all) ? true : false;
		NS4 = (document.layers) ? true : false;
	}
	else
	{
		IE = false;
		NS4 = false;
	}
	
	if(NS4)
	{
		if (myRemote==null) {
			  myRemote = window.open(newURL, '', 'height='+h+',width='+w+',screenX='+x+',left='+x+',screenY='+y+',top='+y+',channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0', 'myWindow');
			  myRemote.focus();
		}
		else{
			if(!myRemote.closed)	// Mora zaradi Netscape oti ako myRemote e zatvoren od strana na korisnikot puka
			{
				myRemote.close();
			}
			
			myRemote = window.open(newURL, '', 'height='+h+',width='+w+',screenX='+x+',left='+x+',screenY='+y+',top='+y+',channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0', 'myWindow');
			myRemote.focus();
		}	
	}
	else
	{
		if (myRemote==null) {
			  myRemote = window.open(newURL, '', 'height='+h+',width='+w+',screenX='+x+',left='+x+',screenY='+y+',top='+y+',channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0', 'myWindow');
			  myRemote.focus();
		}
		else{
			if(!myRemote.closed)	// Mora zaradi Netscape oti ako myRemote e zatvoren od strana na korisnikot puka
			{
				myRemote.close();
			}
			
			myRemote=null;
			myRemote = window.open(newURL, '', 'height='+h+',width='+w+',screenX='+x+',left='+x+',screenY='+y+',top='+y+',channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=0,scrollbars=0,status=0,toolbar=0', 'myWindow');
			myRemote.focus();
		}	
	}
}



function dummy(){
}

//wb2flymenu scripts

var prevPopup=null;
var timeOutID=0;
var subMenuOffset=0;
			
function mouseIn(src,childID)
{
	var chMenu = document.all(childID);
	var posLeft;
	var posTop;
	var posWidth;
	var x;
	var y;
	var masterParent=null;
				
	if(prevPopup!=null)
	{
		if(prevPopup!=chMenu)
		{
			prevPopup.style.visibility="hidden";
		}
	}
	
/*	masterParent = src
	while(true)
	{
		masterParent = masterParent.parentElement;
		if(masterParent==null)
		{
			break;
		}
		posLeft = posLeft + masterParent.offsetLeft;
	}*/
			
	//posLeft = src.parentElement.parentElement.parentElement.parentElement.parentElement.offsetLeft;
	
	//posLeft = src.parentElement.parentElement.parentElement.parentElement.offsetLeft;
	//posTop = src.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.offsetTop;
	prevPopup = chMenu;
	posLeft = src.offsetLeft-15;
	//posLeft = window.event.clientX;
	//document.title = src.tagName;
	posTop = src.offsetTop + src.offsetHeight + 0;
	 

	
	//posWidth = src.offsetWidth;
	posWidth = 0;
				
	y = posTop;
	x = subMenuOffset+posLeft+posWidth;
	chMenu.style.visibility="visible";
	
	
	if (navigator.userAgent.indexOf("Opera")!=-1 && document.getElementById) type="OP";		//Opera
		else if (document.all) type="IE";														//Internet Explorer e.g. IE4 upwards
		else if (document.layers) type="NN";													//Netscape Communicator 4
		else if (!document.all && document.getElementById) type="MO";							//Mozila e.g. Netscape 6 upwards
		else type = "IE";		//I assume it will not get here
	
	
	if (type=="IE") 
		{
			//alert("You are using IE");
			chMenu.style.left = 15+x+"px";
	        chMenu.style.top = 0+y+"px";
	        
		}
	else {
			if (type=="MO") 
			{
			//alert("You are using MO");
			
			//chMenu.style.left = GetAbsoluteLeft(src);
			//chMenu.style.top = GetAbsoluteTop(src);
			
			chMenu.style.left = 15+x+"px";
	        chMenu.style.top = 0+y+"px";			
			
			chMenu.style.position = "absolute";
			chMenu.style.zIndex = 5;			
			};
		 };
	chMenu.style.zIndex = 2500;
 	
	//chMenu.style.left = 2+x+"px";
	//chMenu.style.top = 2+y+"px";
}

		
function mouseOut(src,childID)
{
	var strEval;
				
	if(!src.contains(window.event.toElement))
	{
		strEval = new String();
		strEval = "MainMenuTimer('" + childID + "')";
		timeOutID = window.setTimeout(strEval,250);
	}
}
			
function MainMenuTimer(childID)
{
	var chMenu = document.all(childID);
	chMenu.style.visibility="hidden";
	if(timeOutID!=0)
	{
		window.clearTimeout(timeOutID);
		timeOutID = 0;
	}
}
			
function subMenuMouseIn(src,elementID)
{
	if(timeOutID!=0)
	{
		window.clearTimeout(timeOutID);
		timeOutID = 0;
	}
}
			
function subMenuMouseOut(src,elementID)
{
	if(!src.contains(window.event.toElement))
	{
		var chMenu = document.all(elementID);
		chMenu.style.visibility="hidden";
	}
}

function GetAbsoluteLeft(elem)
    {
       var leftPosition;
       leftPosition=0;
       while(elem!=null)
       {
           if(elem.TagName=='BODY'){break;}
           leftPosition+=elem.offsetLeft;
         elem = elem.offsetParent;
       }
       return leftPosition;
    }
    
function GetAbsoluteTop(elem)
{
   var leftPosition;
   leftPosition=0;
   while(elem!=null)
   {
       if(elem.TagName=='BODY'){break;}
       leftPosition+=elem.offsetTop;
      elem = elem.offsetParent;
   }
   return leftPosition;
}
    
// end of wb2flymenu
