//Swap images
function SimpleSwap(el,which)
{ el.src=el.getAttribute(which || "origsrc");
}
function SimpleSwapSetup()
{ var x = document.getElementsByTagName("img");
  for (var i=0;i<x.length;i++)
  { var oversrc = x[i].getAttribute("oversrc");
    if (!oversrc) continue; 
    x[i].oversrc_img = new Image();
    x[i].oversrc_img.src=oversrc; 
    x[i].onmouseover = new Function("SimpleSwap(this,'oversrc');");
    x[i].onmouseout = new Function("SimpleSwap(this);");
    x[i].setAttribute("origsrc",x[i].src);
  }
}
var PreSimpleSwapOnload =(window.onload)? window.onload : function(){};
window.onload = function(){PreSimpleSwapOnload(); SimpleSwapSetup();}
// prettyPhoto
    $(document).ready(function(){
      $("a[rel^='prettyPhoto']").prettyPhoto({
      opacity: 0.50, 
      show_title: false, 
      theme: 'dark_square',
      overlay_gallery: false
      });
    });
//tooltip
$(document).ready(function(){
  $(".gallery A").simpletooltip();
});
// digital cloack
$(function () {
  var austDay = new Date($("#NextGameDate").val());
  //austDay = new Date(austDay.getFullYear() + 0, 10 - 1, 18, 16);
  
  $('#year').text(austDay.getFullYear());
  $('#imageLayout').countdown({until: austDay, timezone: +2, format: 'HMS',compact: true, layout: $('#imageLayout').html()});
});
//  images map
  $(function() {
  $("map > area").tooltip({ positionLeft: false });
});
// ciprian news
function submit1(){
      $('form#newsDate').submit();
    }
    function submit2(){
      if($('select[name=year]').val()!=''){$('form#newsDate').submit();}
    }
// scroll pane
$(function()
      {
        $('.scroll-pane').jScrollPane({showArrows: true});
      });
// large picture with three news

var integer = 0;
function gallery(){
integer += 1;
if(integer >= 4){
     integer = 1;
}
$('#myslide .cover').css({left:-759*(parseInt(integer)-1)}).hide().fadeIn();
$('#button a').each(function(){
   $(this).removeClass('active2');
      if($(this).hasClass('button'+integer)){
        $(this).addClass('active2')}
  });
}
$(document).ready(function (){
  int=setInterval('gallery()',6000);
  gallery();
  $('#button a').click(function (){
    clearInterval(int);
    var integer = $(this).attr('rel');
    $('#myslide .cover').css({left:-759*(parseInt(integer)-1)}).hide().fadeIn();
    $('#button a').each(function(){
    $(this).removeClass('active2');
      if($(this).hasClass('button'+integer)){
        $(this).addClass('active2')}
    });
  });
      
});

// navigation menu
    jQuery(function(){
      jQuery('ul.sf-menu').superfish();
    });

// add to favorite
function bookmarksite(title, url){
if (document.all)
window.external.AddFavorite(url, title);
else if (window.sidebar)
window.sidebar.addPanel(title, url, "")
}

//large table
  
    var theInt = null;
    var $crosslink, $navthumb;
    var curclicked = 0;
    
    theInterval = function(cur){
      clearInterval(theInt);
      
      if( typeof cur != 'undefined' )
        curclicked = cur;
      
      $crosslink.removeClass("active-thumb");
      $navthumb.eq(curclicked).parent().addClass("active-thumb");
        $(".stripNav ul li a").eq(curclicked).trigger('click');
    };
    
    $(function(){
      
      $("#main-photo-slider").codaSlider();
      
      $navthumb = $(".nav-thumb");
      $crosslink = $(".cross-link");
      
      $navthumb
      .click(function() {
        var $this = $(this);
        theInterval($this.parent().attr('href').slice(1) - 1);
        return false;
      });
      
      theInterval();
    });
