var hoverColour = "#ff0000";

//$(window).resize(function() {
//		$('#footerCntr').css('top',$(document).height()-190);				  
//						  
//});

$(function(){
	$("a.hoverBtn").show("fast", function() {
		$(this).wrap("<div class=\"hoverBtn\">");
		$(this).attr("class", "");
	});
	
	// $('#footerCntr').css('top',$(document).height()-190);
	
	//display the hover div
	$("div.hoverBtn").show("fast", function() {
		//append the background div
		$(this).append("<div></div>");
		
		//get link's size
		var wid = $(this).children("a").width();
		var hei = $(this).children("a").height();
		
		//set div's size
		$(this).width(wid);
		$(this).height(hei);
		$(this).children("div").width(wid);
		$(this).children("div").height(hei);
		
		//on link hover
		$(this).children("a").hover(function(){
			//if($(this).closest('li').hasClass('selected'))
				//return;
				
			//store initial link colour
			// if ($(this).attr('rel') == '') {
				$(this).attr('rel', $(this).css("color"), 'test');
			// }
			//fade in the background
			$(this).parent().children("div")
				.stop()
				.css({"display": "none", "opacity": "1"})
				.fadeIn("fast");
			//fade the colour
			$(this)	.stop()
				.css({"color": $(this).attr("rel")})
				.animate({"color": hoverColour}, 350);
		},function(){
			//if($(this).closest('li').hasClass('selected'))
				//return;
			
			//fade out the background
			$(this).parent().children("div")
				.stop()
				.fadeOut("fast");
			//fade the colour
			$(this)	.stop()
				.animate({"color": $(this).attr("rel")}, 250);
		});
	});
	
	
	
	// Slider
	var tempindex = 0;
	if($('#slider5').length && $('#slider5 li').length > 1){
		var numeric = !$('#slider5').hasClass('prevnext');
		var prevnext = $('#slider5').hasClass('prevnext');
		
		$("#slider5").sudoSlider({ 
			vertical:false,
			fade: true,
			numeric: numeric,
			autoheight: false,
			prevNext: prevnext,
			auto: true,
			pause: 3000,
			continuous:true,
			beforeAniFunc: function(index){
				$('.textBox div.textslide:eq('+tempindex+')').fadeOut();
				$('.textBox div.textslide:eq('+(index-1)+')').fadeIn();
				tempindex = index-1
			}
		}); 
	}
	if($('#slider6').length && $('#slider6 li').length > 1){
		var numeric = !$('#slider6').hasClass('prevnext');
		var prevnext = $('#slider6').hasClass('prevnext');
		
		$("#slider6").sudoSlider({ 
			vertical:false,
			numeric: numeric,
			autoheight: false,
			prevNext: prevnext,
			auto: true,
			pause: 4000,
			continuous:true,
			beforeAniFunc: function(index){
				$('.textBox div.textslide:eq('+tempindex+')').fadeOut();
				$('.textBox div.textslide:eq('+(index-1)+')').fadeIn();
				tempindex = index-1
			}
		}); 
	}
	$('a').each(function() { if (!$(this).attr('href')) $(this).css('text-decoration', 'none'); });
	
	
	// Email links vervangen
	$('a[href*="mailto:"]').each(function(){
		var email = $(this).attr('href').replace("[at]","@").replace(/\[dot\]/g,".");
		$(this).attr('href',email).html(email.replace("mailto:",""));
	});
	
	
	$("a.iframe").fancybox({
		'titlePosition'		: 'inside',
		'transitionIn'		: 'none',
		'transitionOut'		: 'none',
		'width'				: 600,
		'height'			: 600,
		'type'				: 'iframe',
		'scrolling'			: 'no'



	});
	
});	
