$(document).ready(function () {
	table_cell_alternator();
	table_cell_rolover();
	setup_forms();
	round_borders();
	zoom_profile_pics();
	$('.topRep .thumb a').lightBox();
});

function table_cell_alternator() {
	$('.dataTable tr:even').addClass('alternative');
}
function table_cell_rolover() {
	$('.dataTable tr').mouseover(function () {
		$(this).addClass('over');
	});
	$('.dataTable tr').mouseout(function () {
		$(this).removeClass('over');
	});
}
function setup_forms() {
	//$('form').addClass('dataForm');
	$(".dataForm input[type='submit']").addClass('button');
	//$(".dataForm input[type='checkbox']").css('width', 'auto');
}

function round_borders() {
	$('.usesWhiteBorder').each(function (i) {
		$(this).html('<div class="tl"><div class="tr"></div></div><div class="c">' + $(this).html() + '</div><div class="bl"><div class="br"></div></div>');
	});
	$('.box,.smallBox').wrapInner('<div class="wrapper"></div>');
}

function pop_window(url, w, h) {
	myfocus = window.open(url, 'mywindow', 'menubar=no,scrollbars=yes,width='+w+',height='+h); 
	setTimeout('myfocus.focus()',500);
}

function zoom_profile_pics() {
	var container = $('body');
	$('.topRep .thumb').mouseover(function () {
		if ($(this).find('img').length > 0) {
			var pic = $(this).find('img');
			var url = $(pic).attr('src');
			var offset = $(this).offset();
			var html = '<div class="pop" style="left: ' + (offset.left) + 'px; top: ' + (offset.top - 210) + 'px;"></div>';
			$(container).append(html);
			var img = new Image();
			img.src = url.replace('/icons', '') + '?random=' + (new Date()).getTime();
			$(img).load(function () {
				$(this).appendTo('.pop').css({'width': '200px', 'height': '200px'});
			});
		}
	});
	$(container).mouseout(function () {
		$(this).find('.pop').remove();
	});
}
