
$(document).ready(function() {
        function menu_open()  { $(this).find('ul').eq(0).css("opacity","0").css("visibility","visible").fadeTo(500, 1, function() { $(this).css("opacity",""); }); }
    function menu_close() { $(this).find('ul').eq(0).fadeTo(300, 0, function() { $(this).css("visibility","hidden"); }); }

    var config = {    
         sensitivity: 2,    
         interval: 100,    
         timeout: 100,    
         over: menu_open,    
         out: menu_close    
    };

        $("table.menu_top td , table.menu_top td li ").hoverIntent(config);

        /*$("table.menu_top td table td, table.menu_top table td li").hoverIntent(config);

    $("table.menu_top td table td ul li ul").each(function() {
       $(this).css('left',$(this).parent().parent('ul').width());
       $(this).css('top',$(this).parent('li').eq(0).find('a').position().top);
    }); */
                                                   
                                                   
    // Uniform jQuery
    $("reset").uniform();
	//$("input, textarea, reset, select, button").uniform();
    
    // lightbox
   // $("a[href$=.jpg], a[href$=.png], a[href$=.gif], popup").lightBox();
   
});
function display(id) {
    obj = document.getElementById(id);
    obj.style.display = (obj.style.display == 'none') ? '' : 'none';
}

function slide(id) {
    obj = document.getElementById(id);
    $(obj).slideToggle("normal");
}
                
function select(obj) {
        $(obj).siblings('.selected').removeClass('selected');
    $(obj).addClass('selected');
}

function element(id)                                                                                                                                          
{                                                                                                                                          
    if(document.getElementById)                                                                                                                                          
    return document.getElementById(id);                                                                                                                                          
    if(document.all)                                                                                                                                          
    return document.all(id);                                                                                                                                          
    if(document.layers)                                                                                                                                          
    return document.layers(id);                                                                                                                                          
}                                                                                                                                          

function ShowPage(div_name, url, param) 
{                                  
    if (param == "") param = "t=1";                     
    $("#loading").ajaxStart(function(){                                 
      $(this).show();                 
    });                                                                                                                                          

    $.post(url, param, function(data){                                    
       element(div_name).innerHTML=data;                                    
    });                                    
    $("#loading").ajaxStop(function(){                                 
      $(this).hide();                                                                                                                                          
    });                                                                                                                                          
} 

  function insert_sign(sign){                                                                                                           
      document.giftmeform.comments.focus();                                                                                                              
                                                           
      if (document.selection)                                                                                                            
      {                                                                                                           
                                                                                                              
          var s = document.selection.createRange();                                                                                                               
          s.text = sign;                                                                                                              
          s.select();                                                                                                              
          return true;                                                                                                              
                                                                                                                
      }                                                                                                           
      else if (typeof(document.giftmeform.comments.selectionStart)=="number")                                                                                                           
      {                                                                                                           
          var start = document.giftmeform.comments.selectionStart;                                                                                                           
          var end = document.giftmeform.comments.selectionEnd;                                                                                                           
          document.giftmeform.comments.value = document.giftmeform.comments.value.substr(0,start)+sign+document.giftmeform.comments.value.substr(end);                                                                                                  
          document.giftmeform.comments.setSelectionRange(end+sign.length-(end-start),end+sign.length-(end-start));                                                                                                           
                                                                                                              
          return true;                                                                                                           
      }                                                                                                           

      return false;                                                                                                         

  }        


/* в избранное */

function getBrowserInfo() {
    var t,v = undefined;
   
    if (window.chrome) t = 'Chrome';
    else if (window.opera) t = 'Opera';
    else if (document.all) {
        t = 'IE';
        var nv = navigator.appVersion;
        var s = nv.indexOf('MSIE')+5;
        v = nv.substring(s,s+1);
    }
    else if (navigator.appName) t = 'Netscape';
   
    return {type:t,version:v};
}

function bookmark(a){
    var url = window.document.location;
    var title = window.document.title;
    var b = getBrowserInfo();
   
    if (b.type == 'IE' && 8 >= b.version && b.version >= 4) window.external.AddFavorite(url,title);
    else if (b.type == 'Opera') {
        a.href = url;
        a.rel = "sidebar";
        a.title = url+','+title;
        return true;
    }
    else if (b.type == "Netscape") window.sidebar.addPanel(title,url,"");
    else alert("Нажмите CTRL-D, чтобы добавить страницу в закладки.");
    return false;
} 

/* /в избранное  */

if($.browser.msie)
jQuery.fx.off = true;


/* Всплывающие подсказки */

$(function () {
    $('.bubbleInfo').each(function () {
        var distance = 10;
        var time = 250;
        var hideDelay = 500;

        var hideDelayTimer = null;

        var beingShown = false;
        var shown = false;
        var trigger = $('.trigger', this);
        var info = $('.popup', this).css('opacity', 0);


        $([trigger.get(0), info.get(0)]).mouseover(function () {
            if (hideDelayTimer) clearTimeout(hideDelayTimer);
            if (beingShown || shown) {
                return;
            } else {
                beingShown = true;

                info.css({
                    top: 28,
                    left: 60,
                    display: 'block'
                }).animate({
                    top: '-=' + distance + 'px',
                    opacity: 1
                }, time, 'swing', function() {
                    beingShown = false;
                    shown = true;
                });
            }

            return false;
        }).mouseout(function () {
            if (hideDelayTimer) clearTimeout(hideDelayTimer);
            hideDelayTimer = setTimeout(function () {
                hideDelayTimer = null;
                info.animate({
                    top: '-=' + distance + 'px',
                    opacity: 0
                }, time, 'swing', function () {
                    shown = false;
                    info.css('display', 'none');
                });

            }, hideDelay);

            return false;
        });
    });
});

/* / Всплывающие подсказки */
