$(function() {
    jQuery.fn.log = function (msg) {
        if(console)
            console.log("%s: %o", msg, this);
        return this;
    };

    jQuery.fn.debug = function (msg) {
        if(console)
            console.debug(msg, this);
        return this;
    };

    $('#header-username').focus(function(){
        if ( $(this).val() == 'E-mail' ){
            $(this).val('').addClass('login-attivo');
        }
    }).blur(function(){
        if ( $(this).val() == '' ){
            $(this).val('E-mail').removeClass('login-attivo');
        }
    });

    $('#header-password-placeholder').focus(function(){
        $(this).hide();
        $('#header-password').show().focus();
    });

    $('#header-password').blur(function(){
        if ( $(this).val() == '' ){
            $(this).hide();
            $('#header-password-placeholder').show();
        }
    });

    $('.rolloverText').bind("mouseenter", function() {
        this.src = this.src.replace("-off","-on");
        $("#home-photos img[color=" + $(this).attr("color") + "]").css("border","7px solid #" + $(this).attr("color"));
        $("#vert-buttons ul li.photo img[color=" + $(this).attr("color") + "]").css("border","7px solid #" + $(this).attr("color"));
    });
    $('.rolloverText').bind("mouseleave", function() {
        this.src = this.src.replace("-on","-off");
        $("#home-photos img[color=" + $(this).attr("color") + "]").css("border","7px solid #D1D1D1");
        $("#vert-buttons ul li.photo img[color=" + $(this).attr("color") + "]").css("border","7px solid #D1D1D1");
    });
    $('.rolloverImage').bind("mouseenter", function() {
        $(this).css("border","7px solid #" + $(this).attr("color"));
        if($("#big-buttons img[color=" + $(this).attr("color") + "]").size() > 0)
            $("#big-buttons img[color=" + $(this).attr("color") + "]").attr("src", $("#big-buttons img[color=" + $(this).attr("color") + "]").attr("src").replace("-off","-on"));
        if($("#vert-buttons ul li.text img[color=" + $(this).attr("color") + "]").size() > 0)
            $("#vert-buttons ul li.text img[color=" + $(this).attr("color") + "]").attr("src", $("#vert-buttons ul li.text img[color=" + $(this).attr("color") + "]").attr("src").replace("-off","-on"));
    });
    $('.rolloverImage').bind("mouseleave", function() {
        $(this).css("border","7px solid #D1D1D1");
        if($("#big-buttons img[color=" + $(this).attr("color") + "]").size() > 0)
            $("#big-buttons img[color=" + $(this).attr("color") + "]").attr("src", $("#big-buttons img[color=" + $(this).attr("color") + "]").attr("src").replace("-on","-off"));
        if($("#vert-buttons ul li.text img[color=" + $(this).attr("color") + "]").size() > 0)
            $("#vert-buttons ul li.text img[color=" + $(this).attr("color") + "]").attr("src", $("#vert-buttons ul li.text img[color=" + $(this).attr("color") + "]").attr("src").replace("-on","-off"));
    });

    $('.menuitem').bind("mouseenter",function(){
        $('ul', this).show();
    }).bind("mouseleave",function(){
        $('ul', this).hide();
    });


    /*$('#content_body').jScrollPane();*/
});

/*function changePellicola(){

	var pictureIndex = $('#pellicola img').attr('pellicolaIndex');
	pictureIndex++;
	if (pictureIndex > 9){
		pictureIndex = 1;
	}

	$('#pellicola').fadeOut(
		2000,
		function(){
			$('#pellicola img').attr('src', 'images/pellicole/pellicola' + pictureIndex + '.jpg');
			$('#pellicola').fadeIn(
				2000,
				function(){
					$('#pellicola img').attr('pellicolaIndex', pictureIndex);

					window.setTimeout('changePellicola()', 2000);
				}
			);
		}
	)

}*/
