    
    //Get the major version of IE
    function GetIEMajorVersion()
    {
        var IEMajorVer;
        var UserAgentString;
        
        IEMajorVer = "unknown"; //Assume version cannot be determined until proven otherwise
        UserAgentString = navigator.userAgent.toLowerCase();
        
        if (UserAgentString.indexOf("msie") != -1 ) //then it is IE
        {            
            //Assumes IE component of string is in the form msie [MajorVersion].[MinorVersion] eg 'msie 6.0'
            IEMajorVer = UserAgentString.substr(UserAgentString.indexOf("msie") + 5,1);
        }   
                
        return IEMajorVer;
    }
    
    //Show a presentation full screen based on the screen resolution
    //NB Important you user forward slashes in the URL parameter
    //Avoid using null as the name as this can actually result in url not being displayed full screen in new window but in
    //an existing window
    
    function OpenWindowFullScreen(PresURL,name)
    {        
        var HorizontalOffset = new Number(0); //adjust the horizontal margin around browser. ie the distance in from screen edge
        var VerticalOffset = new Number(0); //adjust the vertical margin around browser. ie the distance in from screen edge
        var HorizontalFudge = new Number(10); //Fudge to make bottom margin equal to top
        var VerticalFudge = new Number(30); //Fudge to make right margin equal to left
        var PresHeight = new Number(screen.availHeight - (2 * VerticalOffset) - VerticalFudge);
        var PresWidth = new Number(screen.availWidth - (2 * HorizontalOffset) - HorizontalFudge);
              
        NewWindow = window.open(PresURL,name,'height=' + PresHeight + ',width=' + PresWidth + ',status=no,top='+ VerticalOffset + ',left='+ HorizontalOffset + ',toolbar=no,menubar=no,location=no,scrollbars=1,resizable=1');        
        NewWindow.focus(); //Bring window to front if already open        
    }
    
    //Open a window centred (reasonbly close anyway) with specified size. 
    //Don't allow opening to a size greater than current screen resolution
    //NB Important you user forward slashes in the URL parameter
    //Eg : lnkAV1.Attributes.Add("onclick", String.Format("javascript:OpenAVCentred('avloading.aspx?cd={0}&md={1}','av1',200,300,'false');", theCourse.Directory, theSection.MediaDir1));
    //Note the single quotes around PresUrl and name arguments.
    
    function OpenAVCentred(PresURL,name,height,width,closeParent)
    {        
        var HorizontalOffset = new Number(0); //adjust the horizontal margin around browser
        var VerticalOffset = new Number(0); //adjust the vertical margin around browser
        var PresHeight = new Number(height);
        var PresWidth = new Number(width);
              
        var Top = (screen.availHeight / 2) - (PresHeight / 2)
        var Left = (screen.availWidth / 2) - (PresWidth / 2)
        
        NewWindow = window.open(PresURL,name,'height=' + PresHeight + ',width=' + PresWidth + ',status=no,top='+ Top + ',left='+ Left + ',toolbar=no,menubar=no,location=no,scrollbars=1,resizable=1');        
        NewWindow.focus(); //bring window to front if already open ie the name is the same as that of an existing window.
        if(closeParent == 'true'){ //then close the window that opened this popup.
            window.parent.close();
        }
    }
    
    
