FormUtils.COUNTRY_VISA = 1;
FormUtils.COUNTRY_ALL_VISA = 2;
FormUtils.COUNTRY_ALL = 3;
//SET THIS
FormUtils.FORM_OPTION_OTHER = null;
FormUtils.assignCountries = function(selectId,type)
{
        var select = document.getElementById(selectId);

        function addOption(option)
        {
		if(document.all)
		{
			select.add(option);
		}
		else
			select.add(option,null);
            
        }
        
    
	if(!this.countries) throw "Countries not set";
	for(var i = 0;i<this.countries.length;i++)
	{
            if(type!=this.COUNTRY_ALL && !this.countries[i].v)
            {
              continue;
            }
            addOption(this.newOption(this.countries[i].id,this.countries[i].name));
	}
        if(type == this.COUNTRY_ALL_VISA)
	{
            addOption(this.newOption("other", this.FORM_OPTION_OTHER, null));
            
            var showAll = function(e)
            {
				var select = (e.srcElement)?e.srcElement.options:this;
				
                if(select.options[select.selectedIndex].value == "other")
                {
                    for(var i=select.options.length-1;i>0;i--)
                        select.remove(i);
                    FormUtils.assignCountries(select.id, FormUtils.COUNTRY_ALL);
                }
            }
            
            if(select.addEventListener)
            {
                select.addEventListener("change", showAll, false);
            }
            else if(select.attachEvent)
            {
                select.attachEvent("onchange",showAll);
            }
        }
}