/*
-------------------------------------------------------- 
The Fabler - Registration specific js
Author: Sam Lu
Author URI: http://samlu.ca

-------------------------------------------------------- 
*/

/* Instance Variables */

// Functions

var Forms = {
	init: function() {
		$("#registration-form").append('<input type="text" name="fakepassword" value="password" class="input-largetext" id="reg_fakepassword" autocomplete="off" /><input type="password" name="password" value="" class="input-largetext" id="pass" autocomplete="off" /><input type="text" name="fakerepeatpassword" value="repeat password" class="input-largetext" id="reg_fakerepeatpassword" autocomplete="off" /><input type="password" name="confirmPassword" value="" class="input-largetext" id="confirmPassword" autocomplete="off" /><p><input type="submit" class="register_btn" value="" /></p>');
		
		$(".input-largetext").focus(function(){
			if(this.id == "username" && this.value == "username" || this.id == "email" && this.value == "email")
				this.value = "";			
			
			if(this.id == "username" || this.id == "email")
				this.select();
			
			
			$(this).css('color', '#000000');
			if(this.id == "reg_fakepassword") {
				$(this).hide();
				$("#pass").show();
				$("#pass").focus();				
			}else if(this.id == "reg_fakerepeatpassword") {
				$(this).hide();
				$("#confirmPassword").show();
				$("#confirmPassword").focus();				
			}
						
		});
		
		$(".input-largetext").blur(function(){

			if(this.id == "username" && $.trim(this.value) == "" || this.id == "email" && $.trim(this.value) == ""){
				this.value = this.id;
				$(this).css('color', '#CDCDCD');
			}
			
			if(this.id == "pass" && $.trim(this.value) == "") {
				$(this).hide();
				$("#reg_fakepassword").css('color', '#CDCDCD');
				$("#reg_fakepassword").show();				
			}else if(this.id == "confirmPassword" && $.trim(this.value) == "") {
				$(this).hide();
				$("#reg_fakerepeatpassword").css('color', '#CDCDCD');
				$("#reg_fakerepeatpassword").show();
			}
		});
		
	}
}

$(document).ready(function(){
	Forms.init();
});
