$(document).ready(function(){var idFromURL=window.location.hash?window.location.hash:'#home';idFromURL=idFromURL.replace('SB',' ');var classFromURL='.'+idFromURL.substr(1);var $currentLinkFromURL=$(classFromURL);var color=$currentLinkFromURL.css("borderTopColor");var $links=$("a[rel='history']");var $panels=$('.panel');var $movingBar=$('#nav_move');var $logo=$links.filter('#logo a');var $header=$links.filter('#logo a').parent().parent();var delay=1000;var linkColor='#cccccc';$movingBar.css({width:$currentLinkFromURL.width(),left:$currentLinkFromURL.offset().left-$currentLinkFromURL.parents('#wrap').offset().left});if(color=='rgb(204, 204, 204)'){$movingBar.css({backgroundColor:'#ffffff'});}else if(color=='#cccccc'){$movingBar.css({backgroundColor:'#ffffff'});}else{$movingBar.css({backgroundColor:color});}$logo.css({backgroundColor:color});$header.css({borderBottomColor:color});$currentLinkFromURL.css({color:color}).addClass('cur');$panels.hide().filter(idFromURL).show();if(!$.browser.msie){$('#logo').hide();if(!$.browser.opera){var img=new Image();$(img).attr('src','style/img/silverBranchLogo.png').load(function(){$('#logo a').css('backgroundImage','url(style/img/silverBranchLogo.png)');$('#logo').fadeIn(delay);});$('#splash').hide().load(function(){$(this).stop().fadeIn(delay,function(){$(this).show();});});}else{$(window).load(function(){$('#logo').fadeIn(delay);});}}$.historyInit(pageload);$links.click(function(){var hash=this.href;hash=hash.replace(/^.*#/,'');$.historyLoad(hash);return false;});$links.hover(function(){var $hoveredElement=$(this);var hoveredElementColor=$hoveredElement.css("borderTopColor");if(!$hoveredElement.is('.cur')){$hoveredElement.stop().animate({color:hoveredElementColor},delay/2,function(){$(this).css({color:hoveredElementColor})});}},function(){var $hoveredElement=$(this);var hoveredElementColor=$hoveredElement.css("borderTopColor");if(!$hoveredElement.is('.cur')){$hoveredElement.stop().animate({color:linkColor},delay/2,function(){$(this).css({color:linkColor})});}});function pageload(hash){window.scroll(0,0);hash=hash.replace('SB',' ');if(hash){var $link=$('a.'+hash);}else{var $link=$('a.home');hash='home';}moveNavElementAnimation($link);showHideDiv(hash);return false;}function moveNavElementAnimation(el){if(el.is('.cur')){return false;}var offset=el.offset();var offsetBody=$links.filter('#logo a').parents().filter('#wrap').offset();var colorOfClicked=el.css("borderTopColor");if(colorOfClicked=='#cccccc'){var movingBarColor='#ffffff';}else if(colorOfClicked=='rgb(204, 204, 204)'){var movingBarColor='#ffffff';}else{var movingBarColor=colorOfClicked;}$movingBar.stop().animate({width:el.width(),left:(offset.left-offsetBody.left),backgroundColor:movingBarColor},delay,function(){$movingBar.css({backgroundColor:movingBarColor});});$logo.stop().animate({backgroundColor:colorOfClicked},delay,function(){$logo.css({backgroundColor:colorOfClicked})});$header.stop().animate({borderBottomColor:colorOfClicked},delay,function(){$header.css({borderBottomColor:colorOfClicked})});el.animate({color:colorOfClicked},500,function(){$(this).css({color:colorOfClicked})});$links.filter('.cur').animate({color:linkColor},500,function(){$(this).css({color:linkColor})});$links.filter('.cur').removeClass('cur');el.addClass('cur');}function showHideDiv(hash){if($panels.filter('#'+hash).is(':visible')){return false;}$panels.stop().animate({opacity:0},delay,function(){$panels.hide().filter('#'+hash).show().stop().animate({opacity:1},delay,function(){if($.browser.msie){this.style.removeAttribute("filter");}});});}});
