// JavaScript Document
var gblscroll = 0;
var demonstration;

function naviAction(obj,actionobj){
	if (actionobj==1){
		alert("1");
		//obj.style.borderBottom="1px #990000 solid;";
	} else {
		alert("2");
		//obj.style.borderBottom="0px #990000 solid;";
	}
}

function updateDemonstration(){
  document.getElementById('staynavi').style.top = demonstration.updatePosition()+"px";
}

function scrollingDetector(){
	if (document.body.scrollTop != gblscroll){
	var getCurrentPos = document.getElementById('staynavi').offsetTop;
			 if(document.body.scrollTop > 240){
				 var getTopPostion = document.body.scrollTop-240;
			} else {
				 var getTopPostion=0;
			}
				 var target = Math.round(240)+Math.round(getTopPostion)
				 demonstration = new SmoothMovement(getCurrentPos,target,0);
				 window.setInterval(updateDemonstration, 20);
		gblscroll = document.body.scrollTop;
	 }
}
window.setInterval(scrollingDetector, 500);
