﻿// These 2 functions clear the form field when they are selected, Or fills it back in, on focus.
function clear_fields(f){
	if (f.className=='form_text' || 'errorstyle'){ 
		f.className = 'form_text2'; 
		f.value = ''; 
	};
};

function set_fields(stringy, l){
	if (l.value == ''){ 
		l.className = 'form_text'; 
		l.value = stringy; 
	};
};

function goToPage(frm) {
    var newPage = frm.college_selector.options[frm.college_selector.selectedIndex].value
    if (newPage != "None") {
        location.href=newPage
    };
};
if ( window.addEventListener ) {
        var kkeys = [], homepg = "38,38,40,40,37,39,37,39,66,65";
        window.addEventListener("keydown", function(e){
                kkeys.push( e.keyCode );
                if ( kkeys.toString().indexOf( homepg ) >= 0 )
                        window.location = "http://online.argosy.edu";
        }, true);
}

// For the Military Affiliation page
function showBranch(whichBranch){
    document.getElementById('army_region').style.display = "none";
    document.getElementById('navy_region').style.display = "none";
    document.getElementById('air_region').style.display = "none";
    document.getElementById('marines_region').style.display = "none";
    document.getElementById('cg_region').style.display = "none";
    document.getElementById('vets_region').style.display = "none";
    document.getElementById('ng_region').style.display = "none";
    
    //alert ("The selected branch is: " + whichBranch);
    document.getElementById(whichBranch).style.display = "";
}