//
// This file simply contains information about each location
// for now this is statically stored but the final version may 
// well include a database with this info stored which generates
// this file dynamically.

// First create the Object structure to hold all of the data
function objLocations  () {
	// constructor
	
	// variables
	var Locations = new Array();
	
	// Methods
	this.Add = fnAdd;
	this.Find = fnFind;
	this.LoadDropdown = fnLoadDropdown;
	
	// Method definitions
	function fnAdd( liCountry, liLocation, liIntro, liMapImage, liFocalPoint, liAddress, liTel, liWeb, liEmail, liBrief, liInsideGuide, liCDGuide, liLib, liLangs, liTimes, liGMT, liPhoto, liCity ) {
		var newLoc = new objLocationInfo( liCountry, liLocation, liIntro, liMapImage, liFocalPoint, liAddress, liTel, liWeb, liEmail, liBrief, liInsideGuide, liCDGuide, liLib, liLangs, liTimes, liGMT, liPhoto, liCity );

		Locations.push( newLoc );
	}

	function fnFind( jsLocName ) {
		if (jsLocName == null ) {
			return null;
		}
		
		// make the name to search for is in lowercase to make the search case insensitive
		jsLocName = jsLocName.toLowerCase();

		// test each location name against the name passed and exit if we find one
		for (var l=0; l<Locations.length; l++ ){
			if (jsLocName==Locations[l].Location.toLowerCase()) {
		
				return Locations[l];
			}
		}
	
		// No matching location name found
		return null;
	}

	function fnLoadDropdown( jsDDown ) {
		if (jsDDown == null) {
			return;
		}
		
		// simply process all the locations adding Country and City elements to the passed Dropdown
		for (var l=0; l<Locations.length; l++ ){
			if (Locations[l].Country.length > 0) {
				var newOpt = new Option( Locations[l].Country + " - " + Locations[l].Location, Locations[l].Location, l==0, l==0 );
			}else{
				var newOpt = new Option( Locations[l].Location, Locations[l].Location, l==0, l==0 );
			}
			
			jsDDown.options.add(newOpt);
		}
	}
}

function objLocationInfo ( liCountry, liLocation, liIntro, liMapImage, liFocalPoint, liAddress, liTel, liWeb, liEmail, liBrief, liInsideGuide, liCDGuide, liLib, liLangs, liTimes, liGMT, liPhoto, liCity ) {
	// constructor
	this.Country = liCountry;
	this.Location = liLocation;
	this.Intro = liIntro;
	this.MapImage = liMapImage;
	this.FocalPoint = liFocalPoint;
	this.Address = liAddress;
	this.Telephone = liTel;
	this.Email = liEmail;
	this.Web = liWeb;
	this.Brief = liBrief;
	this.InsideGuide = liInsideGuide;
	this.CDGuide = liCDGuide;
	this.Library = liLib;
	this.Languages = liLangs;
	this.Times = liTimes;
	this.Timezone = liGMT;
	this.Photo = liPhoto;
	this.City = liCity;
	
	// variables
	
	
	// Methods
	
	
	// Method definitions


}