        function pausecomp(millis) 
        {
        var date = new Date();
        var curDate = null;

        do { curDate = new Date(); } 
        while(curDate-date < millis);
        }

            function openWebCT()
            {
                //open the login window
	            document.uonlogin.action = "WebCTLogin.asp";
	            document.uonlogin.target = "WebCT";
	            
	            document.uonlogin.submit();
	            
	            /*
	            winLogin = window.open("WebCTLogin.htm");

	            while (winLogin.document.readyState != "complete")
	            {
		            //pausecomp(500);
	            }

	            //get the time zone offset
	            var now = new Date();
	            var tzo = now.getTimezoneOffset()/60;

	            //set the params
	            winLogin.document.useridForm.webctid.value = document.all.username.value;
	            winLogin.document.useridForm.password.value = document.all.password.value;
	            winLogin.document.useridForm.action = "http://webct.nottingham.ac.uk/webct/urw/lc4130001.tp0/authenticateUser.dowebct";
	            winLogin.document.useridForm.timeZoneOffset.value = tzo;

	            //and submit
	            winLogin.document.useridForm.submit();
	            */
            }


            function openPortal()
            {
	            //open the login window
	            document.uonlogin.action = "PortalLogin.asp";
	            document.uonlogin.target = "Portal";
	            
	            document.uonlogin.submit();
	            /*
	            winLogin = window.open("PortalLogin.htm");
        	
	            while (winLogin.document.readyState != "complete")
	            {
		            //pausecomp(500);
	            }

	            //set the params
	            winLogin.document.useridForm.user.value = document.all.username.value;
	            winLogin.document.useridForm.pass.value = document.all.password.value;

	            //and submit
	            winLogin.document.useridForm.submit();
	            */

            }

            function openOWA()
            {
	            //open the login window
	            document.uonlogin.action = "OWALogin.asp";
	            document.uonlogin.target = "OWA";
	            
	            document.uonlogin.submit();
	            //winLogin = window.open("OWALogin.asp");
        	
	            //while (winLogin.document.readyState != "complete")
	            //{
		            //pausecomp(500);
	            //}

	            //set the params
	            //winLogin.document.logonForm.username.value = document.all.username.value;
	            //winLogin.document.logonForm.password.value = document.all.password.value;

	            //and submit
	            //winLogin.document.logonForm.submit();

            }

            function doCookies()
            {
	            if (document.all.save.checked)
	            {
		            createCookie("username", document.all.username.value, 30);
		            createCookie("password", document.all.password.value, 30);
		            createCookie("save", document.all.save.checked, 30);
	            }
	            else
	            {
		            createCookie("username","",-1);
		            createCookie("password","",-1);
	            }
            }

            function loadCookies()
            {
            	//fill in the url
	            document.getElementById("url").value = window.location.href;

	            if (readCookie("username") && readCookie("password"))
	            {
		            //set the values
		            document.all.username.value = readCookie("username");
		            document.all.password.value = readCookie("password");
		            document.all.save.checked = readCookie("save");
	            }
            }

            function createCookie(name,value,days) 
            {
	            if (days) 
	            {
		            var date = new Date();
		            date.setTime(date.getTime()+(days*24*60*60*1000));
		            var expires = "; expires="+date.toGMTString();
	            }
	            else var expires = "";
	            document.cookie = name+"="+value+expires+"; path=/";
            }

            function readCookie(name) 
            {
	            var nameEQ = name + "=";
	            var ca = document.cookie.split(';');
	            for(var i=0;i < ca.length;i++) 
	            {
		            var c = ca[i];
		            while (c.charAt(0)==' ') c = c.substring(1,c.length);
		            if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	            }
	            return null;
            }