	var tempTitle; //tempTitle wel links naar site maat geen tooltip in IE7

	if (navigator.appVersion.indexOf("Mac")!=-1) {
		document.write("<link rel='stylesheet' type='text/css' href='fancybox/jquery.fancybox-1.3.1_mac.css' media='screen' >");
	}


	$(document).ready(function(){
	

		
		// fancybox titel
		function formatTitle(title, currentArray, currentIndex, currentOpts) {
			
			if (tempTitle == "") {
				tempTitle = "geentitel|geen";
			}
			
			titleArray = tempTitle.split('|');
			var bezoek = "bezoek site";
			var myTitle = titleArray[0];
			var link = titleArray[1];
			
			if (link == "geen") {
				var bezoek = "";
				return '<div>' + myTitle + '<span>' + (currentIndex + 1) + ' / ' + currentArray.length + '<\/span>' +  '<span class="rechts">' + bezoek + '<\/span>' + '<\/div>';
			} else if (link == "offline") {
				var bezoek = "site niet meer online";
				return '<div>' + myTitle + '<span>' + (currentIndex + 1) + ' / ' + currentArray.length + '<\/span>' +  '<span class="rechts">' + bezoek + '<\/span>' + '<\/div>';
			} else {
				return '<div>' + myTitle + '<span>' + (currentIndex + 1) + ' / ' + currentArray.length + '<\/span>' + '<a href="http://' + link + ' "target="_blank">' + bezoek + '<\/a>' + '<\/div>';
			}
    		
		}
		


		// fancybox
		$("a.fblink").fancybox({
			//'cyclic' : true,
			'slideshow'	: true,
			'titleShow'	: true,
			'titlePosition'	: 'inside',
			'opacity' : true,
			'overlayOpacity' : 0.8,
			'transitionIn'	: 'elastic',
			'transitionOut'	: 'elastic',
			//'overlayColor'	: '#fff',
			//'overlayColor'	: '#ee5425',
			'overlayColor'	: '#699b99',
			'centerOnScroll' : false,
			'titleFormat' : formatTitle,
			'showCloseButton' : true
			
		});	
		
		
		$("a.desc").click(function(e) {
			e.preventDefault();
		});
		
		
		
		// slideshow tigger vanuit kader wat over img staat
		$(".over").click(function() {
		
			// title opslaan
			tempTitle = $(this).attr('mytitle');

			// juiste fotos triggeren	
			var myRel = this.id;
			var link = "a.fblink[rel='" + myRel + "']";
			$(link).triggerHandler('click');
			
		});	

		
		
		// items hover
		$(".item_img").hover(
		  function () {
			$(this).parent().children().children().addClass("rood");
			$(this).parent().children().fadeIn();  //  kader rode rand
		  },
		  function () {
			$(this).parent().children().children().removeClass("rood");
			
		  }
		);
		
		// kaderrand niet bij hover anders dubbele fade
		$(".over").mouseout(function() {
			//$(this).fadeOut();
			$(".over:visible").fadeOut();
		});
		
		
		
		


		// pijltjes recent
		$("#recent .next").click(function(event) {
			event.preventDefault(); 
			$("#recent .eerste").animate({left:'-720px'});	
			$("#recent .cijfer").text("2");
			$(this).css('opacity', 0.6).addClass("expanded");
			$("#recent .prev").css('opacity', 1).removeClass("expanded");
		});		

		$("#recent .prev").click(function(event) {
			event.preventDefault();
			$("#recent .eerste").animate({left:'0px'});	
			$("#recent .cijfer").text("1");
			$(this).css('opacity', 0.6).addClass("expanded");
			$("#recent .next").css('opacity', 1).removeClass("expanded");
		});	






		
		
		
		// pijltjes portfolio
		$("#webdesign .next").click(function(event) {
			event.preventDefault(); 
			$("#webdesign .eerste").animate({left:'-720px'});	
			$("#webdesign .cijfer").text("2");
			$(this).css('opacity', 0.6).addClass("expanded");
			$("#webdesign .prev").css('opacity', 1).removeClass("expanded");
		});		

		$("#webdesign .prev").click(function(event) {
			event.preventDefault();
			$("#webdesign .eerste").animate({left:'0px'});	
			$("#webdesign .cijfer").text("1");
			$(this).css('opacity', 0.6).addClass("expanded");
			$("#webdesign .next").css('opacity', 1).removeClass("expanded");
		});	
		
		
		$("#grafisch_werk .next").click(function(event) {
			event.preventDefault(); 
			$("#grafisch_werk .eerste").animate({left:'-720px'});
			$("#grafisch_werk .cijfer").text("2");
			$(this).css('opacity', 0.6).addClass("expanded");
			$("#grafisch_werk .prev").css('opacity', 1).removeClass("expanded");
		});		

		$("#grafisch_werk .prev").click(function(event) {
			event.preventDefault();
			$("#grafisch_werk .eerste").animate({left:'0px'});	
			$("#grafisch_werk .cijfer").text("1");
			$(this).css('opacity', 0.6).addClass("expanded");
			$("#grafisch_werk .next").css('opacity', 1).removeClass("expanded");
		});	
		

		$(".prev").css('opacity', 0.6).addClass("expanded");

		
		
		//menu instellen
		$("#recent .main_menu a[href=#recent]").addClass("current");
		$("#webdesign .main_menu a[href=#webdesign]").addClass("current");
		$("#grafisch_werk .main_menu a[href=#grafisch_werk]").addClass("current");
		$("#werkwijze .main_menu a[href=#werkwijze]").addClass("current");
		$("#over_x41 .main_menu a[href=#over_x41]").addClass("current");
		$("#contact .main_menu a[href=#contact]").addClass("current");
		


		// geen tooltips in IE
		$(".over").each(function() {
			var t = $(this).attr('title');
			$(this).attr('mytitle', t);
			$(this).attr('title', "");
		});			
		
		
		// voor de iPad dit toevoegen i.v.m. hover en niet scrollen
		if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {
			$(".over").fadeTo('fast', 0);
			$(".item_img").unbind('hover');
			$(".item_img").unbind('mouseout');
			
			// betere indicatie klik op iPad?
			$(".over").mousedown(function() {
				$(this).fadeTo('fast', 1);		
			});
			
			if (!navigator.userAgent.match(/3_2/)) {
			
				// scrollen
				$.localScroll.hash({
				});
	
				$('.main_menu').localScroll({
				   hash:'false',
				   easing:'easeOutCirc',
				   duration: 750
				});
			
			}
			
			
			
			
			
		} else {
			// scrollen
			$.localScroll.hash({
			});
	
			$('.main_menu').localScroll({
			   hash:'false',
			   easing:'easeOutCirc',
			   duration: 750
			});
		}
		


});

