//var kImgPath = 'http://www.steinlegal.com/images/navigation/';
//var AppPath = 'http://www.steinlegal.com/';

//var kImgPath = 'http://www.steinlegal.com/images/navigation/';
//var AppPath = 'http://www.steinlegal.com/';

var groupArray = new Array();

function generateNav() {
	groupArray['about'] = new NavItem('About Us','','b-about',0);
	groupArray['about'].addItem('Profile', AppPath + '/about/profile.php','b-about-profile');
	groupArray['about'].addItem('Attorney Bios', AppPath + '/about/bios.php','b-about-bios');

	
	groupArray['biscorp'] = new NavItem('Business and Corporate Law','','b-biscorp',10);
	groupArray['biscorp'].addItem('Business and Corporate Law', AppPath +'/biscorp/BisCorp.php','b-biscorp-biscorp');
	groupArray['biscorp'].addItem('Commercial Real Estate', AppPath +'/biscorp/Commercial.php','b-biscorp-commerical');
	groupArray['biscorp'].addItem('Employment Law', AppPath +'/biscorp/Employment.php','b-biscorp-employ');
	groupArray['biscorp'].addItem('FAQ/Issues', AppPath +'/biscorp/FAQ.php','b-biscorp-faq');
	
	groupArray['trustesttax'] = new NavItem('Trusts and Estates/Tax Planning','','b-trustesttax',10);
	groupArray['trustesttax'].addItem('Estate Planning/Administration', AppPath +'/trustesttax/EstPlanAdmin.php','b-trustesttax-estadmin');
	groupArray['trustesttax'].addItem('Elder Law and Special Needs Planning ', AppPath +'/trustesttax/ElderSpecial.php','b-trustesttax-elder');
	groupArray['trustesttax'].addItem('Tax Planning ', AppPath +'/trustesttax/TaxPlan.php','b-trustesttax-tax');
	groupArray['trustesttax'].addItem('FAQ/Issues ', AppPath +'/trustesttax/FAQ.php','b-trustesttax-faq');

	groupArray['litigation'] = new NavItem('Litigation','','b-litigation',60);
	groupArray['litigation'].addItem('Commercial Litigation', AppPath +'/litigation/Commercial.php','b-litigation-commercial');
	groupArray['litigation'].addItem('Defense Litigation', AppPath +'/litigation/Defense.php','b-litigation-defense');
	groupArray['litigation'].addItem('Alternative Dispute Resolution', AppPath +'/litigation/AlternDisRes.php','b-litigation-alternative');
	groupArray['litigation'].addItem('FAQ/Issues', AppPath +'/litigation/FAQ.php','b-litigation-faq');

	groupArray['personal'] = new NavItem('Personal Legal','','b-personal',127);
	groupArray['personal'].addItem('Residential Real Estate', AppPath +'/personal/Residential.php','b-personal-residential');
	groupArray['personal'].addItem('Personal Injury', AppPath +'/personal/PersInjury.php','b-personal-injury');
	groupArray['personal'].addItem('Matrimonial Law', AppPath +'/personal/Matrimonial.php','b-personal-matrimonial');
	groupArray['personal'].addItem('FAQ/Issues', AppPath +'/personal/FAQ.php','b-personal-faq');

	groupArray['contact'] = new NavItem('Contact Us','','b-contact',640);
	groupArray['contact'].addItem('Contact Form', AppPath +'/contact/index.php','b-contact-form');

}

function startingPoint() {
	return Math.floor((LL_getOrigWidth() - 754) / 2);
}

function handleResize() {
	if (currentLyr) {
		LL_hideLayer(currentLyr);
	}
	setTimeout('repositionLayers();',0);
}

function repositionLayers() {
	LL_setOrigDims();
	var startX = startingPoint();
	if (startX < 0) { 
		startX = 0;
	}
	
	for (var group in groupArray) {
		LL_shiftTo('i_' + group,startX,97);
	}
	
	if (currentLyr) {
		LL_showLayer(currentLyr);
	}
}

function buildNav() {
	var startX = startingPoint();

	for (var group in groupArray) {
		LL_makeLayer('i_' + group,startX,97,754,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="754" class="navWrapper"><tr><td background="' + kImgPath + 'background.gif">';
		if (this.shift > 0) {
			tmpString += '<img src="http://www.steinlegal.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="754" height="26" alt="" border="0" />';
		}
		tmpString += '\</td>\</tr>\</table>';
		
		return tmpString;
	}
}