function initUI(selector) {
	
	var $selector = $(selector);
	
	/* Zebra tables */
	
	var counter = 0;
	$selector.find("table.ui-table tr").each(function(i) {
		if($(this).find('th').length == 0) {
			$(this).addClass(counter % 2 == 0 ? 'even' : 'odd')
			.mouseover(function() {
				$(this).addClass('over');
			})
			.mouseout(function() {
				$(this).removeClass('over');
			});
		}
		counter++;
	});
	
	/* Truncate table cells */
	/*
	$('table.ui-table td.truncate div').each(function(i) {
				
		var sNS = 'http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul';
	
		var xml = document.createElementNS(sNS, 'window');
		//var label = document.createElementNS(sNS, 'description');
		//label.setAttribute('crop', 'end');
		//xml.appendChild(label);
		
		var xml2 = xml.cloneNode(true);
		xml2.firstChild.setAttribute('value', $(this).html());

		this.innerHTML = '';
		this.appendChild(xml2);

	});
	*/
	
	/* Form hover effects */
	
	$selector.find('input, select, textarea').mouseover(function() {
		$(this).addClass('hover');
	}).mouseout(function() {
		$(this).removeClass('hover');
	}).focus(function() {
		$(this).addClass('active');
	}).blur(function() {
		$(this).removeClass('active');
	});
	
	/* Admin controls */
	
	$selector.find('.ui-admin').mouseover(function() {
		$(this).addClass('ui-admin-hover');
	}).mouseout(function() {
		$(this).removeClass('ui-admin-hover');
	});
	
	/* Tooltips */
	
	$selector.find('.ui-tooltip').tooltip({
		track: true, 
		showBody: " - ",
		fade: 250,
		top: 15,
		left: -20,
		showURL: false
	});
	
}

$(document).ready(function() {
	initUI('body');
});
