<!--//--><![CDATA[//><!--
sfHover = function() {
	var sfEls = document.getElementById("navlist").getElementsByTagName("LI");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);
//--><!]]>

$(document).ready(function(){
	$('#navlist').children().hover(
		function(){
			$('#' + this.id + ' a.rollover img').css({'visibility' : 'hidden'});
		},
		function(){
			$('#' + this.id + ' a.rollover img').css({'visibility' : 'visible'});
		}
	)
})

function showDesc(piece) {
	 $('#' + piece).css({"opacity":"1.0" });
	 $('#' + piece + 'bg').show();
}
function hideDesc(piece) {
	 $('#' + piece).css({"opacity":"0" });
	 $('#' + piece + 'bg').hide();
}

function switchPiece(pieceNumber) {
	//$('#thumbs').css("visibility","hidden");
	
	$.ajax({
		url: "includes/ajax_portfolio.php",
		cache: false,
		type: "POST",
		data: {piece : pieceNumber},
		dataType: "html",
		success: function(html){
			$('#portfolioData').html(html);
			$('#portfolioData').show();
			$('#thumbs').hide();
		},
		error: function(textStatus) {
			//alert(textStatus);
			alert("There was an error");
		}
	});
}

function switchAbout(pieceNumber) {
	//$('#thumbs').css("visibility","hidden");
	
	$.ajax({
		url: "includes/ajax_about.php",
		cache: false,
		type: "POST",
		data: {piece : pieceNumber},
		dataType: "html",
		success: function(html){
			$('#aboutData').html(html);
			$('#aboutData').show();
			$('#thumbs').hide();
		},
		error: function(textStatus) {
			//alert(textStatus);
			alert("There was an error");
		}
	});
}

function previewPiece(pieceId,divToFill,showWidth,showHeight,urlPrefix) {
	if(pieceId == "") {
		return false;
	}
	$.ajax({
		url: urlPrefix + "includes/ajax_previewPiece.php",
		cache: false,
		type: "POST",
		data: {piece: pieceId, width: showWidth, height: showHeight, prefix: urlPrefix},
		dataType: "html",
		start: $('#' + divToFill + '').html('<em>Processing</em>'),
		success: function(html){
			$('#' + divToFill + '').html(html);
		},
		error: function(textStatus) {
			//alert(textStatus);
			alert("There was an error displaying the preview, please retry.");
		}
	});
}