// JavaScript Document

/*
Page: country.js ()
Version: 1.0.0
Project: Equiworld.org
Author: Peter Asprey
Copyright: Copyright Peter Asprey 2010
Created: 23rd Feb 2010
Inputs: None
Output: None
Purpose: Populated form ew_form with Country data from country.php JSON
Notes: All Equiworld.Org Functions, Classes and Vars prefixed with ew_
*/


function ew_floodformcountry()
{
 ew_country_status = Boolean(false);
	$.getJSON("json/country.php",
        function(data){
			ew_formcountry(data);
			ew_country_status = Boolean(true);
			ew_country_data = data;

         });
}


function ew_formcountry(ew_data)
{
        	var ew_i = 0;
			var ew_n = 0;
		    var ew_select = document.getElementById("ew_form_C");
            ew_select[0] = new Option("Scotland","SCO"); 
            ew_select[1] = new Option("Search All Countries","All"); 
            ew_select[2] = new Option("United Kingdom","GBR"); 
            ew_select[3] = new Option("United States","USA");    
			ew_n = ew_data.length;
	
		    while(ew_i < ew_n){
					ew_select[ew_i + 4] = new Option(ew_data[ew_i].Country,ew_data[ew_i].Code);
					ew_i++;
				};

}


