// getStyle by ppk - http://www.quirksmode.org/dom/getstyles.html */
function getStyle(el,styleProp) {
	if (el.currentStyle)
		var y = el.currentStyle[styleProp];
	else if (window.getComputedStyle)
		var y = document.defaultView.getComputedStyle(el,null).getPropertyValue(styleProp);
	return y;
}


// addLoadEvent by Simon Willison
function addLoadEvent(func) { 	
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	} else {
	
		window.onload = function() {
			oldonload();
			func();
		}
	}
}

function dashToCamelCase(dashedText) {
	var parts = dashedText.split('-');
	var firstPart = parts[0];
	var lastPart = parts[1];
	var capitalizedLetter = lastPart.charAt(0).toUpperCase();
	return firstPart + capitalizedLetter + lastPart.substr(1);
}

/* apply class names to alternative table rows */
ZebraTables = {
    init: function(className, validRowClassName, autoLink) {
        var listTables = document.getElementsByTagName('table');
        for (var i=0; i < listTables.length; i++) {
            if (listTables[i].className.match(className)) {
                var tableBody = listTables[i].getElementsByTagName('tbody')[0];
                var rows = tableBody.getElementsByTagName('tr');
				var loop = 0;
                for (var x=0; x < rows.length; x++) {
                   if ((validRowClassName == null) || (validRowClassName && validRowClassName == rows[x].className)) {
						if (loop % 2 == 0) {
                       		rows[x].className += ' odd';
                    	}
						if (autoLink) {
							rows[x].onclick = function() {
								var firstLink = this.getElementsByTagName('a')[0];
								if (firstLink) {
									window.location = firstLink.href;
								}
							};
						}
						loop += 1;
					}
                }
            }
        }
    }
};
