<!-- Version 1.3.2 -->
<!-- BEGIN jQuery Include FUNCTIONS -->
// pre-submit callback
function showRequest(formData, jqForm, optionsMCA) {
    var queryString = $.param(formData);
    // var formElement = jqForm[0];
    //alert('About to submit: \n\n' + queryString);
    return true;
}
// post-submit callback
function showResponse(responseText, statusText)  {
    //alert('status: ' + statusText + '\n\nresponseText: \n' + responseText + '\n\nThe output div should have already been updated with the responseText.');
}

<!-- href ajax with targeted div -->
function hrefmaincontentajax(){
	$("#maincontentajax").empty();
	$("#maincontentajax").append('<div style="text-align:center;"><img src="/css/images/css_loading.gif"/></div>');
	$.ajax({
		url: this.href,
		cache: false,
		success: function(html){
			$("#maincontentajax").empty();
			$("#maincontentajax").append(html);
		}
	});
	return false;
}
function hrefmaincontentajax2(){
	$("#maincontentajax2").empty();
	$("#maincontentajax2").append('<div style="text-align:center;"><img src="/css/images/css_loading.gif"/></div>');
	$.ajax({
		url: this.href,
		cache: false,
		success: function(html){
			$("#maincontentajax2").empty();
			$("#maincontentajax2").append(html);
		}
	});
	return false;
}
function hrefpopupContent(){
		$('#popupContent').dialog('destroy');
		//load the help css and js - The METAREV and UIREV will need to be passed from the calling page.
		$('<link>').appendTo('head').attr({
			rel: 'stylesheet',
			type: 'text/css',
			//href: '/css/v1.3.2/popuphelp/jquery-ui-1.7.2.custom.css'
			href: '/css/v'+ $(this).data('metarev') +'/'+ $(this).data('theme') +'/jquery-ui-'+ $(this).data('uirev') +'.custom.css'
			});
		$("#popupContent").dialog({
			width: $(this).data("pdW"), 
			height: $(this).data("pdH"),
			resizable: true, 
			title: this.title, 
			modal: true,
			dialogClass: $(this).data("theme"),
			overlay: { opacity: 0.25, background: "#382509" }/*,
			open: function(event, ui) {
				$(ui).find('#ui-datepicker-div').datepicker().click(function(){
					$(this).datepicker('show');
				});
			},
			close: function(event,ui) {
				$.datepicker._hideDatepicker(null, '');
			},
			beforeclose: function(){
				$("#popupContent iframe, #popupContent object").each(function(){
					this.parentNode.removeChild(this);
				});
			}*/
		});
		$("#popupContent").empty();
		$("#popupContent").append('<div style="text-align:center;"><img src="/css/images/css_loading.gif"/></div>');
		$.ajax({url: this.href, cache: false, success: function(html){ $("#popupContent").empty(); $("#popupContent").append(html); } });
		return false;
}
function hrefpopupForm(){
		$('#popupForm').dialog('destroy');
		//load the help css and js - The METAREV and UIREV will need to be passed from the calling page.
		$('<link>').appendTo('head').attr({
			rel: 'stylesheet',
			type: 'text/css',
			//href: '/css/v1.3.2/popuphelp/jquery-ui-1.7.2.custom.css'
			href: '/css/v'+ $(this).data('metarev') +'/'+ $(this).data('theme') +'/jquery-ui-'+ $(this).data('uirev') +'.custom.css'
			});
		$("#popupForm").dialog({
			width: $(this).data("pdW"), 
			height: $(this).data("pdH"), 
			resizable: true, 
			title: this.title, 
			modal: true, 
			dialogClass: $(this).data("theme"),
			overlay: { opacity: 0.75, background: "#382509" }
		});
		$("#popupForm").empty();
		$("#popupForm").append('<div style="text-align:center;"><img src="/css/images/css_loading.gif"/></div>');
		$.ajax({url: this.href, cache: false, success: function(html){ $("#popupForm").empty(); $("#popupForm").append(html); } });
		return false;
}
function hrefpopupGoogleMap(){
		$('#popupContent').dialog('destroy');
//	alert("0");
		$("#popupContent").dialog({
			width: $(this).data("pdW"), 
			height: $(this).data("pdH"), 
			resizable: true, 
			title: this.title, 
			modal: true, 
			overlay: { opacity: 0.25, background: "#382509" }
		});
//		alert("1");
		$("#popupContent").empty();
		$("#popupContent").append('<div style="text-align:center;"><img src="'+this.href+'"/></div>');
		return false;
}
function hrefpopupThickBox(){
		$('#popupContent').dialog('destroy');
		$("#popupContent").dialog({
			width: $(this).data("pdW"), 
			height: $(this).data("pdH"), 
			resizable: true, 
			title: this.title, 
			modal: true, 
			overlay: { opacity: 0.25, background: "#382509" }
		});
		alert("1");
		$("#popupContent").empty();
		$("#popupContent").append('<div style="text-align:center;"><img src="'+this.href+'"/></div>');
		return false;
}
function hrefpopupHelp(){
		//get rid of the dialog so we can load css.
		$('#popupHelp').dialog('destroy');
		//load the help css and js - The UIREV will need to be determined dynamically
		$('<link>').appendTo('head').attr({
			rel: 'stylesheet',
			type: 'text/css',
			//href: '/css/v1.3.2/popuphelp/jquery-ui-1.7.2.custom.css'
			href: '/css/v'+ $(this).data('metarev') +'/'+ $(this).data('theme') +'/jquery-ui-'+ $(this).data('uirev') +'.custom.css'
			});
		//set the dialog parameters
		$("#popupHelp").dialog({
			width: $(this).data("pdW"), 
			height: $(this).data("pdH"), 
			resizable: true, 
			title: this.title, 
			modal: false,
			dialogClass: $(this).data("theme")
		});
		//clean the contents of the new dialog
		$("#popupHelp").empty();
		//load the loading gif so the client knows something is happening.
		$("#popupHelp").append('<div style="text-align:center;"><img src="/css/images/css_loading.gif"/></div>');
		//Now load the dialog content.
		$.ajax({url: this.href, cache: false, success: function(html){ $("#popupHelp").empty(); $("#popupHelp").append(html); } });
		return false;
}
function popupRefreshParent() {
	window.top.location.href = window.top.location.href;
}

<!-- Checks if a variable is in the query string. -->
function gup(name){
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}
<!-- replace query string -->
function replaceQueryString(url,param,value){
    var re = new RegExp("([?|&])" + param + "=.*?(&|$)","i");
    if (url.match(re))
        return url.replace(re,'$1' + param + "=" + value + '$2');
    else if (url.indexOf("?") == -1)
        return url + '?' + param + "=" + value;
    else
        return url + '&' + param + "=" + value;
}