//var kImgPath = 'http://localhost/KSTest/images/navigation/';
//var AppPath = 'http://localhost/KSTest/';

//var kImgPath = 'http://kilstock.iconologic.com/images/navigation/';
//var AppPath = 'http://kilstock.iconologic.com/';

var groupArray = new Array();

function generateNav() {
	groupArray['serv'] = new NavItem('Our Practice','','b-practice',0);
	groupArray['serv'].addItem('Services', AppPath + 'legalservices/services-specialty.aspx','b-services');
	groupArray['serv'].addItem('By Market', AppPath + 'legalservices/services-practice.aspx','b-services-markets');
	groupArray['serv'].addItem('Pro Bono', AppPath + 'legalservices/pro_bono/pro-bono.aspx','b-about-probono');
	
	groupArray['atto'] = new NavItem('Attorneys','','b-attourneys');
	//removed ",115" from the above script to disable subnav mj
	//groupArray['atto'].addItem('Attorney Search', AppPath +'attorneys/attorneys.aspx','b-attorney-search');
	//groupArray['atto'].addItem('Other Professionals', AppPath +'attorneys/other_professionals.aspx','b-attorney-other-pros');
	
	groupArray['abou'] = new NavItem('About KS','','b-about',0);
	groupArray['abou'].addItem('Pro Bono', AppPath + 'legalservices/pro_bono/pro-bono.aspx','b-about-probono');
	groupArray['abou'].addItem('Community', AppPath + 'about/community.aspx','b-about-community');

	groupArray['abou'].addItem('Overview', AppPath + 'about/overview.aspx','b-about-overview');
	groupArray['abou'].addItem('History', AppPath + 'about/history.aspx','b-about-history');
	groupArray['abou'].addItem('Alumni', 'http://www.kilpatrickstocktonalumni.com','b-about-alumni');
	groupArray['abou'].addItem('Diversity', AppPath + 'about/diversity.aspx','b-about-diversity');

	groupArray['recr'] = new NavItem('Recruiting','','b-recruiting');
	
	groupArray['news'] = new NavItem('News and Events','','b-news',302);
	groupArray['news'].addItem('Press Releases', AppPath + 'news/press.aspx','b-news-pressreleases');
	groupArray['news'].addItem('In The News', AppPath + 'news/in_the_news.aspx','b-news-inthenews');
		groupArray['news'].addItem('Seminars and Events', AppPath + 'news/events/list.aspx','b-news-seminars');
	groupArray['news'].addItem('Press Room', AppPath + 'news/pressroom/pressroom.aspx','b-news-pressroom');
	//groupArray['news'].addItem('Get News', AppPath + 'news/getnews.aspx','b-news-receive');

	groupArray['pubs'] = new NavItem('Publications','','b-publications',276);
	groupArray['pubs'].addItem('Resource Links', AppPath + 'publications/links.aspx','b-pub-resource');
	groupArray['pubs'].addItem('Video Vault', AppPath + 'publications/videos.aspx','b-pub-video');
	groupArray['pubs'].addItem('Newsletters', AppPath + 'publications/newsletters.aspx','b-pub-newsletters');
	groupArray['pubs'].addItem('Articles', AppPath + 'publications/articles.aspx','b-pub-articles');
	groupArray['pubs'].addItem('Legal Alerts', AppPath + 'publications/legal_alerts.aspx','b-pub-legal');
<!--	groupArray['pubs'].addItem('Firm Materials', AppPath + 'publications/materials.aspx','b-pub-firm');-->

	groupArray['loca'] = new NavItem('Locations','','b-locations',0);
	

	groupArray['cont'] = new NavItem('Contact', '','b-contact',503);
	groupArray['cont'].addItem('Detailed Contacts', AppPath + 'contact/contact-detailed.aspx','b-contact-detailed');
	groupArray['cont'].addItem('Contact Forms', AppPath + 'contact/contactform.aspx','b-contact-forms');
	
}

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.kilpatrickstockton.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;
	}
}