menu_status = new Array();
function setTertiaryNavState(id){
    if (document.getElementById) {
        var topId = "top" + id;
        var subId = "sub" + id;

        var top = document.getElementById(topId);
        var sub = document.getElementById(subId);
        
        if (top != null) { // does top level exist?
            if (sub != null) { // does sub level exist?
                if (top.className != 'tertMenu_Arrow_on') {
                   top.className = 'tertMenu_Arrow_on';
                } else {
                   top.className = 'tertMenu_Arrow';
                }
                
                if (menu_status[subId] != 'show') {
                   sub.className = 'show';
                   menu_status[subId] = 'show';                   
                } else {
                   sub.className = 'hide';
                   menu_status[subId] = 'hide';
                }
            } else { // No submenu
                if (top.className != 'tertMenu_on') {
                   top.className = 'tertMenu_on';
                } else {
                   top.className = 'tertMenu';
                }
            }
        }
    }
}

function openWindow(theURL,winName,features) {
	newWin=window.open(theURL,winName,features);
	self.name="main";
	newWin.focus();
}

function showPopup(popup) { // hide all slides and show only selected popup
    // popups with play button
    if (document.getElementById('popup1') != null) {
        document.getElementById('popup1').style.visibility='hidden';
    }
    if (document.getElementById('popup2') != null) {
        document.getElementById('popup2').style.visibility='hidden';
    }
    if (document.getElementById('popup3') != null) {
        document.getElementById('popup3').style.visibility='hidden';
    }
    if (document.getElementById('popup4') != null) {
        document.getElementById('popup4').style.visibility='hidden';
    }
    
    if (popup != '') {
        document.getElementById(popup).style.visibility='visible';
    }
}

function showPopupNotListed(popup) { // hide all slides and show only selected popup
    // popups with play button
    if (document.getElementById('popup1') != null) {
        document.getElementById('popup1').style.visibility='hidden';
    }
    if (document.getElementById('popup2') != null) {
        document.getElementById('popup2').style.visibility='hidden';
    }
    if (document.getElementById('popup4') != null) {
        document.getElementById('popup4').style.visibility='hidden';
    }
    
    if (popup != '') {
        document.getElementById(popup).style.visibility='visible';
    }
}

function hidePopup(popup) { // hide selected popup
    document.getElementById(popup).style.visibility='hidden';
}

function playClick(playid) {
    if (document[playid].src=='http://www.vzam.net/vcastmusic/images/popup/playon.gif') {
        document[playid].src='images/popup/pauseon.gif';
        InitializeTimer();
    } else if (document[playid].src=='http://www.vzam.net/vcastmusic/images/popup/pauseon.gif') {
        document[playid].src='images/popup/playon.gif';
        StopTheClock();
    }
}

function playClickNotListed(playid) {
    if (document[playid].src=='http://www.vzam.net/vcastmusic/images/popup/playon.gif') {
        document[playid].src='images/popup/pauseon.gif';
        InitializeTimerNotListed();
    } else if (document[playid].src=='http://www.vzam.net/vcastmusic/images/popup/pauseon.gif') {
        document[playid].src='images/popup/playon.gif';
        StopTheClock();
    }
}

function playMouseOver(playid) {
    if (document[playid].src=='http://www.vzam.net/vcastmusic/images/popup/playoff.gif') {
        document[playid].src='images/popup/playon.gif';
    } else if (document[playid].src=='http://www.vzam.net/vcastmusic/images/popup/pauseoff.gif') {
        document[playid].src='images/popup/pauseon.gif';
    }
}

function playMouseOff(playid) {
    if (document[playid].src=='http://www.vzam.net/vcastmusic/images/popup/playon.gif') {
        document[playid].src='images/popup/playoff.gif';
    } else if (document[playid].src=='http://www.vzam.net/vcastmusic/images/popup/pauseon.gif') {
        document[playid].src='images/popup/pauseoff.gif';
    }
}

function imgSwap(id, img) {
    document[id].src=img;
}

var secs
var timerID = null
var timerRunning = false
var delay = 1000

function InitializeTimer()
{        
    // Set the length of the timer, in seconds
    secs = 5
    StopTheClock()
    StartTheTimer()
}

function InitializeTimerNotListed()
{        
    // Set the length of the timer, in seconds
    secs = 5
    StopTheClock()
    StartTheTimerNotListed()
}

function StopTheClock()
{
    if(timerRunning)
        clearTimeout(timerID)
    timerRunning = false
}

function StartTheTimer()
{
    if (secs==0)
    {
        StopTheClock()
        if (document.getElementById('popup1').style.visibility=='visible') {
            showPopup('popup2');
            document['play2'].src="images/popup/pauseoff.gif";
            InitializeTimer();
        } else if (document.getElementById('popup2').style.visibility=='visible') {
            showPopup('popup3');
            document['play3'].src="images/popup/pauseoff.gif";
            InitializeTimer();
        } else if (document.getElementById('popup3').style.visibility=='visible') {
            showPopup('popup4');
            document['play4'].src="images/popup/pauseoff.gif";
            InitializeTimer();
        } else if (document.getElementById('popup4').style.visibility=='visible') {
            showPopup('popup1');
            document['play1'].src="images/popup/pauseoff.gif";
            InitializeTimer();
        }
    }
    else
    {
        self.status = secs
        secs = secs - 1
        timerRunning = true
        timerID = self.setTimeout("StartTheTimer()", delay)
    }
}

function StartTheTimerNotListed()
{
    if (secs==0)
    {
        StopTheClock()
        if (document.getElementById('popup1').style.visibility=='visible') {
            showPopupNotListed('popup2');
            document['play2'].src="images/popup/pauseoff.gif";
            InitializeTimerNotListed();        
        } else if (document.getElementById('popup2').style.visibility=='visible') {
            showPopupNotListed('popup4');
            document['play4'].src="images/popup/pauseoff.gif";
            InitializeTimerNotListed();
        } else if (document.getElementById('popup4').style.visibility=='visible') {
            showPopupNotListed('popup1');
            document['play1'].src="images/popup/pauseoff.gif";
            InitializeTimerNotListed();
        }
    }
    else
    {
        self.status = secs
        secs = secs - 1
        timerRunning = true
        timerID = self.setTimeout("StartTheTimerNotListed()", delay)
    }
}