   
    
    var logA=function(){};
    var logW=function(){};
    var $master_msgDialog;
    
    function attivaLog(){
        var $JQDD = $('<div id="JQDD" style="position:absolute; left:480px;top:100px; width:600px; height:200px; overflow:scroll; background-color:white;border:solid 1px red; text-align:left; z-Index:10000000;"><table style="width:100%;"><tr><td onclick="$(\'#JQDD_C\').html(\'\');" style="width:200px;text-align:center;background-color:red;color:white;cursor:pointer;">CLEAR</td><td onclick="$(\'#JQDD\').draggable(\'enable\');" style="width:200px;text-align:center;background-color:red;color:white;cursor:pointer;">DRAGGABLE(ON)</td><td onclick="$(\'#JQDD\').draggable(\'disable\').css(\'opacity\',1);" style="width:200px;text-align:center;background-color:red;color:white;cursor:pointer;">DRAGGABLE(OFF)</td></tr></table><div id="JQDD_C"></div></div>');
        $JQDD.appendTo('body');
        var $JQDD_C = $JQDD.find('#JQDD_C');        
        $JQDD.draggable();
        logA = function(msg){        
            $JQDD_C.html($JQDD_C.html()+msg+"<br>");
        }
        logW = function(msg){        
            $JQDD_C.html(msg+"<br>");
        }
    }

  
    var jqueryslidemenu={

    buildmenu:function(){
	    jQuery(document).ready(function($){
		    var $mainmenu=$("#menutestata>ul");
		    var $headers=$mainmenu.find("ul").parent();
		    $headers.each(function(i){
			    var $curobj=$(this);
			    var $subul=$(this).find('ul:eq(0)');
			    this._dimensions={w:this.offsetWidth, h:this.offsetHeight, subulw:$subul.outerWidth(), subulh:$subul.outerHeight()};
			    this.istopheader=$curobj.parents("ul").length==1? true : false;
			    $subul.css({top:this.istopheader? this._dimensions.h+"px" : 0});
			    $curobj.hover(
				    function(e){
					    var $targetul=$(this).children("ul:eq(0)");
					    this._offsets={left:$(this).offset().left, top:$(this).offset().top};
					    var menuleft=this.istopheader? 0 : this._dimensions.w;
					    menuleft=(this._offsets.left+menuleft+this._dimensions.subulw>$(window).width())? (this.istopheader? -this._dimensions.subulw+this._dimensions.w : -this._dimensions.w) : menuleft;					    
					    if ($targetul.queue().length<=1) //if 1 or less queued animations
					        $targetul.css({left:menuleft+"px", width:this._dimensions.subulw+'px'}).show()//slideDown(50);
				    },
				    function(e){
					    var $targetul=$(this).children("ul:eq(0)");
					    $targetul.hide();//slideUp(50);
					    
				    }
				    //IE6Fix:
			    ); //end hover
		    }); //end $headers.each()		
		    $mainmenu.find("ul").css({display:'none', visibility:'visible'});
		    if($.browser.version.indexOf('6')==0){
		        $('#itemAziende').css('width','110');
		        $('#itemAziende').parent().css('width','110');
				//$('.pivotCerca').css('left','-550px');//menu ricerca rapida
		    }
	    }); //end document.ready
        }
    }

    try{        
        $(function(){
        
            //Creo il menu
            jqueryslidemenu.buildmenu()// JavaScript Document
            
            // Finestra di Dialogo			
            $('#msg_alert').dialog({
                modal: true,
                show: 'slide', 
                draggable: true,	        
                resizable:false,
	            autoOpen: false,
	            width: 600,
	            buttons: {
		            "Ok": function() { 
			            $(this).dialog("close"); 
		            }
	            }
            });		
              
            // Finestra di Dialogo			
            $('#msg_attesa').dialog({	        
                modal: true,	        
                closeOnEscape: false, 
                draggable: true,	        
                resizable:false,
	            autoOpen: false,
	            width: 600
            });	

            // Finestra di Dialogo			
            $master_msgDialog = $('#msg_dialog');
           
            $master_msgDialog.dialog({	        
                bgiframe: true,
                modal: true,
                show: 'slide', 
                draggable: false,	        
                resizable:false,
       	        autoOpen: false,
                width: 750,
                height: 600  
            });	              
            
        });
    }catch(e){}




    function master_MsgAttesa() {
        try {
          
            $('#msg_attesa').dialog('open');
        }
        catch (ex) {
        }
    }



    function master_advDialog(msg, title, imgSrc, w, h) {
        try {
            if (!$master_msgDialog || $master_msgDialog.length <= 0)
                $master_msgDialog = $('#msg_dialog');

 
            if (title)
             $master_msgDialog.dialog("option", "title", title);

            if (title == null)
                title = "";

            if (imgSrc)
                msg = '<table><tr><td  align="left" valign="top"><img alt="" src="' + imgSrc + '" hspace="4"></td><td align="left" valign="top">' + msg + '</td></tr></table>';

            //$master_msgDialog.data('title.dialog', title);
            $master_msgDialog.html(msg);
            if (w && h) {
                $master_msgDialog.dialog("option", "width", w);
                $master_msgDialog.dialog("option", "height", h);
            }
            $master_msgDialog.dialog('open');
        }
        catch (ex) {
        }

    }



    function showAuguriSottoAlbero(mode) {
        var iparam = 0;
        if (mode)
            iparam = mode

        strURL = "/areaclienti/carrello/AuguriSottAlbero.aspx?iparam=" + iparam + "&i=" + new Date().getTime();
        var desc = "Biglietto Auguri sotto l`albero ";
        showDialogPopUp(desc, strURL);

    }

    function showDialogPopUp(desc, strURL) {
        $popUp = $('#msg_dialog');



        $popUp.html('');
       
        $popUp.load(strURL, function () {
            $popUp.dialog("option", "title", desc);
            $popUp.dialog('open');

        });

      
    }


