﻿$.fn.togglepopup = function () {

	var popup = null;
	if (!$(this).attr("ctrltype"))
		popup = $(this).parents("[ctrltype]");
	else
		popup = $(this);
	var hf = $(popup).find("input:hidden").filter("[id*=mphf]");
	var hfl = $(popup).find("input:hidden").filter("[id*=mpl]");
	hf.val(hf.val() == 'true' ? 'false' : 'true');
	if (hfl.val() == 'true') {
		var disp = hf.val() == 'true' ? '' : 'none';
		popup.css('display', disp);
	}
	else {
		hfl.val('true');
		__doPostBack(popup[0].id, '');
	}
	//var disp = hf.val() == 'true' ? '' : 'none';
	//popup.css('display', disp);

	//if (disp == '')
	//	popup.center();
}

$.fn.closepopup = function () {

	var popup = null;
	if (!$(this).attr("ctrltype"))
		popup = $(this).parents("[ctrltype]");
	else
		popup = $(this);
	var hf = $(popup).find("input:hidden").filter("[id*=mphf]");
	hf.val('false');
	popup.css('display', 'none');
}				





