

$(document).ready(function() {
$("input[name*='UserName']").watermark('username', 'Username');
$("input[name*='Password']").watermark('password', 'Password');
});


$(function() {
    $("ul.ulDet").hide();
    var IE7 = (navigator.appVersion.indexOf("MSIE 7.")==-1) ? false : true;
    if (document.getElementById("hiddenMenu")){
    var _selectedThis=document.getElementById("hiddenMenu").value;
    if (_selectedThis!=""){
    		_selectedThis = "#"+_selectedThis;
    	  //alert(_selectedThis);
    	 //$("#macro113").next('ul.ulDet').show();
    	 if (IE7){
				$("ul.ulDet").hide(); 
				$(_selectedThis).children("ul").show();      	 	
    	 }
    	 else
    	 $(_selectedThis).next('ul.ulDet').show();
    	 //$("ul.ulDet:first").show();
    	}
    else
    	$("ul.ulDet:first").show();
   }
    	
    $("ul.left_menu").delegate("li.categoria", "click", function() {
    	//var IE7 = (navigator.appVersion.indexOf("MSIE 7.")==-1) ? false : true;
    	//document.getElementById("hiddenMenu").value=this.id;
    	B2C_Web.B2CService.SetGlobalVarMenu(this.id);
    	if (IE7){
				$("ul.ulDet").hide(); 
				$(this).children("ul").show();    		
    	}
		  else
		    $(this).next('ul.ulDet').toggle("fast").siblings(".ulDet").hide("fast");
    });

    $('div.box_venduti').hover(
     function(){$(this).find('div.divitemtooltip:hidden').fadeIn(500);},
     function(){$(this).find('div.divitemtooltip:visible').fadeOut(500);}
    ); 
});  

$(document).ready(function() {

    /*
    $('#segnala_').hide();
    $("a#inline").fancybox({ 'hideOnContentClick': true, 'frameHeight': 350, 'frameWidth': 500 });
    
    
       
    $('#aggiunto_').hide();
    $("a#aggiunto_").fancybox({ 'hideOnContentClick': true, 'frameHeight': 45, 'frameWidth': 200 });


    */


    $('#menu ul li ul').hide();
    $('#menu ul li a.titolo_macro').click(function() {
        $(this).next('ul').toggle('1000');
        return false;
    });
 

    $('#menu ul li ul').hide();
    $('#menu ul li a.titolo_macro').click(function() {
        $(this).next('ul').toggle('1000');
        return false;
    });


    $('div.faq_section ul li ul').hide();
    $('div.faq_section ul li a.faq').click(function() {
        $('div.faq_section ul li ul').hide();
        if ($(this).parent('li').hasClass('active')) {
            $('div.faq_section ul li').removeClass('active');
            return false;
        }
        $('div.faq_section ul li').removeClass('active');
        $(this).parent('li').addClass('active');
        $(this).next('ul').fadeIn('1000');
        return false;
    });


    $('ul.expandable li ul').hide();
    $('ul.expandable li a').click(function() {
        $('ul.expandable li ul').hide();
        if ($(this).parent('li').hasClass('active')) {
            $('ul.expandable li').removeClass('active');
            return false;
        }
        $('ul.expandable li').removeClass('active');
        $(this).parent('li').addClass('active');
        $(this).next('ul').fadeIn('1000');
        return false;
    });


    /*
    $('#slideshow div.elemento').each(function(i) {
    $('#slideshow div.paginazione').append('<a href="#" rel="' + i + '" id="el_' + i + '">' + (i + 1) + '</a>');
    });

    

    slideshow_home(0);
    $('#slideshow div.paginazione a').eq(0).addClass('active');

    $('#slideshow div.paginazione a').click(function() {
    $('#slideshow div.paginazione a').removeClass('active');
    $(this).addClass('active');
    var i = parseInt($(this).attr('rel'));
    slideshow_home(i);
    return false;

    });
    */

    $('#aziende').hide();
    $('a.apriAziende').bind('click', function() {
        if ($(this).hasClass('apriAziende')) {
            $(this).removeClass('apriAziende').addClass('chiudiAziende');
        } else {
            $(this).removeClass('chiudiAziende').addClass('apriAziende');
        }
        $('#aziende').toggle();
    });

    $('#ordine').hide();
    $('a.apriOrdine').bind('click', function() {
        if ($(this).hasClass('apriOrdine')) {
            $(this).removeClass('apriOrdine').addClass('chiudiOrdine');
        } else {
            $(this).removeClass('chiudiOrdine').addClass('apriOrdine');
        }
        $('#ordine').toggle();
    });


    $('#boxCarrelloShow').hide();
    $('a.boxCarrello').click(function() {

        var offset = $('#box_carrello').offset();
        $('#boxCarrelloShow').css('top', offset.top).css('right', 20);


        if ($('#boxCarrelloShow').css("display") == "block") {
            $('#boxCarrelloShow').fadeOut();
        } else {
            $('#boxCarrelloShow').fadeIn();

        }

        return false;
    });


}
);

function slideshow_home(n) {
    $('#slideshow div.elemento').hide();
    $('#slideshow div.elemento').eq(n).fadeIn(600);
    $('#slideshow div.elemento').eq(n).children('div').css({
        bottom: $('#slideshow div.elemento').eq(n).children('div').height() + 10,
        position: 'relative'
    });
}





