/**
 * @author maikelpl
 */
$(document).ready(function(){
	
	$.preLoadImages('/images/menu_liH.png','/images/menu_li_aH.png');
	
	//footer year
	var today = new Date();
	var ty = today.getFullYear();
	$('#footer_year').html(ty);
	
	//mainmenu
	$('#mainmenu li').last().css('width','800px');
	$('#mainmenu li a').hover(function(){
		var tli = $(this).parent().index();
		if(tli == 0){
			if(!$(this).parent().hasClass('mainmenuitemselected')){
				$(this).parent().css('background','url(images/menu_li_firstH.png) left no-repeat');
			}
		}
		else {
			if(!$(this).parent().hasClass('mainmenuitemselected')){
				$(this).parent().css('background','url(images/menu_liH.png) left no-repeat');
			}
		}
	},function(){
		var tli = $(this).parent().index();
		if(tli == 0){
			if(!$(this).parent().hasClass('mainmenuitemselected')){
				$(this).parent().css('background','url(images/menu_li_first.png) left no-repeat');
			}
		}
		else {
			if(!$(this).parent().hasClass('mainmenuitemselected')){
				$(this).parent().css('background','url(images/menu_li.png) left no-repeat');
			}
		}
	});
	
	//slideshow
	if($('#headerimages ul').eq(0).find('li').length > 1) {
	 $("#headerimages ul").fadeSlideShow({
	  width: 602, // default width of the slideshow
	  height: 220, // default height of the slideshow
	  speed: 1000, // default animation transition speed
	  interval: 7000, // default interval between image change
	  PlayPauseElement: 'fssPlayPause', // default css id for the play / pause element
	  PlayText: 'Play', // default play text
	  PauseText: 'Pause', // default pause text
	  NextElement: 'fssNext', // default id for next button
	  NextElementText: 'Next >', // default text for next button
	  PrevElement: 'fssPrev', // default id for prev button
	  PrevElementText: '< Prev', // default text for prev button
	  ListElement: 'fssList', // default id for image / content controll list
	  ListLi: 'fssLi', // default class for li's in the image / content controll 
	  ListLiActive: 'fssActive', // default class for active state in the controll list
	  addListToId: false, // add the controll list to special id in your code - default false
	  allowKeyboardCtrl: false, // allow keyboard controlls left / right / space
	  autoplay: true // autoplay the slideshow
	 });
	 }	

	//innerfade
	if($('.spotlight_blocks_box').eq(0).find('li').length > 1) {
		$('.spotlight_blocks_box').eq(0).find('ul').innerfade({
			speed: 2000,
			timeout: 5000,
			type: 'random',
			containerheight: '123px'
		});
	}	

	//innerfade
	if($('.spotlight_blocks_box').eq(1).find('li').length > 1) {
		$('.spotlight_blocks_box').eq(1).find('ul').innerfade({
			speed: 2000,
			timeout: 5000,
			type: 'random',
			containerheight: '123px'
		});
	}	

	//innerfade
	if($('.spotlight_blocks_box').eq(2).find('li').length > 1) {
		$('.spotlight_blocks_box').eq(2).find('ul').innerfade({
			speed: 2000,
			timeout: 5000,
			type: 'random',
			containerheight: '123px'
		});
	}	
	
	//innerfade
	if($('#wide_banner ul').find('li').length > 1) {
		$('#wide_banner ul').innerfade({
			speed: 2000,
			timeout: 5000,
			type: 'random',
			containerheight: '99px'
		});
	}
	
	//wide_banner
	$('#wide_banner').find('a').each(function(){
		if($(this).attr('href') == '' || $(this).attr('href').length < 10){
			var timg = $(this).find('img');
			$(this).parent().prepend(timg);
			$(this).remove();
		}
	});
	
});//end document ready

$(window).load(function(){
	
	
	
});//end window load

//preload images
(function($){var cache=[];$.preLoadImages=function(){var args_len=arguments.length;for(var i=args_len;i--;){var cacheImage=document.createElement('img');cacheImage.src=arguments[i];cache.push(cacheImage);}}})(jQuery)
