function ajax(placeHolder, page, data) {
  var loading = $("#loading");
 $(loading).fadeIn();
 $(placeHolder).fadeTo("slow","0");
 
  	$.ajax({
        url: page,
        type: 'POST',
        dataType: 'html',
		data: data,
        success: function(html){
				$(placeHolder).empty();
				$(placeHolder).append(html);
				$(placeHolder).ClearTypeFadeIn({ speed: 1500 });

				$(loading).fadeOut();
        }
}); 
}
function handleResponse(placeHolder,loading) {
   		$(placeHolder).fadeIn();
}

function ajax_quick(placeHolder, page, data) {
  var loading = $("#loading");
 $(loading).fadeIn();

 
  	$.ajax({
        url: page,
        type: 'POST',
        dataType: 'html',
		data: data,
        success: function(html){
				$(placeHolder).empty();
				$(placeHolder).append(html);


				$(loading).fadeOut();
        }
}); 
}


function ajaxz(placeHolder, page, data) {
  var loading = $("#loading");
  	$(placeHolder).fadeOut(); 
	$(placeHolder).load(page,data,handleResponse(placeHolder,loading));  
}

(function($) {
    $.fn.ClearTypeFadeTo = function(options) {
        if (options)
                $(this)
                        .show()
                        .each(function() {
                                if (jQuery.browser.msie) {
                                        // Save the original background color
                                        $(this).attr('oBgColor', $(this).css('background-color'));
                                        // Set the bgColor so that bold text renders correctly (bug with IE/ClearType/bold text)
                                        $(this).css({ 'background-color': (options.bgColor ? options.bgColor : '#fff') })
                                }
                        })
                        .fadeTo(options.speed, options.opacity, function() {
                                if (jQuery.browser.msie) {
                                        // ClearType can only be turned back on if this is a full fade in or
                                        // fade out. Partial opacity will still have the problem because the
                                        // filter style must remain. So, in the latter case, we will leave the
                                        // background color and 'filter' style in place.
                                        if (options.opacity == 0 || options.opacity == 1) {
                                                // Reset the background color if we saved it previously
                                                $(this).css({ 'background-color': $(this).attr('oBgColor') }).removeAttr('oBgColor');
                                                // Remove the 'filter' style to restore ClearType functionality.
                                                $(this).get(0).style.removeAttribute('filter');
                                        }
                                }
                                if (options.callback != undefined) options.callback();
                        });
    };

    $.fn.ClearTypeFadeIn = function(options) {
        if (options)
                $(this)
                        .css({ opacity: 0 })
                        .ClearTypeFadeTo({ speed: options.speed, opacity: 1, callback: options.callback });
    };

    $.fn.ClearTypeFadeOut = function(options) {
        if (options)
                $(this)
                        .css({ opacity: 1 })
                        .ClearTypeFadeTo({ speed: options.speed, opacity: 0, callback: options.callback });
    };
})(jQuery);

jQuery.preloadImages = function()
{
  for(var i = 0; i<arguments.length; i++)
  {
    jQuery("<img>").attr("src", arguments[i]);
  }
}