﻿
function cmsInit() {
    $('a.ajaxBoolean').click(function() {
        var href = $(this).attr("href");

        $.get(
            href, null, function(data) {
                window.location.reload();
            });
        return false;
    });

    $('ul.nav li').click(function() {
        $('ul', this).slideDown(100);
        return false;
    });

    $('ul.nav li').hover(
		function() {
		    //show its submenu
		    
		    //$('ul', this).slideDown(100);

		},
		function() {
		    //hide its submenu
		    $('ul', this).slideUp(100);
		}
	);
	
	
}


forgotPassword = function() {
    $("#forgot-password-link").fadeOut();
    $("#password-row").fadeOut();
    $(".login-subtitle").html("Please enter your e-mail address in the field below.  We will e-mail your password to you.");
    $("#login-button").val("Get Password");
    $("#username-label").html("Email Address");
    $("#fp").val("true");

}

registerNewUserBegin = function() {
    $("#fp").val("false");
    $("#nu").val("true");
    $("#login-form").submit();
}

validateRegistration = function() {
    var ret = true;
    $(".required").each(function() {
        if ($(this).val().length == 0) {
            if (ret) {
                alert("please fill out all required fields");
                ret = false;
            }
        }
    });

    if (ret) {
        var origPassword = null;
        $(".match").each(function() {
            if (origPassword == null) {
                origPassword = $(this).val();
            } else {
                if (origPassword != $(this).val() && ret) {
                    ret = false;
                    alert("The passwords do not match");
                }
            }
        });
    }
    
    return ret;
}
