function _hideBBCode() 
{ 
   this.objs = []; 
   return this; 
} 
_hideBBCode.prototype.IsDisplaySupported = function() 
{ 
   // Opera: Only v7+ supports write access to display attribute ! 
   if( window.opera && !document.childNodes ) return false; 
   // Other DOM browsers and MSIE4+ support it as well. 
   if( document.getElementById || document.all ) return true; 
   // This is where legacy browsers fall. NS4, Hotjava, etc. 
   return false; 
} 
_hideBBCode.prototype.getObj = function(obj) 
{ 
   return ( document.getElementById ? document.getElementById(obj) : 
         ( document.all ? document.all[obj] : 
         ( document.layers ? document.layers[obj] : null ) ) ); 
} 
_hideBBCode.prototype.displayObj = function(obj, status) 
{ 
   var x = this.getObj(obj); 
   if(!x) return; 
   var css = ( document.layers ? x : x.style ); 
   if( this.IsDisplaySupported() ) 
   { 
      css.display = status; 
   } 
   else 
   { 
      css.visibility = ( status == 'none' ? 'hidden' : 'visible' ); 
   } 
} 
_hideBBCode.prototype.open = function(l_hide) 
{ 
   var s='', randomId = 'hide' + Math.floor(Math.random() * 15000); 
   var style = ( this.IsDisplaySupported() ? 'display:none;' : 'visibility:hidden;' ); 
   if( document.layers ) { style = 'position:relative;' + style; } 
   s += '<div><a class="postlink" href="javascript:hideBBCode.showHide(\'' + randomId + '\');" onmouseover="top.status=\'\';" onfocus="this.blur();">' + l_hide + '</a></div>'; 
   s += '<div id="' + randomId + '" style="'+style+'">'; 
   document.write(s); 
   this.objs[randomId] = 'none'; 
} 
_hideBBCode.prototype.close = function() 
{ 
   document.write('</div>'); 
} 
_hideBBCode.prototype.showHide = function(obj) 
{ 
   if( !this.objs[obj] ) return; 
   this.objs[obj] = ((this.objs[obj]=='none') ? 'block':'none'); 
   this.displayObj(obj, this.objs[obj]); 
} 
var hideBBCode = new _hideBBCode();

// Begin Fast Polls Mod
function add_option()
{
	var tbody = document.getElementById('poll_options');
	var form = document.post;
	var table = tbody.parentNode;
	var newOption = form.add_poll_option_text.value;

	// Get total number of options
	var row_index = tbody.rows.length;
	
//	if (row_index >= '{MAX_POLL_OPTIONS}')
//	{
//		alert('{L_TOO_MANY_POLL_OPTIONS}');
//		return false;
//	}

	// Insert the new option at the end
	var newRow   = tbody.insertRow(row_index);
	var newCell  = newRow.insertCell(0);
	var newCell2  = newRow.insertCell(1);
	
	newCell.className = 'row1';
	newCell2.className = 'row2';

	newCell.innerHTML = '<span class="gen"><b>{L_POLL_OPTION}</b></span>';
	newCell2.innerHTML = '<span class="genmed"><input name="poll_option_text[]" size="50" class="post" maxlength="255" value="'+ newOption +'" type="text" /></span> &nbsp;&nbsp;<input type="submit" onclick="del_option(this.parentNode.parentNode.rowIndex); return false;" name="del_poll_option[]" value="{L_DELETE_OPTION}" class="liteoption" /> ';
	
	form.add_poll_option_text.value = "";
	form.add_poll_option_text.focus();
}

function del_option(row_index)
{
	var tbody = document.getElementById('poll_options');
	var form = document.post;
	var table = tbody.parentNode;
	// Try to delete the row, if error occurs, alert the user
	try
	{
		table.deleteRow(row_index);
	} 
	catch (ex)
	{
		alert(ex);
	}
}
// End Fast Polls Mod
//Begin List Users Mod
function dsListUsernames() {
	var user_popup = window.open('./list_usernames.php', 'usernames', 'width=300, height=275, toolbar=false, statusbar=false, menubar=false, scrollbars=false, alwaysraised=true');
		return;
}

