on (press) {
initial_name = "0";
initial_comment = "0";
if (Number(length(name))>=1) {
initial_name = "100";
colorRequired = new Color (bg_name);
colorRequired.setRGB(0xF1F3F3);
} else {
colorRequired = new Color (bg_name);
colorRequired.setRGB(0xFFECE7);
}
if (Number(length(comment))>=1) {
initial_comment = "100";
colorRequired = new Color (bg_comment);
colorRequired.setRGB(0xF1F3F3);
} else {
colorRequired = new Color (bg_comment);
colorRequired.setRGB(0xFFECE7);
}
String.prototype.isEmail = function() {
var ref = arguments.callee;
if(this.indexOf("@") == -1) return false;
if(!isNaN(this.charAt(0))) return false;
var email, user, domain, user_dots, domain_dots;
if((email = this.split("@")).length == 2) {
if((domain = email[1]).split(".").pop().length > 4) return false;
if(domain.split(".").length < 2) return false;
if((user = email[0]).indexOf(".") && domain.indexOf(".")) {
if(user.length == 1 || domain.length == 1) return false;
if(domain.lastIndexOf(".") > domain.length-3) return false;
for(var c, t, i = (user_dots = user.split(".")).length; i--;) {
c = user_dots[i]; t = !ref.$_text.call(c, "-", ".", "_");
if(t || !isNaN(c)) return false;
};
for(var c, t, i = (domain_dots = domain.split(".")).length; i--;) {
c = domain_dots[i]; t = !ref.$_text.call(c, "-", ".");
if(t || !isNaN(c)) return false;
};
} else return false;
} else return false;
return true;
};
String.prototype.isEmail.$_punctuation = function() {
if(this == "") return false;
for(var i = arguments.length; i--;) {
if(this.indexOf(arguments[i]) == 0) return false;
if(this.indexOf(arguments[i]) == this.length-1) return false;
};
return true;
};
String.prototype.isEmail.$_text = function() {
var ref = arguments.caller;
if(!ref.$_punctuation.apply(this, arguments)) return false;
var others = arguments; var checkOthers = function(str) {
for(var i = others.length; i--;) if(str == others[i]) return true;
return false;
};
for(var c, alpha, num, i = this.length; i--;) {
c = this.charAt(i).toLowerCase();
alpha = (c <= "z") && (c >= "a");
num = (c <= "9") && (c >= "0");
if(!alpha && !num && !checkOthers(c)) return false;
};
return true;
};
// Usage Example
var _trace = function(address) {
return "(" + address + "): " + address.isEmail();
};
var checkEmail = function(address) {
return address.isEmail();
};
if (checkEmail(email)) {
colorRequired = new Color (bg_email);
colorRequired.setRGB(0xF1F3F3);
} else {
colorRequired = new Color (bg_email);
colorRequired.setRGB(0xFFECE7);
}
}
on (release) {
if (Number(initial_name) == 100 and Number(initial_comment) == 100 and (checkEmail(email)) == true) {
loadVariablesNum("form.php", 0, "POST");
gotoAndStop("thanks");
}
}