//============================================================================================================
// New layer functions 15/9/2006
function MM_findObj(n, d) { //v4.01	
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,x,y,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-4); i+=5) if ((obj=MM_findObj(args[i]))!=null) { 
	v=args[i+2]; x=args[i+3]; y=args[i+4];
	
	if (obj.style) { 	
	obj=obj.style;
	// some styles for later browsers
	obj.border='solid';
	obj.borderWidth='1px';
	obj.borderColor='#000000';
	v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
	/*obj.width=300;
	obj.height=150;*/
	obj.bgColor="#FFFFFF";
	obj.top=y;
	obj.left=x;	
	obj.visibility=v; }
}

function setMouseClicked(linkName){
	/*var obj=MM_findObj(linkName, '');
	var hid=document.local.layervisibletoggle;
	if(hid.value=="unclicked"){
		var x=posX(obj);
		var y=posY(obj);
		MM_showHideLayers('','','','','',linkName,'','show',x,y);
		
		hid.value="clicked";
	}else{
		var x=posX(obj);
		var y=posY(obj);
		MM_showHideLayers('','','','','',linkName,'','hide',x,y);
		document.local.TARevActReq.visible=false;
		
		hid.value="unclicked";
	}*/
}

function setMouseover(obj,linkName){
	//var hid=document.local.layervisibletoggle.value;
	//if(hid=='unclicked'){
		//alert(n);
		var x=posX(obj)+30;
		var y=posY(obj)+17;
		MM_showHideLayers('','','','','',linkName,'','show',x,y);
	//}
}

function setMouseoff(obj,linkName){
	//var hid=document.local.layervisibletoggle.value;
	//if(hid=='unclicked'){
		var x=posX(obj)+30;
		var y=posY(obj)+17;
		MM_showHideLayers('','','','','',linkName,'','hide',x,y);
	//}
}

function posX(obj)
{
	var countleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			countleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	//netscape differences again
	else if(obj.x){
		countleft += obj.x;
	}
	return countleft;
}

function posY(obj)
{
	var counttop = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
			counttop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	//netscape differences again
	else if(obj.y){
		counttop += obj.y;
	}
	return counttop;
}

//============================================================================================================

var Gwidth = 200
var popDownTimerCounter=0
var popDownTimerID
var popUpTimerCounter=0
var popUpTimerID
var Gdelay = 200

if(document.all){
	docObj = "document.all."
	styleObj = ".style"
	yoffset = 0
}
else{
	docObj = "document."
	styleObj = ""
	yoffset = -8
}

function popUp(evt,currElem,img,height){
	popUpWin = eval(docObj + currElem + styleObj)
	popUpWin.height = height
	
	var ximage = xcoord(img)
	var yimage = ycoord(img)
	var xoffset = 10
	var xpopup = 0
	var ypopup = 0
	var imagewidth = img.width
	var imageheight = img.height
	
	// Default coordinates of the popup
	xpopup = ximage + imagewidth + xoffset
	ypopup = yimage + yoffset
	
	
	// Position popup relative to image coords
	if (document.all){
		popUpWin.top = ypopup
		popUpWin.left = Math.max (2, xpopup)
	}
	else{
		popUpWin.top = ypopup
		popUpWin.left = Math.max (2, xpopup)
	}
	
	if (popUpWin.visibility == "visible"||popUpWin.visibility == "show"){
		popUpWin.visibility = "hidden"
		}
	else{
		popUpWin.visibility = "visible"
		}
		
	return true
}

function popDown(currElem){
	popUpWin = eval(docObj + currElem +styleObj)
	popUpWin.visibility = "hidden"
	return true
}

function popDownTimer(currElem){
	popUpWin = eval(docObj + currElem +styleObj)
	if (popUpWin.visibility == "visible"||popUpWin.visibility == "show"){
		popDownTimerID=window.setTimeout("popDownTimer('"+currElem+"')",Gdelay);
		popDownTimerCounter++
		if (popDownTimerCounter>1){
			window.clearTimeout(popDownTimerID)
			popDownTimerCounter=0
			popDown(currElem)
		}
	}
	else{
		return true
	}
}

function popUpTimer(evt,currElem,img,height){
	popUpWin = eval(docObj + currElem +styleObj)
	if (popUpWin.visibility == "visible"||popUpWin.visibility == "show"){
		popUpTimerID=window.setTimeout("popUpTimer('"+evt+","+currElem+","+img+","+height+"')",Gdelay);
		popUpTimerCounter++
		if (popUpTimerCounter>1){
			window.clearTimeout(popUpTimerID)
			popUpTimerCounter=0
			popUp(currElem)
		}
	}
	else{
		return true
	}
}


// These functions are passed an image's id and return the x,y coordinates
function xcoord(imgID){
	if (document.layers){
		return eval(imgID).x
	}
	else{
		xPos = eval(imgID).offsetLeft
		temp = eval(imgID).offsetParent
		while (temp != null){
			xPos += temp.offsetLeft
			temp = temp.offsetParent
		}
		return xPos
	}
}

function ycoord(imgID){
	if (document.layers){
		return eval(imgID).y
	}
	else{
		yPos = eval(imgID).offsetTop
		temp = eval(imgID).offsetParent
		while (temp != null){
			yPos += temp.offsetTop
			temp = temp.offsetParent
		}
		return yPos
	}
}

// Void function
function evoid(){
	return
}
