
var t = null;
var maxstep = 50;


function replaceImage(id, imageName, altText){
	var img = document.getElementById(id);
	img.src='images/sashes/' + imageName;
	img.alt = altText;
}



   function winBRopen(theURL, Name, popW, popH, scroll) {
     var winleft = (screen.width - popW) / 2;
     var winUp = (screen.height - popH) / 2;
     winProp = 'width='+popW+',height='+popH+',left='+winleft+',t op='+winUp+',scrollbars='+scroll+','
     Win = window.open(theURL, Name, winProp)
     if (parseInt(navigator.appVersion) >= 4){
       Win.window.focus();
     }
   }



function getScrollPosY(){
    if (window.pageYOffset != null){
	    return window.pageYOffset;
    }else if (document.body.scrollTop != null){
	    return document.body.scrollTop;
    }
    
    return 0;
}



function move(){

   
   if (document.all.fixedposdiv != null){
	mov_image = document.all.fixedposdiv;
    } else if (document.getElementById("fixedposdiv") != null){
        mov_imgage = document.getElementById("fixedposdiv");
    } else{
       // no object returned - cancel script
       return;
    }
    

   var sy = getScrollPosY();
   var tp = parseInt(mov_image.style.top.substring(0, mov_image.style.top.length-2)); 
   

   if (!tp){
       mov_image.style.top = getScrollPosY() + "px";
       return;
   }

   
   if (Math.abs(tp-sy) < 5){
       //alert("done");
       t = null;
       return;
   }

   df = Math.min(Math.ceil(Math.abs(tp-sy)/10), maxstep);

   if (tp < sy){
       tp = tp + df;
   }else{
       tp = tp - df;
   } 

   // alert (tp);
   mov_image.style.top = tp + "px";
   t=setTimeout("move()", 10);
}




function handleScrollEvent(){
   
    if ( t == null){
	move();
    }	


}

