Speaker = function (firstName, lastName, lang, gender, age, purpose, id) { this.firstName = firstName; this.lastName = lastName; this.gender = gender; this.age_id = age; this.language_id = lang; this.purpose_id = purpose; this.id = id; } Speaker.prototype.addToShortList = function () { for (v in top.shortlistVoices) { if (top.shortlistVoices[v] == this.id) return; } top.shortlistVoices.push(this.id); top.printShortlistHtml(); } Speaker.prototype.deleteFromShortList = function () { for (v in top.shortlistVoices) { if (top.shortlistVoices[v] == this.id) { top.shortlistVoices.splice(v, 1); break; } } top.printShortlistHtml(); } Speaker.prototype.getAge = function () { opts = document.forms[0].age_id.options; for (i = 0; i < opts.length; i++) { if (opts[i].value == this.age_id) return opts[i].text; } return ''; } Speaker.prototype.getLanguage = function () { opts = document.forms[0].language_id.options; for (i = 0; i < opts.length; i++) { if (opts[i].value == this.language_id) return opts[i].text; } return ''; } Speaker.prototype.getPurpose = function () { opts = document.forms[0].purpose_id.options; for (i = 0; i < opts.length; i++) { if (opts[i].value == this.purpose_id) return opts[i].text; } return ''; } Speaker.prototype.getFullName = function () { return this.firstName + ' ' + this.lastName; } Speaker.prototype.play = function() { text = 'Now playing: ' + this.firstName + ' ' + this.lastName; text += ' (' + this.getLanguage() + '/' + this.getAge() + '/' + this.getPurpose() + ')'; td = top.document.getElementById('playercell'); td.replaceChild(document.createTextNode(text), td.firstChild); } function findSpeakers() { var form = document.forms[0]; var visibleSpeakers = 0; var rows = top.frames[0].document.getElementsByTagName('tr'); var v; for (v in voices) { row = frames[0].document.getElementById(v); if (form.search.value.length != 0) { var fullName = voices[v].firstName.toUpperCase() + ' ' + voices[v].lastName.toUpperCase(); var allWordsFound = true; var searchWords = form.search.value.toUpperCase().split(' '); for (i in searchWords) { if (fullName.indexOf(searchWords[i].toUpperCase()) < 0) { allWordsFound = false; break; } } if (! allWordsFound) { row.style.display = 'none'; continue; } } if (form.language_id.value != 'all' && voices[v].language_id != form.language_id.value) { row.style.display = 'none'; continue; } if (form.gender.value != 'all' && voices[v].gender != form.gender.value) { row.style.display = 'none'; continue; } if (form.age_id.value != 'all' && voices[v].age_id != form.age_id.value) { row.style.display = 'none'; continue; } if (form.purpose_id.value != 'all' && voices[v].purpose_id != form.purpose_id.value) { row.style.display = 'none'; continue; } visibleSpeakers++; row.style.display = ''; } var totalTextNode = document.createTextNode(visibleSpeakers); var visibleCount = top.document.getElementById('speakerstotal'); visibleCount.replaceChild(totalTextNode, visibleCount.firstChild); } function openHelpWindow() { window.open('help.html', 'name', 'height=230, width=430, toolbar=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no'); } function printShortlistHtml() { var form = document.forms[0]; var numShortlistVoices = 0; frames[1].document.open(); frames[1].document.write('\n\ \n\ \n\ Speaker list\n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\ \n\
\n\ '); for (v in shortlistVoices) { numShortlistVoices++; var voice = top.voices[shortlistVoices[v]]; frames[1].document.write('\n\
\n\ < REMOVE\n\ PLAY\n\
' + voice.lastName + ' ' + voice.firstName + ' - ' + voice.getLanguage() + '
\n\
\n'); } frames[1].document.write('\n\
\n\ \n\ \n\ '); frames[1].document.close(); var totalTextNode = document.createTextNode(numShortlistVoices); var visibleCount = top.document.getElementById('shortlisttotal'); visibleCount.replaceChild(totalTextNode, visibleCount.firstChild); } var voices = Array(); var shortlistVoices = Array();