google.load("jquery", "1.3.2");
google.load("jqueryui", "1.7.1");

google.setOnLoadCallback(function() {
    
    // BEGIN set up left nav
    
    if ($("#weNav" + wePageId).length) {
        $("#weNav" + wePageId)
            .addClass("weNavItemHL")
            .attr("src", $("#weNav" + wePageId).attr("src").replace(".png", "HL.png"));
        ;
    }
    
	$(".weNavItem").hover(function() {	    
		$(this).attr("src", "/i/img/" + $(this).attr("id") + "HL.png");
	}, function() {
		if (!$(this).hasClass("weNavItemHL")) {
			$(this).attr("src", "/i/img/" + $(this).attr("id") + ".png");
		}
	});
	
	
	// END set up left nav
	
	if (weEntryId > 0) {
	    $('#weJob' + weEntryId).addClass("weJobNavEntryHL");
	}
	
	
});

function initJobInterestAreas() {

    jQuery().ready(function() {

        jQuery('.weFormInterestAreaList a').each(function() {

            jQuery($(this).click(function() {

                if (jQuery('#weFormInterestAreas').val().length > 0) {
                    jQuery('#weFormInterestAreas').val( jQuery('#weFormInterestAreas').val() + ', ' );
                }

                jQuery('#weFormInterestAreas').val(jQuery('#weFormInterestAreas').val() + jQuery(this).text());

            }));
        });

    });
}

function _validateForm(fields) {
    var doSubmit = true;
    
    for (var i = 0; i < fields.length; i++) {
        if ($("#" + fields[i]).val() == "") {
            $("#" + fields[i] + "Error").hide().fadeIn("slow");
            $(window).scrollTop(0);
            doSubmit = false;
        } else {
            $("#" + fields[i] + "Error").hide();
        }
    }
    
    return doSubmit;    
}

function validateJobApp() {
    return _validateForm(new Array("weFormName", "weFormEmail", "weFormResume", 'weFormInterestAreas', 'weFormHowDidYouHear'));
}

