// JavaScript Document

// Functions relating to portfoliio properties and actions
// Node573 Design and Development
// node573.com


var curVisible = "";  						// the id of the currently visible layer
var blackPixel = new Image();				// our buffer image that loads as the default image
blackPixel.src = "images/black500.png";

var port0 = new Image();
port0.src = "images/port/hurricanescience.png";
var port1 = new Image();
port1.src = "images/port/ipccinfo.png";
var port2 = new Image();
port2.src = "images/port/learnindexing.png";
var port3 = new Image();
port3.src = "images/port/mchughinc.png";
var port4 = new Image();
port4.src = "images/port/usdaclimatereport.png";
var port5 = new Image();
port5.src = "images/port/noblesage.png";
var port6 = new Image();
port6.src = "images/port/siab1.png";
var port7 = new Image();
port7.src = "images/port/TotBK_map.png";
var port8 = new Image();
port8.src = "images/port/blaulb.png";
var port9 = new Image();
port9.src = "images/port/noblesage_page.png";
var port10 = new Image();
port10.src = "images/port/ideadb.png";
var port11= new Image();
port11.src = "images/port/project.png";

var currentImgNum = 0;						// the number of the current image we're viewing in the portfolio viewer
var portfolioArray = new Array(  );			// our array that stores the portfolio information
portfolioArray[0] = new Array( "hurricanescience.net", "HurricaneScience.net: XHTML/CSS", "images/hurricanescience.png", port0.src );
portfolioArray[1] = new Array( "ipccinfo.com", "IPCCinfo.com: XHTML/CSS (<a class='small' href='http://ipccinfo.com' target='_new'>link</a>)", "images/ipccinfo.png", port1.src );
portfolioArray[2] = new Array( "learnindexing.com", "LearnIndexing.com: XHTML/CSS/Photoshop (<a class='small' href='http://learnindexing.com' target='_new'>link</a>)", "images/learnindexing.png", port2.src );
portfolioArray[3] = new Array( "mchughinc.com", "McHughInc.com: HTML/CSS/Photoshop (<a class='small' href='http://mchughinc.com' target='_new'>link</a>)", "images/mchughinc.png", port3.src );
portfolioArray[4] = new Array( "usdaclimatereport.com", "USDAClimateReport.com: XHTML/CSS/Photoshop (<a class='small' href='http://usdaclimatereport.com' target='_new'>link</a>)", "images/usdaclimatereport.png", port4.src );
portfolioArray[5] = new Array( "noblesage.com logo", "NobleSage.com Logo: Illustrator", "images/noblesage.png", port5.src );
portfolioArray[6] = new Array( "Sunset is a Battle CD", "CD Inlay: Photoshop/Illustrator", "images/siab1.png", port6.src );
portfolioArray[7] = new Array( "TotBK", "Map Design: Illustrator", "images/TotBK_map.png", port7.src );
portfolioArray[8] = new Array( "blaulb.com", "BLAULB.com: PHP/CSS/MySQL", "images/blaulb.png", port8.src );
portfolioArray[9] = new Array( "noblesage.com", "NobleSage.com: PHP/CSS/MySQL (<a class='small' href='http://noblesage.com' target='_new'>link</a>)", "images/noblesage.png", port9.src );
portfolioArray[10] = new Array( "ideadb.net", "IdeaDB.net: PHP/CSS/MySQL (<a class='small' href='http://ideadb.net' target='_new'>link</a>)", "images/ideadb.png", port10.src );
portfolioArray[11] = new Array( "Project Tracking App", "Project Tracking Application: PHP/CSS/MySQL", "images/project.png", port11.src );

var defaultDimImg = new Image();
defaultDimImg.src = "images/node573home_default_dim.png";

function doDim( divName ) {
	closeViewer();
	if( curVisible ) document.getElementById( curVisible ).style.visibility= "hidden";
	document.images[0].src = defaultDimImg.src;
	document.getElementById( divName + "Div" ).style.visibility = "visible";
	curVisible = divName + "Div";
}

function viewer( imgNum ) {
	currentImgNum = imgNum;
	document.getElementById( "viewerImg" ).src = portfolioArray[currentImgNum][3];
	document.getElementById( "viewerDiv" ).style.visibility = "visible";
	document.getElementById( "closeButtonDiv" ).style.visibility = "visible";
	document.getElementById( "prevButtonDiv" ).style.visibility = "visible";
	document.getElementById( "nextButtonDiv" ).style.visibility = "visible";
	document.getElementById( "descDiv" ).innerHTML = portfolioArray[currentImgNum][1];
}

function closeViewer() {
	document.getElementById( "viewerImg" ).src = blackPixel.src;
	document.getElementById( "viewerDiv" ).style.visibility = "hidden";
	document.getElementById( "closeButtonDiv" ).style.visibility = "hidden";
	document.getElementById( "prevButtonDiv" ).style.visibility = "hidden";
	document.getElementById( "nextButtonDiv" ).style.visibility = "hidden";
}

function prevPort() {
	if(currentImgNum==0){
		currentImgNum=portfolioArray.length-1; 
	} else {
		currentImgNum--; 
	}
	document.getElementById('viewerImg').src=portfolioArray[currentImgNum][3];
	document.getElementById( "descDiv").innerHTML = portfolioArray[currentImgNum][1];
}

function nextPort() {
	if(currentImgNum==portfolioArray.length-1){
		currentImgNum=0; 
	} else {
		currentImgNum++; 
	}
	document.getElementById('viewerImg').src=portfolioArray[currentImgNum][3];
	document.getElementById( "descDiv").innerHTML = portfolioArray[currentImgNum][1];
}