// ThomsonNOW World Languages Demo
// Created by Wayne Skipper ( wayne@concentricsky.com )
// Copyright 2006 Thomson Higher Education

// per customer request, make sure the demo is viewed with MSIE
/*if ( document.cookie.indexOf( "warn-dm" ) == -1 && navigator.userAgent.indexOf ("MSIE" ) == -1 )
{
    alert( "This demo is optimized  for Internet Explorer. \nUse of another browser may cause unexpected behavior." );
    document.cookie = "warn-dm=1";
}*/

var loc = "" + window.location;

// primary navigation function
function globalNav( destination )
{
    if ( destination.indexOf( "vmentor" ) != -1 )
    {
        var URL = "http://www.wadsworthmedia.com/vMentor/vMentor_spanish_demo.html";
        var strArgs = "width=660, height=520, left=0, top=0, location=no, menubar=no, status=no, titlebar=no";
        window.open( URL, "WLpop", strArgs );
    }
    else if ( destination.indexOf( "ebook" ) != -1 && destination != "gradebook" )
    {
        var URL = "ebook/reader.html";
        var strArgs = "width=800, height=620, location=no, menubar=no, status=no, titlebar=no, resizable=yes";
        window.open( URL, "WLpop", strArgs );
    }
    else if ( destination.indexOf( "video" ) != -1 )
    {
        var URL = "video.html";
        var strArgs = "width=800, height=620, location=no, menubar=no, status=no, titlebar=no, resizable=yes";
        window.open( URL, "WLpop", strArgs );
    }
    else if ( destination.indexOf( "voice" ) != -1 )
    {
        var URL = "voiceboard.html";
        var strArgs = "width=800, height=600, location=no, menubar=no, status=no, titlebar=no, resizable=yes";
        window.open( URL, "WLpop", strArgs );
    }
    else
    {
        window.location = destination + ".html";
    }
}

function demoNote( x, y, w, h, str )
{
    document.write( '<div style="position: absolute; top: ' + y + 'px; left: ' + x + 'px; width: ' + w  + 'px; height: ' + h + ' px; background-color: #ffff66; border: 1px solid black; padding: 2px;z-index: 99">' );
    document.write( str );
    document.write( '</div>' );
}

function buildNav()
{
    if ( loc.indexOf( "student" ) == -1 )
    {
        document.write( '<div style="position: absolute; top: 140px; left: 16px;">' );
        document.write( '<div style="position: absolute; top: 0px; left: 0px;">' );
        document.write( '<span class="hand" onclick="globalNav( \'classOverview\' )"><img src="images/emptyspace.gif" width="98" height="32"/></span>' );
        document.write( '</div>' );
        document.write( '<div style="position: absolute; top: 0px; left: 102px;">' );
        document.write( '<span class="hand" onclick="globalNav( \'classRoster\' )"><img src="images/emptyspace.gif" width="98" height="32"/></span>' );
        document.write( '</div>' );
        document.write( '<div style="position: absolute; top: 0px; left: 204px;">' );
        document.write( '<span class="hand" onclick="globalNav( \'assign\' )"><img src="images/emptyspace.gif" width="98" height="32"/></span>' );
        document.write( '</div>' );
        document.write( '<div style="position: absolute; top: 0px; left: 306px;">' );
        document.write( '<span class="hand" onclick="globalNav( \'practice\' )"><img src="images/emptyspace.gif" width="98" height="32"/></span>' );
        document.write( '</div>' );
        document.write( '<div style="position: absolute; top: 0px; left: 408px;">' );
        document.write( '<span class="hand" onclick="globalNav( \'gradebook\' )"><img src="images/emptyspace.gif" width="98" height="32"/></span>' );
        document.write( '</div>' );
        document.write( '<div style="position: absolute; top: 0px; left: 510px;">' );
        document.write( '<span class="hand" onclick="globalNav( \'calendar\' )"><img src="images/emptyspace.gif" width="98" height="32"/></span>' );
        document.write( '</div>' );
        document.write( '<div style="position: absolute; top: 0px; left: 611px;">' );
        document.write( '<span class="hand" onclick="globalNav( \'resources\' )"><img src="images/emptyspace.gif" width="98" height="32"/></span>' );
        document.write( '</div></div>' );
        document.write( '<div style="position: absolute; top: 82px; left: 640px;">' );
        document.write( '<div style="position: absolute; top: 0px; left: 0px;">' );
        document.write( '<span class="hand" onclick="globalNav( \'ebook\' )"><img src="images/emptyspace.gif" width="60" height="20"/></span>' );
        document.write( '</div>' );
        document.write( '<div style="position: absolute; top: 0px; left: 65px;">' );
        document.write( '<span class="hand" onclick="globalNav( \'video\' )"><img src="images/emptyspace.gif" width="60" height="20"/></span>' );
        document.write( '</div>' );
        document.write( '<div style="position: absolute; top: 0px; left: 130px;">' );
        document.write( '<span class="hand" onclick="globalNav( \'voice\' )"><img src="images/emptyspace.gif" width="80" height="20"/></span>' );
        document.write( '</div>' );
        document.write( '<div style="position: absolute; top: 0px; left: 220px;">' );
        document.write( '<span class="hand" onclick="globalNav( \'instructorHome\' )"><img src="images/emptyspace.gif" width="60" height="20"/></span>' );
        document.write( '</div></div>' );
        document.write( '<div style="position: absolute; top: 12px; left: 665px;">' );
        document.write( '<span class="hand" onclick="globalNav( \'instructorProfile\' )"><img src="images/emptyspace.gif" width="80" height="20"/></span>' );
        document.write( '</div>' );
        document.write( '<div style="position: absolute; top: 12px; left: 850px;">' );
        document.write( '<span class="hand" onclick="globalNav( \'index\' )"><img src="images/emptyspace.gif" width="50" height="20"/></span>' );
        document.write( '</div>' );
    }
    else
    {
        document.write( '<div style="position: absolute; top: 140px; left: 50px;">' );
        document.write( '<div style="position: absolute; top: 0px; left: 0px;">' );
        document.write( '<span class="hand" onclick="globalNav( \'studentOverview\' )"><img src="images/emptyspace.gif" width="98" height="32"/></span>' );
        document.write( '</div>' );
        document.write( '<div style="position: absolute; top: 0px; left: 102px;">' );
        document.write( '<span class="hand" onclick="globalNav( \'studentAssignments\' )"><img src="images/emptyspace.gif" width="98" height="32"/></span>' );
        document.write( '</div>' );
        document.write( '<div style="position: absolute; top: 0px; left: 204px;">' );
        document.write( '<span class="hand" onclick="globalNav( \'studentPractice\' )"><img src="images/emptyspace.gif" width="98" height="32"/></span>' );
        document.write( '</div>' );
        document.write( '<div style="position: absolute; top: 0px; left: 306px;">' );
        document.write( '<span class="hand" onclick="globalNav( \'studentCalendar\' )"><img src="images/emptyspace.gif" width="98" height="32"/></span>' );
        document.write( '</div>' );
        document.write( '<div style="position: absolute; top: 0px; left: 408px;">' );
        document.write( '<span class="hand" onclick="globalNav( \'studentResources\' )"><img src="images/emptyspace.gif" width="98" height="32"/></span>' );
        document.write( '</div>' );
        document.write( '</div>' );
        document.write( '<div style="position: absolute; top: 82px; left: 630px;">' );
        document.write( '<div style="position: absolute; top: 0px; left: 0px;">' );
        document.write( '<span class="hand" onclick="globalNav( \'ebook\' )"><img src="images/emptyspace.gif" width="60" height="20"/></span>' );
        document.write( '</div>' );
        document.write( '<div style="position: absolute; top: 0px; left: 65px;">' );
        document.write( '<span class="hand" onclick="globalNav( \'video\' )"><img src="images/emptyspace.gif" width="60" height="20"/></span>' );
        document.write( '</div>' );
        document.write( '<div style="position: absolute; top: 0px; left: 130px;">' );
        document.write( '<span class="hand" onclick="globalNav( \'voice\' )"><img src="images/emptyspace.gif" width="80" height="20"/></span>' );
        document.write( '</div>' );
        document.write( '<div style="position: absolute; top: 0px; left: 220px;">' );
        document.write( '<span class="hand" onclick="globalNav( \'studentHome\' )"><img src="images/emptyspace.gif" width="60" height="20"/></span>' );
        document.write( '</div></div>' );
        document.write( '<div style="position: absolute; top: 12px; left: 645px;">' );
        document.write( '<span class="hand" onclick="globalNav( \'studentProfile\' )"><img src="images/emptyspace.gif" width="80" height="20"/></span>' );
        document.write( '</div>' );
        document.write( '<div style="position: absolute; top: 12px; left: 830px;">' );
        document.write( '<span class="hand" onclick="globalNav( \'index\' )"><img src="images/emptyspace.gif" width="50" height="20"/></span>' );
        document.write( '</div>' );
    }
}

function swapBkgd( newBkgd )
{
    document.getElementById( "bkgd" ).src = "images/" + newBkgd;
    if ( newBkgd.indexOf( "cal-m" ) != -1 )
        document.getElementById( "viewDayM" ).style.display = "block";
    else
        document.getElementById( "viewDayM" ).style.display = "none";

    if ( newBkgd.indexOf( "cal-w" ) != -1 )
        document.getElementById( "viewDayW" ).style.display = "block";
    else
        document.getElementById( "viewDayW" ).style.display = "none";

    if ( newBkgd.indexOf( "cal-d" ) != -1 )
    {
        document.getElementById( "sel" ).selectedIndex = 2;
        window.scrollTo( 0,0 );
    }
}
