function checkNoticeAlert(){
  var show_n = document.getElementById('notice_about');
  if(show_n){
    var posw=parseInt(parseInt($(window).width()) / 2);
    var mbw=parseInt(parseInt($('#notice_about').width()) / 2);
    $('#notice_about').css("top",145+"px");
    $('#notice_about').css("left",posw-mbw+252+"px");
    $('#notice_about').fadeIn("def");    
  }
}


if(jQuery)(function($){    
  $.extend($.fn,{
    processThreNews: function(o) {
      if(!o) var o = {};
      o.mObj = $(this);      
      o.chooser = $(".chooser", this);
      o.preview = $(".preview", this);
      o.prvws = $(".tn", o.preview);
      o.articles = $("div[id]", o.chooser);
      o.selector = $("<img src='images/bcks/three_new_selector.png' border='0'>").css({
        display: 'none',
        position: 'absolute'
      });
      o.selected = 0;
      o.selWidth = 2;
      o.timerMs = 8000;
      o.imgAddWidth = 7;

      o.startAutoChange = function(){
        clearTimeout(o.t);
        o.t = setTimeout(function(){
          var nextIdx = ((o.selected + 1) > (o.articles.length-1)) ? 0 : o.selected + 1;
          o.moveInPos($(o.articles.get(nextIdx)), nextIdx, o.startAutoChange());
        }, o.timerMs);
      }

      if(o.articles.length>0){
        fo = $(o.articles.get(0));
        var w = fo.outerWidth();
        var h = fo.outerHeight();
        var l = fo.offset().left;
        var t = fo.offset().top;
        o.selector.css({
          width: (w+(o.selWidth*2)+o.imgAddWidth)+'px',
          height: (h+(o.selWidth*2))+'px',
          left: (l-o.selWidth)+'px',
          top: (t-o.selWidth)+'px',
          display: 'block'
        });
        o.chooser.prepend(o.selector);
        o.startAutoChange();
      }else{
        return false;
      }

      o.articles.each(function(idx){
        $(this).bind('mouseenter', function(ev){
          if(o.selected != idx){
            clearTimeout(o.t); 
            o.moveInPos($(this), idx);
          }
        });
        $(this).bind('mouseleave', function(ev){
          o.startAutoChange();
        });
      });
      
      o.prvws.each(function(idx){
         var ovelay = $("<div class='overlay'></div>").css({
           position: 'absolute', 
           left: '0', 
           top: '0', 
           width: o.preview.outerWidth()+'px', 
           height: o.mObj.outerHeight()+'px', 
           backgroundColor: '#FFF'
         });
         if(idx == 0) {
           ovelay.css({display: 'none', opacity: 0});
           o.lastSel = $(this); 
         } 
         $(this).append(ovelay);
      });

      o.moveInPos = function(obj, idx, cllbck){
        var id = obj.attr('id');
        var w = obj.outerWidth();
        var h = obj.outerHeight();
        var l = obj.offset().left;
        var t = obj.offset().top;
        o.selector.stop().animate({ 
          width: (w+(o.selWidth*2)+o.imgAddWidth)+'px',
          height: (h+(o.selWidth*2))+'px',
          left: (l-o.selWidth)+'px',
          top: (t-o.selWidth)+'px'
        }, 350, null, function(){
          if(cllbck != undefined) cllbck.call();
        });

        $("div.overlay", o.preview).stop();              
        $("div.tn:visible div.overlay", o.preview)
        .css({opacity: 0})
        .show()
        .animate({opacity: 1}, 200, null, 
        function(){
          $(this).parent().hide();
          o.prvws.hide();
          var so = $("div[id='"+id+"']", o.preview).show();
          $("div.overlay", so)
          .css({opacity: 1})
          .animate({opacity: 0}, 200, null, 
          function(){ $(this).hide(); });      
        });
        o.selected = idx;
      }
    }
  })
})(jQuery);

$(document).ready(function(){
  loadLoginData();
  checkNoticeAlert();
  comments_init('');
  $('div.three_new_cont').processThreNews();
});

/*$(document).ready(function()
{
   
  $('.notice_about_body a').fadeTo("slow", 0.9);
   
  $('.notice_about_body a').each(function(i)
  {
    $(this).hover(
    function()
    {
      $(this).animate({ opacity: "show", top: "-75″ }, 150);
      $(this).animate({color:"red"},{duration:300}); 
    },    
    function()
    {
      $(this).fadeTo(150, 0.9);
    });
  }); 
});*/

/* Copyright (c) 2006 Mathias Bank (http://www.mathias-bank.de)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php) 
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 * 
 * Thanks to Hinnerk Ruemenapf - http://hinnerk.ruemenapf.de/ for bug reporting and fixing.
 */
jQuery.extend({

 getURLParam: function(strParamName){
    var strReturn = "";
    var strHref = window.location.href;
    var bFound=false;
    
    var cmpstring = strParamName + "=";
    var cmplen = cmpstring.length;

    if ( strHref.indexOf("?") > -1 ){
      var strQueryString = strHref.substr(strHref.indexOf("?")+1);
      var aQueryString = strQueryString.split("&");
      for ( var iParam = 0; iParam < aQueryString.length; iParam++ ){
        if (aQueryString[iParam].substr(0,cmplen)==cmpstring){
          var aParam = aQueryString[iParam].split("=");
          strReturn = aParam[1];
          bFound=true;
          break;
        }
        
      }
    }
    if (bFound==false) return null;
    return strReturn;
  }
});
