


function test(id){
	alert('id: ' +id);
}


function buildNavBar(buildThis){

 

	var nav="none";

	// if no build this argument, use the URL to determin what to build
	// this code isn't completely working yet
	if((buildThis=="")||(buildThis==null)) {
		var url = document.location.href;

		if (url.indexOf('/') != -1) {

			while (url.indexOf('/') != -1) {
				url = url.substring((url.indexOf('/')+1),url.length);
			}
			nav=url;
		}
	}
	else nav = buildThis;

	//alert("buildNavBar(): " +nav);
	
	document.write('<div class="navBar">');
	document.write('<a class="MenuBarItem" id="root_00" name="root_00" target="_self" href="home.html" ><span class=faded>HOME</span></a><br />');
	document.write('<a class="MenuBarItem1" id="root_01" name="root_01" target="_self" href="money_4.html" ><span class=faded>STUFF WE DID FOR MONEY</span></a><br />');

	 if(nav=="money") {
     	document.write('<div class="MenuBarItemList"  id="sub_list_1" name="sub_list_1">');
			document.write('<a class="MenuBarSubItem" id="m4" name="m4" target="_self" href="money_4.html"><span class=faded>MARMOL + RADZINER</span></a> <br />');
			document.write('<a class="MenuBarSubItem" id="m6" name="m6" target="_self" href="money_6.html"><span class=faded>NATHALIE SAPHIER</span></a> <br />'); 
			document.write('<a class="MenuBarSubItem" id="m7" name="m7" target="_self" href="money_7.html"><span class=faded>HAPPY ENDING</span></a> <br />'); 
			//document.write('<a class="MenuBarSubItem" id="m8" name="m8" target="_self" href="money_8.html"><span class=faded>MARTA JOHANSEN</span></a> <br />'); 
			document.write('<a class="MenuBarSubItem" id="m5" name="m5" target="_self" href="money_5.html"><span class=faded>SIMONE WHITE</span></a> <br />');	
			document.write('<a class="MenuBarSubItem" id="m1" name="m1" target="_self" href="money_1.html"><span class=faded>WICK ARCHITECTURE</span></a> <br />');	
			//document.write('<a class="MenuBarSubItem" id="m2" name="m2" target="_self" href="money_2.html"><span class=faded>SEAN SMUDA PHOTOGRAPHER</span></a> <br />');
			//document.write('<a class="MenuBarSubItem" id="m3" name="m3" target="_self" href="money_3.html"><span class=faded>MARMOL RADZINER PREFAB</span></a> <br />');
			
		//document.write('<p>&nbsp;</p>');
 		document.write('</div>');
	 }

	document.write('<a class="MenuBarItem2" id="root_02" name="root_02" target="_self" href="fun_1.html"><span class=faded>STUFF WE DID FOR FUN</span></a><br />');

	 if(nav=="fun") {
		 document.write('<div class="MenuBarItemList" id="sub_list_2">');
			document.write('<a class="MenuBarSubItem" id="f1" name="f1" target="_self" href="fun_1.html"><span class=faded>MOUSE CHIMES</span></a> <br />');
			document.write('<a class="MenuBarSubItem" id="f5" name="f5" target="_blank" href="jallery/home.html"><span class=faded>JALLERY IMAGE GALLERY</span></a> <br />');
			//document.write('<a class="MenuBarSubItem" id="f2" name="f2" target="_self" href="fun_2.html"><span class=faded>3 CAMPSITES</span></a> <br />');
			document.write('<a class="MenuBarSubItem" id="f3" name="f3" target="_self" href="fun_3.html"><span class=faded>COLOR CURVE</span></a> <br />');
			document.write('<a class="MenuBarSubItem" id="f4" name="f4" target="_self" href="fun_4.html"><span class=faded>TOMAS TRANSTROMER</span></a> <br />');
		//document.write('<p>&nbsp;</p>');
  		document.write('</div>');
	 }
	 /*
	 document.write('<a class="MenuBarItem4" id="root_03" name="root_03" target="_self" href="wish_1.html"><span class=faded>STUFF WE LIKE</span></a><br />');

	 if(nav=="wish") {
		 document.write('<div class="MenuBarItemList" id="sub_list_3">');
		 	 //document.write('<a class="MenuBarSubItem" id="w5" name="w5" target="_self" href="wish_5.html"><span class=faded>REKA NYARI</span></a> <br />');	 
			 document.write('<a class="MenuBarSubItem" id="w1" name="w1" target="_self" href="wish_1.html"><span class=faded>FOR THE LOVE OF GOD</span></a> <br />');
			 document.write('<a class="MenuBarSubItem" id="w3" name="w3" target="_self" href="wish_3.html"><span class=faded>MAURIE & EVE</span></a> <br />');
			 //document.write('<a class="MenuBarSubItem" id="w4" name="w4" target="_self" href="wish_4.html"><span class=faded>GOLDFRAPP</span></a> <br />');
			 document.write('<a class="MenuBarSubItem" id="w2" name="w2" target="_self" href="wish_2.html"><span class=faded>LILIANA PORTER: REHEARSAL</span></a> <br />');
			 
			// document.write('<p>&nbsp;</p>');
  		document.write('</div>');
	 }
	*/
	document.write('<a class="MenuBarItem5" id="root_04" name="root_04" target="_self" href="411.html" ><span class=faded>STUFF WE DO</span></a><br />');
	document.write('<a class="MenuBarItem3" id="root_05" name="root_05" target="_self" href="911.html" ><span class=faded>CONTACT US</span></a><br />');
 	document.write('</div>');
	
	var getSmall=26;
	var selectedSmall=26;
	
	if(nav=="money") {
		
		document.getElementById('root_01').style.fontSize=selectedSmall+'px';
		
	 	document.getElementById('root_00').style.fontSize=getSmall+'px';
	 	document.getElementById('root_02').style.fontSize=getSmall+'px';
		document.getElementById('root_03').style.fontSize=getSmall+'px';
		document.getElementById('root_04').style.fontSize=getSmall+'px';
		document.getElementById('root_05').style.fontSize=getSmall+'px';
		 
	}
	else if(nav=="fun") {
		
		document.getElementById('root_02').style.fontSize=selectedSmall+'px';
		
	 	document.getElementById('root_00').style.fontSize=getSmall+'px';
	 	document.getElementById('root_01').style.fontSize=getSmall+'px';
		document.getElementById('root_03').style.fontSize=getSmall+'px';
		document.getElementById('root_04').style.fontSize=getSmall+'px';
		document.getElementById('root_05').style.fontSize=getSmall+'px';
	}
	else if(nav=="wish") {
		
		document.getElementById('root_03').style.fontSize=selectedSmall+'px';
		
	 	document.getElementById('root_00').style.fontSize=getSmall+'px';
	 	document.getElementById('root_01').style.fontSize=getSmall+'px';
		document.getElementById('root_02').style.fontSize=getSmall+'px';
		document.getElementById('root_04').style.fontSize=getSmall+'px';
		document.getElementById('root_05').style.fontSize=getSmall+'px';
	}

	selectNavBar();
}



function selectNavBar(path) {

	//var url= window.parent.mainFrame.document.location.href;
	var nav="none";

	if((path=="")||(path==null)) {
		var url = document.location.href;
		if (url.indexOf('/') != -1) {

			while (url.indexOf('/') != -1) {
				url = url.substring((url.indexOf('/')+1),url.length);
			}
			nav=url;
		}
	}
	else nav = path;

	//alert("selectNavBar() url:" +nav);
	 
	var theLink;
	
		switch (nav) {

			case "index.html": theLink=document.getElementById('root_00'); break;
			case "home.html": theLink=document.getElementById('root_00'); break;

			case "money_1.html": theLink=document.getElementById('m1'); break;
			case "money_2.html": theLink=document.getElementById('m2'); break;
			case "money_3.html": theLink=document.getElementById('m3'); break;
			case "money_4.html": theLink=document.getElementById('m4'); break;
			case "money_5.html": theLink=document.getElementById('m5'); break;
			case "money_6.html": theLink=document.getElementById('m6'); break;
			case "money_7.html": theLink=document.getElementById('m7'); break;
			case "money_8.html": theLink=document.getElementById('m8'); break;
	 
 			case "fun_1.html": theLink=document.getElementById('f1'); break;
			case "fun_2.html": theLink=document.getElementById('f2'); break;
			case "fun_3.html": theLink=document.getElementById('f3'); break;
			case "fun_4.html": theLink=document.getElementById('f4'); break;
			case "fun_5.html": theLink=document.getElementById('f5'); break;
			
			case "wish_1.html": theLink=document.getElementById('w1'); break;
			case "wish_2.html": theLink=document.getElementById('w2'); break;
			case "wish_3.html": theLink=document.getElementById('w3'); break;
			case "wish_4.html": theLink=document.getElementById('w4'); break;
			case "wish_5.html": theLink=document.getElementById('w5'); break;

			case "411.html": theLink=document.getElementById('root_04'); break;
			case "411_html.html": theLink=document.getElementById('root_04'); break;
			case "411_flash.html": theLink=document.getElementById('root_04'); break;
			case "411_intelligence.html": theLink=document.getElementById('root_04'); break;
			case "411_css.html": theLink=document.getElementById('root_04'); break;
			case "411_javascript.html": theLink=document.getElementById('root_04'); break;
			case "411_creativity.html": theLink=document.getElementById('root_04'); break;
			case "411_java.html": theLink=document.getElementById('root_04'); break;
			case "411_flex.html": theLink=document.getElementById('root_04'); break;
			case "411_love.html": theLink=document.getElementById('root_04'); break;	
			
			case "911.html": theLink=document.getElementById('root_05'); break;

			default: theLink=document.getElementById('root_00'); break;
		}
		
		theLink.className="selected";
		theLink.active=true;
		//theLink.focus();
	}

 

/******* div vertical centering code *************/

function align()
{
	var lmt = document.getElementById('splash_center');	 
	var container = document.documentElement;

//alert("lmt: " +lmt+ " container: " +container);

	if(lmt && container){
		
	    var containerHeight;
		var lmtHeight;
			
	    if (container.innerWidth) containerHeight = container.innerHeight;
		else containerHeight = container.clientHeight;
	
	    
		if (lmt.innerWidth) lmtHeight = lmt.innerHeight;
		else lmtHeight = lmt.offsetHeight;
		
		var y = Math.ceil((containerHeight - lmtHeight) / 2);
		if(y < 0) y = 0;

		lmt.style.position = "relative";
		lmt.style.top = y + "px";
	}
	
	
	if (document.getElementById) document.body.style.visibility = 'visible';
	
	/* make the center div visible now that the centering is finished */
	if(document.getElementById('splash_center')!=null) document.getElementById('splash_center').style.visibility = 'visible'; 
}

function hideIntroImage() {
	if(document.getElementById('introImage')!=null) document.getElementById('introImage').style.visibility = 'hidden'; 
}

function addevent(obj,evt,fn,capt){
	
	if(obj.addEventListener){
		obj.addEventListener(evt, fn, capt);
		return true;
	}
	else if(obj.attachEvent){
		obj.attachEvent('on'+evt, fn);
		return true;
	}
	else return false;
}

/* now add the events to the event manager */
 
if (document.getElementById && document.getElementsByTagName){
		addevent(window, 'load', align, false);
		addevent(window, 'resize', align, false);
}
 
/************* dreamweaver javascript *************/

function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

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];}
}
