/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

var last_element = '';
function show_pr_info(t, value)
{
//  console.log('funkcja t='+t);
  if (t!= last_element)
  {

       $(t)                 
        .removeData('qtip') 
        .qtip({
            content: {
                text: value,
                title: {
                    text: '',
                    button: true
                }
            },
            position: {
                my: 'bottom center', // Use the corner...
                at: 'top center', // ...and opposite corner
                viewport: $(window), // Keep the tooltip on-screen at all times
                effect: false // Disable positioning animation
            },
            show: {
                event: 'mouseover', // Don't specify a show event...
                ready: true // ... but show the tooltip when ready
            },
            delay:10000,
            hide: 'unfocus', // Don't specify a hide event either!
            style: {
                classes: 'ui-tooltip-shadow ui-tooltip-light'
            }
        });
      //  console.log("qtip ok");
        setTimeout(setOpacity, 500, true);
        last_element = t;
  }
}

function setOpacity(bool){
 //   console.log('ustawiamy opacity, zmienna: '+bool);
    $('.ui-tooltip').css('opacity', '0.95');
    $('.ui-tooltip').css('filter', 'alpha(opacity=95)');
    if (bool)
        setTimeout(setOpacity, 500, false);
}

function showLeftToolTip(qtip_text)
{
    var scr_width = $('#bg').css('width');
    var tab_scr = scr_width.split('px');
    scr_width = parseInt(tab_scr[0]);
 //   console.log("Długość: "+qtip_text.length);
    if (qtip_text.length>0)
    {
        if(scr_width>1364)
        {
            //tooltip będzie po lewej stronie
            var pos1 = 'right center';
            var pos2 = 'left center';
        }
        else
        {
            //tootip będzie po prawej stronie
             var pos1 = 'left center';
             var pos2 = 'right center';
        }
        $('#menu_wine')
        .removeData('qtip') 
        .qtip({
            content: {
                text: qtip_text,
                title: {
                    text: ' ',
                    button: true
                }
            },
            position: {
                my: pos1, // Use the corner...
                at: pos2, // ...and opposite corner
        //        viewport: $(window) // Keep the tooltip on-screen at all times
                effect: false // Disable positioning animation
            },
            show: {
                event: false, // Don't specify a show event...
                ready: true // ... but show the tooltip when ready
            },
   hide: {event: false,fixed: true},
   events: {hide: function(){
       
            $.ajax({
                type: 'GET',
                url: base + lang + '/closewinebanner/',
                error: function(XMLHttpRequest, textStatus, errorThrown){ },
            });
   }},
            style: {
                classes: 'ui-tooltip-shadow ui-tooltip-blue'
            }
        });
        setTimeout(setOpacity, 500, true);
    }
}

function hide_baner()
{ 
    $('#large_baner').fadeOut('fast');
    $('#dark_cover').fadeOut('slow');
    return true;
}


