<script type="text/javascript">
<!--
/* Predefined Posting Template/Form
Created by Ross of vForums
http://virtualforums.co.uk Please do not repost outside of
vForums support without permission */
var _title = '
New Code Request';
var _description = '
Please ensure you have a read of the <a href="http://capecoral.vforums.co.uk/board/general/topic/3/action/view_topic/page/1/rules/">Rules</a> before posting. If you break the rules, your thread will be locked and moved to a hidden board for dead codes. You are free to repost your code if you don't break the rules again. Repeatedly breaking the rules will result in a warning.';
var _fields = new Array(); var _f = 0;
_fields[_f++] = new Array('
input', '*Code Type', ['size', 40, 'maxLength', 50], '', 'Type of Code/Code Name', true);
_fields[_f++] = new Array('input', 'Forum Link', ['size', 40, 'maxLength', 50], '', 'Link to Your Forum', false);
_fields[_f++] = new Array('input', 'Browser', ['size', 40, 'maxLength', 50], '', 'Browser that you use.', false);
_fields[_f++] = new Array('textarea', '*[
Description', ['cols', 40, 'rows', 10], '', '
A short description of either what the problem is or what you want your code to do. You should include as much information as possible, links to other forums/sites and anything else that may be useful.', true);
var _widths = ['100%', '20%', '40%', '40%'];
var _posting_form = {
errors: new Array(),
init: function() {
this.create_form();
},
create_form: function() {
// Create new post layout
var _holder = document.createElement('table');
_holder.setAttribute('className', 'border');
_holder.setAttribute('class', 'border');
_holder.setAttribute('cellSpacing','1');
_holder.setAttribute('cellPadding', '4');
_holder.setAttribute('align', 'center');
_holder.setAttribute('width', _widths[0]);
_holder.setAttribute('id', 'post_form_holder');
_holder.appendChild(document.c
reateElement('tbody'));
_holder.firstChild.appendChild
( document.createElement('tr') ).appendChild( document.createElement('td') ).appendChild( document.createElement('font') );
_holder.firstChild.lastChild.l
astChild.className = 'title1';
_holder.firstChild.lastChild.l
astChild.colSpan = '3';
_holder.firstChild.lastChild.l
astChild.lastChild.size = '2';
_holder.firstChild.lastChild.l
astChild.lastChild.appendChild
(document.createTextNode(_titl
e));
if(_description) {
_holder.firstChild.appendChild
( document.createElement('tr') ).appendChild( document.createElement('td') ).appendChild( document.createElement('font') );
_holder.firstChild.lastChild.l
astChild.setAttribute('className', 'window1');
_holder.firstChild.lastChild.l
astChild.setAttribute('class', 'window1');
_holder.firstChild.lastChild.l
astChild.setAttribute('colSpan', '3');
_holder.firstChild.lastChild.l
astChild.lastChild.setAttribut
e('size', '2');
_holder.firstChild.lastChild.l
astChild.lastChild.innerHTML = _description;
}
for(_f=0; _f<_fields.length; _f++) {
switch(_fields[_f][0]) {
case 'textarea' :
var _tmp = document.createElement('textarea');
if("undefined" != typeof _fields[_f][3] && _fields[_f][3] != "")
_tmp.innerHTML= _fields[_f][3];
break;
case 'select' :
var _tmp = document.createElement('select');
for(_o=0; _o<_fields[_f][3].length; _o++) {
_tmp.options[_o] = new Option(_fields[_f][3][_o], _fields[_f][3][_o]);
}
break;
default :
var _tmp = document.createElement('input');
_tmp.type = 'text';
if("undefined" != typeof _fields[_f][3] && _fields[_f][3] != "")
_tmp.setAttribute('value', _fields[_f][3]);
break;
}
_tmp.setAttribute('id', _f);
if("undefined" != typeof _fields[_f][2] && _fields[_f][2].length > 0) {
for(_a=0; _a<_fields[_f][2].length; _a++) {
_tmp.setAttribute(_fields[_f][
2][_a++], _fields[_f][2][_a]);
}
}
var _class = 'window' + ((_f % 2 == 0)? '2' : '1');
var _row = document.createElement('tr');
_row.appendChild(document.crea
teElement('td'));
_row.lastChild.setAttribute('class', _class);
_row.lastChild.setAttribute('className', _class);
_row.lastChild.setAttribute('vAlign', 'top');
_row.lastChild.setAttribute('width', _widths[1]);
_row.lastChild.appendChild(doc
ument.createElement('font'));
_row.lastChild.lastChild.setAt
tribute('size', '2');
_row.lastChild.lastChild.style
.fontWeight = 'bold';
_row.lastChild.lastChild.appen
dChild(document.createTextNode
(_fields[_f][1] + ':'));
_row.appendChild(document.crea
teElement('td'));
_row.lastChild.setAttribute('class', _class);
_row.lastChild.setAttribute('className', _class);
_row.lastChild.setAttribute('width', _widths[2]);
_row.lastChild.appendChild(doc
ument.createElement('font'));
_row.lastChild.lastChild.setAt
tribute('size', '2');
_row.lastChild.lastChild.appen
dChild(_tmp);
_row.appendChild(document.crea
teElement('td'));
_row.lastChild.setAttribute('class', _class);
_row.lastChild.setAttribute('className', _class);
_row.lastChild.setAttribute('vAlign', 'top');
_row.lastChild.setAttribute('width', _widths[3]);
_row.lastChild.appendChild(doc
ument.createElement('font'));
_row.lastChild.lastChild.size = '1';
_row.lastChild.lastChild.appen
dChild(document.createTextNode
(_fields[_f][4]));
_holder.firstChild.appendChild
(_row);
}
var _submit = document.createElement('tr');
_submit.appendChild(document.c
reateElement('td'));
_submit.lastChild.setAttribute
('class', 'window' + (((_f+1) % 2 == 0)? '1' : '2'));
_submit.lastChild.setAttribute
('className', 'window' + (((_f+1) % 2 == 0)? '1' : '2'));
_submit.lastChild.setAttribute
('align', 'center');
_submit.lastChild.setAttribute
('colSpan', 3);
var _button = document.createElement('input');
_button.setAttribute('type', 'button');
_button.setAttribute('value', 'Post Message');
_button.onclick = function() { _posting_form.post_it(); };
_submit.lastChild.appendChild(
_button);
_holder.firstChild.appendChild
(_submit);
document.post_form.style.displ
ay = 'none';
document.post_form.parentNode.
insertBefore(_holder, document.post_form);
},
post_it: function() {
// create message and attempt to post it
this.errors = new Array();
document.post_form.message.val
ue = document.post_form.subject.val
ue = '';
var _sub = document.getElementById('0').value;
_fields[0][5] = true;
document.post_form.subject.val
ue = _sub;
for(_f=0; _f<_fields.length; _f++) {
if(document.getElementById(_f)
) {
_value = document.getElementById(_f).va
lue;
if(!_value || _value.match(/^s*$/)) {
if(_f > 0 && _fields[_f][5])
this.show_error('You have left the ' + _fields[_f][1] + ' option empty. This is a required field and as such must contain a value.');
else
_value = '
None';
}
document.post_form.message.val
ue += '
' + _fields[_f][1] + ': ' + _value + '\n\n';
}
}
if(this.errors.length == 0)
document.post_form.post.click(
);
else
this.show_error();
},
show_error: function() {
if("undefined" != typeof arguments[0] && arguments[0]) {
this.errors.push(arguments[0])
;
} else {
// Show Errors
if(document.getElementById('status_holder')) {
document.getElementById('status_holder_title').innerHTML = "An Error Has Occured";
document.getElementById('status_holder_message').innerHTML = this.errors.join("<br />");
document.getElementById('status_holder').style.display = 'block';
}
}
}
}
if(document.post_form && location.href.match(/action\/post\/?$/) && vf_username != 'Guest') {
_posting_form.init();
}
//-->
</script>