/*
 * Load Feature and devices XMLs 
 */

//XML container
var XMLData = {
  bFeaturesFetched : false,
  bDevicesFerched : false
}

$(function() {
  //load device list
  $.ajax( {
    //common download_maps.xml used throughout the site
    url: '/NOKIA_LTA_65/Explore_services/Nokia_Maps/flash/download_maps.xml',
    type: 'GET',
    dataType: 'xml',
    timeout: 100000,
    error: function(){
      alert('Error loading phone list \n Please try refreshing the page!');
    },
    success: function(xml) { 
			XMLData.devices = $(xml); 
			//device-displaying wrapper function defined
			if(typeof showDevices == 'function') {
				showDevices();
			}
	  }
  });//ajax-call-end

  //load features list 
  $.ajax( {
    url: '/NOKIA_LTA_65/Explore_services/Nokia_Maps/xml/maps_features.xml',
    type: 'GET',
    dataType: 'xml',
    timeout: 100000,
    error: function(){
      alert('Error loading feature list \n Please try refreshing the page!');
    },

    success: function(xml) {
      //set the global FeaturePages.featureData variable to be referenced, instead of loading the XML
      XMLData.features = $(xml);
      XMLData.bFeaturesFetched = true;
      FeaturePages.featureCount = 0;
			//feature-displaying wrapper function
			showFeatures();
    }
  });//features-xml-ajax-call-end
});
