function changeFieldBackground(image){
    $("#about-fields-small-background").css("background-image","url("+image+")");   
}

$(document).ready(function() {
    $(".firstPagePicture").mouseover(function() {
         $(this).parent().css('padding-left', '4px');
         $(this).parent().css('padding-top', '3px');
         $(this).parent().css('height', '98px');
         
         $(this).css("border","4px");
         $(this).css("border-style","solid");
         $(this).css("border-color","#0063b3");
         
         $(".first-page-big-pic").hide();
         
         id = $(this).attr("id");
         if($("#fp-big-pic-"+id).length){
//             $("#player1").hide();
             $("#fp-big-pic-"+id).show();
         }else{
             
         }
         
     });
     
     $(".firstPagePicture").mouseout(function() {
         $(this).css("border","0px");
         $(this).parent().css('height', '94px');
         $(this).parent().css('padding-left', '8px');
         $(this).parent().css('padding-top', '7px');
         $(".first-page-big-pic").hide();
//         $("#player1").show();
     });
     
    
     
     $(".firstPageNewsBigPic").mouseover(function() {
         //hide all
         $(".firstPageNewsSmallPic").css("display","none");
         $(".firstPageNewsTitle").css("display","none");
         $(".firstPageNewsDate").css("display","none");
         $(".firstPageNewsLink").css("display","none");
         
         //show current big pic
         $(".firstPageNewsBigPic").css("display","inline");
         
         
         $(".firstPageNewsBox").css("border","none");
         $(".firstPageNewsBox").css("margin-top","0px");
         $(".firstPageNewsBox").css("background-image","url(/images/news-off.gif)");
//         $("#firstPageNewsBoxesContainer").css("margin-left","-5px");
//         $("#firstPageNewsBoxesContainer").css("width","815px");
         
         $(this).parent().css('background-image', 'none');
         $(this).parent().css('border', '4px solid #0063b3');
         $(this).parent().css('height', '90px');
         $(this).parent().css('width', '254px');
         $(this).parent().css('margin-top', '-4px');
         $(this).css("display","none");
        
         $(this).parent().children("a").children(".firstPageNewsSmallPic").css("display","inline");
         $(this).parent().children(".firstPageNewsTitle").css("display","inline");
         $(this).parent().children(".firstPageNewsDate").css("display","inline");
         $(this).parent().children(".firstPageNewsLink").css("display","inline");
     });
     
     $("#firstPageNewsBoxesContainer").mouseleave(function() {
        $(".firstPageNewsBox").css("border","none");
         $(".firstPageNewsBox").css("margin-top","0px");
         $(".firstPageNewsBox").css("background-image","url(../images/news-off.gif)");
         $("#firstPageNewsBoxesContainer").css("margin-left","-5px");
         $("#firstPageNewsBoxesContainer").css("width","815px")
         
         $(".firstPageNewsSmallPic").css("display","none");
         $(".firstPageNewsTitle").css("display","none");
         $(".firstPageNewsDate").css("display","none");
         $(".firstPageNewsLink").css("display","none");
         
         //show current big pic
         $(".firstPageNewsBigPic").css("display","inline");
     });
     
     $(".referencesListBigPic").mouseover(function() {
         //hide all
         $(".referencesListSmallPic").css("display","none");
         $(".referencesListTitle").css("display","none");
         $(".referencesListLink").css("display","none");
         
         //show current big pic
         $(".referencesListBigPic").css("display","inline");
         
         
         $(".referencesListBox").css("border","4px solid #CCCACB");
         
         
         //$("#firstPageNewsBoxesContainer").css("margin-left","-5px");
         //$("#firstPageNewsBoxesContainer").css("width","815px");
         
         $(this).parent().css('background-image', 'none');
         $(this).parent().css('border', '4px solid #0063b3');
//         $(this).parent().css('height', '90px');
//         $(this).parent().css('margin-top', '-4px');
         $(this).css("display","none");
        
         $(this).parent().children("a").children(".referencesListSmallPic").css("display","inline");
         $(this).parent().children(".referencesListTitle").css("display","inline");
         
         $(this).parent().children(".referencesListLink").css("display","inline");
     });
     
     $("#referencesListBoxesContainer").mouseleave(function() {
         $(".referencesListBox").css("border","4px solid #CCCACB");
      
         $(".referencesListSmallPic").css("display","none");
         $(".referencesListTitle").css("display","none");
         $(".referencesListLink").css("display","none");
         
         //show big pics
         
         $(".referencesListBigPic").css("display","inline");
     });
     
    
      $(".tabCell").click(function() {
            $(".tabCell").removeClass("tab-cell-active");
            $(this).addClass("tab-cell-active");
      });
      
      $(".subfield-tabcell").click(function() {
            $(this).parent().parent().parent().children("div").children("a").children("span").removeClass("subfield-tabcell-active");
            $(this).addClass("subfield-tabcell-active");
      });
      
      $(".popupable-opacity-wrapper").hover(
        function() {
          
            $(".popUpAblePicture").css("border","4px solid #CCCACB");
            $(this).parent().children(".popUpAblePicture").css("border","4px solid #0063b3");
      },
      function() {
          
            $(".popUpAblePicture").css("border","4px solid #CCCACB");
            
      }
  );
      
});



$(function() {
    // initialize scrollable
     
     $(".firstPageScrollable").scrollable(
           {
             next: ".next",
             prev: ".prev",
             items: ".items",
             keyboard: false,
             onBeforeSeek: function(event, index){
                size = 3;
                if (this.getIndex()+size+1 == this.getSize()&&index > this.getIndex()) {//check if we move foreward and we reach the end
                    // disable the next link
                   $(".next").addClass("disabled-arrow");
                }else{
                    $(".next").removeClass("disabled-arrow");
                }
            } 
     });
     
     $(".tabsScrollable").scrollable({
             next: ".next",
             prev: ".prev",
             items: ".items",
             keyboard: false,
             disabledClass: "disabled",
             onBeforeSeek: function(event, index){
                size = 4;
                if (this.getIndex()+size+1 == this.getSize()&&index > this.getIndex()) {//check if we move forward and we reach the end
                    // disable the next link
                    $(".next").addClass("disabled-arrow");
                }else{
                   $(".next").removeClass("disabled-arrow");
                }
            } 
     });
     $(".about-arrow-right").click(function(){
         if(!$(".next").hasClass("disabled-arrow"))
         $(".next").trigger("click");
     });
     $(".tabs").tabs("div.panes > div");
     $(".subfield-tabs").tabs("div.subfield-panes > div");
});


