/**
 * 可选可输对象
 * 属性：
 *       
 * 说明：在验证时，必须是可选列表中的值，否则不让其通过。
 * @author  zhaosh
 */
 
function TelephoneObj(editerObj){
	//定义输入对象
	this.edtObj = editerObj;
	//私有对象
	var ParObj=null;
	var BasObj=null;
}

//公共方法
TelephoneObj.prototype.onvalidate=function () {
	//调用BaseObject中的公用函数检查数据合法性
	if(!this.getBaseObj().commonCheck())	return false;
	if(!this.checkvalidate()){
		//add by dongxin 2007年4月26日
		alert("["+this.edtObj.prompt + "]输入不合法！电话号码的格式为: 区号-6到8位电话号-3到4位分机号;");
		return false;
	 
	}
	return true;
}

TelephoneObj.prototype.checkvalidate=function () {
	//add by dongxin 2007年4月26日
	var chkValue = this.edtObj.value;
	if(chkValue==''){
		return true;
	}
	var patrn = /^(0[\d]{2,3}-)?\d{6,8}(-\d{3,4})?$/; 
	if(patrn.test(chkValue)==true){
		return true;
	}
	patrn = /^[0]?[1][3][0-9]{9}$/;
	return patrn.test(chkValue);
	 
}

TelephoneObj.prototype.getParentObj=function (){
	if(this.BasObj==null){
		this.BasObj = new BaseObj(this.edtObj);
	}
	return this.BasObj;
}
TelephoneObj.prototype.getBaseObj=function (){
	if(this.BasObj==null){
		this.BasObj = new BaseObj(this.edtObj);
	}
	return this.BasObj;
}

//行为方法
TelephoneObj.prototype.onReady=function (){
	//调用ParentObj 的初始化方法
	this.getParentObj().onReady();
	
	
}

TelephoneObj.prototype.eventBand=function (){

}


TelephoneObj.prototype.beforeSubmit = function(){
	this.getParentObj().beforeSubmit();
}
