jQuery.extend( jQuery.easing,{
	easeOutElastic: function (x, t, b, c, d) {
		var s=1.70158;var p=0;var a=c;
		if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
		if (a < Math.abs(c)) { a=c; var s=p/4; }
		else var s = p/(2*Math.PI) * Math.asin (c/a);
		return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
	},
	easeOutBounce: function (x, t, b, c, d) {
		if ((t/=d) < (1/2.75)) {	return c*(7.5625*t*t) + b;} 
		else if (t < (2/2.75)) {	return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;} 
		else if (t < (2.5/2.75)) {	return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;} 
		else {						return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;}
	}
});

jQuery(document).ready(function($){
	$("input").each(function(i){
		/*if($(this).is("input:checkbox,input:radio")){
			var input = $(this);
			$(this).addClass("hide");
			var label = $('label[for='+input.attr('id')+']');
			var inputType = (input.is('[type=checkbox]')) ? 'checkbox' : 'radio';
			$('<div class="ui-'+ inputType +'"></div>').insertBefore(input).append(input, label);
			var allInputs = $('input[name='+input.attr('name')+']');
			label.hover(
				function(){ 
					$(this).addClass('hover'); 
					if(inputType == 'checkbox' && input.is(':checked')){ 
						$(this).addClass('checkedHover'); 
					} 
				},
				function(){ $(this).removeClass('hover checkedHover'); }
			);
			input.bind('updateState', function(){	
				if (input.is(':checked')) {
					if (input.is(':radio')) {				
						allInputs.each(function(){
							$('label[for='+$(this).attr('id')+']').removeClass('checked');
						});		
					};
					label.addClass('checked');
				}
				else { label.removeClass('checked checkedHover checkedFocus'); }						
			})
			.trigger('updateState')
			.click(function(){ 
				$(this).trigger('updateState'); 
			})
			.focus(function(){ 
				label.addClass('focus'); 
				if(inputType == 'checkbox' && input.is(':checked')){ 
					$(this).addClass('checkedFocus'); 
				} 
			})
			.blur(function(){ label.removeClass('focus checkedFocus'); });
		} else*/ if($(this).is("input:submit, input:reset")){
			$("input:submit, input:reset").addClass("ui-state-default");
			$("input:submit:not(.ui-state-disabled),input:reset:not(.ui-state-disabled)")
				.hover(
					function() { $(this).addClass("ui-state-hover");},
					function() { $(this).removeClass("ui-state-hover");});
			$(".ui-buttonset #submit").addClass("ui-corner-left");
			$(".ui-buttonset #reset").addClass("ui-corner-right");
		} else {
			$("input:not(.ui-buttonset #submit,.ui-buttonset #reset,#password),select,textarea").addClass("ui-corner-all");
		};
		$("input:text:first").focus();
		return i;
	});
	
/* jQuery UI Init Handlers for Button, Buttonset, input[type='*']. */
	$(".ui-state-default")
	.hover(function(){ $(this).addClass("ui-state-hover")}, function(){ $(this).removeClass("ui-state-hover")})
	.mousedown(function(){
		$(this).parents('.ui-buttonset-single:first').find(".ui-button.ui-state-active").removeClass("ui-state-active");
		if( $(this).is('.ui-state-active.ui-button-toggleable, .ui-buttonset-multi .ui-state-active') ){ $(this).removeClass("ui-state-active"); } else { $(this).addClass("ui-state-active"); }})
	.mouseup(function(){ if(! $(this).is('.ui-button-toggleable, .ui-buttonset-single .ui-button,  .ui-buttonset-multi .ui-button') ){ $(this).removeClass("ui-state-active");}});
	// .over img src swap :hover
		$(".over img")
			.hover(function() { $(this).attr("src", $(this).attr("src").split(".").join("_o."));
			}, function() { $(this).attr("src", $(this).attr("src").split("_o.").join("."));});
		$(".hit img")
			.mousedown(function() { $(this).attr("src", $(this).attr("src").split("_o.").join("_a."));})
			.mouseup(function() { $(this).attr("src",$(this).attr("src").split("_a.").join("_o."));});
	// .fade img:hover
		$(".fade img")
			.hover(function() { $(this).stop().animate({opacity: .5}, 1200);
			}, function() { $(this).stop().animate({opacity: 1}, 300);
			});
	// Instantiate jQuery function calls for generic classes
		// Accordian
		$(".accordion").accordion({
			header:'h3',collapsible: true,
			icons: {header: 'ui-icon-plusthick',headerSelected: 'ui-icon-minusthick'},
			fillSpace: false,event: 'click',autoHeight: true,navigation: false,
			header:'> div > h3'}).sortable({axis:'y',handle:'h3'
		});
		$(".tabs").tabs();// Tabs
		// Datepicker
		var dates = $("#date1,#date2").datepicker({
			defaultDate: "+1w",
			changeMonth: false,
			numberOfMonths: 3,
			onSelect: function(selectedDate) {
				var option = this.id == "from" ? "minDate" : "maxDate";
				var instance = $(this).data("datepicker");
				var date = $.datepicker.parseDate(instance.settings.dateFormat || $.datepicker._defaults.dateFormat, selectedDate, instance.settings);
				dates.not(this).datepicker("option", option, date);
			}
		});
		$(".datepicker").datepicker({
			inline: true,
			altField: '#alternate', altFormat: 'DD, d MM, yy',
			numberOfMonths: 3,
			showButtonPanel: true,
			showOtherMonths: true,
			selectOtherMonths: true,
			changeMonth: false,
			changeYear: false,
			showOn: 'button',
			buttonImage: '../images/icons/ui-icon-calendar.png',
			buttonImageOnly: true,
			minDate: -20, maxDate: '+1M +10D',
			showWeek: true,
			firstDay: 1
		});
		$("#dateformat").change(function() { $(".datepicker").datepicker("option", {dateFormat: $(this).val()});});
		// Form interactivity for IE
		$('input, textarea, select').focus(function (){ $(this).addClass('focused');});
		$('input, textarea, select').blur(function() {$(this).removeClass('focused');});
		// Zebra Stripe table.data tr
		$("table.data tr:even").addClass("alt");
		// Init #top scrollTo
		$('body').prepend('<a name="top"></a>');
		// Build dynamic #copyright
		$('#copyright').html('Copyright &copy; <span class="year"></span> <span class="company"></span>, All Rights Reserved.');
		$('#copyright .year').text((new Date).getFullYear());
		$('#copyright .company').text('InfiniEdge Software, Inc.');
});
/*EOF*/