var la="mailto:";
var dee="jeni";
var at="@";
var da="jeniolsendesign";
var com=".com";
var mailadd = la + dee + at + da + com;
var mailaddtext = dee + at + da + com;
var lastTD = 1;
var lastRollTD = 1;
var portFromIndexLoad = 0;
var browserChecked = 0;
var rollImages = new Array();
var theImages = new Array();
rollImages[0] = "images/menuPieces/about.gif"
rollImages[1] = "images/menuPieces/clients.gif"
rollImages[2] = "images/menuPieces/contact.gif"
rollImages[3] = "images/menuPieces/portfolio.gif"

function browserCheck(port) {
	if (navigator.appName == "Microsoft Internet Explorer" && parseFloat(navigator.appVersion.substr(22,3)) < 7) {
		window.location.assign('browserupgrade.html')
	} else {
		browserChecked = 1
		imageLoader()
		if (port) {
			portFromIndex(port)
		}
	}
}

function imageLoader() {
	//preload images
	limit = rollImages.length
	for (i=0; i<limit; i++) {
		theImages[i] = new Image()
		theImages[i].src = rollImages[i]
	}
}

function portFromIndex(theSwitch) {
	if (browserChecked) {
		switch (theSwitch) {
			case 0:
				return;
				break;
			case 1:
				document.getElementById("11").id = "thumbRolled";
				lastRollTD = 11;
				swapImage('Bell-Construction-logo.gif', 'Bell Construction', 'Construction Company', 11, 0);
				break;
			case 2:
				swapImage('luna-sales-sheet.jpg', 'Luna Vineyards', 'Sales Sheet 1 > 2', 1, 1)
				break;
			case 3:
				document.getElementById("6").id = "thumbRolled";
				lastRollTD = 6;
				swapImage('NV-Day-Spa-Collateral.gif', 'Napa Valley Day Spa', 'Business Card &middot; Gift Certificate &middot; Rack Card', 6, 1);
				break;
			case 4:
				document.getElementById("10").id = "thumbRolled";
				lastRollTD = 10;
				swapImage('luxe-collateral.gif', 'Luxe Skin Spa', 'Business Card &middot; Gift Certificate &middot; Flyer &middot; Rack Card', 10, 1);
				break;
			case 5:
				document.getElementById("3").id = "thumbRolled";
				lastRollTD = 3;
				swapImage('Janette-Gonsalves-Collateral.gif', 'Janette Gonsalves', 'Business Card &middot; Notecard &middot; Yard Sign', 3, 1);
				break;
			case 7:
				document.getElementById("6").id = "thumbRolled";
				lastRollTD = 6;
				swapImage('Vinoasia-logo.gif', 'Vinoasia', 'Wine Distributor to Japan', 6, 0);
				break;
			default:
				return;
		}
	} else {
		browserCheck(theSwitch)
	}
}


function swapImage(theImg, theTitle, theMeta, theTD, theSection, zoom, zoomPic) {
	if (theTD==lastTD) {
		return;
	} else {
		switch (theSection) {
			case 0:
				document.getElementById("imageWellId").style.backgroundImage = "url(images/portfolio/identity/"+theImg+")";
				document.getElementById("titleId").innerHTML = "<span class='title'>"+theTitle+"</span> | "+theMeta;
				break;
			case 1:
				document.getElementById("imageWell").style.backgroundImage = "url(images/portfolio/print/"+theImg+")";
				document.getElementById("title").innerHTML = "<span class='title'>"+theTitle+"</span> | "+theMeta;
				break;
			case 2:
				document.getElementById("imageWell").style.backgroundImage = "url(images/portfolio/packaging/"+theImg+")";
				document.getElementById("title").innerHTML = "<span class='title'>"+theTitle+"</span> | "+theMeta;
				if (zoom) {
					if (zoom==1) {
						zoomString = "ZOOM"
						zoom = 2
					} else {
						zoomString = "BACK"
						zoom = 1
					}
					document.getElementById("zoom").innerHTML = "<a href='#' onclick='swapImage(\""+zoomPic+"\", \""+theTitle+"\", \""+theMeta+"\", \"zoom\", "+theSection+", "+zoom+", \""+theImg+"\")' class='zoomLink'>"+zoomString+"</a>"
				} else {
					document.getElementById("zoom").innerHTML = ""
				}
				break;
			default:
				return;		
		}
		
		if (theTD=="sub" || theTD=="zoom") {
			return;
		} else {
			document.getElementById("thumbChosen").id = lastTD;
			//document.getElementById(theTD).style.border = "1px solid #A9D1DF";	
			document.getElementById("thumbRolled").id = "thumbChosen";
			lastTD = lastRollTD;
		}
	}
}

function indexPageSwap(theSwitch) {
	switch (theSwitch) {
		case 0:
			return;
			break;
		case 1:
			portFromIndexLoad = 1;
			break;
		case 7:
			portFromIndexLoad = 1;
			break;
		default:
			return;
	}
}

function thumbHover(theTD) {
	if (theTD==lastTD) {
		return;
	} else {	
		document.getElementById(theTD).id = "thumbRolled";
		lastRollTD = theTD;
	}
}

function thumbOut(theTD) {
	if (theTD==lastTD || !document.getElementById("thumbRolled")) {
		return;
	} else {	
		document.getElementById("thumbRolled").id = theTD;	
	}
}

function blueNavHover(theID, hovering) {
	if (hovering) {
		document.getElementById(theID).style.visibility = "visible";
	} else {
		document.getElementById(theID).style.visibility = "hidden";	
	}
}
