function SafeEditCtrl( _parent ){
	this._parent = _parent;
	this._curredit = null;
	this._safemode = false;
	
	//模式
	this.safemode = function( safe ){
		if(this._curredit && this._curredit[0]){
			this._curredit.remove();
		}
		
		this._safemode = safe;
		
		if(safe){
			html = "";
			html += "<object id=\"safeedit\" classid=\"clsid:3139d69b-8c03-4a4d-bf60-268c9bd014d3\" codebase=\"./safeedit.cab#version=1,0,0,2\" width=100 height=24>";
			html += "<param name=\"width\" value=\"100\" />";
			html += "<param name=\"height\" value=\"24\" />";
			html += "</object>";
			this._curredit = $(html);
		}else{
			this._curredit = $("<input style=\"width: 96px\" id=\"pwdedit\" value=\"\" type=password> ");
		}		

		this._parent.append(this._curredit);
	}
	
	// 值
	this.value = function( value ){
		if(this._curredit && this._curredit[0]){
			if ( typeof value === "string" ) { //赋值
				this._curredit[0].value = value;
			}else{
				return this._curredit[0].value;
			}
		}else{
			return "";
		}
	}	
	
	//值最大长度
	this.maxlength = function( value ){
		if(this._curredit && this._curredit[0]){
			if ( typeof value === "number" ) { //赋值
				if(this._safemode) {
					this._curredit[0].MaxLength = value;
				}else{
					this._curredit[0].setAttribute("maxLength", value);
				}
			}else{
				if(this._safemode) {
					return this._curredit[0].MaxLength;
				}else{
					return this._curredit[0].getAttribute("maxLength");
				}
			}
		}
	}
	
	//宽
	this.width = function( value ){
		if(this._curredit && this._curredit[0]){
			if ( typeof value === "number" ) { //赋值
				if(this._safemode) {
					this._curredit[0].Width = value;
				}else{
					this._curredit[0].style.width = value;
				}
			}else{
				if(this._safemode) {
					return this._curredit[0].Width;
				}else{
					return this._curredit[0].style.width;
				}
			}
		}
	}
	
	//高
	this.height = function( value ){
		if(this._curredit && this._curredit[0]){
			if ( typeof value === "number" ) { //赋值
				if(this._safemode) {
					this._curredit[0].Height = value;
				}else{
					this._curredit[0].style.height = value;
				}
			}else{
				if(this._safemode) {
					return this._curredit[0].Height;
				}else{
					return this._curredit[0].style.height;
				}
			}
		}
	}
	
	//边框
	this.border = function( value ){
		if(this._curredit && this._curredit[0]){
			if ( typeof value === "boolean" ) { //赋值
				if(this._safemode) {
					this._curredit[0].NoBorder = !value;
				}else{
					if(value){					
						this._curredit[0].style.border = '1px solid ';
					}else{
						this._curredit[0].style.border = 'none';
					}
				}
			}else{
				if(this._safemode) {
					return !this._curredit[0].NoBorder;
				}else{
					return this._curredit[0].style.borderStyle != 'none';
				}
			}
		}
	}
}

