
	/******************************************************************** 
	 **  Keep the scroll postion of the page when refresh               
	 ********************************************************************/
    function fnLoad()
    {
        with(window.document.body)
        {
            addBehavior ("#default#userData");    		// make the body could support userdate
            load("scrollState" + getFileName());    	// Get former status saved in userdate
            scrollLeft = getAttribute("scrollLeft");    // scrool left position 
            scrollTop = getAttribute("scrollTop");		// scrool Top position 
        }
    }

    function fnUnload()
    {
        with(window.document.body)
        {
            setAttribute("scrollLeft",scrollLeft);
            setAttribute("scrollTop",scrollTop);
            save("scrollState" + getFileName());   
            // Add the file name, in case will effected by the userdata of other files 
            // the data in userdate could not be visited by different folders
        }
    }
	
    function getFileName()
    {
        var url = this.location.href
        var pos = url.lastIndexOf("/");
        if(pos == -1)
            pos = url.lastIndexOf("\\")
        var filename = url.substr(pos +1)
        return filename;
    }
	

	/******************************************************************** 
	 **  Open pop up windows               
	 ********************************************************************/
	function popupwin(mylink, windowname)
	{
		//if (! window.focus) return true;
		var href;
		if (typeof(mylink) == 'string')
			href=mylink;
		else
			href=mylink.href;
			
		windowname = window.open(href, windowname, 	   'width=495,height=470,location=no,menubar=no,scrollbars=no,resizable=no,statusbar=no,menubar=no');
		if (window.focus) {windowname.focus()}
		return false;
	}	
		

	//Open Demo Video window
	function openVideoWindow(URL) 
	{
		var MyWindow=window.open(URL,'videodemo','width=495,height=470,location=no,menubar=no,scrollbars=no,resizable=no,statusbar=no,menubar=no');
		if (window.focus) {MyWindow.focus()}
	}
		