All pastes #335555 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-02-01 12:29 UTC
rendered paste body
	<script type="text/javascript">
	<!--        
	     ///This function sets the scroll position of div to cookie.
	    function setScrollPos()
	    {
	        var divY = document.getElementById('catalogue').scrollTop; 
	        document.cookie = "divPos=!*" + divY + "*!"; 
	    } 
	    ///Attaching a function on window.onload event.
	    window.onload = function()
	    {
	        var strCook = document.cookie; 
	        if(strCook.indexOf("!~")!= -1)
	        { 
	            var intS = strCook.indexOf("!~"); 
	            var intE = strCook.indexOf("~!"); 
    	        var strPos = strCook.substring(intS+2,intE); 
    	        document.body.scrollTop = strPos; 
    	    } 
    	    /// This condition will set scroll position of <div>.
    	    if(strCook.indexOf("!*")!= -1)
    	    { 
    	        var intdS = strCook.indexOf("!*"); 
    	        var intdE = strCook.indexOf("*!"); 
    	        var strdPos = strCook.substring(intdS+2,intdE); 
    	        document.getElementById('catalogue').scrollTop = strdPos; 
    	    }
    	};
    	/// Function to set Scroll position of page before postback. 
    	function SetScrollPosition()
    	{ 
        var intY = document.body.scrollTop; 
    	    document.cookie = "yPos=!~" + intY + "~!"; 
    	}
    	/// Attaching   SetScrollPosition() function to window.onscroll event.
    	window.onscroll = SetScrollPosition;
    	document.getElementById('catalogue').onscroll = SetScrollPosition;
	-->
	</script>