/**
 * 
 */
function showInfo(showObj, msg) {

	var options = {};
	$(".ui-widget div").addClass('ui-state-highlight')
			.addClass('ui-corner-all');
	$(".ui-widget div .msg").text(msg);

	$(showObj).show("drop", options, 200);

}

function loading() {
	$("#processing-modal").dialog({
		height : 100,
		width : 200,
		modal : true,
		buttons : {
		},
		close : function(event, ui) {
		},
		resizable : false,
		draggable : false

	});
}

function unloading() {
	$("#processing-modal").dialog("destroy");
}

function checkDate(val) {
	var validformat = /^\d{2}\/\d{2}\/\d{4}$/; // Basic check for format
												// validity
	var returnval = false;
	if (!validformat.test(val)) {
		//alert("Invalid Date Format. Please correct and submit again.")
		return false;
	}
	else { // Detailed check for valid date ranges
		var monthfield = val.split("/")[0];
		var dayfield = val.split("/")[1];
		var yearfield = val.split("/")[2];
		var dayobj = new Date(yearfield, monthfield - 1, dayfield);
		if ((dayobj.getMonth() + 1 != monthfield)
				|| (dayobj.getDate() != dayfield)
				|| (dayobj.getFullYear() != yearfield))
			//alert("Invalid Day, Month, or Year range detected. Please correct and submit again.")
			returnal = false;
		else
			returnval = true;
	}
	/*if (returnval == false)
		input.select()*/
	return returnval;

}


function confirmDialog(title, msg, url, width, height) {
	if (width == undefined || null == width) {
		width = 300;
	}
	if (height == undefined || null == height) {
		height = 200;
	}
	$("#dialog-modal").attr('title', title);
	$("#dialog-modal p").html(msg);
	$("#dialog-modal").dialog({
		height : height,
		width : width,
		modal : true,
		buttons : {
			"确定": function() {
				$( this ).dialog( "close" );
			},
			"取消": function() {
				$( this ).dialog( "close" );
			}

		},
		close : function(event, ui) {
			if (url != undefined && null != url) {
				location.href = url;
			}
		},
		resizable : false,
		draggable : false

	});
}







function showDialog(title, msg, url, width, height) {
	if (width == undefined || null == width) {
		width = 300;
	}
	if (height == undefined || null == height) {
		height = 200;
	}
	$("#dialog-modal").attr('title', title);
	$("#dialog-modal p").html(msg);
	$("#dialog-modal").dialog({
		height : height,
		width : width,
		modal : true,
		buttons : {
			Ok : function() {
				if (url == undefined || null == url) {
					$(this).dialog("close");
				} else {
					location.href = url;
				}
			}
		},
		close : function(event, ui) {
			if (url != undefined && null != url) {
				location.href = url;
			}
		},
		resizable : false,
		draggable : false

	});
}

// email validation
function isValidEmail(str) {
	return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
}
