function jQueryGetElem(elm) {
	return $("*").get($("*").index($("#" + elm)[0]));
}

function openPopup(url, width, height) {
	var mywindow = window.open(url, "mywindow","toolbar=no,location=0,status=0,scrollbars=1,width=" + width + ",height=" + height + "");
	mywindow.moveTo(screen.availWidth / 2 - (width / 2), screen.availHeight / 2 - (height / 2));
	return false;
}

function goLocation(url) {
	window.location = url;
}

function getCallbackYes() {
	var callback = function() {
		$('#dialog').dialog('close');
	};
	return callback;
}

function getCallbackNo() {
	var callback = function() {
		$('#dialog').dialog('close');
	};
	return callback;
}

function openDialogConfirm(yes, no) {
	$('#dialog').dialog({
		autoOpen : false, 
		buttons : 	{ "Yes" : yes, 
						   "No" : no
						}, 
		draggable : false, 
		modal : true
	});
	$('#dialog').dialog('open');
}

function getCallbackDeleteItem(id, url) {
	var callback = function() {
		goLocation(url);
		jQuery('#dialog').dialog('close');
	};
	return callback;
}

function openPopup(url, width, height) {
	var mywindow = window.open(url, "mywindow","toolbar=no,location=0,status=0,scrollbars=1,width=" + width + ",height=" + height + "");
	mywindow.moveTo(screen.availWidth / 2 - (width / 2), screen.availHeight / 2 - (height / 2));
	return false;
}

/*
* AJAX by classic javascript
*/

function Inint_AJAX() {
   try { return new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) {} 
   try { return new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) {}
   try { return new XMLHttpRequest(); } catch(e) {}
   alert("XMLHttpRequest not supported");
   return null;
};

/*
* AJAX by JQuery
*/

var ajaxSendElementItems;

function ajaxSend() {
	$("#" + ajaxSendElementItems).html('');
	var loading = '<img src="images/animation/ajaxLoading.gif" align="absmiddle">';
	$("#" + ajaxSendElementItems).append(loading);
}