function goBack() {
	try {
		history.back();
	} catch (e) {
		reloadSelf();
	}
	return false;
}

function reloadTop() {
	top.location.href = top.location.href;
}

function reloadSelf() {
	location.href = location.href;
}

function showLoading() {
	var loadingElem = $(".edit-loading");
	try {
		loadingElem.height($(window).height());
		loadingElem.show();
	} catch (e) {
		alert(e);
	}
	return false;
}

function hideLoading() {
	$(".edit-loading").hide();
}

function closeDialog() {
	if (typeof(self.parent.tb_remove) != 'undefined') {
		self.parent.tb_remove();
	} else {
		window.close();
	}
	return false;
}

//data tables extensions
/*
 * Function: fnGetColumnIndex
 * Purpose:  Return an integer matching the column index of passed in string representing sTitle
 * Returns:  int:x - column index, or -1 if not found
 * Inputs:   object:oSettings - automatically added by DataTables
 *           string:sCol - required - string matching the sTitle value of a table column
 */
$.fn.dataTableExt.oApi.fnGetColumnIndex = function ( oSettings, sCol ) {
	var cols = oSettings.aoColumns;
	for ( var x=0, xLen=cols.length ; x<xLen ; x++ ) {
		if ( cols[x].sTitle.toLowerCase() == sCol.toLowerCase() ) {
			return x;
		};
	}
	return -1;
}

$.fn.dataTableExt.oApi.fnGetColumnVis = function( oSettings, iCol){
	var colIndex = this.fnGetColumnIndex(iCol);
	return oSettings.aoColumns[colIndex].bVisible;
}
