$(document).ready( function () {
        
        $('#countries-toggle').toggle( function () {
                $('#countries').stop().animate({'height': $('#countries .outside').height() }, 700, 'easeOutExpo');
                return false;
        }, function () {
                $('#countries').stop().animate({'height': 0 }, 700, 'easeOutExpo');
                return false;
        }).disableTextSelect();
        
        $('#countries-close').click( function () {
                $('#countries-toggle').trigger('click');
                return false;
        });
        
/*tabs*/
$('.tabs a').click( function () {
  $(this).parents('.tabs').find('td').removeClass('current');
  $(this).parents('td').addClass('current');            
  var ids = '';
  $(this).parents('.tabs').find('a').each( function () {
    ids += '#'+$(this).attr('name')+',';
  });
  $(ids).addClass('hidden');
  $('#'+$(this).attr('name')).removeClass('hidden');
  return false;
});

var id = $.frequency($("#promo").data("impression"));
$.promo(id);

$('.more-options,.close_').click(function () {
$(this).parents('.ns_').find('.modal').toggleClass('hidden');
return false;
});


/*scroll logo*/                         
$('.next_').click( function () {
$('.scrollable_').scrollTo('+=592px', 1000);                            
});
$('.prev_').click( function () {
$('.scrollable_').scrollTo('-=592px', 1000);                            
});     

/*scroll page*/
$("<a name='top'></a>").prependTo("body");
$('.top, .banners, .prodbox').localScroll();
$('.top a, .banners a').click(function () { 
return false;
});

/*trigger for tabs*/
$('.trigger_').click( function (){
$('a[name='+$(this).attr('name')+']:not(.trigger_)').trigger('click');
window.scrollTo(0,$("#"+$(this).attr('name')).offset().top);
return false;
});

/*show flash chooser in popup*/
$('.flashalert').click( function () {
var id = $(this).attr('name');
$(window).htmlPopup({
'opacity':'0.65',
'width': $('#'+id).data('width'),
'duration': 300,
'top': $('#'+id).data('top'),
'html': $('#'+id).html()
});
return false;
});

$('.close-popup').live( 'click', function () {
                $('#jQuery_overlay').trigger('click');
        });

if( location.hash == '#white_list_reg' || location.search.search('done_') == '1'){
$('.popup_').trigger('click');
};

/*Renew tabs*/
$('.sections li').click( function () {
$('.sections li').removeClass('current');
$(this).addClass('current');
$('.section').addClass('hidden');
$('#'+$(this).find('a').attr('name')).removeClass('hidden');
$('#'+$(this).find('a').attr('name')+'_').removeClass('hidden');
return false;
});


});

