function registration_close() {
	c = $("#registration");
	d = $("#registration-blackout");
	c.fadeOut();
	d.fadeOut();
}
function registration_type_change() {
	type = $('select#student-type').val();
	//alert(type);

	if (type == 0) {
		$('div#college-form').fadeOut('fast', function() {
            $('div#activate-form').fadeIn();
        });
		$('div#activate').fadeIn();
		$('div#register').fadeIn();
		//$('div#activate-form').fadeIn();
	} else if (type == 1) {
		$('div#activate-form').fadeOut('fast', function() {
            $('div#college-form').fadeIn();
        });
		$('div#register').fadeIn();
		$('div#activate').fadeOut();
		//$('div#college-form').fadeIn();
	}
}


function submitActivation()
{
    data = $('#form-activation').serialize();

    $.ajax({
        'url'      : '/register/activate',
        'type'     : 'post',
        'dataType' : 'html',
        'data'     : data,

        success: function(html) {
            c = $("div#activate-form");
            //  remove the old selectbox stuff
            c.fadeOut('slow', function() {
                c.html(html);
            });
	        $('#institution-hs_input').remove();
	        $('#institution-hs_container').remove();
            c.fadeIn();
			$('#institution-hs').selectbox();
        },
        error: function(xhr) {
            if(xhr.responseText.length != 0) {
                alert(xhr.responseText);
            } else {
                alert("There was an error validating your request, please try again.");
            }
        }
    });
}

function submitCollegeRegistration()
{
    data = $('#register-form-college').serialize();

    $.ajax({
        'url'      : '/register/college',
        'type'     : 'post',
        'dataType' : 'html',
        'data'     : data,

        success: function(html) {
            c = $("div#college-form");
            c.fadeOut('slow', function() {
                c.html(html);
            });
            c.fadeIn();
        },
        error: function(xhr) {
            if(xhr.responseText.length != 0) {
                alert(xhr.responseText);
            } else {
                alert("There was an error validating your request, please try again.");
            }
        }
    });	
}

function submitHighschoolRegistration()
{
    data = $('#register-form-highschool').serialize();

    $.ajax({
        'url'      : '/register/highschoolactivation',
        'type'     : 'post',
        'dataType' : 'html',
        'data'     : data,

        success: function(html) {
            c = $("div#activate-form");
            c.fadeOut('slow', function() {
                c.html(html);
            });
            c.fadeIn();
        },
        error: function(xhr) {
            if(xhr.responseText.length != 0) {
                alert(xhr.responseText);
            } else {
                alert("There was an error validating your request, please try again.");
            }
        }
    });	
}