//var kImgPath = 'http://localhost/tb/images/navigation/';
//var AppPath = 'http://localhost/tb/';

//var kImgPath = 'http://www.vilaw/images/navigation/';
//var AppPath = 'http://www.vilaw.com/';

var groupArray = new Array();

function generateNav() {
	groupArray['serv'] = new NavItem('Our Practice','','b-practice',0);
	groupArray['serv'].addItem('By Practice Specialty', AppPath + 'practice_group.php','b-services-pgroups');
	groupArray['serv'].addItem('Services', AppPath + 'service_specialty.php','b-services');
	
	groupArray['atto'] = new NavItem('Attorneys','','b-attourneys',115);
	groupArray['atto'].addItem('Attorney Search', AppPath +'attorney.php','b-attorney-search');
	groupArray['atto'].addItem('Other Professionals', AppPath +'other_professionals.php','b-attorney-other-pros');
	
	groupArray['abou'] = new NavItem('About TBA','','b-about',0);

	groupArray['abou'].addItem('Community', AppPath + 'community.php','b-about-community');
	groupArray['abou'].addItem('Clients', AppPath + 'Clients.php','b-about-clients');
	groupArray['abou'].addItem('Overview', AppPath + 'firm_overview.php','b-about-overview');
	groupArray['abou'].addItem('Diversity', AppPath + 'firm_diversity.php','b-about-diversity');
	groupArray['abou'].addItem('Affiliates', AppPath + 'affiliates.php','b-about-affiliates');

	groupArray['recr'] = new NavItem('Recruiting','','b-recruiting',150);
	groupArray['recr'].addItem('Attorneys', AppPath + 'attorneys_jobs.php','b-recr-attorneys');
	groupArray['recr'].addItem('Other Profesionals', AppPath + 'op_jobs.php','b-recr-other_professional');
	groupArray['recr'].addItem('Summer Associates', AppPath + 'sa_jobs.php','b-recr-summer_associate');
	// groupArray['news'].addItem('Press Room', AppPath + 'pressroom.php','b-news-pressroom');


	groupArray['pubs'] = new NavItem('Publications','','b-publications',300);
	//groupArray['pubs'].addItem('In the News', AppPath + 'pressrelease.php','b-news-pressrelease');
	groupArray['pubs'].addItem('Articles', AppPath + 'articles.php','b-pub-articles');
	//groupArray['pubs'].addItem('Press Room', AppPath + 'pressroom.php','b-news-pressroom');
	groupArray['pubs'].addItem('Resource Links', AppPath + 'link.php','b-pub-resource');
	
	
	// groupArray['pubs'].addItem('Legal Alerts', AppPath + 'publications/legal_alerts.aspx','b-pub-legal');
	
	groupArray['loca'] = new NavItem('Locations','','b-locations',115);

	groupArray['cont'] = new NavItem('Contact', '','b-contact',424);
}

function startingPoint() {
	return Math.floor((LL_getOrigWidth() - 740) / 2);
}

function handleResize() {
	if (currentLyr) {
		LL_hideLayer(currentLyr);
	}
	setTimeout('repositionLayers();',5);
}

function repositionLayers() {
	LL_setOrigDims();
	var startX = startingPoint();
	if (startX < 0) { 
		startX = 0;
	}
	
	for (var group in groupArray) {
		LL_shiftTo('i_' + group,startX,84);
	}
	
	if (currentLyr) {
		LL_showLayer(currentLyr);
	}
}

function buildNav() {
	var startX = startingPoint();

	for (var group in groupArray) {
		LL_makeLayer('i_' + group,startX,84,740,26,false,groupArray[group].buildItem(group,0));
	}
	LL_catchResize('handleResize');
}

function NavItem(alt,href,src,shift) {
	this.alt = alt;
	this.href = href;
	this.src = src;
	this.shift = shift;
	this.subGroup = new Array();
}
NavItem.prototype.addItem = addItem;
NavItem.prototype.buildItem = buildItem;

function addItem(alt,href,src) {
	this.subGroup[this.subGroup.length] = new NavItem(alt,href,src);
}

function buildItem(id,subId) {
	if (subId != 0) {	// subNav item
		eval('b_' + id + '_sub' + subId + ' = newImage("' + kImgPath + this.src + '.gif");');
		eval('bo_' + id + '_sub' + subId + ' = newImage("' + kImgPath + this.src + '_over.gif");');
	
		return '<a href="' + this.href + '" onMouseOver="rollOverSub(\'' + id + '\',' + subId + ');" onMouseOut="rollOutSub(\'' + id + '\',' + subId + ');"><img src="' + kImgPath + this.src + '.gif" alt="' + this.alt + '" name="' + id + '_sub' + subId + '" border="0" />\</a>';
	} else {
		eval('b_' + id + ' = newImage("' + kImgPath + this.src + '.gif");');
		eval('bo_' + id + ' = newImage("' + kImgPath + this.src + '_over.gif");');

		var tmpString = '<table border="0" cellpadding="0" cellspacing="0" width="740" class="navWrapper"><tr><td background="' + kImgPath + 'background.gif">';
		if (this.shift > 0) {
			tmpString += '<img src="http://www.vilaw.com/images/spacer.gif" width="' + this.shift + '" height="26" alt="" border="0">';
		}
		if (this.subGroup.length > 0) {
			for (var i=0; i < this.subGroup.length; i++) {
				tmpString += this.subGroup[i].buildItem(id,i + 1);
			}
		} else {
			tmpString += '<img src="' + kImgPath + 'background.gif" width="740" height="26" alt="" border="0">';
		}
		tmpString += '\</td>\</tr>\</table>';
		
		return tmpString;
	}
}