function init() {
	// jQuery/Blueprint tabs
	$("ul.tabs li.label").hide(); 
	$("#tab-set > div").hide();
	
	default_tab = $("#tab-set > ul > li > .selected").attr("href")
	if (default_tab == undefined) {
		$("#tab-set > div").eq(0).show();
		$("#tab-set > .tabs > li > a").eq(0).addClass("selected")
	} else {
		$("#tab-set > " + default_tab).show();
	}

	$("#toggle-label").click(function() {
		$(".tabs li.label").toggle(); 
		return false; 
	});

	// Alternating row colors on table
	$('table.alternate tr:even:not(.information)').addClass('even');
	$('table.alternate tr:odd:not(.information)').addClass('odd');

	//Add hover to table rows
	$('table.hover tr').hover(function() {
		$(this).addClass('hover');
	}, function() {
		$(this).removeClass('hover');
	})

	
	try {
		document_ready_module()
	} catch (e) {}
}

function submit_form(url, data) {
	form = ''
	form += '<form action="' + url + '" method="post" id="js_created_form">'
	$.each(data, function(i, val){
		form += '<input type="hidden" name="' + i + '" value="' + val + '">'
	});
	form += '</form>'
	$('#empty_div').append(form)
	$('#js_created_form').submit()	
}

// Chow an html snippet in JQM
function show_snippet(identifier) {
	init_overlay('dialog_' + identifier)
	var api = $("#dialog_" + identifier).overlay()
	api.load()
}

function close_overlay(element) {
	$("#" + element).overlay().close()
}

function init_overlay(element) {
	$(function() {
			$('#' + element).overlay( {		speed: 'fast',
											finish: {top: 20},
											fadeInSpeed: 'fast',
											onBeforeLoad:	function() {
													this.getBackgroundImage().expose({	color: '#222',
																						opacity: 0.5,
																						speed: 500
																					});
											},
										closeOnClick:	true,
										onClose:	function() {
														$.unexpose();
													}
										});
	});
}

// Hide the JQM window
function hide_snippet(identifier) {
	$("#dialog_" + identifier).overlay().close()
	return false
}

