function imgover(whichimg) {
	var imgsrc = new String(whichimg.src);
	imgsrc = imgsrc.replace(new RegExp('_off\.','g'),'_on\.');
	whichimg.src = imgsrc;
}

function imgout(whichimg) {
	var imgsrc = new String(whichimg.src);
	imgsrc = imgsrc.replace(new RegExp('_on\.','g'),'_off\.');
	whichimg.src = imgsrc;
}

function togglesearchcat(whichcat) {
	el = document.getElementById('cat_' + whichcat);
	if (el) {
		tobj = document.getElementById('table_' + whichcat);
		if (el.src.indexOf('plus') != -1) {
			el.src = "/images/common/minus.gif";
			if (tobj) {
//				for (r = 1; r < tobj.rows.length; r++) {
//					tobj.rows[r].className = "hidden";
//				}
				tobj.className = "hidden";
			}
		} else {
			el.src = "/images/common/plus.gif";
			if (tobj) {
//				for (r = 1; r < tobj.rows.length; r++) {
//					tobj.rows[r].className = "visible";
//				}
				tobj.className = "visible";
			}
		}
	}
}

function getObj(obj,tagname) {
	nobj = obj.tagName;
	while (nobj != tagname) {
		obj = obj.parentNode;
		nobj = obj.tagName;
	}
	return obj;
}

function getNewRowIndex(robj,tobj) {
	rowcount = 0;
	for (r = 0; r < tobj.rows.length; r++) {
		if (tobj.rows[r].id == robj.id) {
			return rowcount;
		} else {
			rowcount++;
		}
	}
}

function togglelogin() {
	el = document.getElementById('loginform');
	if (el) {
		el.style.display = el.style.display == 'none' ? 'block' : 'none';
	}
}

var activesponsor, sponsors, sponsortimer;

function initsponsors(sponsorlist) {
	sponsors = sponsorlist.split(',');
	activesponsor = 0;
	el = document.getElementById('sponsor_' + sponsors[0]);
	if (el) {
		el.style.display = 'block';
	}
	if (sponsors.length > 1) {
		sponsortimer = setInterval('rotatesponsors()',14000);
	}
}

function rotatesponsors() {
	el = document.getElementById('sponsor_' + sponsors[activesponsor]);
	if (el) el.style.display = 'none';
	if (sponsors.length > activesponsor + 1) {
		activesponsor++;
	} else {
		activesponsor = 0;
	}
	el = document.getElementById('sponsor_' + sponsors[activesponsor]);
	if (el) el.style.display = 'block';
}