
function MarcioTabs(container,effect,closable,currentclass,starttab) {
	$('#'+container+' ul:first li').each(function () {
		var tab = this;
		var dest = $(tab).contents().attr("href").replace(/^.*#/,'#');
		$(dest).addClass('child_content');
		$(tab).addClass('tab_link');
		$(tab).click(function () {
			if (closable > 0) {
				if ($(tab).is('.'+currentclass)) {
					$(tab).removeClass(currentclass);
					$(dest).hide(effect);
					}
				else {
					var open = 0;
					$('#'+container+' ul:first li').each(function () {
						if ($(this).is('.'+currentclass)) {
							open = 1;
							}
						});
					if (open == 1) {
						$('#'+container+' .child_content').hide();
						$('#'+container+' .tab_link').removeClass(currentclass);
						$(dest).show();
						}
					else {
						$(dest).show(effect);
						}
					$(tab).addClass(currentclass);
					}
				}
			else {
				$('#'+container+' .child_content').hide();
				$('#'+container+' .tab_link').removeClass(currentclass);
				$(dest).show();
				$(tab).addClass(currentclass);
				}
			return false; 
			});
		$(dest).hide();
		});
	if (closable < 1) {
		$('#'+container+' li:first').click();
		}
	if (starttab > 0) {
		var count = 0;
		$('#'+container+' ul:first li').each(function () {
			count = count + 1;
			if (count == starttab) {
				$(this).click();
				}
			});
		}
	}

function DelFavorite(ObjRef) {
		$("#pref-"+ObjRef).effect("highlight", {}, 1000).fadeOut('fast');
		$("#box_preferiti").load("/sidebar/right/?delfavorite="+ObjRef); 
		return false;
		}
function EmptyShoplist() {
		$("#box_shoplist").load("/sidebar/right/?emptyshoplist=1"); 
		return false;
		}


// Pre-submit callback
function showRequest(XMLHttpRequest) {
jQuery('#loading').fadeIn('fast');
}
// Post-submit callback
function showResponse(XMLHttpRequest, textStatus)  {
jQuery('#loading').fadeOut('slow');
}
// Ajax Error Catchig
function handleError(XMLHttpRequest, textStatus, errorThrown) {
// typically only one of textStatus or errorThrown
// will have info
jQuery('#loading').fadeOut('slow');
alert('Errore durante la comunicazione con il server');
}
jQuery.ajaxSetup({
global: true,
type: "GET",
beforeSend:showRequest,
complete: showResponse ,
cache: false,
error:handleError
});

/**
* @author Remy Sharp
* @url http://remysharp.com/2007/01/25/jquery-tutorial-text-box-hints/
*/


(function ($) {

$.fn.hint = function (blurClass) {
    if (!blurClass) blurClass = 'blur';
    
    return this.each(function () {
        var $input = $(this),
            title = $input.attr('title'),
            $form = $(this.form),
            $win = $(window);

        function remove() {
            if (this.value === title && $input.hasClass(blurClass)) {
                $input.val('').removeClass(blurClass);
            }
        }

        // only apply logic if the element has the attribute
        if (title) { 
            // on blur, set value to title attr if text is blank
            $input.blur(function () {
                if (this.value === '') {
                    $input.val(title).addClass(blurClass);
                }
            }).focus(remove).blur(); // now change all inputs to title
            
            // clear the pre-defined text when form is submitted
            $form.submit(remove);
            $win.unload(remove); // handles Firefox's autocomplete
        }
    });
};

})(jQuery);


