String.prototype.trim = function(){return this.replace(/^\s+|\s+$/, '');};

// Array Remove - By John Resig (MIT Licensed)
Array.prototype.remove = function(from, to) {
  var rest = this.slice((to || from) + 1 || this.length);
  this.length = from < 0 ? this.length + from : from;
  return this.push.apply(this, rest);
};

var initDatePicker=function( jqueryStr ){
	return $(jqueryStr).datepicker({
		dateFormat: 'yy-mm-dd'
		,changeMonth: true
		,changeYear: true
		,showOn: 'button'
		,buttonImage: 'images/calendar.gif'
	});
};

var loadBody=function( url, data ){
	$("#messagePnl").hide("drop").html("");
	$("#loadingIcon").css({display:'none'});
	$("#bodyPnl").css({display:'inline'});
	$("#bodyPnl").html('<img src="images/loading.gif"/>').load(url, data);
};

var submitWithValidation=function(){
	if(!$(this).valid())return false;

	$("#messagePnl").html("");
	$("#bodyPnl").css({display:'none'});
	$("#loadingIcon").css({display:'inline'});
	$(this).ajaxSubmit({target:'#bodyPnl'});
	return false;
};