// JavaScript Document
$(document).ready(function(){

$("#org_reg").toggle(function(){
	$("#get_into").fadeOut().queue(function () {
		$("#user_reg").animate({
							   width: "900px",
							   height: "1100px"
							   }, 500).queue(function () {;
				$("#register_org").fadeIn();
					
		});
	 });
}, function(){
$("#get_into").fadeIn().queue(function () {
		$("#user_reg").animate({
							   width: "0px",
							   height: "0px"
							   }, 500).queue(function () {;
				$("#register_org").fadeOut();
		});
	 });
});



















//Make sure e-mail is OK
//formatted and not in the system
$("#user_email").blur(function()
		{
			email = $(this).val();
			emailLen = email.length;
			cssNoMatch = {
				color: "red",
				fontSize: "12px",
				fontFamily: "arial",
				fontWeight: "bold"
			};
			
			cssMatch = {
				color: "green",
				fontSize: "12px",
				fontFamily: "arial",
				fontWeight: "bold"
			};
			
			if(emailLen > 2){
				
				$.ajax({
					type: "POST",
					url: "ajax/verify_e-mail.php",
					data: "email=" + email,
					success: function(html){
						ok = html.search("OK");
						if(ok != "-1" || ok != -1){
						$("#email_match").css(cssMatch).html(html).fadeIn();
						$("#submit").attr("disabled","");
						passOK = true;
						} else {
						$("#email_match").css(cssNoMatch).html(html).fadeIn();
						$("#submit").attr("disabled","disabled");
						passOK = false;
						}
					}
				});
			} else {
				$("#email_match").fadeOut();
			}
		});

 });