function ge()
{
  var ea;
  for( var i = 0; i < arguments.length; i++ ) {
    var e = arguments[i];
    if( typeof e == 'string' )
      e = document.getElementById(e);
    if( arguments.length == 1 )
      return e;
    if( !ea )
      ea = new Array();
    ea[ea.length] = e;
  }
  return ea;
}

function show2()
{
  for( var i = 0; i < arguments.length; i++ ) {
    var element = ge(arguments[i]);
    if (element && element.style) element.style.display = 'block';
  }
}

function hide2()
{
  for( var i = 0; i < arguments.length; i++ ) {
    var element = ge(arguments[i]);
    if (element && element.style) element.style.display = 'none';
  }
}

function shown(el) {
    el = ge(el);
    return (el.style.display != 'none');
}

function shide(el) {if (shown(el)) {hide2(el);} else {show2(el);}}


function addToFav(user_id) {
	$('#fv'+user_id).html('<img valign="middle" src="/images/upload.gif">');

	$.post('/', {act: 'a_fav', subact: 'add', 'uid': user_id}, function() {
		$('#fv'+user_id).html('<label style="padding: 5px; font-weight:normal;">Added to favorites.</label>');
	});
}

function removeFromFav(user_id) {
	$('#fv'+user_id).html('<img valign="middle" src="/images/upload.gif">');

	$.post('/', {act: 'a_fav', subact: 'delete', 'uid': user_id}, function() {
		$('#fv'+user_id).html('<label style="padding: 5px; font-weight:normal;">Removed from favorites.</label>');
	});
}

function adminChangeEmail(user_id) {
	var val = $('#inp_'+user_id).val();

 	if( val )
 	{
		$('#edit_'+user_id).html('<img valign="middle" src="/images/upload.gif">');

	    $('#inp_'+user_id).val( "updating..." );

		$.post('/', {act: 'a_adm_edit', subact: 'editemail', email: val, uid: user_id}, function() {
			$('#edit_'+user_id).html('<a href="javascript: if(confirm(\'Are you sure you want to update this email?\')) adminChangeEmail(\'' + user_id + '\')"><img alt="Edit Email" src="/images/icon_edit.gif" /></a>');
			$('#inp_'+user_id).val( val );
		});
	}
	else
	{		alert( "E-mail address can't be empty!" );
	}
}