﻿ns4 = (document.layers) ? true : false
ie4 = (document.all) ? true : false

function printArticle() {
    if (window.print) {
        window.print();
    } else if (agt.indexOf("mac") != -1) {
        alert("Press 'Cmd+p' on your keyboard to print article.");
    } else {
        alert("Press 'Ctrl+p' on your keyboard to print article.")
    }
}

function navTo(gohere) {
    window.open(gohere, "window1", config = "width=700,height=400,resizable=yes,toolbar=yes,scrollbars=yes,menubar=yes,location=yes,top=0,left=0");
}

function openDisclaimer(gohere) {
    window.open(gohere, "privacy", config = "width=500,height=400,resizable=yes,toolbar=no,scrollbars=yes,menubar=yes,location=no,top=10,left=10");
}

function openContact(gohere) {
    window.open(gohere, "window1", config = "width=500,height=350,resizable=yes,toolbar=no,scrollbars=yes,menubar=yes,location=no,top=10,left=10");
}

function openTaleo(gohere) {
    window.open(gohere, "window1", config = "width=780,height=580,resizable=yes,toolbar=no,scrollbars=no,menubar=yes,location=no,top=10,left=10");
}

function openWindow(gohere) {
    window.open(gohere, "window1", config = "width=780,height=580,resizable=yes,toolbar=no,scrollbars=yes,menubar=yes,location=yes,top=10,left=10");
}

function openSmallWindow(gohere) {
    window.open(gohere, "window1", config = "width=650,height=400,resizable=yes,toolbar=no,scrollbars=yes,menubar=yes,location=yes,top=10,left=10");
}

function openTour(gohere) {
    window.open(gohere, "window1", config = "width=600,height=450,resizable=yes,toolbar=no,scrollbars=yes,menubar=yes,location=no,top=10,left=10");
}

function openTimeline() {
    window.open("include/flash/timeline/timeline.aspx", "timeline", config = "width=567,height=360,menubar=no,toolbar=no,scrollbars=yes,resizable=no,top=10,left=10");
}

function openDonate() {
    window.open("donate.aspx", "donate", config = "width=770,height=780,menubar=no,toolbar=yes,scrollbars=yes,resizable=yes,top=10,left=10");
}



var timeoutSetting
function show(id, btnId) {
    clearTimeout(timeoutSetting)
    if (ns4) document.layers[id].visibility = "show"
    else if (ie4) document.all[id].style.visibility = "visible"
    else if (!document.all && document.getElementById) document.getElementById(id).style.visibility = "visible"

    var onImg = document.getElementById(btnId).firstChild.src
    onImg = onImg.toLowerCase();
    onImg = onImg.replace("_off.gif", "_on.gif")
    document.getElementById(btnId).firstChild.src = onImg
}

function hideAll() {
    hide2('menu_careers', 'linkCareers')
    hide2('menu_projects', 'linkProjects')
}

function hide(id, btnId, time) {
    if (time == null) { time = 0 }
    timeoutSetting = setTimeout("hide2('" + id + "', '" + btnId + "')", time)
}

function hide2(id, btnId) {
    if (ns4) document.layers[id].visibility = "hide"
    else if (ie4) document.all[id].style.visibility = "hidden"
    else if (!document.all && document.getElementById) document.getElementById(id).style.visibility = "hidden"

    var offImg = document.getElementById(btnId).firstChild.src
    offImg = offImg.toLowerCase();
    offImg = offImg.replace("_on.gif", "_off.gif")
    document.getElementById(btnId).firstChild.src = offImg
}

function Collapser(item) {
    // Make sure the tags are setup correctly, if not just return 
    if (!item.parentNode.getElementsByTagName("ul")[0]) return;
    var x = item.parentNode.getElementsByTagName("ul")[0];
    // if already visible, make disappear, otherwise reappear 
    x.style.display = (x.style.display == "") ? 'none' : "";
}

function moveMe(checkhere, fldLength, gohere) {
    checkhere.focus();
    checkhere.select();
    currValue = checkhere.value;
    currField = checkhere;
    nextField = gohere;

    setTimeout("checkForNum(" + fldLength + ")", 100);
}

function checkForNum(fldLength) {
    if (currField.value.length == fldLength && currField.value != currValue) {
        //     alert(currField.value+":"+currValue+":"+nextField.name);
        nextField.focus();
        //	  nextField.select();
    }
    else { setTimeout("checkForNum(" + fldLength + ")", 5); }
}

