
var moveArray = new Array();

var site_section_heights = new Array(1067,1846,1846,1846,1846);
var site_section_names = new Array('section_top','section_home','section_band','section_photos','section_contact');

function kolc_pageTop() {
  return (self.pageYOffset)?(self.pageYOffset):((document.documentElement && document.documentElement.scrollTop)?(document.documentElement.scrollTop):(document.body.scrollTop));
}

function kolc_movePage() {
  if(moveArray.length == 0) {return false;}

  eval(moveArray.shift());
  setTimeout('kolc_movePage()',50);
}

function kolc_switchSections(whereto) {

  kolc_scrollTo=0;
  kolc_scrollFrom = kolc_pageTop();
  section_num = 0;
  for(i=0;i<site_section_names.length;i++) {
    if(i>0) {section_num++; kolc_scrollTo+=site_section_heights[i-1]}
    if(site_section_names[i] == whereto) {i=site_section_names.length;}
  }
  if(kolc_scrollFrom==kolc_scrollTo) {
    window.location='#'+whereto;
    return false;
  } else {
    $("#mp3player").css("top", 11 + ((section_num-1) * 1841));
    window.paused=1;
  }

  /* Set up vertical scroll transition. */
  steps=50;
  for(i=1; i<=steps; i++) {
    multi=Math.sqrt(i/steps);
    moveArray[i]='window.scroll(0,'+(kolc_scrollFrom+(kolc_scrollTo-kolc_scrollFrom)*multi)+');';
  }
  moveArray[steps]+="window.location='#"+whereto+"'; window.paused=0; ";

  /* And fire it off. */
  setTimeout('kolc_movePage()',50);

  return false;
}

function kolc_onLoadHandler() {
	if(location.hash == "") {
		setTimeout('kolc_switchSections(\'section_home\')', 2000);
	} else {

		whereto = location.hash.substring(1);
		kolc_scrollTo=0;
		kolc_scrollFrom = kolc_pageTop();
		section_num = 0;
		for(i=0;i<site_section_names.length;i++) {
		    if(i>0) {section_num++; kolc_scrollTo+=site_section_heights[i-1]}
		    if(site_section_names[i] == whereto) {i=site_section_names.length;}
		}
		$("#mp3player").css("top", 11 + ((section_num-1) * 1841)); 
	}
}

function kolc_swapMember(member) {
	$("#bandmemberpic").attr('src', '/images/band/' +  member + '.jpg');
	$("#bandmemberbio").load('/' + member + '_bio.html');
}

window.paused=0;


