// JavaScript Document
var active_Button = false;
var active_Group = false;
var nav_timer = null;

$(document).ready(function ()
		        		{
											
						/*$("table.two_tone_table tr:even").css("background-color", "#f5f5f5");
						$("table.two_tone_table tr:odd").css("background-color", "#d3d3d3");
						$("table.two_tone_table tr:eq(0)").css("background-color", "#ffffff");*/
						
						$('#home_topnav a').mouseover(function()
		                        {	
									unhighlight_btn(active_Button);
									active_Button = '#home_topnav';
									highlight_btn(active_Button);
		                        });
						$('#home_topnav a').mouseout(function()
		                        {
									unhighlight_btn(active_Button);
		                        });
						$('#products_topnav a').mouseover(function()
		                        {
									unhighlight_btn(active_Button);
									active_Group = "#products_dd";
									active_Button = '#products_topnav';
									highlight_btn(active_Button);
									$('#products_dd').animate( { opacity: 'show', height: 'show' }, 100 );
						if(nav_timer) {
                        clearTimeout(nav_timer);
                        nav_timer = null;
                		}
		                        });
						$('#products_topnav a').mouseout(function()
		                        {
									nav_timer = setTimeout(function () { $('#products_dd').animate( { opacity: 'hide', height: 'hide' }, 100 ), unhighlight_btn('#products_topnav'); }, 1000);
		                        });
						$('#products_dd a').mouseover(function()
		                        {
		                if(nav_timer) {
                        clearTimeout(nav_timer);
                        nav_timer = null
                }
		                        });
						$('#products_dd a').mouseout(function()
		                        {
									nav_timer = setTimeout(function () { $('#products_dd').animate( { opacity: 'hide', height: 'hide' }, 100 ), unhighlight_btn('#products_topnav'); }, 1000);
		                        });
						
						
						$('#projectshowcase_topnav a').mouseover(function()
		                        {
									unhighlight_btn(active_Button);
									active_Group = "#projectshowcase_dd";
									active_Button = '#projectshowcase_topnav';
									highlight_btn(active_Button);
									$('#projectshowcase_dd').animate( { opacity: 'show', height: 'show' }, 100 );
						if(nav_timer) {
                        clearTimeout(nav_timer);
                        nav_timer = null;
                		}
		                        });
						$('#projectshowcase_topnav a').mouseout(function()
		                        {
									nav_timer = setTimeout(function () { $('#projectshowcase_dd').animate( { opacity: 'hide', height: 'hide' }, 100 ), unhighlight_btn('#projectshowcase_topnav'); }, 1000);
									unhighlight_btn(active_Button);
		                        });
						$('#projectshowcase_dd a').mouseover(function()
		                        {
		                if(nav_timer) {
                        clearTimeout(nav_timer);
                        nav_timer = null
                }
		                        });
						$('#projectshowcase_dd a').mouseout(function()
		                        {
									nav_timer = setTimeout(function () { $('#projectshowcase_dd').animate( { opacity: 'hide', height: 'hide' }, 100 ), unhighlight_btn('#projectshowcase_topnav'); }, 1000);
		                        });
						
						
						$('#precastresources_topnav a').mouseover(function()
		                        {
									unhighlight_btn(active_Button);
									active_Group = "#precastresources_dd";
									active_Button = '#precastresources_topnav';
									highlight_btn(active_Button);
									$('#precastresources_dd').animate( { opacity: 'show', height: 'show' }, 100 );
						if(nav_timer) {
                        clearTimeout(nav_timer);
                        nav_timer = null;
                		}
		                        });
						$('#precastresources_topnav a').mouseout(function()
		                        {
									nav_timer = setTimeout(function () { $('#precastresources_dd').animate( { opacity: 'hide', height: 'hide' }, 500 ), unhighlight_btn('#precastresources_topnav'); }, 1000);
		                        });
						$('#precastresources_dd a').mouseover(function()
		                        {
		                if(nav_timer) {
                        clearTimeout(nav_timer);
                        nav_timer = null
                }
		                        });
						$('#precastresources_dd a').mouseout(function()
		                        {
									nav_timer = setTimeout(function () { $('#precastresources_dd').animate( { opacity: 'hide', height: 'hide' }, 500 ), unhighlight_btn('#precastresources_topnav'); }, 1000);
		                        });
						$('#ourcompany_topnav a').mouseover(function()
		                        {
									unhighlight_btn(active_Button);
									active_Group = "#ourcompany_dd";
									active_Button = '#ourcompany_topnav';
									highlight_btn(active_Button);
									$('#ourcompany_dd').animate( { opacity: 'show', height: 'show' }, 100 );
						if(nav_timer) {
                        clearTimeout(nav_timer);
                        nav_timer = null;
                		}
		                        });
						$('#ourcompany_topnav a').mouseout(function()
		                        {
									nav_timer = setTimeout(function () { $('#ourcompany_dd').animate( { opacity: 'hide', height: 'hide' }, 100 ), unhighlight_btn('#ourcompany_topnav'); }, 1000);
		                        });
						$('#ourcompany_dd a').mouseover(function()
		                        {
		                if(nav_timer) {
                        clearTimeout(nav_timer);
                        nav_timer = null
                }
		                        });
						$('#ourcompany_dd a').mouseout(function()
		                        {
									nav_timer = setTimeout(function () { $('#ourcompany_dd').animate( { opacity: 'hide', height: 'hide' }, 100 ), unhighlight_btn('#ourcompany_topnav'); }, 1000);
		                        });
						
		});

function highlight_btn( active_Button )
{
	switch (active_Button) {
   case '#home_topnav':
	$("table#home_topnav td:eq(0)").css({'backgroundImage' : 'url(../img/interface/topnav_item_rounded_leftside.png)'});
	$("table#home_topnav td:eq(1)").css({'background-color' : '#414141'});
	$("table#home_topnav a").css({'color' : '#bfbfbf'});
	$("table#home_topnav td:eq(2)").css({'backgroundImage' : 'url(../img/interface/topnav_item_rounded_rightside.png)'});
	break;
	case '#products_topnav':
	$("table#products_topnav td:eq(0)").css({'backgroundImage' : 'url(../img/interface/topnav_item_rounded_leftside.png)'});
	$("table#products_topnav td:eq(1)").css({'background-color' : '#414141'});
	$("table#products_topnav a").css({'color' : '#bfbfbf'});
	$("table#products_topnav td:eq(2)").css({'backgroundImage' : 'url(../img/interface/topnav_item_rounded_rightside.png)'});
	break;
	case '#precastresources_topnav':
	$("table#precastresources_topnav td:eq(0)").css({'backgroundImage' : 'url(../img/interface/topnav_item_rounded_leftside.png)'});
	$("table#precastresources_topnav td:eq(1)").css({'background-color' : '#414141'});
	$("table#precastresources_topnav a").css({'color' : '#bfbfbf'});
	$("table#precastresources_topnav td:eq(2)").css({'backgroundImage' : 'url(../img/interface/topnav_item_rounded_rightside.png)'});
	break;
	case '#ourcompany_topnav':
	$("table#ourcompany_topnav td:eq(0)").css({'backgroundImage' : 'url(../img/interface/topnav_item_rounded_leftside.png)'});
	$("table#ourcompany_topnav td:eq(1)").css({'background-color' : '#414141'});
	$("table#ourcompany_topnav a").css({'color' : '#bfbfbf'});
	$("table#ourcompany_topnav td:eq(2)").css({'backgroundImage' : 'url(../img/interface/topnav_item_rounded_rightside.png)'});
	break;
	case '#projectshowcase_topnav':
	$("table#projectshowcase_topnav td:eq(0)").css({'backgroundImage' : 'url(../img/interface/topnav_item_rounded_leftside.png)'});
	$("table#projectshowcase_topnav td:eq(1)").css({'background-color' : '#414141'});
	$("table#projectshowcase_topnav a").css({'color' : '#bfbfbf'});
	$("table#projectshowcase_topnav td:eq(2)").css({'backgroundImage' : 'url(../img/interface/topnav_item_rounded_rightside.png)'});
	break;
	}
	
}

function unhighlight_btn( active_Button )
{
	if(nav_timer) {
						clearTimeout(nav_timer);
                        nav_timer = null
						$(active_Group).animate( { opacity: 'hide', height: 'hide'  }, 100 );
                }
	switch (active_Button) {
   case '#home_topnav':
	$("table#home_topnav td:eq(0)").css({'backgroundImage' : 'none'});
	$("table#home_topnav td:eq(1)").css({'background-color' : ''});
	$("table#home_topnav a").css({'color' : '#ffffff'});
	$("table#home_topnav td:eq(2)").css({'backgroundImage' : 'none'});
	break;
	case '#products_topnav':
	$("table#products_topnav td:eq(0)").css({'backgroundImage' : 'none'});
	$("table#products_topnav td:eq(1)").css({'background-color' : ''});
	$("table#products_topnav a").css({'color' : '#ffffff'});
	$("table#products_topnav td:eq(2)").css({'backgroundImage' : 'none'});
	break;
	case '#precastresources_topnav':
	$("table#precastresources_topnav td:eq(0)").css({'backgroundImage' : 'none'});
	$("table#precastresources_topnav td:eq(1)").css({'background-color' : ''});
	$("table#precastresources_topnav a").css({'color' : '#ffffff'});
	$("table#precastresources_topnav td:eq(2)").css({'backgroundImage' : 'none'});
	break;
	case '#ourcompany_topnav':
	$("table#ourcompany_topnav td:eq(0)").css({'backgroundImage' : 'none'});
	$("table#ourcompany_topnav td:eq(1)").css({'background-color' : ''});
	$("table#ourcompany_topnav a").css({'color' : '#ffffff'});
	$("table#ourcompany_topnav td:eq(2)").css({'backgroundImage' : 'none'});
	break;
	case '#projectshowcase_topnav':
	$("table#projectshowcase_topnav td:eq(0)").css({'backgroundImage' : 'none'});
	$("table#projectshowcase_topnav td:eq(1)").css({'background-color' : ''});
	$("table#projectshowcase_topnav a").css({'color' : '#ffffff'});
	$("table#projectshowcase_topnav td:eq(2)").css({'backgroundImage' : 'none'});
	break;
	}
	
}