// JavaScript Document
document.onclick = pickPg;
if (document.images) {
    var boardNum = 0;
    var boardSpeed = 6000;

    // Create an array of images for the billboard 
    var billboard = new Array();
    billboard[0] = new Image();
    billboard[0].src = "images/flip1.png";
    billboard[1] = new Image();
    billboard[1].src = "images/flip2.png";
    billboard[2] = new Image();
    billboard[2].src = "images/flip3.png";

    // Create an array of URLs that correspond to the images
    var url = new Array();
    url[0] = "#";
    url[1] = "#";
    url[2] = "#";
}

// Function to rotate the images on the billboard
function rotateBoard() {
    if (boardNum < (billboard.length - 1)) {
         boardNum++;
    }
    else {
        boardNum = 0;
    }
    document.billboard.src = billboard[boardNum].src;
    setTimeout('rotateBoard()', boardSpeed);
}

// Function to load the appropriate URL when the user clicks on an image
function jumpBillboard() {
    window.location = url[boardNum];
}

function pickPg() {

	var ev = arguments[0] || window.event,
	origEl = ev.target || ev.srcElement;
	
	if (origEl.id == "pg_a" && origEl.className != "selected") {
		
		var pos = (parseInt(origEl.innerHTML)-1)*(-1450);
		
		document.getElementById(origEl.parentNode.parentNode.parentNode.id).scrollIntoView(true);
		
		document.getElementById(origEl.parentNode.parentNode.id).setAttribute("style", "top:"+pos+"px;");
	
	} // end if
	
	if ( origEl.id == "pg_d" && origEl.className != "selected") {
		
		var pos = (parseInt(origEl.innerHTML)-1)*(-1020);
		
		document.getElementById(origEl.parentNode.parentNode.parentNode.id).scrollIntoView(true);
		
		document.getElementById(origEl.parentNode.parentNode.id).setAttribute("style", "top:"+pos+"px;");
	
	} // end if
	
} // end function

function MM_openBrWindow(theURL,winName,features) { 

  window.open(theURL,winName,features);

} // end function

/*function goto() {
	
	var query = window.location.search;
	
	if (query == "?0") {//Flash
		
		show(0, 1450);
		
		window.location = "#flash";
		
	} // end if
	
	else if (query == "?1") {//javascript, php
		
		show(1, 1450);
		
		window.location = "#brussels";
		
	} // end if
	
	else if (query == "?2") {//AS3
		
		show(1, 1450);
		
		window.location = "#flash";
		
	} // end if
	
	if (query == "?3") {//Print Design, CS3
		
		show(2, 1450);
		
		window.location = "#print";
		
	} // end if
	
	if (query == "?4") {//Branding Projects
		
		show(3, 1010);
		
		window.location = "#brand";
		
	} // end if
	
	if (query == "?5") {// xml
		
		show(1, 1450);
		
		window.location = "#snapApp";
		
	} // end if
	
} // end function

function show(int, num) {
	
	var tabs = new Array(document.getElementById("tab1"), document.getElementById("tab2"), document.getElementById("tab3"), document.getElementById("tab4"));
	
	var tabPos = new Array(-3, -110, -217, -324);
	
	tabs[int].setAttribute("class", "selected");
	
	tabs[int].childNodes[1].setAttribute("style", "visibility:visible;position:relative;left:"+tabPos[int]+"px;height:"+num+"px;"); 
	
	tabs[int].parentNode.parentNode.setAttribute("style", "height:"+(num+400)+"px;");
	
	document.getElementById("tabArea").setAttribute("style", "height:"+num+"px;");
	
	
	for (var i=0;i<tabs.length;i++) {
		
		if(i!=int) {
			
			tabs[i].setAttribute("class", "tabs");	
			
			tabs[i].childNodes[1].setAttribute("style", "visibility:hidden;position:relative;left:"+tabPos[i]+"px;");
			
		} // end if
		
	} // end for
	
	document.onclick = pickPg;
	
} // end function*/



