﻿/* Checks to make sure the object exists and if it does returns it,
a Netscape compatability issue */

function findObject(n) 
{ 
  var x;
  var NS4 = (document.layers) ? true : false;
  var NS6 = (document.getElementById && !document.all) ? true : false;

  if (!NS6)
  	{
 	 if(!(x = document[n]) && document.all) 
 	 x = document.all[n]; 
 	}
  else	
  	{
  	 x = document.getElementById(n);
  	}
  return x;
}




function menu(l, v) 
{ 
  var obj;
  var MenuObj;
  var MenuName;

  MenuName = l + "MenuName";
    if ((obj=findObject(l))!=null) 
    { 
      MenuObj=findObject(MenuName);
      if (obj.style) 
      { 
      	obj=obj.style;
      	MenuObj=MenuObj.style;
      	 
//      	v=(v=='show')?'visible':(v=='hide')?'hidden':v;
      }

	  if (v=='show')
	  	{
	      obj.visibility='visible'; 
	      MenuObj.background='maroon';
	      MenuObj.border = 'solid black 1px';
	     }
	  if (v=='hide')
	  	{
	  	obj.visibility='hidden'; 
	      MenuObj.background='#cc0000';
	      MenuObj.border = 'solid #cc0000 1px';

	  	}
   }
}

// AIA Firm Search Keywords pop-up
// For showing AIA members what keywords that users search on
function AIAkeywordspopup()
{
var mywindow = window.open("http://67.59.131.61/findanarchitect/keywords.html","",",width=400,height=400,status,scrollbars,resizable");
mywindow.moveTo(400,20);
}



// Home page rotating graphics

if (document.images) {
ads = new Array(6);
ads[0] = "/images/home_aia1.jpg";
ads[1] = "/images/home_aia2.jpg";
ads[2] = "/images/home_aia3.jpg";
ads[3] = "/images/home_aia4.jpg";
ads[4] = "/images/home_aia5.jpg";
ads[5] = "/images/home_aia6.jpg";
}

/*
newplace = new Array(2);
newplace[0] = "http://www.afluentvision.com/pcs/citrix/index.shtml";
newplace[1] = "http://www.afluentvision.com/pcs/citrix/PCSwebinar.shtml";
*/
var timer = null
var	 counter = 0

function banner() {
	    timer=setTimeout("banner()", 6000);
		counter++;
		if (counter >= 5)
		counter = 0;
		document.rotatingHomeImage.src = ads[counter];
}


function updateEndDateMonth(monthIndex)
{
//alert (monthIndex);
//document.getElementById("endMonth").selectedIndex.value = monthIndex
var objStartMonthIndex = document.getElementById("startMonth");
var objEndMonthIndex = document.getElementById("endMonth");
//alert("objects set3");
//alert(objStartMonthIndex.selectedIndex)
//alert(objStartMonthIndex.value);
objEndMonthIndex.selectedIndex = parseInt(objStartMonthIndex.selectedIndex);

//document.getElementById('endMonth').selectedIndex = parseInt(monthIndex);

}
function updateEndDateDay(dayIndex)
{
document.getElementById("endDay").selectedIndex = parseInt(document.getElementById("startDay").selectedIndex)
}

function updateEndDateYear(dayIndex)
{
document.getElementById("endYear").selectedIndex = parseInt(document.getElementById("startYear").selectedIndex)
}



function insertDateStamp()
{
var months=new Array(13);

months[1]="Jan.";

months[2]="Feb.";

months[3]="March";

months[4]="April";

months[5]="May";

months[6]="June";

months[7]="July";

months[8]="Aug.";

months[9]="Sept.";

months[10]="Oct.";

months[11]="Nov.";

months[12]="Dec.";

var time=new Date();

var lmonth=months[time.getMonth() + 1];

var date=time.getDate();

var year=time.getYear();

if (year < 2000)   

year = year + 1900; 

document.write( lmonth + " ");

document.write(date + ", " + year );


//var theDate = document.createElement('p'); 
//theDate.id = 'dateStamp'; 
//theDate.appendChild(document.createTextNode(lmonth + " " + date + ", " + year)); 
 
//var scr = document.getElementById('dateStamp'); 
//scr.parentNode.insertBefore(theDate, scr); 

}