doneLoading = false;

arrowImage = new Image();
arrowImage.src = "images/arrow.gif";

spacerImage = new Image();
spacerImage.src = "images/spacer.gif";

currentPage = null;

function arrowOn(which) { if (document.images) {
	document.images['arrow-'+which].src = arrowImage.src;
}}

function arrowOff(which) { if (document.images && which != currentPage) {
	document.images['arrow-'+which].src = spacerImage.src;
}}

function initMenu(which) {
	currentPage = which;
	arrowOn(which);
}

function enlarge(img,vert) {
	if (!vert) {
		var theWindow = window.open("enlarge.html?img="+escape(img),"b2_win","width=540,height=390,directories=no,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no");
	} else {
		var theWindow = window.open("enlargev.html?img="+escape(img),"b2_win","width=390,height=540,directories=no,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no");
	}
	if (theWindow.opener == null) theWindow.opener = window;
	theWindow.opener.name = "opener";
	if (theWindow.focus) theWindow.focus();
}

function portfolio(cat,img,w,h,dir) {
	if (!dir) dir = 'port';
	var theWindow = window.open("enlarge.html?img="+escape(dir+"/"+cat+"/"+img),"b2_win","width="+w+",height="+h+",directories=no,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no");
	if (theWindow.opener == null) theWindow.opener = window;
	theWindow.opener.name = "opener";
	if (theWindow.focus) theWindow.focus();
}

function caseEnlarge(cat,img,w,h) {
	portfolio(cat,img,w,h,'case');
}

function caseStudy(which) {
	window.open('case-'+which+'.html', 'B2CaseStudy','left=25,top=25,status=no,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no,width=647,height=345');
}

currentBlock = null;
numBlocks = null;
blockLayers = new Array();
contentFrame = null;

function initBlocks(noShow) {
	
	for (var i=0; i<numBlocks; i++) {
		blockLayers[i] = new DHTMLLayer('block'+(i+1));
	}
	if (!noShow) show(blockLayers[0]);
	if (!noShow) { currentBlock = 0; } else { currentBlock = null; }
	doneLoading=true;
}

function nextBlock() {
	oldBlock = currentBlock;
	if (currentBlock == numBlocks-1) {
		currentBlock=0;
	} else {
		currentBlock++;
	}
	hide(blockLayers[oldBlock]);
	show(blockLayers[currentBlock]);
}

function prevBlock() {
	oldBlock = currentBlock;
	if (currentBlock == 0) {
		currentBlock=numBlocks-1;
	} else {
		currentBlock--;
	}
	hide(blockLayers[oldBlock]);
	show(blockLayers[currentBlock]);
}

function jumpBlock(which) {
	hide(blockLayers[currentBlock]);
	show(blockLayers[(which-1)]);
	currentBlock = (which-1);
}

function showBlock(which) {
	for (var i=0; i<blockLayers.length; i++) {
		if ((i+1) == which) { //alert('showing '+(i+1));
			show(blockLayers[i]);
		} else { //alert('hiding '+(i+1));
			hide(blockLayers[i]);
		}
	}
}

function hideBlock(which) {
	for (var i=0; i<blockLayers.length; i++) {
		if ((i+1) == which) hide(blockLayers[i]);
	}
}