if(typeof HBFitness == "undefined") HBFitness={};
var customersCollection = new Array();

HBFitness.Customer = function(id) {
	this.CustomerID = id;
	this.LocationID = '';
	this.LastName = '';
	this.FirstName = '';
	this.Email = '';
	this.Password = '';
	this.AllowLogin = '';
	this.IsActive = '';
	this.PrimPhone = '';
	this.AltPhone = '';
	this.AddressLine1 = '';
	this.AddressLine2 = '';
	this.City = '';
	this.State = '';
	this.ZipCode = '';
	this.CreatedBy = '';
	this.Updated = '0';
	this.Error = '';
	this.Credits = '';
	this.Comments = '';
	this.BillingDate = '';
	this.MaxSessionsAllowed= '';
	this.Schema = '<Customer><CustomerID /><LocationID /><LastName /><FirstName /><Email /><Password /><AllowLogin /><IsActive /><PrimaryPhone /><AltPhone /><LocAddressLine1 /><LocAddressLine2 /><LocCity /><LocState /><LocZipCode /><CreatedBy /><Updated /><error /><BillingDate /><MaxSessionsAllowed /></Customer>';
}

Object.extend(HBFitness.Customer.prototype, {
	SelectByCustomerID : function(CustomerID) {
		var sArgs ='CustomerID='+CustomerID;
		IFRPB2('getCustomerByCustomerID',sArgs,'SelectByCustomerIDProcess()');
		SelectByCustomerIDProcess = function() {
			try {
				var xml = document.all.ifr_getCustomerByCustomerID.contentWindow.document.all.xmlReturn;
				var oXml = new ActiveXObject('MSXML2.FreeThreadedDOMDocument');
				oXml.loadXML(xml.xml);
				this.CustomerID = oXml.firstChild.getElementsByTagName('CustomerID')[0].text;
				this.LocationID = oXml.firstChild.getElementsByTagName('LocationID')[0].text;
				this.LastName = oXml.firstChild.getElementsByTagName('LastName')[0].text;
				this.FirstName = oXml.firstChild.getElementsByTagName('FirstName')[0].text;
				this.Email = oXml.firstChild.getElementsByTagName('Email')[0].text;
				this.Password = oXml.firstChild.getElementsByTagName('Password')[0].text;
				this.AllowLogin = oXml.firstChild.getElementsByTagName('AllowLogin')[0].text;
				this.IsActive = oXml.firstChild.getElementsByTagName('IsActive')[0].text;
				this.PrimPhone = oXml.firstChild.getElementsByTagName('PrimaryPhone')[0].text;
				this.AltPhone = oXml.firstChild.getElementsByTagName('AltPhone')[0].text;
				this.AddressLine1 = oXml.firstChild.getElementsByTagName('LocAddressLine1')[0].text;
				this.AddressLine2 = oXml.firstChild.getElementsByTagName('LocAddressLine2')[0].text;
				this.City = oXml.firstChild.getElementsByTagName('LocCity')[0].text;
				this.State = oXml.firstChild.getElementsByTagName('LocState')[0].text;
				this.ZipCode = oXml.firstChild.getElementsByTagName('LocZipCode')[0].text;
				this.CreatedBy = oXml.firstChild.getElementsByTagName('CreatedBy')[0].text;
				this.BillingDate = oXml.firstChild.getElementsByTagName('BillingDate')[0].text;
				this.MaxSessionsAllowed = oXml.firstChild.getElementsByTagName('MaxSessionsAllowed')[0].text;
			} catch(e) {
				this.Error = e.message;
			}
		}
	},
	load : function(xml) {
		try {
			var oXml = new ActiveXObject('MSXML2.FreeThreadedDOMDocument');
			oXml.loadXML(xml.xml);
			this.CustomerID = oXml.firstChild.getElementsByTagName('CustomerID')[0].text;
			this.LocationID = oXml.firstChild.getElementsByTagName('LocationID')[0].text;
			this.LastName = oXml.firstChild.getElementsByTagName('LastName')[0].text;
			this.FirstName = oXml.firstChild.getElementsByTagName('FirstName')[0].text;
			this.Email = oXml.firstChild.getElementsByTagName('Email')[0].text;
			this.Password = oXml.firstChild.getElementsByTagName('Password')[0].text;
			this.AllowLogin = oXml.firstChild.getElementsByTagName('AllowLogin')[0].text;
			this.IsActive = oXml.firstChild.getElementsByTagName('IsActive')[0].text;
			this.PrimPhone = oXml.firstChild.getElementsByTagName('PrimaryPhone')[0].text;
			this.AltPhone = oXml.firstChild.getElementsByTagName('AltPhone')[0].text;
			this.AddressLine1 = oXml.firstChild.getElementsByTagName('LocAddressLine1')[0].text;
			this.AddressLine2 = oXml.firstChild.getElementsByTagName('LocAddressLine2')[0].text;
			this.City = oXml.firstChild.getElementsByTagName('LocCity')[0].text;
			this.State = oXml.firstChild.getElementsByTagName('LocState')[0].text;
			this.ZipCode = oXml.firstChild.getElementsByTagName('LocZipCode')[0].text;
			this.CreatedBy = oXml.firstChild.getElementsByTagName('CreatedBy')[0].text;
			this.BillingDate = oXml.firstChild.getElementsByTagName('BillingDate')[0].text;
			this.MaxSessionsAllowed = oXml.firstChild.getElementsByTagName('MaxSessionsAllowed')[0].text;
		} catch(e) {
			this.Error = e.message;
		}
	},
	toxml : function() {
		var oXml = new ActiveXObject('MSXML2.FreeThreadedDOMDocument');
		oXml.loadXML(this.Schema);	
	}
});