/* -------------------------------------------------------------------

	Boondoggle
	
	This JavaScript file collects all general functions used
	throughout the site, as well as some smaller specific
	functions.

------------------------------------------------------------------- */



// when the document is ready to be traversed and manipulated...
$(document).ready(function(){
	
	// LINK HANDLER
	// when you click on a link with class externalLink
	$("a.externalLink").click(function(){
		// open a new window with the link's location
		window.open($(this).attr("href"));
		// and do nothing after (to prevent the link from actually firing)
		return false;
	});
	
	// add first and last to list items
		$('ul li:first-child').addClass( 'first_item' );
		$('ul li:last-child').addClass( 'last_item' );

	// set body id for custom css
	var pathname = window.location.pathname;
	var newID = pathname.split("/")[1];
      newID = newID.replace(".", "_");
	$("body").attr("id",newID);	
	
	// add link to small header images projects
	$("#smallHeaderCnt").css({"cursor": "pointer"}).click(function(){
		window.location = "/"+newID+"/default.aspx"
	});

  // show navigation and logo elements
	$(".group-navigation, .group-application-navigation, .site-banner").addClass("showHeaderFragments");	
	
	// add target blank to rss feeds
	$(".temporary-rss-feed-item-list .content-list a").attr('target', '_blank');
	
  // delete last seperator activity list homepage
  $(".content-fragment.activity-message-list span.separator:last").hide();	
	
	// general content pages random header image
	bgImageTotal = 5; 
	randomNumber = Math.round(Math.random()*(bgImageTotal-1))+1; 
	imgPath=('/themes/beleefmechelen-v0_1/images/custom/headerImages/header'+randomNumber+'.jpg'); 
	$('#generalHeaderImages').css('background-image', ('url("'+imgPath+'")'));
 
  // hide IE6 layer 
  $('a#closeIE6').click(function(){
		$('#ie6').hide();
	});

});


