var idsTypes = new Array('ids[vacancy][]', 'ids[resume][]');

function check_all()
{
	for(var j=0; j<idsTypes.length; j++)
	{	if( document.short_form[idsTypes[j]] )
		{	if(document.short_form[idsTypes[j]].length != undefined)
			{	for(var i=0; document.short_form[idsTypes[j]] && i<document.short_form[idsTypes[j]].length; i++)
					document.short_form[idsTypes[j]].item(i).checked = ( (document.short_form.ids.checked) ? 1 : 0 );
			}
			else
			{	document.short_form[idsTypes[j]].checked = ( (document.short_form.ids.checked) ? 1 : 0 );
			}
		}
	}
}

function is_all_checked()
{
	for(var j=0; j<idsTypes.length; j++)
	{	if( document.short_form[idsTypes[j]] )
		{	if(document.short_form[idsTypes[j]].length != undefined)
			{	for(var i=0; document.short_form[idsTypes[j]] && i<document.short_form[idsTypes[j]].length; i++)
				{	if( !document.short_form[idsTypes[j]].item(i).checked )
						return false;
				}
			}
			else
			{	return ( (!document.short_form[idsTypes[j]].checked) ? false : true );
			}
		}
	}

	return true;
}

function mark_agency(is_agency, id, what, user)
{
	var handleSuccess = function(o)
	{
		alert(o.responseText);
	}

	var handleFailure = function(o)
	{

	}

	var callback =
	{
  	success:handleSuccess,
  	failure: handleFailure
	};

	var postData = 'is_agency='+is_agency+'&id='+id+'&what='+what+'&user='+user;
	var cObj = YAHOO.util.Connect.asyncRequest('POST', '/markagency/', callback, postData);

}

function del_user(user)
{
	var handleSuccess = function(o)
	{
		alert(o.responseText);
	}

	var handleFailure = function(o)
	{

	}

	var callback =
	{
  	success:handleSuccess,
  	failure: handleFailure
	};

	if(confirm('Вы уверены? Пользователь обидится!'))
	{
		var postData = 'user='+user;
		var cObj = YAHOO.util.Connect.asyncRequest('POST', '/deluser/', callback, postData);
	}
}