var auto = {
names: 'Steve Buscemi Catherine Keener Dermot Mulroney Danielle Zerneck James LeGros Rica Martens Peter Dinklage Kevin Corrigan Hilary Gilford Robert Wightman Tom Jarmusch Michael Griffiths Matthew Grace Ryan Bowker Francesca DiMauro',
blurb: 'phpBB is a free, open source Internet community application, with outstanding discussion forums and membership management. Written in the PHP scripting language, and making use of the popular MySQL database, phpBB is a standard among web hosting companies throughout the world, and is one of the most widely-used bulletin board packages in the world. phpBB short-circuits the need for you to be a web development master in order to create and manage massive online communities',
password: 'secret',
fillerup: function() {
var all_inputs = document.getElementsByTagName('input');
var all_selects = document.getElementsByTagName('select');
var all_textareas = document.getElementsByTagName('textarea');
for (var i = 0, max = all_selects.length; i < max; i++) {
var sel = all_selects;
if (sel.selectedIndex != -1&& sel.options[sel.selectedIndex].value) {
continue;
}
var howmany = 1;
if (sel.type == 'select-multiple') {
var howmany = 1 + this.getRand(sel.options.length - 1);
}
for (var j = 0; j < howmany; j++) {
var index = this.getRand(sel.options.length - 1);
sel.options[index].selected = 'selected';
}
}
for (var i = 0, max = all_textareas.length; i < max; i++) {
var ta = all_textareas;
if (!ta.value) {
ta.value = this.getRandomString(10)+ '\n\n'+ this.getRandomString(10);
}
}
for (var i = 0, max = all_inputs.length; i < max; i++) {
var inp = all_inputs;
var type = inp.getAttribute('type');
if (!type) {
type = 'text';
}
if (type == 'checkbox') {
inp.setAttribute('checked', 'checked');
}
if (type == 'radio') {
var to_update = true;
var name = inp.name;
var input_array = inp.form.elements[inp.name];
for (var j = 0; j < input_array.length; j++) {
if (input_array[j].checked) {
to_update = false;
continue;
}
}
if (to_update) {
var index = this.getRand(input_array.length - 1);
input_array[index].setAttribute('checked', 'checked');
}
}
if (type == 'password') {
if (!inp.value) {
inp.value = this.getPassword();
}
}
if (type == 'text') {
if (!inp.value) {
if (inp.name.indexOf('name') != -1) {
inp.value = this.getRandomName() + ' ' + this.getRandomName();
}
else if (inp.name.indexOf('email') != -1) {
inp.value = this.getRandomString(1) + '@example.org';
}
else {
inp.value = this.getRandomString(1);
}
}
}
}
},
getRandomString: function (how_many_words) {
if (!how_many_words) {
how_many_words = 5;
}
if (!this.words) {
this.words = this.blurb.split(' ');
}
var retval = '';
for (var i = 0; i < how_many_words; i++) {
retval += this.words[this.getRand(this.words.length) - 1];
retval += (i < how_many_words - 1) ? ' ' : '';
}
return retval;
},
getRandomName: function () {
if (!this.split_names) {
this.split_names = this.names.split(' ');
}
return this.split_names[this.getRand(this.split_names.length) - 1];
},
getPassword: function () {
if (!this.password) {
this.password = 'secret';
}
return this.password;
},
getRand: function (count) {
return Math.round(count * Math.random());
}
};
auto.fillerup()