﻿// JScript File

function nav(page)
{
    var url;
    
    switch (page)
    {
        
        case "contact":
            url = "tnbContact.aspx";
            break;
            
        case "faqs":
            url = "tnbFaqs.aspx";
            break;
            
        case "interviews":
            url = "tnbInterviews.aspx";
            break;
            
        case "reviews":
            url = "tnbReviews.aspx";
            break;
                
        case "news":
            url = "tnbNews.aspx";
            break;
            
        default:
            url = "index.aspx";
            break;
            
    }
    
    location.href = url;
    
}

function resizeDivs()
{

    var divL = document.getElementById("containerLeft").offsetHeight;
    var divR = document.getElementById("containerRight").offsetHeight;

    if (divL > divR)
        document.getElementById("containerRight").style.height = divL + "px";
    else if (divR > divL)
        document.getElementById("containerLeft").style.height = divR + "px";
        
}

function founder()
{
    window.open("tnbFounders.aspx", "", "width=500,toolbar=0,menubar=0,scrollbars=1");
}

function validComment()
{

    var fname = document.getElementById("txtFullName").value;
    var email = document.getElementById("txtEmailAddr").value;
    var cmmt = document.getElementById("txtCommentText").value;
    
    if (fname.length == 0 || email.length == 0 || cmmt.length == 0)
    {
        alert("All fields are required for commenting.");
        document.getElementById("txtFullName").focus();
        return false;
    }
    else
    {
        return true;
    }

}

function cleanText(ctrl)
{

    var txt = ctrl.value;
    txt = txt.replace(/</g,"");
    txt = txt.replace(/>/g,"");

    ctrl.value = txt;
    
}