// JavaScript Document

	function rollup(chosen) {
	
		var flag = "flag" + chosen;
		var col = "col" + chosen;
		var imgdist = -50 * chosen + 50;
		var dotdist = -16 * chosen;
		document.getElementById(flag).style.backgroundPosition = '0px ' + imgdist + 'px';
		document.getElementById(col).style.backgroundPosition = dotdist + 'px 0px';
			
		return;
	} 
	
	function rollout(chosen) {
	
		var flag = "flag" + chosen;
		var col = "col" + chosen;
		document.getElementById(flag).style.backgroundPosition = '-50px 0px';
		document.getElementById(col).style.backgroundPosition = '0px 0px';
			
		return;
	} 
	
	
	$(document).ready(function() {
	
		
        $('a.grouplink').click(function(){
			if ($('#'+$(this).attr('rel')).css('display') == 'none'){
				$('.grouper').fadeOut('fast');
				$('.page').fadeOut('fast');
	            $('#'+$(this).attr('rel')).fadeIn('fast');
			}
		}); 

		$('a.pagelink').click(function(){
			$('#portfolio-box').fadeOut('normal');
            $('#'+$(this).attr('rel')).fadeIn('fast');
        }); 
		
	
	
		$('a.closer').click(function() {
			$(this).parents('.grouper').fadeOut('fast');
		});

		$('a.close').click(function() {
			$(this).parents('.page').fadeOut('fast');
			$('#portfolio-box').fadeIn('fast');
		});



		$.fn.delay = function(time, callback){
			// Empty function:
			jQuery.fx.step.delay = function(){};
			// Return meaningless animation, (will be added to queue)
			return this.animate({delay:1}, time, callback);
		}


		$('a.prevpage').click(function(){
			$(this).parents('.page').fadeOut('normal');
			$('#'+$(this).attr('rel')).delay(300);
			$('#'+$(this).attr('rel')).fadeIn('normal');
		}); 

        $('a.nextpage').click(function(){
			$(this).parents('.page').fadeOut('normal');
			$('#'+$(this).attr('rel')).delay(300);
			$('#'+$(this).attr('rel')).fadeIn('normal');
		}); 

		
		
		
	});
	

