/* functionaliteiten */

$(window).load(function() {
	$('#Scroller-1').css('display', 'block');
	$('#Scroller-1').jScrollPane();
	  $('.scroll-to').bind(
        'click', function() {
      		var goto = $(this).attr('rel');
       		$('#Scroller-1')[0].scrollTo(goto);
          return false;
    });
});

$(window).load(function() {
	$('img.imgSwitch').mouseover(function() {
    	imgsrc = $(this).attr("src");
        imgsrcactive = imgsrc.replace(/.gif$/ig,"_hover.gif");
        $(this).attr("src", imgsrcactive);
    });

    $('img.imgSwitch').mouseout(function() {
      	$(this).attr("src", imgsrc);
    });
       
    $('img.squares').mouseover(function() {
      	imgsrc = $(this).attr("src");
       	imgsrcactive = imgsrc.replace("/_small/","/_medium/");
       	imgsrclarge = imgsrc.replace("/_small/","/_extralarge/");
       	
       	var legende = $(this).attr("title");
       	$('#image img').attr("src", imgsrcactive);
       	$('#image img').attr("title", legende);
       	$('#image img').attr("alt", legende);
      	$('#image a').attr("href", imgsrclarge);
		if (!legende)
		{
			$('.textImagetext').hide();
		}
		else 
		{
			$('.textImagetext').show();
			$('.textImagetext').html(legende); 
		} 	

    });
    
 
 	if ( $("img.imgActive").length > 0 ) { 
 		imgsrc = $('img.imgActive').attr("src");
    	$('img.imgActive').attr("src", imgsrc.replace(/.gif/g,'_active.gif'));
 	}
 	
    $("div#image a").fancybox({ 'hideOnContentClick': true, 'overlayShow': true });
    
    $('#navSquare a').each(function(){
    	menulink = $(this).attr("href");
   		menulinkreplaced = menulink.replace(/ /g,'_');
		$(this).attr("href", menulinkreplaced);
	});
	
    $('#menu a').each(function(){
    	menulink = $(this).attr("href");
   		menulinkreplaced = menulink.replace(/ /g,'_');
		$(this).attr("href", menulinkreplaced);
	});
	
    $('#menu img').each(function(){
    	menulink = $(this).attr("src");
   		menulinkreplaced = menulink.replace(/ /g,'_');
		$(this).attr("src", menulinkreplaced);
	});	
    
});

function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
}
window.onload = externalLinks;

