function hide()
{
    document.getElementById().className="hide";
}
 
 
 $(document).ready(function(){ 
 
     var tabContainers = $('div.tabs > div');
    
    $('div.tabs ul.tabNavigation a').click(function () {
         tabContainers.hide().filter(this.hash).show();
/*      $('div.tabs ul.tabNavigation a').removeClass('selected');*/
        $('div.tabs ul.tabNavigation a').removeClass('selected');
        $('div.tabs ul.tabNavigation a').attr('style','color:#000; height:18px');
        $(this).addClass('selected');
        $(this).attr('style','color:#fff;font-size:12px; height:18px');
        $('div.tabs > div').addClass('yellow');
        return false;}).filter(':first').click();

    $(".close").click(function(){
        $(".popup1").hide();
    })

    $(document).pngFix(); 

    $("#loginBtn").click(
          function () {
              $('#popup').toggle( 'drop' ,{},750);
        }
    );

    $("#send2friend_btn").click(
          function () {
              $('#sendPopup').toggle( 'drop' ,{},500);
        }
    );
    
    $("#goBtn").click(
          function () {
              $('#goPopup').toggle( 'drop' ,{},500);
              return false;
        }
    );
    
    $("#goBtnOk").click(
          function () {
              location.href=$("a.goTab").attr('href');
            
        }
    );

 //   $("a.goTab").attr('href');
    

    $("#rightBannerImg").click(
          function () {
              $('#popupRightBanner').toggle( 'drop' ,{},500);
              return false;
        }
    );
    
//    $("#koko").click(
//          function () {
//              
//              return false;
//        }
//    );    

    $("span.btnApprove").click(
  		function () {

            var popup = $('#approvePopup');
            
            if ((popup.css('display') != 'none') && (popup.css('opacity') == 1))
            {
                popup.hide( 'drop' , {}, 500);
            }
            else if ((popup.css('display') == 'none') && (popup.css('opacity') == 0 || popup.css('opacity') == 1))
            {
                popup.css(
                { 
                    position: "absolute",
                    marginLeft: 0,
                    marginTop: 0,
                    top: $(this).position().top, 
                    left: '200' 
                });

                popup.toggle( 'drop' , {}, 500);
            }
            
            

            return false;
        }
    );
    
 }); 
 
 
 /*
     $("a.btnApprove").click(
          function () {
            if (($('#approvePopup').css('display') != 'none') && ($('#approvePopup').css('opacity') == 1))
            {
                $('#approvePopup').hide( 'drop' , {}, 500);
            }
            else if (($('#approvePopup').css('display') == 'none') && ($('#approvePopup').css('opacity') == 0 || $('#approvePopup').css('opacity') == 1))
            {
                $('#approvePopup').css(
                { 
                    position: "absolute",
                    marginLeft: 0,
                    marginTop: 0,
                    top: $(this).position().top, 
                    left: '200' 
                });

                $('#approvePopup').toggle( 'drop' , {}, 500);
                t=setTimeout("approveCallback()",4000);
            }
          
            return false;
        }
 */
 

 function theProc()
 {
    $('#approvePopup').css(
    { 
        position: "absolute",
        marginLeft: 0,
        marginTop: 0,
        top: $(this).position().top, 
        left: '200' 
    });

    $('#approvePopup').toggle( 'drop' , {}, 500); 
 }

// function approveCallback()
// {
//     if ($('#approvePopup').css('display') != 'none' && ($('#approvePopup').css('opacity') == 1))
//     {
//        $('#approvePopup').hide( 'drop' , {}, 500);
//     }
// }

 function approvePopupHide()
 {
     if ($('#approvePopup').css('display') != 'none' && ($('#approvePopup').css('opacity') == 1))
     {
        $('#approvePopup').hide( 'drop' , {}, 500);
     }
 }
 
 
 function loginPopupHide()
 {
    $('#popup').toggle( 'drop' ,{},500);
 } 
 
 function goPopupHide()
 {
    $('#goPopup').toggle( 'drop' ,{},500);
 } 
 
 function howToPopupHide()
 {
    $('#popupRightBanner').toggle( 'drop' ,{},500);
 }
 
 function sendPopupHide()
 {
    $('#sendPopup').toggle( 'drop' ,{},500);
 }
 
 $(document).ready(function() { 

    var optionsLogin = { 
        success:    loginResp,
        dataType: 'xml'
    }; 
 
    $('#login_fm').submit(function() { 
        $(this).ajaxSubmit(optionsLogin); 
        return false; 
    }); 
    
    var optionsSend2 = { 
        success:    send2Resp,
        dataType: 'xml'
    }; 
 
    $('#send2_form').submit(function() { 
        $(this).ajaxSubmit(optionsSend2); 
        return false; 
    }); 
    
}); 
 

function getErrorsText(source, node)
{
    var errors = '';
    $(node, source).each(        
        function ()
        {
           errors = errors + '&nbsp;<b style="color: red;">Error:</b>&nbsp;' + $(this).text() + '<br />';
        }
    );
    
    return errors;
} 
 
function send2Resp(xml, statusText)
{
    if ($('msgtext',xml).length > 0)
    {
        var errors = getErrorsText(xml, 'msgtext');
        $('#send2_errors').html(errors);
        $('#send2_img').attr('src','/img/site/random/random_send2_image.php?im=1&' + Math.random());
//        $('#send2_img').attr('src','/img/site/random/randoage.php?' + Math.random());
    }
    else
    {

        $('#sendPopup').hide( 'drop' ,{direction: "top"},500);
        
            $.blockUI({ 
            message: $('div.growlUI'), 
            fadeIn: 700, 
            fadeOut: 700, 
            timeout: 3000, 
            showOverlay: false, 
            centerY: false, 
            css: { 
                width: '350px', 
                top: '10px', 
                left: '', 
                right: '10px', 
                border: 'none', 
                padding: '5px', 
                backgroundColor: '#000', 
                '-webkit-border-radius': '10px', 
                '-moz-border-radius': '10px', 
                opacity: '.8', 
                color: '#fff' 
            } 
        }); 
        
    }
}
 
// post-submit callback 
function loginResp(xml, statusText)  { 
    if ($('msgtext',xml).length > 0)
    {
        var errors = getErrorsText(xml, 'msgtext');
        $('#login_errors').html(errors);
    }
    else
    {
        window.location = '/contribute/';
    }
} 

 
 function simple_tooltip(target_items, name){
 $(target_items).each(function(i){
 $("body").append("<div class='"+name+"' id='"+name+i+"'><p>"+$(this).attr('title')+"</p></div>");
 var my_tooltip = $("#"+name+i);

 $(this).removeAttr("title").mouseover(function(){
 my_tooltip.css({opacity:0.7, display:"none"}).fadeIn(400);
 }).mousemove(function(kmouse){
 my_tooltip.css({left:kmouse.pageX+15, top:kmouse.pageY+15});
 }).mouseout(function(){
 my_tooltip.fadeOut(400);
 });
 });

}
$(document).ready(function(){
    simple_tooltip("a.contrib_img","tooltip");
});