// JavaScript Document
currentDir = currentDirectory();

URLparams = location.href.split("?");
if (URLparams.length > 1) {
	var newLoc = newLoc+"?"+URLparams[1];
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
	alert("MM_showHideLayers - i: "+i+"  v: "+v);
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

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 goPage(pg) {
	//alert("goPage0 - pg: "+pg);
	switch (pg) {
	case "1-0" : locationBuff = "portfolio_awards.html"; break;
	case "1-1" : locationBuff = "portfolio_awards.html"; break;
	case "1-2" : locationBuff = "gallery_Arroyo_Trabuco.html"; break;
	case "1-3" : locationBuff = "portfolio_projects_recent.html"; break;
	case "2-0" : locationBuff = "team_tom_lehman_bio.html"; break;
	case "2-1" : locationBuff = "team_tom_lehman_bio.html"; break;
	case "2-2" : locationBuff = "team_chris_brands_bio.html"; break;
	case "2-3" : locationBuff = "team_joni_summers_bio.html"; break;
	case "3-0" : locationBuff = "media_articles.html"; break;
	case "3-1" : locationBuff = "media_articles.html"; break;
	case "3-2" : locationBuff = "media_photography.html"; break;
	case "3-3" : locationBuff = "media_publication.html"; break;
	case "4-0" : locationBuff = "philosophy.html"; break;
	case "5-0" : locationBuff = "process.html"; break;
	case "6-0" : locationBuff = "history.html"; break;
	case "7-0" : locationBuff = "testimonials.html"; break;
	case "8-0" : locationBuff = "contactus.aspx"; break;
	default : alert("page: "+pg+" not found");
	}
	
	if (URLparams.length > 1) {
		var locationBuff = locationBuff+"?"+URLparams[1];
	}
	window.location = locationBuff;
}

function currentDirectory() {
	//alert("currentDirectory() - window.location: "+window.location);
	var dirsBuff = String(window.location);
	//var dirsBuff = "arf/woof/bark/yip";
	var dirsBuffArray = dirsBuff.split("/");
	//alert("currentDirectory() - window.location: "+window.location+"  **current directory: "+dirsBuffArray[dirsBuffArray.length - 2]);
	return dirsBuffArray[dirsBuffArray.length - 2];
}

function layerObscure() {
	//keeps spider content layer from showing without letting spider know
	var buff1 = "visibility";
	var buff2 = "hidden";
	document.write(buff1+":"+buff2);
}

function showContactForm(lvl,butnLoc) {
	var URLparams = location.href.split("?");
	if (lvl==undefined) {
		var newLoc = "../infoForm.php";
	} else if (lvl == 0) {
		var newLoc = "infoForm.php";
	} else if (lvl == 1) {
		var newLoc = "../infoForm.php";
	} else if (lvl == 2) {
		var newLoc = "../../infoForm.php";
	}
	if (URLparams.length > 1) {
		var newLoc = newLoc+"?"+URLparams[1];
		if (butnLoc !=undefined) {
			var newLoc = newLoc+"&butnLoc="+butnLoc;
		}
	} else {
		if (butnLoc !=undefined) {
			var newLoc = newLoc+"?butnLoc="+butnLoc;
		}
	}
	displayWindow(newLoc,"logWin",550,500,"toolbar=no,location=no,directories=no,status=no,scrollbars=no,scrolling=no,resizable=yes,copyhistory=no");
}
function displayWindow(theURL,winName,width,height,features) { //v3.1
    var window_width = width;
    var window_height = height;
    var newfeatures= features;
    var window_top = (screen.height-window_height)/2;
    var window_left = (screen.width-window_width)/2;
    newWindow=window.open(''+ theURL + '',''+ winName + '','width=' + window_width + ',height=' + window_height + ',top=' + window_top + ',left=' + window_left + ',features=' + features + '');
}

function drawMenuH(itemsArray, currPageNum, spaces) {
	//For horizontal menu
	//called wherever you want the menu to draw. 
	//currPageNum tells which item to show as selected
	//spaces tells how many &nbsp's between items
	var n=0;
	var linkBuff = "";
	var pixPerChar = 6;
	var alignment=" ";
	var vAlignment="valign=\"middle\"";
	var theLast = false;
	var pipStrg = "<img src=\"global/gui/images/subNavPip.gif\" width=\"15\" height=\"11\">";
	/*itemsArray = [
["index.html","Design Philosphy","_parent"],
["gallery.html","Photo Gallery","_parent"]];*/
	linkBuff = "<table width=\"100%\" border=\"0\" bordercolor=\"#FF0000\" cellspacing=\"0\" cellpadding=\"0\"><tr>\n";
	for (var idx=0; idx<itemsArray.length; idx++) {
		itm=itemsArray[idx];
		wdth = itm[1].length*pixPerChar+12;
		wdthStrg = "width=\""+wdth+"\" ";
		if (itm[2]!="") {
			var trgtStrg = " target=\""+itm[2]+"\"";
		}
		if(idx==itemsArray.length-1) {
			//alignment=" align=\"right\"";
			theLast = true;
			wdthStrg = " ";
		}
		//alert("itm[1]: "+itm[1]+"    itm[1].length: "+itm[1].length+"    wdth: "+wdth);
		if (idx != currPageNum) {
			linkBuff += "<td "+wdthStrg+" "+alignment+" "+vAlignment+">"+pipStrg+"<a href=\""+itm[0]+"\""+trgtStrg+" title=\""+itm[1]+"\" class=\"MenuTextH\">"+itm[1]+"</a>\n</td>";
		} else {
			linkBuff += "<td "+wdthStrg+" "+alignment+" "+vAlignment+">"+pipStrg+"<a href=\""+itm[0]+"\""+trgtStrg+" title=\""+itm[1]+"\" class=\"MenuTextHSelected\">"+itm[1]+"</a>\n</td>";
		}
		//if (!theLast) {
			//linkBuff += "<td width=\"30\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n</td>";
			linkBuff += "<td width=\"10\">&nbsp;&nbsp;\n</td>";
		//}
		n++;
	}
	linkBuff += "</tr></table>\n";
	//linkBuff += "end menu\n";
	//alert(linkBuff);
	document.write(linkBuff);
}

function drawMenuV(itemsArray, currPageNum, spaces) {
	//For horizontal menu
	//called wherever you want the menu to draw. 
	//currPageNum tells which item to show as selected
	//spaces tells how many &nbsp's between items
	var n=0;
	var linkBuff = "";
	var pixPerChar = 6;
	var alignment=" ";
	var theLast = false;
	var ht=15;
	var htString = "height=\""+ht+"\" ";
	var wdth = 200;
	var wdthStrg = "width=\""+wdth+"\" ";
	var htImage = "<img src=\"global/gui/images/spacer.gif\" width=\"1\" height=\""+ht+"\">";
	var pipImage = "<img src=\"global/gui/images/right_nav_pip.gif\" width=\"11\" height=\"10\">";
	/*itemsArray = [
["index.html","Design Philosphy","_parent"],
["gallery.html","Photo Gallery","_parent"]];*/
	linkBuff = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
	for (var idx=0; idx<itemsArray.length; idx++) {
		itm=itemsArray[idx];
		//alert("itm[1]: "+itm[1]+"    itm[1].length: "+itm[1].length+"    wdth: "+wdth);
		if (idx != currPageNum) {
			linkBuff += "<tr><td "+wdthStrg+" "+htString+" "+alignment+">"+htImage+" "+pipImage+"<a href=\""+itm[0]+"\" target=\""+itm[2]+"\" title=\""+itm[1]+"\" class=\"MenuTextH\">"+itm[1]+"</a>\n</td></tr>";
		} else {
			linkBuff += "<tr><td "+wdthStrg+" "+htString+" "+alignment+">"+htImage+" "+pipImage+"<a href=\""+itm[0]+"\" target=\""+itm[2]+"\" title=\""+itm[1]+"\" class=\"MenuTextHSelected\">"+itm[1]+"</a>\n</td></tr>";
		}
		if (!theLast) {
			//linkBuff += "<td width=\"30\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\n</td>";
			//linkBuff += "<td width=\"10\">&nbsp;&nbsp;\n</td>";
		}
		n++;
	}
	linkBuff += "</tr></table>\n";
	//linkBuff += "end menu\n";
	//alert(linkBuff);
	document.write(linkBuff);
}


function drawMenuV1(itemsArray, currPageNum, spaces) {
	//For vertical menu
	//called wherever you want the menu to draw. 
	//currPageNum tells which item to show as selected
	//spaces tells how many <br>s between items
	var n=0;
	var linkBuff = "";
	/* itemsArray = [
["index.html","Design Philosphy","_parent"],
["gallery.html","Photo Gallery","_parent"],
["fengshui.html","Feng Shui","_parent"],
["testimonials.html","Testimonials","_parent"],
["links.html","Links","_parent"]]; */
	var pipImage = "<img src=\"global/gui/images/right_nav_pip.gif\" width=\"11\" height=\"10\">";
	for (var idx=0; idx<itemsArray.length; idx++) {
		itm=itemsArray[idx];
		if (idx != currPageNum) {
			linkBuff = pipImage+"<a href=\""+itm[0]+"\" target=\""+itm[2]+"\" title=\""+itm[1]+"\" class=\"MenuText\">"+itm[1]+"</a>";
			document.write(linkBuff);
		} else {
			linkBuff = pipImage+"<a href=\""+itm[0]+"\" target=\""+itm[2]+"\" title=\""+itm[1]+"\" class=\"MenuTextSelected\">"+itm[1]+"</a>";
			document.write(linkBuff);
		}
		for (var i=0; i < spaces; i++) {
			document.write("<br>");
		}
		n++;
	}
}

function showSlideshowPage(n) {
	//Called by flash minislide shows when you click view photo gallery
	//alert("showSlideshowPage - n: "+n);
	switch(n) {
		case 1: document.location = "gallery_North_Oaks_Golf_Club.html";
			break;
		case 2: document.location = "gallery_Encanterra.html";
			break;
		case 3: document.location = "gallery_The_Raven_at_Lora_Bay.html";
			break;
		default: document.location = "slideshow.html";
	}
	
}

function drawMainNavTemp() {
	//placehodler for main menu system
	menuArray = [
["index.html","Home","_parent"],
["information.html","Building Information","_parent"],
["services.html","Building Services","_parent"],
["space.html","Available Space","_parent"],
["tenant.html","Tenant Requests","_parent"],
["contact.html","Contact Us","_parent"],
[" "," ","_parent"]];
drawMenuH(menuArray,-1,1);

	return "";
}