﻿function topHover(sender, over) {
    try {
        var divs = sender.getElementsByTagName("div");
        var positions = new Array("left", "middle", "right");
        if (divs[0].className.indexOf("selected") < 0) {
            for (i = 0; i < divs.length; i++) {
                for (j = 0; j < positions.length; j++) {
                    if (divs[i].className.indexOf(positions[j]) > -1) { 
                        if(over)
                            divs[i].className = "topnav_item_" + positions[j] + "_hover";
                        else
                            divs[i].className = "topnav_item_" + positions[j];
                    }
                }
            }
        }
    }
    catch (e) {
        
    }
}


function showLogin(btn) {
    document.getElementById("divForgotPassword").style.display = "none";
    document.getElementById("divLogin").style.display = "";
    if (btn == 'submit')
        return true;
    else
        return false;
}

function showForgotPassword() {
    document.getElementById("divForgotPassword").style.display = "";
    document.getElementById("divLogin").style.display = "none";

    return false;
}

function confirmLogout(){
    if($('#ctl00_ContentPlaceHolder1_hdnQETest') && $('#ctl00_ContentPlaceHolder1_hdnQETest').val() == 'true'){
        return confirm("If you are in your test session, logging out now will lapse your contest slot and you will not be allowed to participate in this round again. \nAre you sure you want to logout?");
    }
}

function confirmNavigate() {
    if ($('#ctl00_ContentPlaceHolder1_hdnQETest') && $('#ctl00_ContentPlaceHolder1_hdnQETest').val() == 'true') {
        return confirm("If you are in your test session, navigating to other pages will lapse your contest slot and you will not be allowed to participate in this round again. \nAre you sure you want to navigate away from this page?");
    }
}

$(document).ready(function () {
    if($('#ctl00_ContentPlaceHolder1_hdnQETest') && $('#ctl00_ContentPlaceHolder1_hdnQETest').val() == 'true'){
        $('.page_footer a').each(function(){
            var t = $(this);
            if(t.attr('rel') != 'trademarks'){
                t.attr('target', '_blank');
            }
        });
    }
});

function showGP() 
{
    document.getElementById("ctl00_ContentPlaceHolder1_imgGrandPrize").style.display = "";
    document.getElementById("ctl00_ContentPlaceHolder1_imgStuGrandPrize").style.display = "none";
}

function showSGP() {
    document.getElementById("ctl00_ContentPlaceHolder1_imgGrandPrize").style.display = "none";
    document.getElementById("ctl00_ContentPlaceHolder1_imgStuGrandPrize").style.display = "";
}