(function($) { $(document).ready(function(){
	$("ul.nav").superfish({
		hoverClass	: "sfHover",
		delay		: 800,
		animation   : { opacity:.8},
		speed		: "fast",
		oldJquery	: false, /* set to true if using jQuery version below 1.2 */
		disableHI	: false, /* set to true to disable hoverIntent detection */
		onInit		: function(){},
		onBeforeShow: function(){},
		onShow		: function(){},
		onHide		: function(){}
	});

	$('label').hover(function () { $(this).css({background: '#fffff0 !important'}); }, function ()  {$(this).css({background: 'transparent'}); });

	$('#esprit_form').bind('submit',function() {
		$.modal($('<div id="loading"><img src="/images/loading-red.gif" alt="Loading..." /><strong>&nbsp;&nbsp;Attempting to login...</strong></div><div align="right"><a href="#" class="modalClose">Close</a></div>'),
				{close: true, closeTitle:'close' });
		$('#esprit_form input[type=submit]').attr('disabled',true);

		$.post('/pages/ajax_engine?engine=esprit_login',$('#esprit_form').serialize(), function (data) {
			$('#esprit_form input[type=submit]').removeAttr('disabled');
			if (data.status) {
				location.href = data.data;
				$('#loading').html("Visit the login for <a href='" + data.data + "'>" + $('#esprit_form input[name=domain]').val() + '</a><br /><br />');
				return true;
			} else {
				$('#loading').html("<div id='err_container' align='left'><strong>There appears to have been some errors:</strong></div>");
				var el = $('<dl>').appendTo($('#err_container'));
				el.parent().css('text-align','left');
				for (idx in data.data) {
					$('<dd>' + data.data[idx] + '</dd>').appendTo(el);
				}
			}

		},"json");
		return false;
	});

});})(jQuery);

jQuery.fn.addDropShadow = function () {
	this.wrap("<div class='wrap0'><div class='wrap1'><div class='wrap2'>" +
					 "<div class='wrap3'></div></div></div></div>");

}

jQuery.fn.fixClearType = function(){
   return this.each(function(){
       if( !!(typeof this.style.filter  && this.style.removeAttribute))
           this.style.removeAttribute("filter");
   })
}
