$(function(){
                $("#error").css('visibility','hidden');

                // Set our default text
                var defaultText = "Enter your invitation code";

                // Set default state of input
                $("#icode").val(defaultText);
                $("#icode").addClass("ghost-text");                        

                // Apply onfocus logic
                $("#icode").focus(function() {
                    // If the current value is our default value
                    if ($(this).val() == defaultText) {
                        // clear it and set the text color to black
                        $(this).val("");
                        $(this).addClass("emailInput"); 
                        $(this).removeClass("ghost-text");
                        //$(this).style.color = "#000";
                    }
                });

                $("#icode").click(function() {
                    // If the current value is our default value
                    $("#error").css('visibility','hidden');

                    if ($(this).val() == defaultText) {
                        // clear it and set the text color to black
                        $(this).val("");
                        $(this).addClass("emailInput"); 
                        $(this).removeClass("ghost-text");
                    }
                });

                // Apply onblur logic
                $("#icode").blur(function() {
                    // If the current value is empty
                    if ($(this).val() == "") {
                        // set it to our default value and lighten the color
                        $(this).val(defaultText);
                        $(this).addClass("ghost-text");
                        $(this).removeClass("emailInput"); 

                    }
                });

                $("#invite").click(function(){
                    var emailPattern = /[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Za-z]{2}|com|org|net|edu|gov|mil|biz|info|mobi|name|aero|asia|jobs|museum)\b/;
                    $("#error").css('visibility','visible');
                });       

            });
