function loadText(portfolio) {
	$('#imageView').fadeOut(250, 
			function callback() {
				$('#portfolioText').load(portfolio + '-text.php');
				$('#portfolioText').fadeIn(250);
				$('#infoLink').fadeOut(250);
			  	this;
			}
		);
	
}

function loadImage(gallery,image) {

	$imagePath = '../_images/portfolio/gallery/' + gallery + '/' + image;
	
	function callback() {	
		$('#imageView').html('<img id="currentImage" src="' + $imagePath + '" width="347" height="354" />');
		$('#imageView').fadeIn(200);
		$('#infoLink').fadeIn(250);
		correctPNG(); // IE 5.5 & 6 fix
		this;
	}
		
	if ( $('#portfolioText').css('display') != 'none' ) {
		$('#portfolioText').fadeOut(200, callback);
	}
	else {		
		if ( $('#currentImage').attr("src") != $imagePath ) {
			$('#imageView').fadeOut(200, callback);
		}		
	}
	
}

var galleries = new Array(); 
galleries[0] = "premium";
galleries[1] = "promotional";
galleries[2] = "incentive";
galleries[3] = "apparel";
galleries[4] = "pos"; 
galleries[5] = "importing"; 
galleries[6] = "creative"; 
galleries[7] = "production"; 
galleries[8] = "technology"; 
function nextGallery(currentGallery) {

	var next;
	
	for ( var i = 0; i < galleries.length; i++ ) {

		if ( galleries[i] == currentGallery ) {
			if ( i >= galleries.length-1 ) {
				next = galleries[0];
				break;
			}
			else {
				next = galleries[i+1];
				break;
			}
		}
		else if ( i >= galleries.length-1 ) {
			next = galleries[0];
			break;
		}
	}
		
	window.location = "/portfolio/gallery.php?g=" + next;
}
