var indexArray=new Array();var index=0;$(window).load(function(){$('body').show();index=0;$(".g_repeat_header").each(function(){indexArray[index]=$(this).attr('id');index++});$(".g_repeat_design").each(function(){indexArray[index]=$(this).attr('id');index++});$(".g_repeat_research").each(function(){indexArray[index]=$(this).attr('id');index++});index=0;$('html, body').scrollTop(0);$('#next_btn').click(function(){if(index<indexArray.length-1){index++;var elementClicked='#'+indexArray[index];var destination=$(elementClicked).offset().top;$("html:not(:animated),body:not(:animated)").animate({scrollTop:destination+0},800);return false}});$('#prev_btn').click(function(){if(index>0){index--;var elementClicked='#'+indexArray[index];var destination=$(elementClicked).offset().top;var offset=(index==0)?-160:0;$("html:not(:animated),body:not(:animated)").animate({scrollTop:destination+offset},800);return false}});$(window).scroll(function(){var i=0;var id_tag='';index=indexArray.length-1;for(i=0;i<indexArray.length-1;i++){id_tag='#'+indexArray[i];next_id_tag='#'+indexArray[i+1];if(($(window).scrollTop()+140>=$(id_tag).offset().top)&&($(window).scrollTop()<$(next_id_tag).offset().top)){index=i;if(index<$(".g_repeat_header").length){reset_nav();$("#about_btn").css('border-bottom','4px solid #c00')}else if(index<($(".g_repeat_header").length+$(".g_repeat_design").length)){reset_nav();$("#design_btn").css('border-bottom','4px solid #c00')}else if(index<($(".g_repeat_header").length+$(".g_repeat_design, .g_repeat_research").length)){reset_nav();$("#research_btn").css('border-bottom','4px solid #c00')}break}}$('#display').html($(window).scrollTop()+","+$('#top').offset().top+","+index)});if($.browser.msie){$(document).keydown(function(event){if(event.keyCode==37)$('#prev_btn').click();else if(event.keyCode==39)$('#next_btn').click()})}else{$(window).keydown(function(event){if(event.keyCode==37)$('#prev_btn').click();else if(event.keyCode==39)$('#next_btn').click()})}$('#about_btn').click(function(){var tag='#'+indexArray[1];var destination=$(tag).offset().top;$("html:not(:animated),body:not(:animated)").animate({scrollTop:destination},800)});$('#design_btn').click(function(){var tag='#'+indexArray[$(".g_repeat_header").length];var destination=$(tag).offset().top;$("html:not(:animated),body:not(:animated)").animate({scrollTop:destination},800)});$('#research_btn').click(function(){var tag='#'+indexArray[$(".g_repeat_design, .g_repeat_header").length];var destination=$(tag).offset().top;$("html:not(:animated),body:not(:animated)").animate({scrollTop:destination},800)})});function reset_nav(){$(".nav_btn").css('border-bottom','none')}
