// Poll Object Constructor function Poll (doc, q_num) { var pollform = doc.poll; this.name = pollform.name.value || ''; this.whovote = getRadioValue(pollform.whovote); this.whoview = getRadioValue(pollform.whoview); // Array of Questions and Answers // A single poll can have multiple questions // Each question can have one or several answers this.qa = new Array(); for (var i=0; i"; html += "
Open to: "; html += ""+this.whovote+", results viewable to: "; html += ""+this.whoview+""; for (var i=0; i\n"; html += '

'; if (this.qa[i].atype == "radio" || this.qa[i].atype == "check") { var type = this.qa[i].atype; if (type == "check") type = "checkbox"; for (var j=0; j'; html += this.qa[i].answer[j] + '
\n'; } } else if (this.qa[i].atype == "drop") { html += '\n'; } else if (this.qa[i].atype == "text") { html += ''; } else if (this.qa[i].atype == "scale") { html += '' var from = Number(this.qa[i].from); var to = Number(this.qa[i].to); var by = Number(this.qa[i].by); for (var j=from; j<=to; j=j+by) { html += ''; } html += '

' +j+ '
'; } html += '

'; } html += ' '; return html; } // Poll method to generate Poll tags Poll.prototype.outputPolltags = function (pollID, post) { var tags = ''; if (post == true) tags += '
'; tags+= '\n'; for (var i=0; i\n'; tags += ' ' + this.qa[i].question + '\n'; // answer choices for radio, checkbox and drop-down if (this.qa[i].atype == "radio" || this.qa[i].atype == "check" || this.qa[i].atype == "drop") { for (var j=0; j\n'; } } tags += ' \n'; } tags += ''; if (post == true) tags += '
'; return tags; } Poll.callRichTextEditor = function() { var oEditor = FCKeditorAPI.GetInstance('draft'); oEditor.Commands.GetCommand('LJPollLink').Execute(); } // Answer Object Constructor function Answer (doc, q_idx) { var pollform = doc.poll; this.question = pollform["question_"+q_idx].value; var type = pollform["type_"+q_idx]; this.atype = type.options[type.selectedIndex].value; this.answer = new Array(); if (this.atype == "radio" || this.atype == "check" || this.atype == "drop") { for (var i=0; i