//xb api created by Allen Moore to ease the pain of Cross broswer dhtml
//why create my own when others already exist?
//To help me learn and stay up on standards and scripting techniques.
//special thanks to Shelly Powers at www.theburningbird.com, 
//Bob Clary at Netscape  developer.netscape.com/evangelism/docs/api/xbStyle/
//and Dan Steinman at www.dansteinman.com
//for their inspiration and guidance (albeit unkown to them) for this project.


//This is browser detection
DOM = (document.getElementById) ? 1:0;   //dom compliant browsers
ie5 = (DOM && document.all)? 1:0;		//ie 5.x browsers
ie4 = (document.all && !DOM) ? 1:0;		//ie 4.x browsers
ie = (ie5 || ie4) ? 1:0;
ns4 = (document.layers) ? 1:0;			//ns 4.x browsers
compatible = (DOM || ie || ns4) ? 1:0;
browserStr = ns4 ? "ns4" : DOM ? "DOM" : ie5 ? "ie5" : "ie4";

docTitle = document.title

//This is the core object interface 

//This is the object creation method.
//It creates and object for all DIVs with "Obj" in the ID
function createObjects(){

	//objects = new Array();
	if (ns4){							//create object for ns4.x browsers
		elements = document.layers
	}else if (ie4){						//create object for ie4.x browsers
		elements = document.all.tags("DIV")
	}else if (DOM){						//create object for DOM browsers
		elements = document.getElementsByTagName("DIV")	
	} 
  	for (i = 0; i < elements.length; i++) {
		obj = elements[i]
      	if (obj.id.indexOf("Div") != -1)
		index = obj.id.indexOf("Div")
			eval(obj.id.substr(0,index)+' = new DOMobject("'+obj.id+'")')
			//objects[obj.id] = new DOMobject(obj);
      }
}

//additional functions
	//preload images
function preload(imgObj,imgSrc) {
		eval(imgObj+' = new Image()')
		eval(imgObj+'.src = "'+imgSrc+'"')
}

if (compatible){
	document.writeln('<scr'+'ipt language="JavaScript1.2" src="xbAPI/'+browserStr+'_xbAPI.js"><\/scr'+'ipt>')
}else{
//check browser version for compatibility. Route to error.htm if not compatible.
	window.location= 'error.htm';
}