// JavaScript Document
//var thisPic=0 //index to pictures array for left project nav
var projPic=0 //index to pictures array for bottom project images
var next = "images/downarrow.gif"
var previous = "images/uparrow.gif"
var projnext = "images/proj_right_arrow.gif"
var projprevious = "images/proj_left_arrow.gif"
var blank = "images/blank.gif"
var imgCt = myJSVars.length-5
var projimgCt = myProjVars.length-7

 function getlink(theURL,pos) { //v2.0
 
 thisPic=pos; //index to pictures array for left project nav
 
 var LinkUrl = pgLink[theURL];
 	LinkUrl = LinkUrl+"&img="+pos;
	window.location=LinkUrl}

	function processPrevious() {
		if (document.images && thisPic > 0) {
			thisPic--
			document.thumbnail1.src= myJSVars[thisPic]
			document.thumbnail2.src= myJSVars[thisPic+1]
			document.thumbnail3.src= myJSVars[thisPic+2]
			document.thumbnail4.src= myJSVars[thisPic+3]
			document.thumbnail5.src= myJSVars[thisPic+4]
			if(thisPic==0){
			document.previous.src=blank
			}
			if(thisPic==imgCt){
			document.next.src=blank
			}
			else document.next.src=next
		}
	}
	function processNext() {
		if(document.images && thisPic < imgCt) {
			thisPic++
			document.thumbnail1.src= myJSVars[thisPic]
			document.thumbnail2.src= myJSVars[thisPic+1]
			document.thumbnail3.src= myJSVars[thisPic+2]
			document.thumbnail4.src= myJSVars[thisPic+3]
			document.thumbnail5.src= myJSVars[thisPic+4]
			if(thisPic==0){
			document.previous.src=blank
			}
			else document.previous.src=previous
			}
		if(thisPic==imgCt){
		document.next.src=blank
		}
		else document.next.src=next
		
	}
	
	function projectPrevious() {
		if (document.images && projPic > 0) {
			projPic--
			document.pthumbnail1.src= myProjVars[projPic]
			document.pthumbnail2.src= myProjVars[projPic+1]
			document.pthumbnail3.src= myProjVars[projPic+2]
			document.pthumbnail4.src= myProjVars[projPic+3]
			document.pthumbnail5.src= myProjVars[projPic+4]
			document.pthumbnail6.src= myProjVars[projPic+5]
			document.pthumbnail7.src= myProjVars[projPic+6]
			if(projPic==0){
			document.projprevious.src=blank
			}
			if(projPic==projimgCt){
			document.projnext.src=blank
			}
			else document.projnext.src=projnext
		}
	}
	function projectNext() {
		if(document.images && projPic < projimgCt) {
			projPic++
			document.pthumbnail1.src= myProjVars[projPic]
			document.pthumbnail2.src= myProjVars[projPic+1]
			document.pthumbnail3.src= myProjVars[projPic+2]
			document.pthumbnail4.src= myProjVars[projPic+3]
			document.pthumbnail5.src= myProjVars[projPic+4]
			document.pthumbnail6.src= myProjVars[projPic+5]
			document.pthumbnail7.src= myProjVars[projPic+6]
			if(projPic==0){
			document.previous.src=blank
			}
			else document.projprevious.src=projprevious
			if(projPic==projimgCt){
			document.projnext.src=blank
			}
			else document.projnext.src=projnext
		}
	}

function checkNav(indexVal) {
	var checkVal = myJSVars.length
	if((indexVal+5) >= checkVal) {
		document.next.src=blank
		}
	}

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

  function swapPic(img) {
    document['mainPhoto'].src = img;
  }
  
// function getlink(theURL) { //v2.0
//	window.location=myDescr[theURL][1];
//} 
    function swapDesc(imgMsg) {	 
	 // Change Text On Screen
			 try{ // Using a try statement to prevent javascript errors from showing up and/or halting other scripts
				var txtOBJ = document.getElementById("archDescr");
				var txtOBJa = document.getElementById("landDescr");
				var txtOBJb = document.getElementById("imgDescr");
				if (architect[imgMsg] != "") {
				txtOBJ.innerHTML = "Architect:<br>"+ architect[imgMsg];
				}
				if (landscape[imgMsg] != "") {
					txtOBJa.innerHTML = "Landscape Architect:<br>"+ landscape[imgMsg];
				}
				if (myDescr[imgMsg] != "") {
					txtOBJb.innerHTML = "<span class='smalltextblue'>"+ myDescr[imgMsg] +"</span>";
				}
			}catch( er ){  alert("JavaScript Error: " + er );  return; } // Custom error alert. wrap alert statement with /* */ to hide all errors for this chunk of code
  }
      function clearDesc() {	 
	 // Change Text On Screen
			 try{ // Using a try statement to prevent javascript errors from showing up and/or halting other scripts
				var txtOBJ = document.getElementById("archDescr");
				var txtOBJa = document.getElementById("landDescr");
				var txtOBJb = document.getElementById("imgDescr");
				txtOBJ.innerHTML = "";
				txtOBJa.innerHTML = "";
				txtOBJb.innerHTML = "";
			}catch( er ){  alert("JavaScript Error: " + er );  return; } // Custom error alert. wrap alert statement with /* */ to hide all errors for this chunk of code
  }
    function projDesc(proj) {	 
	 // Change Text On Screen
			 try{ // Using a try statement to prevent javascript errors from showing up and/or halting other scripts
				var txtOBJ2 = document.getElementById("projDescr");
				//txtOBJ2.innerHTML = myDescr[proj][2];
			}catch( er ){  alert("JavaScript Error: " + er );  return; } // Custom error alert. wrap alert statement with /* */ to hide all errors for this chunk of code
  }


  
//  function MM_openBrWindow(theURL) { //v2.0
//  window.open(theURL);
//}


function MM_openBrWindow(theURL) { //v2.0
	window.open('bigImage.php?pic='+theURL);
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}