// JavaScript Document

//set the array for the images on the home page.
var imgArray=new Array("#img1", "#img2", "#img3", "#img4", "#img5");
var imageCount = 2;

jQuery(document).ready(function() 
{
	switch( pageid )
		{
			case 'menu1':
			//alert("test");
			$("#menu1").css("background-color", "#993333");
			break;
			
			case 'menu2':
			$("#menu2").css("background-color", "#993333");
			break;
			
			case 'menu3':
			$("#menu3").css("background-color", "#993333");
			break;
			
			case 'menu4':
			$("#menu4").css("background-color", "#993333");
			break;
			
			case 'menu5':
			$("#menu5").css("background-color", "#993333");
			break;
		}
	
	$("#menu .menu-item").hover (
		function()
		{
			if ( $(this).attr('id') != pageid )
			{
				$(this).animate({backgroundColor:"#993333"}, 100);
			}
		},
		function()
		{
			if ( $(this).attr('id') != pageid )
			{
				$(this).animate({backgroundColor:"#633"}, 100);
			}
		}
	
	);
	
	
	$("#menua a").css({opacity: '.7'});
	
		//When hovering on the menu bar, the links will animate their opacity from 0% to 100% over a short time
	$("#menua a").hover ( 
		function() 
		{
			if ( jQuery.support.opacity )
			{
				$(this).stop().animate({"opacity": "1"}, 500); //Normal Browsers
			} 
			else 
			{
				$(this).stop().animate({"filter": "alpha(opacity=100)"}, 500); //IE5-7
				$(this).stop().animate({"-ms-filter": "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"}, 500); //IE8
			}
			
			//animate the menu info popups
			$("#menu_hover_text").css('display', 'none');
			$("#menu_hover_text").customFadeIn(300);
			$("#menu_hover_text").css('display', 'inline');

			switch( $(this).parent().attr("id") )
			{
				case 'fiber':
				$('#menu_hover_text').text( fiberText );
				break;
				
				case 'tech':
				$('#menu_hover_text').text( techText );
				break;
				
				case 'subscribers':
				$('#menu_hover_text').text( subscriberText );
				break;
				
				case 'about':
				$('#menu_hover_text').text( aboutText );
				break;
			}
			
		},
		function() 
		{
			if ( jQuery.support.opacity )
			{
				$(this).stop().animate({"opacity": ".7"}, 1); //Normal Browsers
			} else
			{
				$(this).stop().animate({"filter": "alpha(opacity=0)"}, 500); //IE5-7
				$(this).stop().animate({"-ms-filter": "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"}, 500); //IE8
			}
		}
	);
	
});


function create_mail(naam, domain, tld, label) {
	var mail = '';
	mail += '<a href="' + 'ma' + 'il' + 'to:' + naam;
	mail += '&#64;' + domain + '.' + tld;
	mail += '">' + label + '<' + '/a>';
	document.write(mail);
}



function startCarousel() 
{	
	imageCount = 2;
	
	//Home page Carousel, with easing effects
	jQuery("#imgCarousel").jCarouselLite(
	{
		auto: 5000,
		speed: 800,
	});
	
};

function updateImg(imgId)
{
	//here we update the background image after the image gets clicked or the auto function of the jcarousel runs
	$.each(imgArray, function(index, value)
		{
			if ( value != imgId )
			{
				$(value).css({"background-image": "url(assets/carousal/carousel_off.png)"});
			}
			else
			{
				$(value).css({"background-image": "url(assets/carousal/carousel_on.png)"});
			}
		});
}

