

function scanExamples(direction) {
if (direction=="right") scanNext();
if (direction=="left") scanPrev();
}



var currentPosition = 0;
var currentScreen = 1;
var screens = 3;
var degree = 60;
var speed = 10;

function scanNext() {
var theList = document.getElementById("examplesList");
var listWidth = theList.offsetWidth;
var distance = (listWidth/screens)*-1;

document.getElementById("left").style.display = "block";

theList.style.left = (theList.offsetLeft-degree)+"px";
currentPosition = currentPosition-degree;

animTimeout = setTimeout("scanNext()",speed);

if (currentPosition<=distance) {
	clearTimeout(animTimeout);
	currentScreen++;

	if (currentScreen>=screens) {
		document.getElementById("right").style.display = "none";
		}
	currentPosition = 0;
	}
}


function scanPrev() {
var theList = document.getElementById("examplesList");
var listWidth = theList.offsetWidth;
var distance = listWidth/screens;

document.getElementById("right").style.display = "block";

theList.style.left = (theList.offsetLeft+degree)+"px";
currentPosition = currentPosition+degree;

animTimeout = setTimeout("scanPrev()",speed);

if (currentPosition>=distance) {
	clearTimeout(animTimeout);
	currentScreen--;

	if (currentScreen<=1) {
		document.getElementById("left").style.display = "none";
		}
	currentPosition = 0;
	}
}


function showInfo(obj) {

var theExamples = document.getElementById("examplesList").getElementsByTagName("li");
var theInfo = document.getElementById("contentList").getElementsByTagName("div");

for (i=0;i<theInfo.length;i++) {
	theInfo[i].style.display = "none";
	}

for (j=0;j<theExamples.length;j++) {
	if (theExamples[j]==obj) {
		theInfo[j+1].style.display = "block";

		theExamples[j].getElementsByTagName("div")[1].style.display = "block";		

		}
	}
}

function hideInfo(obj) {

var theExamples = document.getElementById("examplesList").getElementsByTagName("li");
var theInfo = document.getElementById("contentList").getElementsByTagName("div");

for (i=0;i<theInfo.length;i++) {
	theInfo[i].style.display = "none";
	}

for (j=0;j<theExamples.length;j++) {
	theExamples[j].getElementsByTagName("div")[1].style.display = "none";		
	}


theInfo[0].style.display = "block";


}



function showDemo(obj) {

var selectedDemo;
var theExamples = document.getElementById("examplesList").getElementsByTagName("li");
for (i=0;i<theExamples.length;i++) {
	if (theExamples[i]==obj) {
		selectedDemo = i;
		}
	}

var demoArray = new Array(
"examples/chevron/products.html",
"examples/zinio/index.html",
"examples/engage/engage_1.html",
"examples/jigsaw/jigsaw_1.html",
"examples/crystalCruises/tour_the_ships/tour_harmony.html",
"examples/asi/asi_1.html",
"examples/halogenGuides/halogen_1.html",
"examples/wedriveu/wedriveu_1.html",
"http://www.spearstreetcapital.com",
"examples/veo/work.html",
"examples/razorgator/razorgator_1.html",
"http://www.millergroup.net"
);

var demoWindow = window.open(demoArray[selectedDemo],"demo","status=0, toolbar=0,location=0,menubar=0,scrollbars=1, height=700, width=1024");
demoWindow.focus();

}


function showContact() {

document.getElementById("contactName").innerHTML = "Mat Bergman";
document.getElementById("contactCompany").innerHTML = "Dynamic Interface Engineering, LLC";
document.getElementById("contactEmail").innerHTML = "<a href=\"mailto:mat@matbergman.com\">mat@matbergman.com<\/a>";
document.getElementById("contactPhone").innerHTML = "510-621-3278";
document.getElementById("contactInfo").style.display = "block";

document.getElementById("contactLink").onclick = hideContact;
document.getElementById("contactLink").innerHTML = "Close contact";

}

function hideContact() {
document.getElementById("contactInfo").style.display = "none";

document.getElementById("contactLink").onclick = showContact;
document.getElementById("contactLink").innerHTML = "Contact";
}


