$(document).ready( function(){


	$('#print_port_link').click(function(){


		$('#print_port_link').css({color:"#64A143"});
		$('#web_port_link').css({color:"black"});

		
			$('#web_port_logos1').fadeOut("normal");
			$('#web_port_logos2').fadeOut("normal");
			$('#print_port_logos2').fadeOut("fast");		
			$('#print_port_logos1').delay(500).fadeIn("normal");			
			$('#selection_print').fadeIn("normal");
			$('#selection_web').fadeOut("normal");
			$('#web_gal').fadeOut("normal");
			$('#print_gal').delay(500).fadeIn("normal")
		

	});

	$('#web_port_link').click(function(){


		$('#print_port_link').css({color:"black"});
		$('#web_port_link').css({color:"#64A143"});
	
			$('#print_port_logos1').fadeOut("normal");
			$('#print_port_logos2').fadeOut("normal");
			$('#web_port_logos2').fadeOut("fast");
			$('#web_port_logos1').delay(800).fadeIn("normal");
			$('#selection_web').fadeIn("normal");
			$('#selection_print').fadeOut("normal");
			$('#web_gal').delay(800).fadeIn("normal");
			$('#print_gal').fadeOut("normal");

		$('#web_port_logos2').fadeOut("fast");
		


	});


	$('.print_logo').click( function(){

		id = $(this).attr("alt");
		print_gal = id+"_gal";

		$('.gal_page').css({color:"black"});
		$('#'+id+"_1").css({color:"#64A143"});
		$('.following_img').fadeOut("fast");
		$('.galleries').fadeOut("fast");
		$('#'+print_gal).delay(1000).fadeIn("normal");
		$('.first_img').delay(200).fadeIn("normal");
		document.getElementById(id+'_current_img').value = 1;

	});

	$('.web_logo').click( function(){

		id = $(this).attr("alt");
		web_gal = id+"_gal";
		
		$('.gal_page').css({color:"black"});
		$('#'+id+"_1").css({color:"#64A143"});
		$('.following_img').fadeOut("fast");
		$('.galleries').fadeOut("fast");
		$('#'+web_gal).delay(1000).fadeIn("normal");
		$('.first_img').delay(200).fadeIn("normal");


		document.getElementById(id+'_current_img').value = 1;
	});


	$('.arrow_left').click(function(){
		
		folder = $(this).attr("title");

		current = document.getElementById(folder+'_current_img').value;
		prev = current - 1;

		if(current > 1){
		
		$('.following_img').fadeOut("fast");
		$('.first_img').fadeOut("fast");

		$('#'+folder+"_"+prev+"_").delay(200).fadeIn("normal");

		
		document.getElementById(folder+'_current_img').value = prev;
		$('.gal_page').css({color:"black"});
		$('#'+folder+"_"+prev).css({color:"#64A143"});
		}


	});

	$('.arrow_right').click(function(){
		
		folder = $(this).attr("title");

		var current = document.getElementById(folder+'_current_img').value;
		var max_img = document.getElementById(folder+'_max_img').value;
		next = eval(current - -1);
				
		if(current < max_img){
		
		$('.following_img').fadeOut("fast");
		$('.first_img').fadeOut("fast");

		$('#'+folder+"_"+next+"_").delay(200).fadeIn("normal");

		document.getElementById(folder+'_current_img').value = next;
		$('.gal_page').css({color:"black"});
		$('#'+folder+"_"+next).css({color:"#64A143"});		
		}


	});


	$('#p1').click( function(){
		
		
			$('#print_port_logos2').fadeOut("fast");
			$('#print_port_logos1').delay(800).fadeIn("normal");
			$(this).css({color:"#64A143"});
		


	});

	$('#p2').click( function(){
		
			$('#print_port_logos1').fadeOut("fast");
			$('#print_port_logos2').delay(800).fadeIn("normal");
			$(this).css({color:"#64A143"});
			$('#p1').css({color:"black"});

		


	});

	$('#w1').click( function(){
		
		
			$('#web_port_logos2').fadeOut("fast");
			$('#web_port_logos1').delay(800).fadeIn("normal");
			$(this).css({color:"#64A143"});
			$('#w2').css({color:"black"});


	});

	$('#w2').click( function(){

	
			$('#web_port_logos1').fadeOut("fast");
			$('#web_port_logos2').delay(800).fadeIn("normal");
			$(this).css({color:"#64A143"});
			$('#w1').css({color:"black"});
		

	});

	$('.gal_page').click( function(){

		current = $(this).attr("title");
		gal_img = $(this).attr("id");
		folder = $(this).attr("alt");	
	
		$('.gal_page').css({color:"black"});
		$(this).css({color:"#64A143"});
		
		$('.first_img').fadeOut("fast");
		$('.following_img').fadeOut("fast");
		$('#'+gal_img+"_").delay(800).fadeIn("normal");

		
		document.getElementById(folder+'_current_img').value = current;

	});




});

