$(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').click(function () {
$(this).parents('.ns_').find('.modal').toggleClass('hidden');
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;
});

/*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;
});

/*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;
});


});

