function FlowerFls(_objId, _nGender) {
	/* constants */
	this.GENDER_MALE = 1;
	this.GENDER_FEMALE = 2;
	this.DEFAULT_THEME = 0;
	this.DEFAULT_BODYSHAPE = '0,0,0,0,0,0,0';
	
	/* members */
	this.isLoaded = false;
	this.nGender = _nGender;
	this.nTheme = this.DEFAULT_THEME;
	this.sBodyshape = this.DEFAULT_BODYSHAPE;
	this.objId = _objId;
	this.obj = null;
	
	/* inner logic */
	// 查找flash对象, 并赋与this.obj
	this.findObj = function() {
		if (!this.isLoaded || null == this.obj) {
			try {
				var tmpObj = document.getElementById(this.objId);
				if (null == tmpObj) {
					alert('查找对象' + this.objId + '失败!');
				} else {
					this.obj = tmpObj;
				}
			} catch (ex) {
				alert('查找对象' + this.objId + '遇到错误!');
			}
		}
	};

	// 检查性别
	this.checkGender = function(_nGender) {
		if ( (_nGender & this.nGender) > 0 ) { return true; }
		else {
			if (nGender = 2) { alert('当前形象性别是女性, 不能试穿男性产品'); }
			else { alert('当前形象性别是男性, 不能试穿女性产品'); }
			return false;
		}
	};

	/* interfaces */
	// 初始化
	this.init = function(_nGender, _nTheme) {
		this.findObj();
//		this.setServiceURL('http://199.155.122.119/dressup/dressup-action.jsp');
		var argv = arguments;
		var argc = arguments.length;
		
		switch (argc) {
		case 0:
			this.obj.svcInit(this.nGender);
			break;
		case 1:
			this.nGender = _nGender;
			this.obj.svcInit(this.nGender);
			break;
		case 2:
			this.nGender = _nGender;
			this.nTheme = _nTheme;
			this.obj.svcInit(this.nGender);
			this.obj.setTheme(this.nTheme);
			break;
		default:
			alert('Bad parameter');
			return;
		}
		this.isLoaded = true;
	};
	
	// 获取后台处理请求的URL
	this.getServiceURL = function() {
		this.findObj();
		return this.obj.getServiceURL();
	};
	
	// 设置后台处理请求的URL
	this.setServiceURL = function(_sURL) {
		this.findObj();
		this.obj.setServiceURL(_sURL);
	};
	
	// 设置快照URL
	this.getQuickCameraURL = function() {
		this.findObj();
		return this.obj.getQuickCameraURL();
	};
	
	// 设置快照URL
	this.setQuickCameraURL = function(_sURL) {
		this.findObj();
		this.obj.setQuickCameraURL(_sURL);
	};

	// 生成快照于_sTarget中
	this.takeQuickCamera = function(_sTarget) {
		this.findObj();
		this.obj.takeQuickCamera(_sTarget);
	};
	
	// 设置是否可移动
	this.setMovable = function(_bMovable) {
		this.findObj();
		this.obj.setMoveFlag(_bMovable);
	};
	
	// 重新开始
	this.reset = function() {
		this.findObj();
		this.obj.svcReset();
	};

	// 设置性别
	this.setGender = function(_nGender) {
//		alert('change gender from ' + this.nGender + ' to ' + _nGender);
		if (this.nGender == _nGender) return;
		this.nGender = _nGender;
		if (!this.isLoaded) {
			this.init(this.nGender);
		} else {
			this.obj.svcSetGender(this.nGender);
		}
	};
	
	// 设置体型参数(肩宽,臂围,胸围,腰围,臀围,腿围,腿长)
	this.setBodyshape = function(_sBodyshape) {
		this.sBodyshape = _sBodyshape;
		this.findObj();
		this.obj.svcSetBodyshape(this.sBodyshape);
	};

	// 设置背景
	this.setBackground = function(_nId) {
		this.findObj();
		this.obj.svcSetBackground(_nId);
	};
	
	// 设置发型
	this.setHair = function(_nGender, _nId) {
		if (true) {
			this.findObj();
			this.nGender = _nGender;
			this.obj.svcSetHair(_nId);
		}
	};

	// 设置脸
	this.setFace = function(_sFileName, _nGender, _bMyself, _nHairId) {
		if ( (this.nGender & _nGender) == 0 ) {
			var sDesc = (this.nGender == this.GENDER_MALE) ? "男性" : "女性";
			if (!confirm("当前形象是" + sDesc + ", 您是否要切换性别? 切换后所有已穿衣物将全部脱去.")) { return false; }
		}
		this.nGender = _nGender;
		this.findObj();
		this.obj.svcSetFace(_sFileName, _nGender, _bMyself, _nHairId);
	};

	// 穿衣裤
	this.tryClothes = function(_nGender, _nId, _nDressMode) {
		if (true) {
			this.findObj();
			this.nGender = _nGender;
			this.obj.svcTryClothes2(_nGender, _nId, _nDressMode);
		}
	};

	// 穿配饰
	this.tryFitting = function(_nGender, _nId, _sType) {
		if (true) {
			this.findObj();
			this.nGender = _nGender;
			this.obj.svcTryFitting2(_nGender, _nId, _sType);
		}
	};

	// 穿形象
	this.tryAppearance = function(_nGender, _nId) {
		if (true) {
			this.findObj();
			this.nGender = _nGender;
			this.obj.svcTryAppearance2(_nGender, _nId);
		}
	};

	// 穿编辑推荐形象(与形象是不同对象)
	this.tryRecommendAppearance = function(_nGender, _nId) {
		if (true) {
			this.findObj();
			this.nGender = _nGender;
			this.obj.svcTryRecommendAppearance2(_nGender, _nId);
		}
	};

	// 设置主题
	this.setTheme = function(_nTheme) {
		if (this.nTheme == _nTheme) return;
		this.nTheme = _nTheme;
		if (!this.isLoaded) {
			this.init(this.nGender, this.nTheme);
		} else {
			this.obj.setTheme(this.nTheme);
		}
	};
	
	// 测试设置身体
	this.setBody = function(_sURL) {
		this.findObj();
		return this.obj.setBody(_sURL);
	};
}
