function Traffic(){
	this.hasInfo;
	this.title;
	this.date;
	this.provider;
	this.trainData;
	this.busData;
	this.busDataTitle;
	this.PROVIDER_INDEX = ["未区分", "鉄道", "名鉄バス", "とよたおいでんバス", "地域バス", "豊栄交通"];

	this.init = function(xml){
		this.hasInfo = 0;
		this.title = "";
		this.date = "";
		this.provider = new Array();
		this.trainData = new Array();
		this.busData = new Array();
		this.busDataTitle = new Array();

		var metaObj = xml.getElementsByTagName("metadata")[0];
		var metaTitleObj = metaObj.getElementsByTagName("title")[0];
		var metaDateObj = metaObj.getElementsByTagName("date")[0];
		var metaProviderObj = metaObj.getElementsByTagName("provider")[0];
		var metaProviderObjCount = metaProviderObj.childNodes.length;

		this.title = metaTitleObj.firstChild.nodeValue;
		//this.hasInfo = metaTitleObj.getAttribute("info");
		this.hasInfo = (this.title.indexOf("平常運行") >= 0 || !this.title || this.title == " " || this.title == "　") ? 0 : 1;
		this.date = metaDateObj.firstChild.nodeValue;

		for (var i = 0; i < metaProviderObjCount; i++){
			this.provider[0] = new Array();
			if(metaProviderObj.childNodes[i].tagName == "data"){
				var thisId = metaProviderObj.childNodes[i].getAttribute("id");
				var thisGroupId = metaProviderObj.childNodes[i].getAttribute("groupid") || 0;
				var thisValue = metaProviderObj.childNodes[i].firstChild.nodeValue;
				if(!this.provider[thisGroupId])this.provider[thisGroupId] = new Array();
				this.provider[thisGroupId].push([thisId, thisValue]);
			}
		}
		
		var dataObj = xml.getElementsByTagName("datainfo")[0];
		var dataObjCount = dataObj.childNodes.length;
		for(var i = 0; i < dataObjCount; i++){
			var child = dataObj.childNodes[i];
			
			if(child.tagName == "train"){
				//電車
				for(var j = 0, len = child.childNodes.length; j < len; j++){
					if(child.childNodes[j].tagName == "data"){
						var thisValue = child.childNodes[j].firstChild.nodeValue;
						this.trainData.push(thisValue);
					}
				}
			}
			if((child.tagName !== undefined) && (child.tagName.indexOf("bus_") >= 0)){
				//バス
				var thisNum = Number(child.tagName.split("_")[1]);
				this.busData[thisNum - 1] = new Array();
				for(var j = 0, len = child.childNodes.length; j < len; j++){
					
					if(child.childNodes[j].tagName == "title"){
						this.busDataTitle[thisNum - 1] = child.childNodes[j].firstChild.nodeValue;
					}
					if(child.childNodes[j].tagName == "data"){
						this.busData[thisNum - 1].push(child.childNodes[j].firstChild.nodeValue);
					}
				}
			}
		}
	}
	
	this.getTitle = function(){
		return this.title;
	}
	this.getDate = function(){
		return this.date;
	}
	this.getProvider = function(){
		return this.provider;
	}
	this.getTrainData = function(){
		return this.trainData;
	}
	this.getBusData = function(){
		return this.busData;
	}
	this.getBusDataTitle = function(){
		return this.busDataTitle;
	}
}
