/* highlight.js should make the text links for the categories and individual *
 * projects to remain highlighted. The following URL is an example of what   *
 * the regular expressions will search through:                              *
 *                                                                           *
 * http://www.nwdbonline.com/projects/restaurant-kobeclub-miami.shtml        */


function categoryHighlight()
{
    var categoryMatches;
    var defaultCID = 'restaurant';
    var categoryType = defaultCID;
    
    categoryMatches = location.pathname.match(/projects\/(\w+)/);
    
    if (categoryMatches != null)
    {
    	if (categoryMatches.length > 1)
    	{
    		categoryType = categoryMatches[1];
    	}

    	$('#' + categoryType + 'link').attr('src', '/images/' + categoryType + '-on.jpg');
    }
}


//highlights the main menu items


function menuHighlight()
{
    var menuMatches;
    var defaultMID = 'team';
    var menuName = defaultMID;
    
    menuMatches = location.pathname.match(/(team|publications|contact)\.shtml$/);
    
    if (menuMatches != null)
    {
    	if (menuMatches.length > 1)
    	{
    		menuName = menuMatches[1];
    	}

    	$('#nav_' + menuName + '_on').attr('src', '/images/nav_' + menuName + '_off.jpg');
    }
    else
    {
			menuMatches = location.pathname.match(/\/(\w+)\/$/);

			if (menuMatches != null)
			{
				if (menuMatches.length > 1)
				{
					menuName = menuMatches[1];
				}

				$('#nav_' + menuName + '_on').attr('src', '/images/nav_' + menuName + '_off.jpg');
			}
		}

}


// highlights the project names

function projectNameHighlight()
{
    var projectMatches;
    var textColor = '#ffffff';
    var defaultPID = 'kobeclub-miami';
    var projectName = defaultPID;
 
    projectMatches = location.pathname.match(/\w+-(\w+?-?\w+)\.shtml$/);

 
    if (projectMatches != null)
    {
			if (projectMatches.length > 1)
			{
				projectName = projectMatches[1];
			}

			$('#' + projectName).css('color', '#ffffff');
    }
}


$(window).load(projectNameHighlight);
$(window).load(menuHighlight);
$(window).load(categoryHighlight);
