
$(function(){      
    topnav2height = $('#topnav2').height();
    ctrheight = $('#ctright_overig').height() - 221; // 371 - 150
    ctlheight = $('#ctleft').height() + 60;
              
    if(ctrheight == "-221"){
        ctrheight = $('#ctright').height() + 30;
        
        $('#ctleft').css('margin-top', 221); 
        ctltop = $('#ctleft').css('margin-top');
    
        if(ctlheight > ctrheight){
            $('#inner').css('height', ctlheight);           
        }else{                                   
            $('#inner').css('height', ctrheight);               
        }
            
    } else {      
        $('#ctleft').css('margin-top', topnav2height); 
        ctltop = $('#ctleft').css('margin-top');
                                                        
        if(ctlheight > ctrheight){
            $('#inner').css('height', ctlheight);           
        }else{                                   
            $('#inner').css('height', ctrheight);               
        }        
    }                       
});


/** target attribute is not allowed when using xhtml */
$(function(){
   $('#footer a').attr('target','_blank');
   $('a.target-blank').each(function(key, value){
        $(value).attr('target','_blank');  
   }); 
}); 

$(window).bind("load", function() { 
    var sponsorImages = $('.sponsorOverview img');
    if(sponsorImages.size() > 0) {
        sponsorImages.each(function(key, value) {
            value = $(value);
            value.css('margin-top',(80-value.attr('height'))/2);
        });
    }
});  

// SCROLLER

var numShow             = 2;    
var subSponsorsWrapper  = null;
var subSponsors         = null;
var sponsors            = null;
var max_height          = null;
var original_ul         = null;

$(window).bind("load", function() {  
    subSponsorsWrapper  = $('#subSponsorsWrapper');
    subSponsors         = $('#subSponsors');
    sponsors            = subSponsors.children();
    max_height          = subSponsors.height();

    subSponsors.append(subSponsors.html());
    animateReady();
});

function animateReady(marginTop) {
    if(!marginTop) marginTop = 0;

    subSponsors.css('margin-top',marginTop);
    
    subSponsors.animate(
    {
        marginTop: -max_height
     }, sponsors.size()*3000, 'linear', function() { animateReady() }
     );     
}

//Foto's in Gallery'
$(function(){
   $('.gallerypic').fancybox( {
            //frameWidth: 550,
            //frameHeight: 505,
            padding: 25,
            overlayShow: true,
            centerOnScroll: false,
            hideOnContentClick: false
   }

   );
       
});

//Live ticker fancy box
$(function(){
   //console.log ($('a[name=tickerbox]'));
   $('a[name=tickerbox]').fancybox( {
            frameWidth: 460,
            frameHeight: 600,
            overlayShow: true,
            centerOnScroll: false,
            hideOnContentClick: false
   }

   );
       
});

//promo film fancy box
$(function(){
   //console.log ($('a[name=tickerbox]'));
   $('a[name=fancy-movie]').fancybox( {
            frameWidth: 550,
            frameHeight: 505,
            padding: 25,
            overlayShow: true,
            centerOnScroll: false,
            hideOnContentClick: false
   }

   );
       
});

