/** * Formal Forms - Covidien Standard Code for Ajax Form Submission with Formalized UI * *///$.fn.addSpotLight = function(spotLight) {$.fn.submitSearch = function() {    	var thisDiv = this;		/*    var spotLightTag = '';    if (spotLight != '') {        var axel = Math.random()+"";        var a = axel * 10000000000000;        spotLightTag = "<img src='" + spotLight + a + "?' width='1' height='1' alt='' />";    }    */    $("#locatorSubmitBtn").click(function () { 
		//var locatorURL = '';
		if($("#locatorzip").val() != '')
		{
			//$(thisDiv).append(spotLightTag).show('slow');
			location.href = 'http://locator.yourhernia.com/results.aspx?zip=' + $("#locatorzip").val();
		}
		else if ($("#locatorstate").val() != '')
		{
			if($("#locatorcity").val() != '')
			{
		    	//$(thisDiv).append(spotLightTag).show('slow');
				location.href = 'http://locator.yourhernia.com/results.aspx?state=' + $("#locatorstate").val() + '&city=' + $("#locatorcity").val();
			}
			else
			{
				//$(thisDiv).append(spotLightTag).show('slow');
				location.href = 'http://locator.yourhernia.com/results.aspx?state=' + $("#locatorstate").val();
			}
		}
		else
		{
			alert('You need to provide either a zip code, or a city AND state.');
		}
	});
};		$.fn.activateForm = function(target, options, hideForm, spotLight) {	var thisDiv = this;	$('.formFail',this).hide();	$('.formSuccess',this).hide();	$('.formInProcess',this).hide();	$('form',thisDiv)		.validate({			submitHandler: function(form){				var method = $('form',thisDiv).attr('method') == undefined ? 'post' : $('form',thisDiv).attr('method');				var parms = $('form',thisDiv).serialize();				$(':submit',thisDiv).fadeOut('slow');				$('.formInProcess',thisDiv).show();				for(key in options){				   parms = parms + '&' + key + '=' + options[key];				}				$.ajax({					type: method,					url: target,					data: parms,					complete: function(){						$('.formInProcess',thisDiv).hide('slow');												if (!hideForm) {							$(':submit',thisDiv).show('slow');						}						else {							$('form',thisDiv).hide();													}					},					error: function(request,textStatus,exception){						$('.formFail',thisDiv).append(textStatus);						$('.formFail',thisDiv).show();					},					success: function(results){						var spotLightTag = '';						if (spotLight != '') {							var axel = Math.random()+"";							var a = axel * 10000000000000;							spotLightTag =							"<img src='" + spotLight + a + "?' width='1' height='1' alt='' />";}						$('.formSuccess',thisDiv).append(spotLightTag).show('slow');													$('.formResults',thisDiv).html(results);												}				});						return false;			}		});	return thisDiv;};		
