function stripe(stripeClass) {
var pattern = new RegExp("(^|\\s)"+stripeClass+"(\\s|$)")
var table = document.getElementsByTagName('table');
for (i = 0, len1 = table.length; i < len1; i++) {
	if (pattern.test(table[i].className)) {
		var trs = table[i].getElementsByTagName('tr');
		for (k = 0, len2 = trs.length; k < len2; k+=2) {
			trs[k].className += ' even';
			}
		}
	}
}

function rowstolinks(rowsToLinksClass) {
var pattern = new RegExp("(^|\\s)"+rowsToLinksClass+"(\\s|$)")
var table = document.getElementsByTagName('table');
for (i = 0, len1 = table.length; i < len1 ; i++) {
	if (pattern.test(table[i].className)) {
		var trs = table[i].getElementsByTagName('tr');
		for (k = 0, len2 = trs.length; k < len2; k++) {
			var link = trs[k].getElementsByTagName('a')
			if (link.length == 1) {
				trs[k].onclick = new Function("document.location.href='" + link[0].href + "'");
				trs[k].onmouseover = new Function("this.className='highlight'; window.status='" + link[0].href + "';");
				trs[k].onmouseout = new Function("this.className='" + trs[k].className + "'; window.status='';");
				}
			}
		}
	}
}

function pop(iUrl, winW, winH, winN) {
	var iWidth = (winW)? winW : 600;
	var iHeight = (winH)? winH : 500;
	var iTitle = (winN)? winN : 'popupWin';
	var scrollB = 'no';
	var posCode = '';

	if(screen) {
		var scrW = screen.width ? screen.width - 100 : 0;
		var scrH = screen.height ? screen.height - 100 : 0;
		if( scrW < iWidth ) { scrollB = 'yes'; iWidth = scrW; }
			else { scrW = screen.width }
		if( scrH < iHeight ) { scrollB = 'yes'; iHeight = scrH; }
			else { scrH = screen.height }
		var posX = Math.round( ( scrW - iWidth ) / 2 );
		var posY = Math.round( ( scrH - iHeight ) / 2 );
		posCode = ',left='+posX+',top='+posY;
	}

	iOptions = 'width=' + iWidth + ',height=' + iHeight + ',scrollbars=' + scrollB + ',resizable=yes,toolbar=no,status=yes' + posCode;

	if(iUrl.match(/\.(gif|jpe?g|png)$/i)) {
		popWin = window.open('', '_blank', iOptions);
		popWin.document.open();
		popWin.document.write('<html><head><title>' +
			iTitle +
			'</title></head><body style="background: #fff; margin: 0; padding: 10px;">' +
			'<table cellpadding="0" cellspacing="0" border="0" height="100%"><tr><td>' + 
			'<img src="' + iUrl + '" /></td></tr></table></body></html>'
			);
		popWin.document.close();
	} else {
		popWin = window.open(iUrl, iTitle, iOptions);
	}

	popWin.focus();
	return false;
}

function runScripts() {
	stripe('stripe');
	rowstolinks('objectslist');
}

window.onload = runScripts;
