Mobi.Select = {
	frmName:'',
	action:new Array(),
	method:new Array(),
	frmElmn:new Array(),
	objId:'',
	catId:'',
	idObj:new Array('','','',''),
	startUpControle:false,
	onChangeArr:new Array(),

	getSubCategories:function(cat_id, obj_id) {
		this.objId = obj_id;
		var param = 'cat_id=' + cat_id;
		Mobi.AJAX.connection('/ajax/getSubCategories.asp', param, this.setSubCategories, 'POST');
	},
	setSubCategories:function() {
		if(http.readyState == 4) {
			try {
				if(http.status==200) {
					var catList = eval('(' + http.responseText + ');');
					Mobi.Select.supprOptions(document.getElementById(Mobi.Select.objId));
					Mobi.Select.setElement(document.getElementById(Mobi.Select.objId), catList);
				}
			}
			catch(e) {
				alert(e)
			}
		}
	},
	getModelYear:function(cat_id, obj_id) {
		this.objId = obj_id;
		var param = 'cat_id=' + cat_id;
		Mobi.AJAX.connection('/ajax/getSubCategories.asp', param, this.setSubCategories, 'POST');
	},
	getRelatedProducts:function(cat_id) {
		this.objID = 'product_list';
		var param = 'cat_id=' + cat_id;
		Mobi.AJAX.connection('/ajax/getRelatedProducts.asp', param, this.setRelatedProducts, 'POST');
	},
	setRelatedProducts:function(){
		if(http.readyState == 4) {
			try {
				if(http.status==200) {
					Encoder.EncodeType = "entity";
					var decoded = Encoder.htmlDecode(http.responseText);
					//var results = eval('(' + http.responseText + ');');
					document.getElementById('product_list').innerHTML = decoded;
				}
			}
			catch(e) {
				alert(e)
			}
		}
	},
	setElement:function(elmn, elmnArr) {
		for(i=0;i<elmnArr.length;i++){
			this.addOption(elmn, elmnArr[i].n, elmnArr[i].i, false);
		}
	},
	addOption:function(field, txt, val, selected) {
		var newOption;
		var fLength;
		newOption = new Option(txt, val, selected, selected);
	  	fLength = field.length;
	  	field.options[fLength] = newOption;
	},
	supprOptions:function(obj) {
		obj.options.length = 0;
	}
}
