var timeout    = 500;
var closetimer = 0;
var ddmenuitem = 0;

function jsddm_open()
{  jsddm_canceltimer();
   jsddm_close();
   ddmenuitem = $(this).find('ul').css('visibility', 'visible');}

function jsddm_close()
{  if(ddmenuitem) ddmenuitem.css('visibility', 'hidden');}

function jsddm_timer()
{  closetimer = window.setTimeout(jsddm_close, timeout);}

function jsddm_canceltimer()
{  if(closetimer)
   {  window.clearTimeout(closetimer);
      closetimer = null;}}

$(document).ready(function()
{  $('#jsddm > li').bind('mouseover', jsddm_open)
   $('#jsddm > li').bind('mouseout',  jsddm_timer)
$('a.bwGal').zoomimage({
    border: 20,
    centered: true,
    controls: false,
    hideSource: true
});
   });

document.onclick = jsddm_close;

function close_opera_banner()
{
    $("#mess_opera").hide('blind');
    SetCookie('hide_b1',true,1);
}
function SetCookie(cookieName,cookieValue,nDays) {
 var today = new Date();
 var expire = new Date();
 if (nDays==null || nDays==0) nDays=1;
 expire.setTime(today.getTime() + 3600000*24*nDays);
 document.cookie = cookieName+"="+escape(cookieValue) + ";path=/;expires="+expire.toGMTString();
}
$(document).ready(function() {
    $('#click_to_login').click(function() {
    $("#login_error").hide();
    $("#login_form").toggle("slide",{direction: 'up'});
    return false;
});
});
function refresh_servers_info()
{
    $("#servers_info_1").html('<img style="margin-top: 8px;" src="/img/ajax-loader2.gif" width="43" height="11" alt="" />');
    $.get("/servers_info.php?s", function(data){
//    $("#servers_info_content").hide();
    $("#servers_info_content").html(data);
    $("#servers_info_1").html('Наши сервера');
//    $("#servers_info_content").show("blind");
}, 'html');
}
function refresh_lastposts()
{
    $("#lastpreload").html('<img style="margin-top: 2px;" src="/img/ajax-loader2.gif" width="43" height="11" alt="" />');
    $.get("/lastposts.php", function(data){
//    $("#last_posts").hide();
    $("#last_posts").html(data);
    $("#lastpreload").html('');
//    $("#last_posts").show("blind");
}, 'html');
}
function refresh_players(p)
{
    $("#s_players").html('<div align=center style="padding: 18px 0px 12px 0px;"><img src="/img/ajax-loader2.gif" width="43" height="11" alt="" /></div>');
    $.get("/players.php?p=" + p, function(data){
//    $("#s_players").hide();
    $("#s_players").html(data);
//    $("#s_players").show("blind");
}, 'html');
}
function click_to_load(i)
{
    $.post("/dl.php",{ i: i});
}

