function openMenu(a,e) {
	var menuClicked = a;
	var myClassName = menuClicked.className;
	if(myClassName.indexOf('select')!= -1){
		menuClicked.className = myClassName.replace('select','');
	} else {
		menuClicked.className = myClassName + 'select';
	};

	if (document.getElementById(e).style.display == 'none') {
		document.getElementById(e).style.display = 'block';
	} else {
		document.getElementById(e).style.display = 'none';
	}
}

function hideall() {
	var Nodes = document.getElementsByTagName('ul');
	var max = Nodes.length;
	for(var i = 0;i < max;i++) {
		var nodeObj = Nodes.item(i);
		nodeObj.style.display = 'none';
	}
	document.getElementById('menu').style.visibility = 'visible';
}


function collapseAll(){
	var Nodes = document.getElementsByTagName('a');
	var max = Nodes.length;
	for(var i = 0;i < max;i++) {
		var nodeObj = Nodes.item(i);
		if(nodeObj.className.indexOf('menuclass1select')!= -1){
			nodeObj.className = nodeObj.className.replace('select','');
		};
	}
}

function expandAll(){
	var Nodes = document.getElementsByTagName('ul');
	var max = Nodes.length;
	for(var i = 0;i < max;i++) {
		var nodeObj = Nodes.item(i);
		nodeObj.style.display = 'block';
	}
	
	var classesArray = new Array('menuclass1');
	var Nodes = document.getElementsByTagName('a');
	var max = Nodes.length;
	for(var i = 0;i < max;i++) {
		var nodeObj = Nodes.item(i);
		for(y=0;y<classesArray.length;y++){
			if(nodeObj.className == classesArray[y]){
				nodeObj.className = nodeObj.className + 'select';
			};
		}
	}
}
//----------------------------------------------------------------
// PRELOAD MENUS
//----------------------------------------------------------------
mainmenuArray = new Array(['mainmenu_0a','images/mainmenu/menu-01.gif'],
['mainmenu_0b','images/mainmenu/menu-02.gif'],
['mainmenu_0c','images/mainmenu/menu-03.gif'],
['mainmenu_1a','images/mainmenu/menu-04.gif'],
['mainmenu_1b','images/mainmenu/menu-05.gif'],
['mainmenu_1c','images/mainmenu/menu-06.gif'],
['mainmenu_1d','images/mainmenu/menu-07.gif'],
['mainmenu_2a','images/mainmenu/menu-08.gif'],
['mainmenu_2b','images/mainmenu/menu-09.gif'],
['mainmenu_2c','images/mainmenu/menu-10.gif'],
['mainmenu_3a','images/mainmenu/menu-11.gif'],
['mainmenu_3b','images/mainmenu/menu-12.gif'],
['mainmenu_3c','images/mainmenu/menu-13.gif'],
['mainmenu_4a','images/mainmenu/menu-14.gif'],
['mainmenu_4b','images/mainmenu/menu-15.gif'],
['mainmenu_4c','images/mainmenu/menu-16.gif'],
['mainmenu_4d','images/mainmenu/menu-17.gif'],
['mainmenu_5a','images/mainmenu/menu-18.gif'],
['mainmenu_5b','images/mainmenu/menu-19.gif'],
['mainmenu_5c','images/mainmenu/menu-20.gif'],
['mainmenu_6a','images/mainmenu/menu-21.gif'],
['mainmenu_6b','images/mainmenu/menu-22.gif'],
['mainmenu_6c','images/mainmenu/menu-23.gif'],
['logohome','images/banner/logo-hot.gif']);

function newPict(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}
function preloadPicts() {
	if (document.images) {
		for(x=0;x<mainmenuArray.length;x++){
			eval('over_' + mainmenuArray[x][0] + '= newPict(mainmenuArray[x][1])');
		}
	}
}
//----------------------------------------------------------------
imageCaptions = new Array(['vdl-01-01.jpg','Garden House from Edgewater Terrace'],
['vdl-01-02.jpg','View from Edgewater Terrace before Garden House'],
['vdl-01-03.jpg','View from Silver Lake Boulevard, looking South'],
['vdl-01-04.jpg','From the reservoir, 1932.'],
['vdl-01-05.jpg','View from Silver Lake Boulevard, looking East'],
['vdl-01-06.jpg','Main entrance'],
['vdl-01-07.jpg','Stairway leading to the second floor, on the left<br>is a view into the drafting room, 1932.'],
['vdl-01-08.jpg','Office bedroom, entrance level'],
['vdl-01-09.jpg','Garden House seen from main structure, 1950\'s.'],
['vdl-01-10.jpg','Garden House living room from patio'],
['vdl-01-11.jpg','Play Room, Garden House'],
['vdl-01-12.jpg','Garden Room South-West corner'],
['vdl-01-13.jpg','Garden Room looking out to patio'],
['vdl-01-14.jpg','Garden Room built-in bookshelves'],
['vdl-01-15.jpg','Living Room / dining area, 1934.'],
['vdl-01-16.jpg','Living Room / dining area, 1934.'],
['vdl-01-17.jpg','Living Room / dining area, 1934.'],
['vdl-01-18.jpg','Living Room'],
['vdl-01-19.jpg','Living Room looking at Reservoir'],
['vdl-01-20.jpg','View from the living room toward the terrace, late 1950\'s.'],
['vdl-01-21.jpg','Kitchen'],
['vdl-01-22.jpg','Kitchen'],
['vdl-01-23.jpg','Neutra\'s bed and work room "upper south", 1940\'s.'],
['vdl-01-24.jpg','Rooftop terrace looking South-West at Reservoir'],
['vdl-01-25.jpg','Dione Neutra resting on rooftop terrace'],
['vdl-01-26.jpg','Roof shelter with partial glazed windscreen, 1950\'s.'],
['vdl-01-27.jpg','Roof shelter, 1950\'s.'],
['vdl-02-01.jpg','Infrared photograph from Silver Lake Boulevard'],
['vdl-02-02.jpg','From Silver Lake Boulevard with San Gabriel Mountains'],
['vdl-02-03.jpg','From Silver Lake Boulevard'],
['vdl-02-04.jpg','From Silver Lake Boulevard'],
['vdl-02-05.jpg','Main entrance before installation of louvers'],
['vdl-02-06.jpg','Main entrance after installation of louvers'],
['vdl-02-07.jpg','Louvers'],
['vdl-02-08.jpg','Main entrance reflective pond'],
['vdl-02-09.jpg','Seminar Room from main entrance'],
['vdl-02-10.jpg','Stairs from Seminar Room'],
['vdl-02-11.jpg','Stairs with Garden House in background'],
['vdl-02-12.jpg','Seminar Room and Music Room'],
['vdl-02-13.jpg','Stairs, patio, and bridge to Garden House'],
['vdl-02-14.jpg','Patio, looking at bridge to Garden House'],
['vdl-02-15.jpg','Patio seen from South-West corner of Garden House'],
['vdl-02-16.jpg','Living Room with reflecting pool in background'],
['vdl-02-17.jpg','Living Room'],
['vdl-02-18.jpg','Living Room, stairs to penthouse,<br>and reflecting pool'],
['vdl-02-19.jpg','Living Room'],
['vdl-02-20.jpg','Dining area'],
['vdl-02-21.jpg','Living Room and dining area to the right'],
['vdl-02-22.jpg','Living Room'],
['vdl-02-23.jpg','Living Room with reflecting pool in background'],
['vdl-02-24.jpg','Living Room'],
['vdl-02-25.jpg','Breakfast Room and stairs down to entrance level'],
['vdl-02-26.jpg','Breakfast Room and hallway to bedrooms'],
['vdl-02-27.jpg','Breakfast Room and hallway to bedrooms'],
['vdl-02-28.jpg','Breakfast Room, hallway to bedrooms,<br>stairs to entrance level'],
['vdl-02-29.jpg','Kitchen as seen from Breakfast Room'],
['vdl-02-30.jpg','Bedroom balcony as seen from bridge'],
['vdl-02-31.jpg','Kitchen as seen from bedroom balcony'],
['vdl-02-32.jpg','Patio and House from roof of Garden House'],
['vdl-02-33.jpg','Penthouse, deck and reflecting pool'],
['vdl-02-34.jpg','Richard Neutra'],
['vdl-02-35.jpg','Penthouse, deck and reflecting pool'],
['vdl-02-36.jpg','Reservoir reflected in pool and penthouse windows'],
['vdl-02-37.jpg','Penthouse interior and reflecting pool'],
['vdl-02-38.jpg','Trees reflected in pool and penthouse windows'],
['vdl-02-39.jpg','Reservoir reflected in pool and penthouse windows'],
['vdl-02-40.jpg','Looking North to the Reservoir'],
['vdl-02-41.jpg','Looking North to the Reservoir'],
['vdl-02-42.jpg','Sunset reflected in pool with Reservoir in background'],
['vdl-02-43.jpg','Looking North, Reflecting Pool and Penthouse canopy']);
//----------------------------------------------------------------
function changeImage(me){
myThumbURL = me.parentNode.style.backgroundImage;
myBigPicURL = myThumbURL.replace("-thumb","");
document.getElementById("bigpic").style.backgroundImage = myBigPicURL;

	for(x=0;x<imageCaptions.length;x++){
		if(myBigPicURL.indexOf(imageCaptions[x][0]) != -1){
			document.getElementById("photo_caption").innerHTML = imageCaptions[x][1];
		}	
	}
}
//----------------------------------------------------------------
function changeElevation(whichMap){
	var myElevation = whichMap.id;
	document.getElementById("elevation").src = "images/elevations/" + myElevation + ".gif";
	document.getElementById("elevationLayer").style.visibility = "visible";

}
function closeElevation(){
	document.getElementById("elevationLayer").style.visibility = "hidden";
	document.getElementById("elevation").src = "images/common/spacer.gif";
}

function changeDrawing(whichDrawing,caption){
	var myDrawing = whichDrawing.id;
	var myDrawingTitle = document.getElementById(myDrawing).innerHTML;
	myDrawingTitle = myDrawingTitle.replace("<br>","");
	myDrawingTitle = myDrawingTitle.replace("<BR>","");
	document.getElementById("drawing").src = "images/drawings/" + myDrawing + ".gif";
	document.getElementById("drawing_caption").innerHTML = caption + ": " + myDrawingTitle;
}

function changePlan(whichPlan,caption){
	var myPlan = whichPlan.id;
	var myPlanTitle = document.getElementById(myPlan).innerHTML;
	myPlanTitle = myPlanTitle.replace("<br>","");
	myPlanTitle = myPlanTitle.replace("<BR>","");
	document.getElementById("plan").src = "images/plans/" + myPlan + ".gif";
	document.getElementById("plan_caption").innerHTML = caption + ": " + myPlanTitle;
}

function emailFunction(name,domain,domainExtension){
	window.location = "mailto:" + name + "@" + domain + "." + domainExtension;
}
