function _(element) 
{
    if (arguments.length > 1) 
    {
        for (var i = 0, elements = [], length = arguments.length; i < length; i++)
          elements.push($(arguments[i]));
        return elements;
    }
    else
        return document.getElementById(element);
}
function checkinput()
{
	alert('voting closed ');
	return;
	/*var user = $('#username').val();
	var a_id = $('#area_id').val();
	var area = $("select[@name='area_id'] option[@selected]").text();
	var s_id = $('#server_id').val();
	var server = $("select[@name='server_id'] option[@selected]").text();
	var vcode = $('#vcode').val();
	var id = $('#hid').val();
	if(user == '' || user == null)
	{
		alert('Please input your Account ID');
		_('username').focus();
		return;
	}
	if(vcode == '' || vcode == null)
	{
		alert('Please input validation code');
		_('vcode').focus();
		return;		
	}
	$.post
	(
		'index.php?do=post',
		{account:user,g_id:a_id,group:area,s_id:s_id,server:server,vcode:vcode,votenum:$('#myvote').html(),v_id:$('#hvid').val()},
		function(data)
		{
			eval("var data="+data+";");
			if(data['txt']==0)
			{
				alert(data['text']);
				_('username').focus();
				return;
			}
			else
			{
				alert(data['text']);
				$('#myvote').html(data['num']);		
				$('#showaccount').fadeOut();
				return;
			}
		}
	)*/
}
function areaChanged(value, type) 
{
	oAreaId = _('area_id');
	oServerId = _('server_id');

    var area = serverList[0];
    for (var i=0; i<serverList.length; i++) 
    {
        if (serverList[i].id == value) 
		{
        	area = serverList[i];
        	break;
        }
    }
            
    if (area) 
    {
        oServerId.options.length = 0;
        for (var i=0; i<area.sub.length; i++) 
        {
        	oServerId.options.add(new Option(area.sub[i].name, area.sub[i].id));
        	if ('1' == area.sub[i].id) 
        		oServerId.options[i].selected = true;
        }
    }
}
$(function(){
	oAreaId = _('area_id');
	oServerId = _('server_id');
	oAreaId.options.length = 0;
        
	for (var i=0; i<serverList.length; i++) 
	{
		oAreaId.options.add(new Option(serverList[i].name,serverList[i].id));
		if ('1' == serverList[i].id) 
			oAreaId.options[i].selected = true;
	}
	
	areaChanged(1, 0);
	
	$('#showload').click(function(){$('#showaccount').fadeIn('slow');changeCode()});
})
function changeCode()
{
	_('_code').src='index.php?do=code&'+Math.random();
}
function closeDiv()
{
	$('#showaccount').fadeOut('slow');
	$('#vcode').val('');
}
