/***************************************************************************************************

	Library Name		:	Locality Data Structure Library
	File Name		:	localitydatastructure.js
	Version			:	1.0.1
	Author			:	Subbaraman K (latestbios@yahoo.com)
	Create Date		:	24th Aug 2006
	Modify Date		:	31th Aug 2006

***************************************************************************************************/

// Dealer list in a Locality

function __TSWS_DL_dealerdata(__TSWS_DL_strID, __TSWS_DL_strName, __TSWS_DL_strDealerType, __TSWS_DL_strDemoAvailability, __TSWS_DL_strStoreTime, __TSWS_DL_strPhone, __TSWS_DL_strAddress, __TSWS_DL_strLandmark, __TSWS_DL_strArea, __TSWS_DL_strCity, __TSWS_DL_strPincode, __TSWS_DL_strState, __TSWS_DL_strRegion){
	this.id			=	__TSWS_DL_strID;
	this.name			=	__TSWS_DL_strName;
	this.type			=	__TSWS_DL_strDealerType;
	this.demo			=	__TSWS_DL_strDemoAvailability;
	this.timing		=	__TSWS_DL_strStoreTime;
	this.phone			=	__TSWS_DL_strPhone;
	this.address		=	__TSWS_DL_strAddress;
	this.landmark		=	__TSWS_DL_strLandmark;
	this.area			=	__TSWS_DL_strArea;
	this.city			=	__TSWS_DL_strCity;
	this.pincode		=	__TSWS_DL_strPincode;
	this.state			=	__TSWS_DL_strState;
	this.region		=	__TSWS_DL_strRegion;
}
function __TSWS_DL_dealer_add(__TSWS_DL_strID, __TSWS_DL_strName, __TSWS_DL_strDealerType, __TSWS_DL_strDemoAvailability, __TSWS_DL_strStoreTime, __TSWS_DL_strPhone, __TSWS_DL_strAddress, __TSWS_DL_strLandmark, __TSWS_DL_strArea, __TSWS_DL_strCity, __TSWS_DL_strPincode, __TSWS_DL_strState, __TSWS_DL_strRegion){
	if(typeof(__TSWS_DL_strID)=='undefined')					__TSWS_DL_strID			=	"";
	if(typeof(__TSWS_DL_strName)=='undefined')				__TSWS_DL_strName			=	"";
	if(typeof(__TSWS_DL_strDealerType)=='undefined')		__TSWS_DL_strDealerType	=	"";
	if(typeof(__TSWS_DL_strDemoAvailability)=='undefined')	__TSWS_DL_strDemoAvailability	=	"";
	if(typeof(__TSWS_DL_strStoreTime)=='undefined')			__TSWS_DL_strStoreTime			=	"";
	if(typeof(__TSWS_DL_strPhone)=='undefined')				__TSWS_DL_strPhone		=	"";
	if(typeof(__TSWS_DL_strAddress)=='undefined')			__TSWS_DL_strAddress		=	"";
	if(typeof(__TSWS_DL_strLandmark)=='undefined')			__TSWS_DL_strLandmark	=	"";
	if(typeof(__TSWS_DL_strArea)=='undefined')				__TSWS_DL_strArea			=	"";
	if(typeof(__TSWS_DL_strCity)=='undefined')				__TSWS_DL_strCity			=	"";
	if(typeof(__TSWS_DL_strPincode)=='undefined')			__TSWS_DL_strPincode		=	"";
	if(typeof(__TSWS_DL_strState)=='undefined')				__TSWS_DL_strState		=	"";
	if(typeof(__TSWS_DL_strRegion)=='undefined')				__TSWS_DL_strRegion		=	"";

	this._arrDealer[this._count++]=new __TSWS_DL_dealerdata(__TSWS_DL_strID, __TSWS_DL_strName, __TSWS_DL_strDealerType, __TSWS_DL_strDemoAvailability, __TSWS_DL_strStoreTime, __TSWS_DL_strPhone, __TSWS_DL_strAddress, __TSWS_DL_strLandmark, __TSWS_DL_strArea, __TSWS_DL_strCity, __TSWS_DL_strPincode, __TSWS_DL_strState, __TSWS_DL_strRegion);
}

function __TSWS_DL_dealer_get(__TSWS_DL_intIndex){
	if(this._count==0) return null;
	if(typeof(__TSWS_DL_intIndex)=='undefined') __TSWS_DL_intIndex = -1;
	if(__TSWS_DL_intIndex >-1 && __TSWS_DL_intIndex < this._count)
		return this._arrDealer[__TSWS_DL_intIndex];
	else return null;
	//else return this._arrDealer[this._count-1];
}
function __TSWS_DL_dealer_count(){
	return	this._count;
}

function __TSWS_DL_dealers(__TSWS_DL_strArea, __TSWS_DL_strCity, __TSWS_DL_strState, __TSWS_DL_strRegion, __TSWS_DL_strAreaID, __TSWS_DL_strCityID, __TSWS_DL_strStateID, __TSWS_DL_strRegionID){
	this._count	=	0;
	this._arrDealer	=	new Array(0);
	this.addDealer	=	__TSWS_DL_dealer_add;
	this.getDealer	=	__TSWS_DL_dealer_get;
	this.count			=	__TSWS_DL_dealer_count;

	this.area			=	__TSWS_DL_strArea;
	this.city			=	__TSWS_DL_strCity;
	this.state			=	__TSWS_DL_strState;
	this.region		=	__TSWS_DL_strRegion;

	this.areaid		=	__TSWS_DL_strAreaID;
	this.cityid		=	__TSWS_DL_strCityID;
	this.stateid		=	__TSWS_DL_strStateID;
	this.regionid		=	__TSWS_DL_strRegionID;
}
DealerData		=	__TSWS_DL_dealerdata;

// Locality list in a City

function __TSWS_DL_localitydata(__TSWS_DL_strID, __TSWS_DL_strName, __TSWS_DL_strPincode, __TSWS_DL_strLetter){
	this.id			=	__TSWS_DL_strID;
	this.name		=	__TSWS_DL_strName;
	this.pincode		=	__TSWS_DL_strPincode;
	this.letter		=	__TSWS_DL_strLetter;
}

function __TSWS_DL_locality_add(__TSWS_DL_strID, __TSWS_DL_strName, __TSWS_DL_strPincode, __TSWS_DL_strLetter){
	if(typeof(__TSWS_DL_strID)=='undefined')		__TSWS_DL_strID			=	"";
	if(typeof(__TSWS_DL_strName)=='undefined')		__TSWS_DL_strName		=	"";
	if(typeof(__TSWS_DL_strPincode)=='undefined')	__TSWS_DL_strPincode	=	"";
	if(typeof(__TSWS_DL_strLetter)=='undefined')	__TSWS_DL_strLetter		=	"";

	this._arrLocality[this._count++]=new __TSWS_DL_localitydata(__TSWS_DL_strID, __TSWS_DL_strName, __TSWS_DL_strPincode, __TSWS_DL_strLetter);
}

function __TSWS_DL_locality_get(__TSWS_DL_intIndex){
	if(this._count==0) return null;
	if(typeof(__TSWS_DL_intIndex)=='undefined') __TSWS_DL_intIndex = -1;
	if(__TSWS_DL_intIndex >-1 && __TSWS_DL_intIndex < this._count)
		return this._arrLocality[__TSWS_DL_intIndex];
	else return null;
	//else return this._arrLocality[this._count-1];
}
function __TSWS_DL_locality_count(){
	return	this._count;
}

function __TSWS_DL_localities(__TSWS_DL_strCity, __TSWS_DL_strState, __TSWS_DL_strRegion, __TSWS_DL_strCityID, __TSWS_DL_strStateID, __TSWS_DL_strRegionID){
	this._count			=	0;
	this._arrLocality	=	new Array(0);
	this.addLocality		=	__TSWS_DL_locality_add;
	this.getLocality		=	__TSWS_DL_locality_get;
	this.count			=	__TSWS_DL_locality_count;

	this.city			=	__TSWS_DL_strCity;
	this.state		=	__TSWS_DL_strState;
	this.region		=	__TSWS_DL_strRegion;

	this.cityid		=	__TSWS_DL_strCityID;
	this.stateid		=	__TSWS_DL_strStateID;
	this.regionid		=	__TSWS_DL_strRegionID;
}
LocalityData		=	__TSWS_DL_localitydata;

// City list in a State

function __TSWS_DL_citydata(__TSWS_DL_strID, __TSWS_DL_strName, __TSWS_DL_strLetter, __TSWS_DL_blnMajorCity){
	this.id			=	__TSWS_DL_strID;
	this.name		=	__TSWS_DL_strName;
	this.letter		=	__TSWS_DL_strLetter;
	this.ismajorcity	=	__TSWS_DL_blnMajorCity;
}

function __TSWS_DL_city_add(__TSWS_DL_strID, __TSWS_DL_strName, __TSWS_DL_strLetter, __TSWS_DL_blnMajorCity){
	if(typeof(__TSWS_DL_strID)=='undefined')			__TSWS_DL_strID			=	"";
	if(typeof(__TSWS_DL_strName)=='undefined')		__TSWS_DL_strName		=	"";
	if(typeof(__TSWS_DL_strLetter)=='undefined')		__TSWS_DL_strLetter	=	"";
	if(typeof(__TSWS_DL_blnMajorCity)=='undefined')	__TSWS_DL_blnMajorCity		=	false;

	this._arrCity[this._count++]=new __TSWS_DL_citydata(__TSWS_DL_strID, __TSWS_DL_strName, __TSWS_DL_strLetter, __TSWS_DL_blnMajorCity);
}

function __TSWS_DL_city_get(__TSWS_DL_intIndex){
	if(this._count==0) return null;
	if(typeof(__TSWS_DL_intIndex)=='undefined') __TSWS_DL_intIndex = -1;
	if(__TSWS_DL_intIndex >-1 && __TSWS_DL_intIndex < this._count)
		return this._arrCity[__TSWS_DL_intIndex];
	else return null;
	//else return this._arrCity[this._count-1];
}
function __TSWS_DL_city_count(){
	return	this._count;
}

function __TSWS_DL_cities(__TSWS_DL_strState, __TSWS_DL_strRegion, __TSWS_DL_strStateID, __TSWS_DL_strRegionID){
	this._count			=	0;
	this._arrCity	=	new Array(0);
	this.addCity		=	__TSWS_DL_city_add;
	this.getCity		=	__TSWS_DL_city_get;
	this.count			=	__TSWS_DL_city_count;

	this.state			=	__TSWS_DL_strState;
	this.region		=	__TSWS_DL_strRegion;

	this.stateid		=	__TSWS_DL_strStateID;
	this.regionid		=	__TSWS_DL_strRegionID;
}
CityData		=	__TSWS_DL_citydata;

