/*
////////////////////////////////////////////////////////////////////////////////////////////////////////
//  Function: imgOn() 
// Arguments: 'imgName' - string value of the img tag
//   Returns: -
// Objective: swaps the src of 'imgName' with preloaded 'imgName' + 'on' .src
////////////////////////////////////////////////////////////////////////////////////////////////////////        
function SwapOn(imgName) {
		if (document.images) {
			KillAll();
			document[imgName].src = eval(imgName + "_on.src");
			
				 
        }
}

////////////////////////////////////////////////////////////////////////////////////////////////////////
//  Function: imgOff() 
// Arguments: 'imgName' - string value of the img tag
//   Returns: -
// Objective: swaps the src of 'imgName' with preloaded 'imgName' + 'off' .src
////////////////////////////////////////////////////////////////////////////////////////////////////////        
function SwapOff(imgName) {
        if (document.images) {
			
            document[imgName].src = eval(imgName + "_off.src");
			
        }
}
function KillAll(){
	SwapOff('pubs');
}
*/


function ShowLayerController(layername, obj){
	MoveLayer(layername, DL_GetElementLeft(obj), DL_GetElementTop(obj));
}

function MoveLayer(layer_id, leftpos, toppos){
	document.getElementById(layer_id).style.left=leftpos + 138;
	document.getElementById(layer_id).style.top=toppos;
}

function DL_GetElementLeft(eElement)
{
    var nLeftPos = eElement.offsetLeft;          // initialize var to store calculations
    var eParElement = eElement.offsetParent;     // identify first offset parent element  
    while (eParElement != null)
    {                                            // move up through element hierarchy
        nLeftPos += eParElement.offsetLeft;      // appending left offset of each parent
        eParElement = eParElement.offsetParent;  // until no more offset parents exist
    }
    return nLeftPos;                             // return the number calculated
}

function DL_GetElementTop(eElement)
{
    var nTopPos = eElement.offsetTop;            // initialize var to store calculations
    var eParElement = eElement.offsetParent;     // identify first offset parent element  
    while (eParElement != null)
    {                                            // move up through element hierarchy
        nTopPos += eParElement.offsetTop;        // appending top offset of each parent
        eParElement = eParElement.offsetParent;  // until no more offset parents exist
    }
    return nTopPos;                              // return the number calculated
}

var onLayer = "";

function Layer_Call(section){
	onLayer = section;
	IMA_showHideLayers(section, '', 'show');
}
function MM_findObj(n, d) {
  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 IMA_showHideLayers() {	
	
  var i,p,v,obj,args=IMA_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

var timerID = "global";
function hidemenus() {
	IMA_showHideLayers('introduction','','hide');
	IMA_showHideLayers('leadership','','hide');
	IMA_showHideLayers('member_services','','hide');
	IMA_showHideLayers('organizing','','hide');
	IMA_showHideLayers('local_dir','','hide');
	IMA_showHideLayers('yellow_card','','hide');
	IMA_showHideLayers('news','','hide');
	IMA_showHideLayers('pubs','','hide');
	IMA_showHideLayers('pac','','hide');
	if (onLayer != "") {
		IMA_showHideLayers(onLayer, '', 'show');
	}
}
function startTimer() {
	stopTimer();
	timerID = setTimeout("hidemenus()", 500);
}
function stopTimer() {
	clearTimeout(timerID);
}

function MM_callJS(jsStr) {
  return eval(jsStr)
}

