function showModal() { if ($.browser.msie && $.browser.version == '6.0') { $('body,html').animate({scrollTop: 0}, 0); $('#modal, #modal .bg').height($(document).height()); $('#modal .win').css('top', parseInt((parseInt($(window).height()) - parseInt($('#modal .win').height())) /2) +'px'); } $('#modal').show(); $('#modal .bg').css('opacity', .8); $('#modal .win') .css('margin-left', -parseInt(parseInt($('#modal').find('.win').width())/2) +'px') .css('margin-top', -parseInt(parseInt($('#modal').find('.win').height())/2) +'px'); } function closeModal() { $('#modal').hide(); return false; } jQuery('#errjs').ready(function() { $('#errjs').remove(); }); jQuery(document).ready(function() { $('#langs li').live('click', function() { var href = (!$(this).hasClass('active')) ? $(this).find('a').attr('href') : false; var cont = $(this).closest('#langs'); var lang = cont.find('div').attr('class'); var sel = $(this).attr('class').replace(/active/gi, '').replace(/ /gi, ''); cont.toggleClass('open'); if (cont.hasClass('open')) { var th = cont.find('li.active'); var repl = '
  • ' + th.html() + '
  • '; $(this).remove(); $(repl).prependTo(cont.find('ul')); } else { cont.find('li').removeClass('active'); cont.find('div').attr('class', sel); $(this).addClass('active'); } if (href != false) document.location = href; else return false; }); // hover fix $('button') .mouseover(function() { $(this).addClass('hover');}) .mouseout(function() { $(this).removeClass('hover');}); // modal $(document).keydown(function(e) { if (e.which == 27) closeModal(); }); $('#modal').find('.close').live('click', closeModal); // hotnews $('#hotnews .left, #hotnews .right').live('click', function() { var news = $('#hotnews p'); var num = 0; var to = 0; var right = $(this).hasClass('right'); $.each(news, function(k,v) { num++; if ($(v).hasClass('active')) { $(v).removeClass('active'); if (right) to = (num == $(news).size()) ? 0 : k+1; else to = (num == 1) ? $(news).size()-1 : k-1; $('#hotnews .i a.active').removeClass('active'); $('#hotnews p:eq('+to+'), #hotnews .i a:eq('+to+')').addClass('active'); return false; } }); return false; }); $('#hotnews .i a').live('click', function() { var links = $('#hotnews .i a'); $(this).data('this', true); $.each(links, function(k,v) { if ($(v).data('this')) { $('#hotnews .i a.active, #hotnews p.active').removeClass('active'); $('#hotnews p:eq('+k+')').addClass('active'); $(v).data('this', false).addClass('active'); return false; } }); return false; }); function changeHotnews(interval) { $('#hotnews .right').trigger('click'); setTimeout( function() { changeHotnews(interval); }, interval ); } changeHotnews(5000); // hotinfo $('#hotinfo a').live('click', function() { var li = $(this).closest('li'); var lis = $(this).closest('ul').find('li'); lis.removeClass('active') li.addClass('active'); return false; }); // menu1-2 $('#menu a.submenu').live('click', function() { var a = $(this); var isactive = a.hasClass('active'); a.closest('.menu1').find('a.submenu').removeClass('active'); $('#menu .menu2').hide(); if (!isactive) { a.addClass('active'); $(a.attr('href')).fadeIn(300); } return false; }); });