/* 
  ------------------------------------------------
  JETENGINE Image & Meta Data Script
  C0D3D by Gunnar Leffler
  http://www.leftech.com
  custom made for diegourrutia.com
  Get your site revvin like a 747 jet engine
  ------------------------------------------------
*/

//START GLOBAL VARIABLES
var theBigPictureURL ="";
var ndx =0;
var slides;

var imgs = new Array();
var cf_indexer = 0;

var t,t1,t2;
var picURL = ""; 

//END GLOBAL VARIABLES

function populateSideNav ()
{
	var txt = '';    
	var temp;
	var i = 0;
	var j = 0;
      var idnum = 0;//This is for the id of each thumbnail
	for ( i = 0; i < slides.length; i++)
	{
     	 for ( j = 0; j < 4; j++)
	 {
	   temp = slides[i][j];
	   if (temp != "null")
	   {
	    if (temp.charAt(0) != "i")   
	    {
		idnum = (i+1)*6+(j+1);
		removeT(temp);
 		txt += '<img src ="'+temp+'" style="cursor: pointer;" onclick ="document.getElementById(\'slide\').src = \''+picURL+'\';document.getElementById(\'comment\').innerHTML = \'&nbsp;'+slides[i][4]+'\';" id = "th'+idnum+'" onmouseover = "setOpacity(\'th'+idnum+'\',25);" onmouseout = "setOpacity(\'th'+idnum+'\',20);" onload = "setOpacity(\'th'+idnum+'\',20);" >&nbsp;';
	    } else 
	    {
             txt += '<img src = "'+temp+'" &nbsp;>';
	    }
	   }
	 }
	txt += '<br>';
   }
  document.getElementById('navigate').innerHTML = txt;
}

function initializePage (pageType)
{
 if (pageType == "Architecture")
 {
slides = new Array(
["arch/a2_p1t.jpg","arch/a2_p2t.jpg","arch/a2_p3t.jpg","arch/a2_p4t.jpg","<u>Blue(5) Tower</u>&nbsp;-&nbsp;This concept explores an idea of 5 residences on a vertical lineup, the building has two wings facing east and west that contain solar panels designed to provide both the cooling and the heating requirements and contribute with the energy as well. A roof terrace is located between houses."],
["arch/a18_p1t.jpg","arch/a18_p2t.jpg","arch/a18_p3t.jpg","arch/a18_p4t.jpg","<u>Compassed House</u>&nbsp;-&nbsp;An experiment that embraces three perceptions: Monumentality, Openness and Concealment. Concepts that at times seem antagonic."],
["arch/a17_p1t.jpg","arch/a17_p2t.jpg","arch/a17_p3t.jpg","arch/a17_p4t.jpg","<u>PV Shopping Center</u>&nbsp;-&nbsp;A shopping center with fourteen stores suspended on water, designed for a site by the ocean.(not built)"],
["arch/a6_p1t.jpg","arch/a3_p1t.jpg","arch/a3_p2t.jpg","arch/a8_p2t.jpg","<u>Tonala Jewelry Center</u>&nbsp;-&nbsp;A complex for the jewelry industry, containing 200 spaces for wholesale and retail.<br>Under development. Tonala Mexico."],
["arch/a3_p3t.jpg","arch/a3_p4t.jpg","arch/a3_p5t.jpg","null","<u>Tonala Jewelry Center</u>&nbsp;-&nbsp;A complex for the jewelry industry, containing 200 spaces for wholesale and retail.<br>Under development. Tonala Mexico."],
["arch/a21_p1t.jpg","arch/a21_p2t.jpg","arch/a21_p3t.jpg","arch/a21_p4t.jpg","<u>Eugene Track and Field Memorial</u>"],
["arch/a21_p5t.jpg","arch/a21_p6t.jpg","null","null","<u>Eugene Track and Field Memorial</u>"],
["arch/a19_p1t.jpg","arch/a19_p2t.jpg","arch/a19_p3t.jpg","null","<u>35th Ave Loft</u>&nbsp;-&nbsp;1,400 sf. Eugene Oregon. Under development."],
["arch/a20_p1t.jpg","arch/a20_p2t.jpg","null","null","Office for an industrial complex.<br> Zapopan Mexico (not built)."],
["arch/a1_p1t.jpg","arch/a1_p2t.jpg","arch/a1_p3t.jpg","arch/a1_p4t.jpg","Instituto de Ciencias High School building. Completed in 2007"],
["arch/a7_p1t.jpg","arch/a7_p2t.jpg","arch/a7_p3t.jpg","arch/a7_p4t.jpg","<u>Campus</u>&nbsp;-&nbsp;UAG Campus competition. Tepic, Mex."],
["arch/a6_p11t.jpg","arch/a7_p5t.jpg","arch/a6_p9t.jpg","arch/a6_p10t.jpg","<u>Campus</u>&nbsp;-&nbsp;UAG Campus competition. Tepic, Mex."],
["arch/a6_p2t.jpg","arch/a6_p3t.jpg","arch/a6_p4t.jpg","null","<u>Campus</u>&nbsp;-&nbsp;UAG Campus competition. Tepic, Mex."],
["arch/a6_p5t.jpg","arch/a6_p6t.jpg","arch/a6_p7t.jpg","arch/a6_p8t.jpg","<u>Campus</u>&nbsp;-&nbsp;UAG Campus competition. Tepic, Mex."],
["arch/a13_p1t.jpg","arch/a13_p2t.jpg","arch/a13_p3t.jpg","design/d9_p1t.jpg","Offices for Urrutia-Michel, Guadalajara, Mex. completed 2001"],
["arch/a10_p1t.jpg","arch/a10_p2t.jpg","null","null","House for Cesar Hernandez. (not Built)"],
["arch/a9_p1t.jpg","arch/a9_p2t.jpg","arch/a9_p3t.jpg","null","Competition for JVC information center.  2000"],
["arch/a5_p1t.jpg","null","null","null","Housing competition for Aomori, Japan."],
["arch/a16_p1t.jpg","arch/a16_p2t.jpg","arch/a16_p3t.jpg","arch/a16_p4t.jpg","Av &quot;C&quot; loft. Zapopan, Mex. Completed in 2005"],
["arch/a12_p1t.jpg","arch/a12_p2t.jpg","arch/a12_p3t.jpg","arch/a12_p4t.jpg","<u>8th St. Loft</u>&nbsp;-&nbsp; Zapopan, Mex. Completed 2001."],
["design/d21_p1t.jpg","null","null","null","<u>Metal Loft</u>&nbsp;-&nbsp; "],
["arch/a14_p1t.jpg","null","null","null","<u>Warehouse</u>&nbsp;-&nbsp; (Not built)"],
["arch/a15_p1t.jpg","arch/a11_p4t.jpg","arch/a15_p2t.jpg","null","<u>A-Frame House</u>&nbsp;-&nbsp; &quot;A&quot; frame addition. Pinetop, Arizona,1998"],
["arch/a11_p1t.jpg","arch/a11_p2t.jpg","arch/a11_p3t.jpg","null","<u>Villa</u>&nbsp;-&nbsp; House remodeling, Zapopan Mexico. 1999"]


);
} else 
{
slides = new Array(
["img/sep1.gif","null","null","null",""],
["design/d1_p1t.jpg","design/d1_p2t.jpg","design/d1_p3t.jpg","design/d3_p2t.jpg","Furniture Design"],
["design/d2_p1t.jpg","design/d2_p2t.jpg","design/d2_p3t.jpg","design/d3_p3t.jpg","Furniture Design"],
["design/d4_p1t.jpg","design/d10_p2t.jpg","design/d9_p2t.jpg","design/d11_p1t.jpg","Furniture Design"],
["design/d15_p1t.jpg","design/d16_p1t.jpg","design/d17_p1t.jpg","design/d18_p1t.jpg","Furniture Design"],
["design/d19_p1t.jpg","design/d20_p1t.jpg","design/d24_p1t.jpg","design/d26_p1t.jpg","Furniture Design"],
["design/d29_p1t.jpg","design/d31_p1t.jpg","null","null","Furniture Design"],
["img/sep2.gif","null","null","null",""],
["design/d5_p1t.jpg","design/d6_p1t.jpg","design/d7_p1t.jpg","design/d7_p2t.jpg","Exhibit And Product Design"],
["design/d8_p1t.jpg","design/d12_p1t.jpg","design/d12_p2t.jpg","design/d13_p1t.jpg","Exhibit And Product Design"],
["design/d14_p1t.jpg","design/d22_p2t.jpg","design/d23_p1t.jpg","design/d30_p1t.jpg","Exhibit And Product Design"],
["design/d25_p1t.jpg","design/d25_p2t.jpg","design/d25_p4t.jpg","design/d25_p5t.jpg","Exhibit And Product Design"],
["design/d27_p1t.jpg","design/d28_p1t.jpg","null","null","Exhibit And Product Design"]


);
}
 populateSideNav();
}

function removeT (s)
{
  var i;
  var retval = "";
  for (i = 0; i < s.length; i++)
  {
	  if (s.charAt(i) != "t") retval += s.charAt(i);//s[i];
  }
 picURL = retval;
}

function setOpacity(id, value)
{
	document.getElementById(id).style.opacity = value/25;
	document.getElementById(id).style.filter = 'alpha(opacity=' + value*4 + ')';

}

function preload ()
{
 for (var i = 0;i < slides.length;i++) 
 {
  imgs[i] = new Image ();
  imgs[i].src = slides[i][0];
 }
}

function FadeOut()
{
 var o =arguments[0];
 if (o != 0)
 {
  setOpacity('slidefront',o);
  o--;
  t = setTimeout('FadeOut('+o+');',o*3);
 } else setOpacity ('slidefront',0);

}

function NextImage ()
{


 document.getElementById('slidefront').src = slides[cf_indexer][0];
 window.status = cf_indexer;
 cf_indexer++;
 if (cf_indexer >= slides.length) cf_indexer = 0;
 document.getElementById('slideback').style.background = 'url('+slides[cf_indexer][0]+')';//I really like FireFox, but damn...
 FadeOut(25);
 document.getElementById('caption').innerHTML = slides[cf_indexer][1];
}


function PrevImage ()
{
 
 document.getElementById('slidefront').src = slides[cf_indexer][0];
 window.status = cf_indexer;
 cf_indexer--;
 if (cf_indexer == -1) cf_indexer = slides.length-1;
 document.getElementById('slideback').style.background = 'url('+slides[cf_indexer][0]+')';
 FadeOut(25);
 document.getElementById('caption').innerHTML = slides[cf_indexer][1];
}

function toTop(id){
document.getElementById(id).scrollTop=0
}

function scrollDivDown(id,step){
t  = 0;
document.getElementById(id).scrollTop+=step
step--;
if (step > 0) t=setTimeout("scrollDivDown('"+id+"',"+step+")",2); else document.getElementById(id).scrollTop+=1;

}

function scrollDivUp(id,step){
t  = 0;
document.getElementById(id).scrollTop-=step
step--;
if (step > 0) t=setTimeout("scrollDivUp('"+id+"',"+step+")",2); else document.getElementById(id).scrollTop-=1;

}

function toBottom(id){
document.getElementById(id).scrollTop=document.getElementById(id).scrollHeight
}

function toPoint(id){
document.getElementById(id).scrollTop=100
} 








