     
        
        
        function limitChars(textid, limit, infodiv)
{
var text = $('#'+textid).val(); 
var textlength = text.length;
if(textlength > limit)
{
 $('#' + infodiv).html('You cannot write more then '+limit+' characters');
 $('#'+textid).val(text.substr(0,limit));
 return false;
}
else
{
 $('#' + infodiv).html('You have '+ (limit - textlength) +' characters left.');
 return true;
}
}

$(function(){
$('#abouttheitem').keyup(function(){
limitChars('abouttheitem', 2000, 'charlimitinfo');
})
});

$(document).ready(function(){
$('span.remove_reasons').hide();
$('.rem').click(function(){
var removereason = this.id.replace('remove_item','remove_reason');
$('#'+removereason).show();
});
$('.app').click(function(){
var removereason = this.id.replace('approve_item','remove_reason');
$('#'+removereason).hide();
});
});

function checkForm()
{
  if($('#item_name').val() == '' || $('#abouttheitem').val() == '')
  {
    if($('#item_name').val() == '')
      alert('You must enter an item name');
    if($('#abouttheitem').val() == '')
      alert('You must enter some text about the item');      
    return false;
  }
  return true;
}


$(function() {
	$('#items a').lightBox();
});
