// ThomsonNOW Demo Platform v1.0
// Created by Wayne Skipper ( wayne@concentricsky.com )
// Copyright 2006 Thomson Higher Education

var offset = 67;
var tabOffset = 27;

function initPage( type, bkgd )
{

    // instructor or student?
    var isInst = ( type == "inst" );

    // tab states
    var stateHome = ( loc.indexOf( "Home" ) != -1 ) ? "on" : "off";
    var stateCourses = ( loc.indexOf( "Courses" ) != -1 || loc.indexOf( "Diagnostic" ) != -1 ) ? "on" : "off";
    var stateStudents = ( loc.indexOf( "Students" ) != -1 ) ? "on" : "off";
    var stateGradebook = ( loc.indexOf( "Grade" ) != -1 ) ? "on" : "off";
    var stateAssignments = ( loc.indexOf( "Assignments" ) != -1 ) ? "on" : "off";
    var stateMaterials = ( loc.indexOf( "Materials" ) != -1 ) ? "on" : "on";
    var stateCommunication = ( loc.indexOf( "Communication" ) != -1 ) ? "on" : "off";

    // HEADER
    document.write( '<div style="position: absolute; top: 0px; left: 0px;">' );
    document.write( '<img src="../images/headerTN.gif" id="hdr"/>' );
    document.write( '</div>' );

    // TABS

    // tab container
    document.write( '<div style="position: absolute; top: ' + offset + 'px; left: 0px;" id="tabDiv">' );
    document.write( '<table height="27" cellspacing="0" cellpadding="0" border="0"><tr class="hand">' );
    document.write( '<td><img src="../images/tabs/spacer_left.gif"/></td>' );

    // home tab
    document.write( '<td><img src="../images/tabs/home_' + stateHome + '.gif" onclick="globalNav(\'home\')"' );
    if ( stateHome != 'on' && loc.indexOf( "Diagnostic" ) == -1 )
        document.write( ' onmouseover="this.src=\'../images/tabs/home_over.gif\'" onmouseout="this.src=\'../images/tabs/home_off.gif\'"' );
    document.write( '/></td>' );
    document.write( '<td><img src="../images/emptyspace.gif" width="1"/></td>' );

    // courses tab
    document.write( '<td><img src="../images/tabs/courses_' + stateCourses + '.gif" onclick="globalNav(\'courses\')"' );
    if ( stateCourses != 'on' && loc.indexOf( "Diagnostic" ) == -1 )
        document.write( ' onmouseover="this.src=\'../images/tabs/courses_over.gif\'" onmouseout="this.src=\'../images/tabs/courses_off.gif\'"' );
    document.write( '/></td>' );

    // students tab
    if ( isInst )
    {
        document.write( '<td><img src="../images/emptyspace.gif" width="1"/></td>' );
        document.write( '<td><img src="../images/tabs/students_' + stateStudents + '.gif" onclick="globalNav(\'students\')"' );
        if ( stateStudents != 'on' && loc.indexOf( "Diagnostic" ) == -1 )
            document.write( ' onmouseover="this.src=\'../images/tabs/students_over.gif\'" onmouseout="this.src=\'../images/tabs/students_off.gif\'"' );
        document.write( '/></td>' );
    }
    document.write( '<td><img src="../images/emptyspace.gif" width="1"/></td>' );

    // gradebook/grades tab
    if ( isInst )
    {
        document.write( '<td><img src="../images/tabs/gradebook_' + stateGradebook + '.gif" onclick="globalNav(\'gradebook\')"' );
        if ( stateGradebook != 'on' && loc.indexOf( "Diagnostic" ) == -1 )
            document.write( ' onmouseover="this.src=\'../images/tabs/gradebook_over.gif\'" onmouseout="this.src=\'../images/tabs/gradebook_off.gif\'"' );
    }
    else
    {
        document.write( '<td><img src="../images/tabs/grades_' + stateGradebook + '.gif" onclick="globalNav(\'gradebook\')"' );
        if ( stateGradebook != 'on' && loc.indexOf( "Diagnostic" ) == -1 )
            document.write( ' onmouseover="this.src=\'../images/tabs/grades_over.gif\'" onmouseout="this.src=\'../images/tabs/grades_off.gif\';"' );
    }
    document.write( '/></td>' );
    document.write( '<td><img src="../images/emptyspace.gif" width="1"/></td>' );

    // assignments tab
    document.write( '<td><img src="../images/tabs/assignmentsTests_' + stateAssignments + '.gif" onclick="globalNav(\'assignments\')"' );
    if ( stateAssignments != 'on' && loc.indexOf( "Diagnostic" ) == -1 )
        document.write( ' onmouseover="this.src=\'../images/tabs/assignmentsTests_over.gif\'" onmouseout="this.src=\'../images/tabs/assignmentsTests_off.gif\'"' );
    document.write( '/></td>' );
    document.write( '<td><img src="../images/emptyspace.gif" width="1"/></td>' );

    // materials tab
    document.write( '<td><img src="../images/tabs/materials_' + stateMaterials + '.gif" onclick="globalNav(\'materials\')"' );
    if ( stateMaterials != 'on' && loc.indexOf( "Diagnostic" ) == -1 )
        document.write( ' onmouseover="this.src=\'../images/tabs/materials_over.gif\'" onmouseout="this.src=\'../images/tabs/materials_off.gif\'"' );
    document.write( '/></td>' );
    document.write( '<td><img src="../images/emptyspace.gif" width="1"/></td>' );

    // communication tab
    document.write( '<td><img src="../images/tabs/communication_' + stateCommunication + '.gif" onclick="globalNav(\'communication\')"' );
    if ( stateCommunication != 'on' && loc.indexOf( "Diagnostic" ) == -1 )
        document.write( ' onmouseover="this.src=\'../images/tabs/communication_over.gif\'" onmouseout="this.src=\'../images/tabs/communication_off.gif\'"' );
    document.write( '/></td>' );
    document.write( '<td><img src="../images/emptyspace.gif" width="1"/></td>' );

    document.write( '</tr></table>' );
    document.write( '</div>' );
/*
    //TAB OUTLINES AND LINKS
    if ( isInst ) {
		    // removed red lines for the moment : onmouseover="this.style.border=\'2px solid #c00;\'"; onmouseout="this.style.border=\'1px dotted #c00\';"
		    //home
		    document.write('<div style="position: absolute; top:67px; left:16px;">');
		    document.write('<img onclick="globalNav(\'home\')" src="../images/emptyspace.gif" class="hand" width="104" height="27" /> ' );
		    document.write('</div>');
		    //courses
		    document.write('<div style="position: absolute; top:67px; left:122px;">');
		    document.write('<img onclick="globalNav(\'courses\')" src="../images/emptyspace.gif" class="hand" width="104" height="27" /> ' );
		    document.write('</div>');
		    //students
		    document.write('<div style="position: absolute; top:67px; left:228px;">');
		    document.write('<img onclick="globalNav(\'students\')" src="../images/emptyspace.gif" class="hand" width="104" height="27" /> ' );
		    document.write('</div>');
		    //gradebook
		    document.write('<div style="position: absolute; top:67px; left:334px;">');
		    document.write('<img onclick="globalNav(\'gradebook\')" src="../images/emptyspace.gif" class="hand" width="104" height="27" /> ' );
		    document.write('</div>');
		    //assignments/tests
		    document.write('<div style="position: absolute; top:67px; left:440px;">');
		    document.write('<img onclick="globalNav(\'assignments\')" src="../images/emptyspace.gif" class="hand" width="118" height="27" /> ' );
		    document.write('</div>');
		    //course materials
		    document.write('<div style="position: absolute; top:67px; left:560px;">');
		    document.write('<img onclick="globalNav(\'materials\')" src="../images/emptyspace.gif" class="hand" width="104" height="27" /> ' );
		    document.write('</div>');
		    //communication
     	            document.write('<div style="position: absolute; top:67px; left:666px;">');
		    document.write('<img onclick="globalNav(\'communication\')" src="../images/emptyspace.gif" class="hand" width="104" height="27" /> ' );
		    document.write('</div>');
		    }
    else 	{
    		    //home
		    document.write('<div style="position: absolute; top:67px; left:16px;">');
		    document.write('<img onclick="globalNav(\'home\')" src="../images/emptyspace.gif" class="hand" width="104" height="27" /> ' );
		    document.write('</div>');
		    //courses
		    document.write('<div style="position: absolute; top:67px; left:122px;">');
		    document.write('<img onclick="globalNav(\'courses\')" src="../images/emptyspace.gif" class="hand" width="104" height="27" /> ' );
		    document.write('</div>');
		    //grades
		    document.write('<div style="position: absolute; top:67px; left:228px;">');
		    document.write('<img onclick="globalNav(\'gradebook\')" src="../images/emptyspace.gif" class="hand" width="104" height="27" /> ' );
		    document.write('</div>');
		    //assignments
		    document.write('<div style="position: absolute; top:67px; left:334px;">');
		    document.write('<img onclick="globalNav(\'assignments\')" src="../images/emptyspace.gif" class="hand" width="118" height="27" /> ' );
		    document.write('</div>');
		    //assignments/tests
		    document.write('<div style="position: absolute; top:67px; left:454px;">');
		    document.write('<img onclick="globalNav(\'materials\')" src="../images/emptyspace.gif" class="hand" width="104" height="27" /> ' );
		    document.write('</div>');
		    //course materials
		    document.write('<div style="position: absolute; top:67px; left:560px;">');
		    document.write('<img onclick="globalNav(\'communication\')" src="../images/emptyspace.gif" class="hand" width="104" height="27" /> ' );
		    document.write('</div>');
    		}
*/

    // BACKGROUND
    var tmp = loc.split( ".html" );
    var tmp2 = tmp[0].split( "page"  );
    var page = Number ( tmp2[1] );
    var imageFolder = ( loc.indexOf( "Materials" ) != -1 || ( loc.indexOf( "studentAssignments" ) != -1 && page > 7  ) ) ? "../courseMaterials/images/" : "images/";

    document.write( '<div style="position: absolute; top: ' + Number( offset + tabOffset + 16 ) + 'px; left: 16px;" id="bkgdDiv">' );
    document.write( '<img src="' + imageFolder + bkgd + '.gif" id="bkgd" vB="' + bkgd + '"/>' );
    document.write( '</div>' );

    // GLOBAL NAV
    document.write( '<div style="position: absolute; top: 24px; left: 380px; color:#0020b7; font-size: 7.5pt; width: 300px" valign="top">' );
    document.write( '<img src="../images/arrow_select_light.gif"/> <div style="position: absolute; top: 0px; left: 14px">Help</div></div>' );
    document.write( '<div style="position: absolute; top: 24px; left: 380px;">' );
    document.write( '<img src="../images/emptyspace.gif" width="98" height="10"/> ' );
    document.write( '</div>' );
    if ( isInst )
    {
        document.write( '<div style="position: absolute; top: 40px; left: 482px;color:#0020b7; font-size: 7.5pt;" valign="top">' );
        document.write( '<img src="../images/arrow_select_light.gif"/> <div style="position: absolute; top: 0px; left: 14px">Preferences</div></div>' );
        //document.write( '<div style="position: absolute; top: 40px; left: 482px;">' );
        //document.write( '<img src="../images/emptyspace.gif" onclick="globalNav(\'prefs\')" class="hand" width="98" height="10"/> ' );
        //document.write( '</div>' );
        document.write( '<div style="position: absolute; top: 40px; left: 380px;color:#0020b7; font-size: 7.5pt; width: 200px" valign="top">' );
        document.write( '<img src="../images/arrow_select_light.gif"/> <div style="position: absolute; top: 0px; left: 14px">Admin Tools</div></div>' );
        document.write( '<div style="position: absolute; top: 40px; left: 380px;">' );
        document.write( '<img src="../images/emptyspace.gif" width="98" height="10"/> ' );
        document.write( '</div>' );
        document.write( '<div style="position: absolute; top: 24px; left: 482px;color:#0020b7; font-size: 7.5pt; width: 200px" valign="top">' );
        document.write( '<img src="../images/arrow_select_light.gif"/> <div style="position: absolute; top: 0px; left: 14px">My Account</div></div>' );
        document.write( '<div style="position: absolute; top: 24px; left: 482px;">' );
        document.write( '<img src="../images/emptyspace.gif" width="98" height="10"/> ' );
        document.write( '</div>' );
        document.write( '<div style="position: absolute; top: 24px; left: 584px;color:#0020b7; font-size: 7.5pt; width: 200px" valign="top">' );
        document.write( '<img src="../images/arrow_select_light.gif"/> <div style="position: absolute; top: 0px; left: 14px">Upload Files</div>' );
        document.write( '</div>' );
        document.write( '<div style="position: absolute; top: 40px; left: 584px;color:#0020b7; font-size: 7.5pt; width: 200px" valign="top">' );
        document.write( '<img src="../images/arrow_select_light.gif"/> <div style="position: absolute; top: 0px; left: 14px">ThomsonNOW Tools</div>' );
        document.write( '</div>' );
        document.write( '<div style="position: absolute; top: 24px; left: 740px;color:#0020b7; font-size: 7.5pt; font-weight: bold; width: 100px" valign="top">' );
        document.write( '<img src="../images/arrow_select_dark.gif"/> <div style="position: absolute; top: 0px; left: 14px">Sign Out</div></div>' );
        document.write( '<div style="position: absolute; top: 24px; left: 740px;">' );
        //document.write( '<img src="../images/emptyspace.gif" onclick="globalNav( \'reset\' )" class="hand" width="98" height="10"/> ' );
        document.write( '</div>' );
        document.write( '<div style="position: absolute; top: 40px; left: 740px;color:#0020b7; font-size: 7.5pt;" valign="top">' );
        document.write( '<img src="../images/arrow_select_light.gif"/> <div style="position: absolute; top: 0px; left: 14px">Feedback</div>' );
        document.write( '</div>' );
    }
    else
    {
        document.write( '<div style="position: absolute; top: 40px; left: 380px;color:#0020b7; font-size: 7.5pt; width: 300px" valign="top">' );
        document.write( '<img src="../images/arrow_select_light.gif"/> <div style="position: absolute; top: 0px; left: 14px">My Account</div>' );
        document.write( '</div>' );
        document.write( '<div style="position: absolute; top: 24px; left: 640px;color:#0020b7; font-size: 7.5pt; font-weight: bold;  width: 300px" valign="top">' );
        document.write( '<img src="../images/arrow_select_dark.gif"/><div style="position: absolute; top: 0px; left: 14px;">Sign Out</div>' );
        document.write( '</div>' );
        document.write( '<div style="position: absolute; top: 24px; left: 640px;z-index:400;">' );
        //document.write( '<img src="../images/emptyspace.gif" onclick="globalNav( \'reset\' )" class="hand" width="98" height="10"/> ' );
        document.write( '</div>' );
        document.write( '<div style="position: absolute; top: 24px; left: 482px;color:#0020b7; font-size: 7.5pt; width: 300px" valign="top">' );
        document.write( '<span class="" onclick="//globalNav( \'account\' )">' );
        document.write( '<img src="../images/arrow_select_light.gif"/> <div style="position: absolute; top: 0px; left: 14px">ThomsonNOW Tools</div></span>' );
        document.write( '</div>' );
        document.write( '<div style="position: absolute; top: 40px; left: 640px;color:#0020b7; font-size: 7.5pt;" valign="top">' );
        document.write( '<img src="../images/arrow_select_light.gif"/> <div style="position: absolute; top: 0px; left: 14px">Feedback</div>' );
        document.write( '</div>' );
    }
    document.write( '<div style="position: absolute; top: 24px; left: 162px; font-size: 7.5pt; width: 200px;">' );
    if ( isInst )
        document.write( 'Welcome <b>Demo Instructor</b>' );
    else
        document.write( 'Welcome <b>Demo Student</b>' );
    document.write( '</div>' );

    document.write( '<div style="position: absolute; top: 42px; left: 170px;' );
    document.write( 'background-color: white; border: 2px solid #c00; height: 15px; padding-left: 2px; padding-right: 2px;z-index: 99; font-weight:bold">' );
    document.write( '<a href="javascript:globalNav( \'reset\' )" style="text-decoration: none; font-size: 8pt">Return to demo home</a>' );
    document.write( '</div>' );
}

function initTunnelPage( bkgd )
{
    document.write( '<div style="position: absolute; top: 16px; left: 16px;" id="bkgdDiv">' );
    document.write( '<img src="images/' + bkgd + '.gif" id="bkgd" vB="' + bkgd + '"/>' );
    document.write( '</div>' );
}

function buildCourseTree()
{
    var id = getCookie( "selectedCourse" );
    if ( id == "" )
        id = "1";

    document.write( '<div style="height: 15px; width: 300px; top: 163px; left: 29px; position: absolute; border: 2px dotted #c00; background-color: #d9d9d9" >' );
    document.write( '<table width="100%"><tr>' );
    document.write( '<td id="courseSelectText" nowrap="1" style="font-family:verdana; font-size: 8pt; " class="hand" onclick="showCourseDropBox()"><font style=""></font></td>' );
    document.write( '<td valign="center" style="width: 15px; cursor: pointer; cursor: hand;" id="courseSelectButton" onclick="showCourseDropBox()"><img src="../images/select_bg_down_arrow.gif" valign="center" onmouseover="this.src=\'../images/select_bg_down_arrow_over.gif\'" onmouseout="this.src=\'../images/select_bg_down_arrow.gif\'" onclick="closeTree()"></td>' );
    document.write( '</tr></table>' );
    document.write( '<iframe src="../misc/courseTreeSource.html" name="courseSelector" id="courseSelector" style="height: 100; width: 300; border: solid 1px #8080A0; position: absolute; display: none;"></iframe>' );
    document.write( '</div>' );
    document.write( '<script language="javascript">var bRenderedTree = false;var left = false;</script>' );

    var Loaded = false;

    c=new TN("CMSCourseTree","Course Tree",1,"",null,[["ip_2","/media/img/folder/folderLockedOpen.gif"],["ip_4","/media/img/folder/courseOpen.gif"],["ip_3","/media/img/folder/folderLockedClosed.gif"],["ip_7","/media/img/folder/folderClosed.gif"],["ip_5","/media/img/folder/courseClosed.gif"],["ip_6","/media/img/folder/folderOpen.gif"],["ip_1","/media/img/tree/new.gif"]]);
    c=c.ac(new TN("5","All Courses",4097,"",null,[["oi","6"],["ci","7"],["objectType","folder"],["name","All Courses"],["id","0"]]));
    if ( id == 1 )
        selnode_CMSCourseTree=c.ac(new TN("13",truncateString( DATABASE.general.courses[0].name, 32 ),528392,"",null,[["oi","4"],["accessLevel","3"],["ci","5"],["objectType","course"],["id","1"]]));
    else
        c.ac(new TN("13",truncateString( DATABASE.general.courses[0].name, 32 ),528392,"",null,[["oi","4"],["accessLevel","3"],["ci","5"],["objectType","course"],["id","1"]]));
    if ( id == 2 )
        selnode_CMSCourseTree=c.ac(new TN("14",truncateString( DATABASE.general.courses[1].name, 32 ),528384,"",null,[["oi","4"],["accessLevel","3"],["ci","5"],["objectType","course"],["id","2"]]));
    else
        c.ac(new TN("14",truncateString( DATABASE.general.courses[1].name, 32 ),528384,"",null,[["oi","4"],["accessLevel","3"],["ci","5"],["objectType","course"],["id","2"]]));

    c=c.p;
    treeroot_CMSCourseTree=c;
    initTree();
    c.geh_onselect= onNodeSelect;
    var oldOL = window.onload;
}

// usage:
//            <div style="position: absolute; top: 300px; left: 200px; width: 500px">
//                <script language="javascript">showProgress()</script>
//            </div>

function showProgress( itemArray, active )
{
    var cellSize = Math.floor( 100 / itemArray.length ) ;

    document.write( '<table cellpadding="0" cellspacing="0" border="0" width="100%" height="18"><tr>' );

    for ( var i = 0; i < itemArray.length; i ++ )
    {
        document.write( '<td width="9" background="../images/progress/' );
        if ( active == i )
        {
            if ( i == 0 )
                document.write( 'activeLeft.gif' );
            else
                document.write( 'activeLeft2.gif' );
        }
        else if ( active < i )
        {
            if ( active == i - 1 )
                document.write( 'connect0.gif' );
            else
                document.write( 'connect1.gif' );
        }
        else if ( i == 0 )
            document.write( 'pastLeft.gif' );
        else
            document.write( 'pastMiddle.gif' );
        document.write( '"><img src="../images/emptyspace.gif" height="18" width="9"/></td>' );
        document.write( '<td background="../images/progress/' );
        if ( active == i )
            document.write( 'activeMiddle.gif' );
        else if ( active < i )
            document.write( 'connect1.gif' );
        else
            document.write( 'pastMiddle.gif' );
        document.write( '" width="' + cellSize + '%" valign="middle"><span style="font-size: 7.5pt; font-weight: bold; margin-top:-3px;' );
        if ( active > i )
            document.write( 'color: blue;' );
        else if ( active == i )
            document.write( 'color: #000000' );
        else
            document.write( 'color: #97abbf' );
        document.write( '"><nobr>' );
        if ( active > i )
            document.write( '<img src="../images/arrow_select_dark.gif" style="position:relative;top:3px;"/>' );
        document.write( '&nbsp;' + Number( i + 1 ) + '. ' + itemArray[i] + '</span></nobr></td>' );
    }

    document.write( '<td background="../images/progress/' );
    if ( active == itemArray.length - 1 )
        document.write( 'activeEnd.gif' );
    else
        document.write( 'futureEnd.gif' );
    document.write( '" width="9"><img src="../images/emptyspace.gif" width="9"/></td>' );
    document.write( '</tr></table>' );

    document.getElementById( 'stepName' ).innerHTML = itemArray[ active ];
}

function initFooter()
{
    document.write( '<div id="ftrDiv" style="position: absolute; top: 0px; left: 0px; display: none">' );
    document.write( '<img src="../images/footerTN.gif"/>' );
    document.write( '</div>' );
}

function attachFooter()
{
    // calculate height of bkgd image, position and display footer
    var footerY = offset + tabOffset + document.getElementById( 'bkgd' ).height + 25;
    document.getElementById( "ftrDiv" ).style.top = footerY + "px";
    document.getElementById( "ftrDiv" ).style.left = "20px";
    document.getElementById( "ftrDiv" ).style.display ="block";
}

function homeLink( x, y, levels )
{
    document.write( '<div style="position: absolute; top: ' + y + 'px; left: ' + x + 'px;' );
    document.write( 'background-color: white; border: 2px solid blue; padding: 2px; height: 15px; z-index: 99; font-weight:bold">' );
    dotdot = '';
    for (var i = 0; i < levels; i++)
    {
        dotdot += '../';
    }
    document.write( '<a href="javascript:gotoPage(\''+dotdot+'index\')" style="text-decoration: none">Return to demo home</a>' );
    document.write( '</div>' );
}

/*
 * x, y = coordinates
 * w,h = width, height
 * point = direction of pointer ( 0 for none or 1-4 )
 * str = html to display in the bubble
*/
function speechBubble( x, y, w, h, str, point )
{
    // no bubble if str is empty
    if ( str == "" )
        return;

    var imgBASE = "../images/bubbles/";

    document.write( '<div style="position: absolute; top: ' + y + 'px; left: ' + x + 'px; z-index: 98">' );
    document.write( '<table width="' + w + '" height="' + h + '" border="0" cellspacing="0" cellpadding="0" style="font-size: 10pt">' );
    document.write( '<tr><td width="8" height="8"><img src="' + imgBASE + 'corner-ul.gif"/></td>' );
    document.write( '<td width="100%" height="8" style="background-image: url(' + imgBASE + 'top.gif); background-repeat: repeat-x"></td>' );
    document.write( '<td width="8" height="8"><img src="' + imgBASE + 'corner-ur.gif"/></td></tr>' );
    document.write( '<tr><td width="8" height="100%" style="background-image: url(' + imgBASE + 'left.gif); background-repeat: repeat-y"></td>' );
    document.write( '<td width="100%" height="100%" bgcolor="#fea750" valign="top">' );
    document.write( str );
    document.write( '</td><td width="8" height="100%" style="background-image: url(' + imgBASE + 'right.gif); background-repeat: repeat-y"></td></tr>' );
    document.write( '<tr><td width="8" height="8"><img src="' + imgBASE + 'corner-ll.gif"/></td>' );
    document.write( '<td width="100%" height="8" style="background-image: url(' + imgBASE + 'bottom.gif); background-repeat: repeat-x"></td>' );
    document.write( '<td width="8" height="8"><img src="' + imgBASE + 'corner-lr.gif"/></td>' );
    document.write( '</tr></table>' );
    document.write( '</div>' );

    var pointX, pointY, pointIMG;

    if ( point == undefined || point == '0' )
          return;
    else if ( point == '1' )
    {
          pointX = x;
          pointY = y-25;
    }
    else if ( point == '2' )
    {
          pointX = x+w-30;
          pointY = y-25;
    }
    else if ( point == '3' )
    {
          pointX = x+w-30;
          pointY = y+h-2;
    }
    else if ( point == '4' )
    {
          pointX = x;
          pointY = y+h-2;
    }
    else if ( point == '5' )
    {
        pointX = x;
        pointY = y-25;

        document.write( '<div style="position: absolute; top: ' + pointY + 'px; left: ' + pointX + 'px; z-index: 99"><img src="' + imgBASE + "point1.gif" + '"/></div>' );

        pointX = x+w-30;
        pointY = y-25;

        document.write( '<div style="position: absolute; top: ' + pointY + 'px; left: ' + pointX + 'px; z-index: 99"><img src="' + imgBASE + "point2.gif" + '"/></div>' );
    }

    pointIMG = imgBASE + "point" + point + ".gif";
    if (point < 5)
    {
        document.write( '<div style="position: absolute; top: ' + pointY + 'px; left: ' + pointX + 'px; z-index: 99"><img src="' + pointIMG + '"/></div>' );
    }
}

function writeCourseName( val )
{
    document.write( truncateString( DATABASE.general.courses[val].name, 62 ) );
}

function writeCourseNumber( val )
{
    document.write( DATABASE.general.courses[val].number.slice( 0, 9 ) );
}
