//ROLLOVER RELATED
///////////////////////////
var over = new Array();
var out = new Array();
function addRollovers(idArr) {
	var imgs, a;
	if (!document.images) return;
	for (i = 0; i < idArr.length; i++) {
		imgs = getObj(idArr[i]);
		if (!imgs) continue;
		a = imgs.parentNode;
		if (a && a.tagName == 'A'){
			over[i] = new Image();
			out[i] = new Image();
			over[i].src = getRollSrc(imgs.src,"gif",1);
			out[i].src = imgs.src;
			imgs.setAttribute('ro_index',i);
			a.onmouseover = function() { this.childNodes[0].src = over[this.childNodes[0].getAttribute('ro_index')].src; }
			a.onfocus = function() { this.childNodes[0].src = over[this.childNodes[0].getAttribute('ro_index')].src; }
			a.onmouseout = function() { this.childNodes[0].src = out[this.childNodes[0].getAttribute('ro_index')].src; }
			a.onblur = function() { this.childNodes[0].src = out[this.childNodes[0].getAttribute('ro_index')].src; }
		}
	}
}
function getRollSrc(src, ext, hover) {
	return (hover) ? src.replace("a."+ext,"b."+ext) : src.replace("b."+ext,"a."+ext);
}


//GENERAL PURPOSE FUNCTIONS
///////////////////////////

var wini; //Reference to a window
function PopWin(url, name, width, height) {
	var settings, lp, tp;
	if (width || height){
		h = (height < screen.height) ? height : screen.height -30;
		w = (width <= screen.width) ? width : screen.width;
		lp = (screen.width) ? (screen.width-w)/2 : 0;
		tp = (screen.height) ? (screen.height-h)/2 : 0;
		settings = 'height='+ h +',width='+ w +',top='+tp+',left='+lp+',scrollbars=yes,resizable';
	}
	else {
		settings = '';
	}
wini = window.open(url,name,settings);
	if (wini) wini.focus();
	return ( !wini )
}// PopWin()

function addEvent(obj,evType,fn){
	if(obj.addEventListener){
		obj.addEventListener(evType,fn,true);
		return true;
	}
	else if(obj.attachEvent){
		var r=obj.attachEvent("on"+evType,fn);
		return r;
	}
	else{
		eval("obj.on"+evType+ " = " + fn);
		return true;
	}
}

function getObj(name, ref) {
  if (document.getElementById) {
  	this.obj = document.getElementById(name);
		if(this.obj) 
			this.style = document.getElementById(name).style;
  }
  else if (document.all) {
		this.obj = document.all[name];
		if(this.obj)
			this.style = document.all[name].style;
  }
  else if (document.layers) {
   	this.obj = document.layers[name];
		if(this.obj)
	   	this.style = document.layers[name];
  }
	return this.obj; //secondary functionality returns reference to obj
}


function PopLinks() {
	if (document.getElementsByTagName)
		els = document.getElementsByTagName('A');
	else if (document.all.tags)
		els = document.all.tags('A');
	if (!els) return;
	for (var i = 0; i < els.length; i++) {
	//add event only to those <A>'s with appropriate "rel" attribute
		if (els[i].rel.indexOf("external") >= 0 ) {
			if(els[i].rel.indexOf(':') < 0) {
				els[i].onclick = function() { return PopWin(this.href,'_blank',0,0); }
			}
			else {
				args = els[i].rel.split(':');
				els[i].onclick = function() { return PopWin(this.href,'_blank',args[1],args[2]); }
			}
		}
	}// for
}// PopLinks()





