
var layer  = null;
var ns = false;
var ie = false;
var moz = false;
var curr_num = null; 
var isLoaded = false;
var div,x,y;
var fx,fy;
var timeoutID = null;

var preloadFlag = false;

/* stuff below added for CSL_IVIG */
function getObj(name,newImg)
{
  if (document.getElementById)
  {
  	this.obj = document.getElementById(name);
	this.style = document.getElementById(name).style;
	this.src = document.getElementById(name).src;
	//alert("before:"+this.src);
	this.src = newImg;
	//alert("after:"+this.src);

  }
  else if (document.all)
  {
	this.obj = document.all[name];
	this.style = document.all[name].style;
	this.src = document.all[name].src;
	this.src = newImg;
  }
  else if (document.layers)
  {
	this.obj = getObjNN4(document,name);
	this.style = this.obj;
	this.src = this.src;
	this.src = newImg;
  }

  return this.obj;
}

function getObjNN4(obj,name)
{
	var x = obj.layers;
	var foundLayer;
	for (var i=0;i<x.length;i++)
	{
		if (x[i].id == name)
		 	foundLayer = x[i];
		else if (x[i].layers.length)
			var tmp = getObjNN4(x[i],name);
		if (tmp) foundLayer = tmp;
	}
	return foundLayer;
}


function newImage(arg) {
    	if (document.images) {
    		rslt = new Image();
    		rslt.src = arg;
    		return rslt;
    	}
    }
    
 function changeImages(name,newImg) {
    	if (document.images && (preloadFlag == true)) {
			var tmpObj = getObj(name, newImg);
			getObj(name).src= newImg
		}
 }


/* End of IVIG Specific stuff */

function preLoadImages(){
	// required line, calls exhibeo init function to
	// initialise editing/saving constructs	
	// comment out when developing new templates when required.
	// "init" is a reserved exhibeo function name, do not use. 
	
	
	if(pageAction != "publish"){init()};
	
	if(document.layers)ns = true;
	if(document.getElementById && !document.all)moz = true;
	if(document.all)ie = true;

	if (document.images) {
    		indapsNavA_over = newImage("images/1/csl/tri_A-level-selected.gif");
    		indapsNavB_over = newImage("images/1/csl/tri_B-level-selected.gif");
    		indapsNavC_over = newImage("images/1/csl/tri_C-level-selected.gif");
    		preloadFlag = true;
    }

	isLoaded = true;
	
}

var isClicked = null;
var locked = false;


function swapImage(imgName, state) {
	if(isLoaded){
		//alert(document[imgName].src)
		document[imgName].src = eval(imgName + "_" + state + ".src");
		
	}	
	
}


/*
    Ned Collyer 03/11/2003 6:09PM
    Updated: remove win.moveTo(x,y) from open, openpopup, and openplainpopup as it did not work for external links
*/


function Open(url,h,w){
var x = Number(screen.availWidth / 4);
var y = Number(screen.availHeight / 4) - 100;
var win = parent.window.open(url,"win","height=" + w + ",width=" + h + ",resizable=1,location=1,menubar=1,status=1,toolbar=1,scrollbars=1");
win.focus();
}


function openPopUp(url,w,h){
	var x = screen.availWidth - screen.availWidth;
	var y = screen.availHeight - screen.availHeight;
	var win = parent.window.open(url,"win","width=" + w + ",height=" + h + ",resizable=1,location=1,menubar=0,status=1,toolbar=0,scrollbars=1");
	win.focus();

}


function openPlainPopUp(url,w,h){
    
    var x = Number(screen.availWidth / 4);
    var y = Number(screen.availHeight / 4) - 100;
    
	var win = window.open(url,"win","width=" + w + ",height=" + h + ",resizable=0,location=0,menubar=0,status=0,toolbar=0,scrollbars=1");
	
	win.focus();
}



function chk(obj) {
	var  O = obj;
	var pI = "";
	for(var propertyName in O){
	 if(propertyName != "innerHTML" & propertyName != "innerText" & propertyName != "outerHTML" & propertyName != "outerText")
	 pI += propertyName + " = " + O[propertyName] + "  ,   ";
	 }
	alert(pI)
}






function openMgrWin(val){
var loc = "list-all.asp?id=" + val;


mgrwin = window.open(loc,"mgrwin","height=400,width=400,resizable=0,location=0,menubar=0,status=0,toolbar=0");
mgrwin.focus();
mgrwin.moveTo(10,10);
}


