<!--
var c            = 2;
var _file_upload = 0;
var _email       = 0;
var _web         = 0;
var _desc        = 0;
var _secret_key  = 0;

/* button timer */
function disable_submit()
{
	var x;
	
	x = document.forms.pastebin_add;
	x['submit_button'].disabled = true;	
}

function enable_submit()
{
	var x;
	
	x = document.forms.pastebin_add;
	x['submit_button'].value = _pastebin_add_submit_button_js;
	x['submit_button'].disabled = false;
}

function time_count()
{
	document.forms.pastebin_add['submit_button'].value = _pastebin_add_submit_button_js_timer+' '+c;
	if (c == 0)
	{ 
		enable_submit();
		return;
	}
	c-=1;
	t=setTimeout("time_count()",1000);
}


/* file upload */
function _upload_file()
{
	if (_file_upload == 1)
		file_upload_hide();
	else if (_file_upload == 0)
		file_upload_show();
}

function file_upload_show()
{
	var text_area;
	var file_input;
	var file_upload_link;
	
	text_area = document.forms.pastebin_add.code;
	text_area.style.display = 'none';

	file_input = document.getElementById('file_input');
	file_input.style.display = 'block';
	
	file_upload_link = document.getElementById('file_upload_link');
	file_upload_link.innerHTML = _pastebin_add_paste_code;
	
	document.forms.pastebin_add.file_upload.value = 1;
	
	_file_upload = 1;
}

function file_upload_hide()
{
	var text_area;
	var file_input;
	var file_upload_link;
	
	text_area = document.forms.pastebin_add.code;
	text_area.style.display = 'inline';
	
	file_input = document.getElementById('file_input');
	file_input.style.display = 'none';
	
	file_upload_link = document.getElementById('file_upload_link');
	file_upload_link.innerHTML = _pastebin_add_upload_file_js;
	
	document.forms.pastebin_add.file_upload.value = 0;
	
	_file_upload = 0;
}

/**
 * sntax hinting
 */
function hintSyntax() {}
hintSyntax.prototype.hint = function()
{
    var syntax = document.forms['pastebin_add'].syntax;
    var _hint  = document.forms['pastebin_add'].hint.value;
    
    for (var i = 0; i < syntax.options.length; i++)
    {
        if (syntax.options[i].label.toLowerCase().substr(0, _hint.length) == _hint)
        {
            syntax.options[i].selected = true;
            return;            
        }
    }	
}
hintSyntax.prototype.hide_image = function()
{
	document.getElementById('hint').style.background = 'white';	
}
hintSyntax.prototype.show_image = function()
{
	var hint = document.getElementById('hint');
	
	if (hint.value == '')
	{
		hint.style.backgroundImage = 'url(/images/hint.png)';
		hint.style.backgroundPosition = 'center';
		hint.style.backgroundRepeat  = 'no-repeat';
	}	
}
hintSyntax = new hintSyntax();

/**
 * post locking object
 */

function lock() { }
lock.prototype.show = function()
{
	document.getElementById('lock_block').style.display = 'block';
	document.getElementById('lock_link').innerHTML = '<img style="vertical-align: middle" src="/images/lock_icon.gif" width="16" height="16" alt="This post is secret" />&nbsp;<span class="decoration"><b>!</b></span> <a href="" title="Make your post public" onclick="lock.hide(); return false;">'+_pastebin_add_make_public_post_js+'</a> <span class="decoration"><b>!</b></span>';	
}
lock.prototype.hide = function()
{
	document.getElementById('lock_block').style.display = 'none';
	document.getElementById('lock_link').innerHTML = '<img style="vertical-align: middle" src="/images/lock_icon.gif" width="16" height="16" alt="This post is secret" />&nbsp;<span class="decoration"><b>!</b></span> <a href="" title="Make your post secret or hidden" onclick="lock.show(); return false;">'+_pastebin_add_make_secret_post_js+'</a> <span class="decoration"><b>!</b></span>';	
	
	this.reset_notice();
	this.reset_main_form();
	this.reset_lock_form();
}
lock.prototype.reset_notice = function()
{
	document.getElementById('lock_notice').innerHTML = '<br />';
}
lock.prototype.reset_main_form = function()
{
	document.forms.pastebin_add.lock_pass.value   = '';
	document.forms.pastebin_add.lock_secret.vaue  = '0';
	document.forms.pastebin_add.lock_hidden.value = '0';
}
lock.prototype.reset_lock_form = function()
{
	document.forms.lock_form.lock_pass.value   = '';
	document.forms.lock_form.lock_hidden.checked = false;	
}
lock.prototype.activate = function()
{
	this.reset_notice();
	this.reset_main_form();
	this.activate_secret();
	this.activate_hidden();
	
}
lock.prototype.activate_secret = function()
{
	var lock_pass = document.forms.lock_form.lock_pass.value;
	
	if (lock_pass.trim() != '')
	{
		// show lock notice
		document.getElementById('lock_notice').innerHTML =  '<img src="/images/active.png" alt="Secret mode active" width="8" height="8" />&nbsp;'+_pastebin_add_secret_label+'&nbsp;&nbsp;';
		// notify main form about making secret post
		document.forms.pastebin_add.lock_secret.value = '1';
		document.forms.pastebin_add.lock_pass.value = lock_pass;
	}
	else 
		document.getElementById('lock_notice').innerHTML =  '<img src="/images/inactive.png" alt="Secret mode inactive" width="8" height="8" />&nbsp;'+_pastebin_add_secret_label+'&nbsp;&nbsp;';	
}
lock.prototype.activate_hidden = function()
{
	var lock_hidden = document.forms.lock_form.lock_hidden;
	
	if (lock_hidden.checked == true)
	{
		// show hidden notice
		document.getElementById('lock_notice').innerHTML += '<img src="/images/active.png" alt="Hidden mode active" width="8" height="8" />&nbsp;'+_pastebin_add_hidden_label;
		// notify main form about making  hidden post
		document.forms.pastebin_add.lock_hidden.value = '1';
	}
	else
	{
		document.getElementById('lock_notice').innerHTML += '<img src="/images/inactive.png" alt="Hidden mode inactive" width="8" height="8" />&nbsp;'+_pastebin_add_hidden_label;			
		document.forms.pastebin_add.lock_hidden.value = '0';
	}
	
}
var lock = new lock();

function show_email()
{
	if (_email == 0)
	{
		document.getElementById('email_field').style.display = 'inline';
		_email = 1;
	}
	else if (_email == 1)
	{
		document.getElementById('email_field').style.display = 'none';
		//document.forms.pastebin_add.email.value = '';
		_email = 0;
	}
}

function show_web()
{
	if (_web == 0)
	{
		document.getElementById('web_field').style.display = 'inline';
		_web = 1;
	}
	else if (_web == 1)
	{
		document.getElementById('web_field').style.display = 'none';
		//document.forms.pastebin_add.web.value = '';
		_web = 0;
	}
}

function show_desc()
{
	if (_desc == 0)
	{
		document.getElementById('desc').style.display = 'inline';
		_desc = 1;
	}
	else if (_desc == 1)
	{
		document.getElementById('desc').style.display = 'none';
		_desc = 0;
	}	
}

function show_secret_key()
{
	if (_secret_key == 0)
	{
		document.getElementById('secret_key').style.display = 'block';
		_secret_key = 1;
	}
	else if (_secret_key == 1)
	{
		document.getElementById('secret_key').style.display = 'none';
		_secret_key = 0;
	}	
}
-->