﻿function MulConditions(conditionArr){
	this.conditionArr = conditionArr; 
	this.initFlag = false;
	this.selectCondition = {};
}

MulConditions.prototype ={
	init:function(){
		for(var n in this.conditionArr){
			if(Micheas.$(this.conditionArr[n].id)){
					
			}else{ 
				Micheas.log.write("no element id:"+this.conditionArr[n].id);
				return false;
			}
		}
		this.initFlag = true;
	},
	formatPara:function(){
		if(this.initFlag){
		    var tmpValue; 
			for (var n in this.conditionArr) {
			    tmpValue = "";
				this.selectCondition[this.conditionArr[n].type] = null;
				if(this.conditionArr[n].type == "Destination"){
			        tmpValue = Micheas.$(this.conditionArr[n].id).innerHTML;
			        if(tmpValue == "未定义"){
			            tmpValue = "";
			        }
			    }else{
			        tmpValue = Micheas.$(this.conditionArr[n].id).value.trimAll();
			    }
				 if(tmpValue != ""){
				 	if(this.selectCondition[this.conditionArr[n].type]){
						this.selectCondition[this.conditionArr[n].type] += "|" + tmpValue;
					}else{
						this.selectCondition[this.conditionArr[n].type] = tmpValue;
					}
				 }
			}
			return this.selectCondition;
		}else{
			Micheas.log.write("not init");
		}
	}
}