function country_change(country, city)
{
  if (country.selectedIndex!=0)
  {
	var url = '/login/cities/id/country_id'.replace('country_id', country.selectedIndex);
	new Ajax.Updater(city, url, {asynchronous:true, evalScripts:false, onComplete:function(request, json){ $(city).enable(); }});
  }
  else
	$(city).disable();
}

function voteform(tform, update)
{
	if( !document.getElementById( 'voteform' ) )
	{
		return;
	}

	var p		= null;
	var inputs	= Form.getInputs(tform, 'radio');

	for (var i = 0, length = inputs.length; i < length; i++)
	{
		p	= inputs[i];

		pp	= p.nextSibling;

		if( 'label' == pp.tagName.toLowerCase() )
		{
			pp.onmouseover	= function()
			{
				voteover( document.getElementById( this.htmlFor ) );
			}
			pp.onmouseout	= function()
			{
				voteout( document.getElementById( this.htmlFor ) );
			}
		}

		p.onmouseover	= voteover;
		p.onmouseout	= voteout;
		p.onclick		= function() {
			new Ajax.Updater(update, tform.action, {asynchronous:true, evalScripts:false, parameters:Form.serialize(tform)}); return false;
		}
	}
}

function voteover( o )
{
	if( !o )
		o	= this;

	o.checked	= true;
}

function voteout( o )
{
	if( !o )
		o	= this;

	o.checked	= false;
}

function activelink(alink, selectorName)
{
	var value	= document.getElementById(selectorName).value;

	if ( '' == value )
		return false;

	alink.href	= alink.href.replace('000', value);

	return true;
}
