document.expando = true;

// Create a new image group object, to manage image state and rollovers
// 
function ImageGroup() {
	this.hasbeensetup = false;
}

// 
ImageGroup.prototype.setup = function() {
	for (var name in this.images) {
		var self = this;
		var info = this.images[name];
		info.imgobj = window.document.images[name];
		if (inpath(info.path)) {
			// hilite the section we are in
			this.domouseover(info.imgobj);
		} else {
			// apply rollovers to other sections
			info.imgobj.onmouseover = function() { self.domouseover(this); };
			info.imgobj.onmouseout = function() { self.domouseout(this); };
			info.roll_imgobj = new Image;
			info.roll_imgobj.src = name + this.rollsuffix + this.extension;
		}
	}
	this.hasbeensetup = true;
}

ImageGroup.prototype.domouseover = function(img) {
	var name = img.name;
	var info = this.images[name];
	img.src = this.base + name + this.rollsuffix + this.extension;
}
ImageGroup.prototype.domouseout = function(img) {
	var name = img.name;
	var info = this.images[name];
	img.src = this.base + name + this.extension;
}

function inpath(path) {
	if (document.URL.indexOf(path) != -1) { return true; } else { return false; }
}




function setsection_cmsauto(id) {
	var div = document.getElementById(id);
	if (!div) return;
	var links = div.getElementsByTagName('a');
	for (var link in links) {
		var thelink = links[link];
		if (inpath(thelink.pathname)) {
			var images = thelink.getElementsByTagName('img');
			var name = images[0].name;
			images[0].onload = function(event) {
				CMSGlobal.addItem(this, null, 1, null)
			}
//			CMSGlobal.setOn(name);
//			thelink.onmouseover = null;
//			thelink.onmouseout = null;
		}
	}
}

// places a lock in front of urls that contain the given path
function lockhref(path) {
	var selector = 'a[href*="'+path+'"]';
//	var selector = 'a';
	var elems = document.getElementsBySelector(selector);
	for (var e in elems) {
		elems[e].innerHTML = "<img src='/images/css/lock.gif' border='0'>" + elems[e].innerHTML;
		elems[e].href = '#';
	}
}


