﻿/*

	xml2array.js
	05/21/2011
	
	John Wamer
	
	This is a work around function to replace previous function of the same name that was provided by: http://www.openjs.com/scripts/xml_parser/
	
	The old version failed under IE7 and had to be replaced quickly in production enviroment
	
	This function is the result of the last minute work around.  More bugs are expected, but hopefully this suffices for now
	
	DEPENDS ON : xml2json.js
	

*/
//check to see if xml2json is available, if not load it
if(typeof functionname !== 'function'){
	include('/templates/coachyouths_template/globaljs/xml2json.js');
}

function xml2array(data){

	
	
	try{
		json = xml2json(data);
	       
	    arr	=	jQuery.parseJSON(json);
	    
	    return arr;
	    
	}///end try
	catch(e){
		var arr		=	new Array();
		return	arr;
	
	}//end catch


}//end function

//this function includes all necessary js files for the application
function include(file)
{

  var script  = document.createElement('script');
  script.src  = file;
  script.type = 'text/javascript';
  script.defer = true;

  document.getElementsByTagName('head').item(0).appendChild(script);

}




