﻿var windowActive = false;

function enableOverlay() {
    //document.getElementById("mainVideoPlayer").style.visibility = "hidden";
    document.getElementById("overlay").style.visibility = "visible";
    document.getElementById("overlay").style.display = "inline";
    scrollTo(0, 0);
}
function disableOverlay() {
    if (!windowActive) {
        //document.getElementById("mainVideoPlayer").style.visibility = "visible";
    }
    document.getElementById("overlay").style.visibility = "hidden";
    document.getElementById("overlay").style.display = "none";
}

function popVideo(videoID) {
    enableOverlay();
    document.getElementById("videoPlayer").style.visibility = "visible";
    document.getElementById("videoFrame").src = "playVideo.aspx?vid=" + videoID;
    _gaq.push(['_trackPageview', '/open_video_' + videoID ]);
    //pageTracker._trackPageview('/open_video_' + videoID);
}

function closeVideo() {
    disableOverlay();
    document.getElementById("videoPlayer").style.visibility = "hidden";
    document.getElementById("videoFrame").src = "";
    _gaq.push(['_trackPageview', '/close_video']);
}

function popPlayerInfo(playerID) {
    enableOverlay();
    document.getElementById("videoPlayer").style.visibility = "visible";
    document.getElementById("videoFrame").src = "ShowPLayer.aspx?pid=" + playerID;
    _gaq.push(['_trackPageview', '/open_player_' + playerID]);
}

function popNominationForm() {
    enableOverlay();
    document.getElementById("Nominate").style.visibility = "visible";
    _gaq.push(['_trackPageview', '/NominationFormButton']);
}

function popNominationFormHeader() {
    enableOverlay();
    document.getElementById("Nominate").style.visibility = "visible";
    _gaq.push(['_trackPageview', '/NominationFormHeader']);
}

function closeNominationForm() {
    disableOverlay();
    document.getElementById("Nominate").style.visibility = "hidden";
    _gaq.push(['_trackPageview', '/NominationForm_Close']);
}

function popNominationTY() {
    enableOverlay();
    document.getElementById("NominateTY").style.visibility = "visible";
    _gaq.push(['_trackPageview', '/NominationFormThankYou']);
}

function closeNominationTY() {
    disableOverlay();
    document.getElementById("NominateTY").style.visibility = "hidden";
    _gaq.push(['_trackPageview', '/NominationFormThankYou_Close']);
}

function popInfoForm() {
    enableOverlay();
    document.getElementById("F150Info").style.visibility = "visible";
    _gaq.push(['_trackPageview', '/InfoForm']);
}

function closeInfoForm() {
    disableOverlay();
    document.getElementById("F150Info").style.visibility = "hidden";
    _gaq.push(['_trackPageview', '/InfoForm_Close']);
}

function popInfoFormTY() {
    enableOverlay();
    document.getElementById("F150InfoTY").style.visibility = "visible";
    _gaq.push(['_trackPageview', '/InfoFormThankYou']);
}

function closeInfoFormTY() {
    disableOverlay();
    document.getElementById("F150InfoTY").style.visibility = "hidden";
    _gaq.push(['_trackPageview', '/InfoFormThankYou_Close']);
}

function popPreviousWinners() {
    windowActive = true;
    enableOverlay();
    document.getElementById("PreviousWinners").style.visibility = "visible";
    _gaq.push(['_trackPageview', '/PreviousWinners']);
}

function closePreviousWinners() {
    windowActive = false;
    disableOverlay();
    document.getElementById("PreviousWinners").style.visibility = "hidden";
    _gaq.push(['_trackPageview', '/PreviousWinners_Close']);
}

function popCYWinners() {
    windowActive = true;
    enableOverlay();
    document.getElementById("CYWinners").style.visibility = "visible";
    _gaq.push(['_trackPageview', '/CurrentYearWinners']);
}

function closeCYWinners() {
    windowActive = false;
    disableOverlay();
    document.getElementById("CYWinners").style.visibility = "hidden";
    _gaq.push(['_trackPageview', '/CurrentYearWinners_Close']);
}
