// 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(top, subTop) {
	//alert("goPage0 - currentDir: "+currentDir+",  top: "+top+",  subTop: \""+subTop+"\"");
	var topicDirs = "condos,amenities,dev,own,tra,contact";
	if (topicDirs.indexOf(currentDir)<0) {
		var locationBuff = top+"/"+top+subTop+".php";
	//alert("goPage1 - locationBuff: "+locationBuff);
	} else if (top == "index") {
		var locationBuff = "../"+top+subTop+".php";
	//alert("goPage2 - locationBuff: "+locationBuff);
	} else if (top == currentDir) {
		var locationBuff = top+subTop+".php";
	//alert("goPage3 - locationBuff: "+locationBuff);
	} else if (topicDirs.indexOf(currentDir)>=0 && top != currentDir) {
		var locationBuff = "../"+top+"/"+top+subTop+".php";
	//alert("goPage4 - locationBuff: "+locationBuff);
	}
	//alert("goPage5 - currentDir: "+currentDir+",  top: "+top+",  subTop: "+subTop+",  locationBuff: "+locationBuff);
	if (URLparams.length > 1) {
		var locationBuff = locationBuff+"?"+URLparams[1];
	}
	window.location = locationBuff;
}

function drawFlashNav(top, subTop) {
	//Inserts the Flash object block with parameters 
	//called wherever you want the menu to draw. 
	//top tells which topic label to go to in the flash
	//subTop tells which sub-topic label to go to in the flash
	if (top =="index" || top == "") {
		var swif = "global/gui/topnav.swf";
	} else {
		var swif = "../global/gui/topnav.swf";
	}
	//var swif = "global/gui/topnav.swf"
	var bkClr = "#D0E0D3"
	var objBuff = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\"750\" height=\"219\">\n";
  objBuff = objBuff + "<param name=\"movie\" value=\""+swif+"?topic="+top+"&subTopic="+subTop+"\">\n";
  objBuff = objBuff + "<param name=\"quality\" value=\"high\">\n";
	objBuff = objBuff + "<param name=\"BGCOLOR\" value=\""+bkClr+"\">\n";
	objBuff = objBuff + "<param name=\"wmode\" value=\"transparent\">\n";
  objBuff = objBuff + "<embed src=\""+swif+"?topic="+top+"&subTopic="+subTop+"\" width=\"750\" height=\"219\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" bgcolor=\""+bkClr+"\" wmode=\"transparent\"></embed>\n";
  objBuff = objBuff + "</object>";
	//alert(objBuff);
	
	document.write(objBuff);
}

function drawFlashContent(top, subTop, w, h) {
	//Inserts the Flash object block with parameters 
	//called wherever you want the menu to draw. 
	//top tells which topic label to go to in the flash
	//subTop tells which sub-topic label to go to in the flash
	//alert("w: "+w+"   h: "+h);
	if (w == "" || w == undefined) {
		w=750;
		h=440;
	}
	if (top =="index" || top == "") {
		var swif = "assets/"+top+subTop+".swf";
	} else {
		var swif = "../assets/"+top+subTop+".swf";
	}
	//var swif = "assets/"+top+subTop+".swf"
	var bkClr = "#D0E0D3"
	var objBuff = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\""+w+"\" height=\""+h+"\">\n";
  objBuff = objBuff + "<param name=\"movie\" value=\""+swif+"?topic="+top+"&subTopic="+subTop+"\">\n";
  objBuff = objBuff + "<param name=\"quality\" value=\"high\">\n";
	objBuff = objBuff + "<param name=\"BGCOLOR\" value=\""+bkClr+"\">\n";
	objBuff = objBuff + "<param name=\"wmode\" value=\"transparent\">\n";
  objBuff = objBuff + "<embed src=\""+swif+"?topic="+top+"&subTopic="+subTop+"\" width=\""+w+"\" height=\""+h+"\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" bgcolor=\""+bkClr+"\" wmode=\"transparent\"></embed>\n";
  objBuff = objBuff + "</object>";
	//alert("drawFlashcontent -  objbuff: "+objBuff);
	
	document.write(objBuff);
}

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 theLast = false;
	/*itemsArray = [
["index.html","Design Philosphy","_parent"],
["gallery.html","Photo Gallery","_parent"]];*/
	linkBuff = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tr><td>\n";
	for (var idx=0; idx<itemsArray.length; idx++) {
		itm=itemsArray[idx];
		wdth = itm[1].length*pixPerChar+12;
		wdthStrg = "width=\""+wdth+"\" ";
		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+"><a href=\""+itm[0]+"\" target=\""+itm[2]+"\" title=\""+itm[1]+"\" class=\"MenuTextH\">"+itm[1]+"</a>\n</td>";
		} else {
			linkBuff += "<td "+wdthStrg+" "+alignment+"><a href=\""+itm[0]+"\" target=\""+itm[2]+"\" 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() {
	//Called by flash minislide shows when you click view photo gallery
	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 "";
}