ModalboxExt = {
	Loading: function(Message,type) {
		if( type == 'WAIT' ){
			for (var i=0;i<$('MB_content').childNodes.length;i++ ) {
				if($('MB_content').childNodes[i].style){ 						
	  				$('MB_content').childNodes[i].style.display = 'none' ;
				}
	  		}
	  		$('MB_content').appendChild(ModalboxExt.Loading(Message));
	  		Modalbox.resizeToContent();
	  		return false;
		}
		else if( type == 'BACK' ){
			var _infoType = arguments[2] ? arguments[2] : 'text';
			$('MB_content').appendChild(this.Promptinfo(Message,{infoType:_infoType},'HTML'));
			$('MB_EXT_loading').remove();
	  		Modalbox.resizeToContent();
			$('MB_EXT_okbtn').observe('click', function(){
				for (var i=0;i<$('MB_content').childNodes.length;i++ ) {
					if($('MB_content').childNodes[i].style && $('MB_content').childNodes[i].style.display=='none'){ 						
		  				$('MB_content').childNodes[i].style.display = '' ;
					}
			  	}
			  	this.parentNode.remove();
			  	Modalbox.resizeToContent();
			});
	  		return false;
		}
		else{
			return new Element("div", { id:'MB_EXT_loading' }).update(Message ? Message : Modalbox.options.loadingString);
		}
	},
	/**
	 * 提示消息
	 * @param {String} Message 提示框信息 
	 * @param {String} infoType 提示框类型:text,question,error,warning
	 * @return Modalbox.Show();
	 */
	Promptinfo:function(Message,pt_options){
//		pt_options.infoType= pt_options.infoType ? pt_options.infoType : 'text';
		if( pt_options.infoType=='text' || pt_options.infoType=='error' || pt_options.infoType=='question' || pt_options.infoType=='warning' ){
			var promptinfo_div = new Element("div",{id:'MB_EXT_'+pt_options.infoType+'info'}).update('<p>'+Message+'</p>');
			var promptinfo_btn = new Element("input", {id:'MB_EXT_okbtn', type:'button',value: pt_options.okLable ? pt_options.okLable : '确定' });
			promptinfo_div.appendChild(promptinfo_btn);
		
			if(arguments[2] && arguments[2]=='HTML'){
				return promptinfo_div;
			}
			pt_options.afterLoad=function(){
				if(Object.isFunction(pt_options.afterLoadExt)){
					pt_options.afterLoadExt();
				}
				if( Object.isFunction(pt_options.okFun) ) {
					$('MB_EXT_okbtn').observe('click', pt_options.okFun);	
				} else {
					$('MB_EXT_okbtn').observe('click', Modalbox.hide.bindAsEventListener(Modalbox));
				}
			}
			Modalbox.show(promptinfo_div,pt_options);
		}
	},
	/**
	 * 
	 */
	Confirm: function(cf_content,cf_options){
		
		var confirm_div = new Element('div',{id:'MB_EXT_Confirm'});
		var confirmok_btn = new Element('input', { id:'MB_EXT_Okbtn', 'type': 'button','value': cf_options.okLable ? cf_options.okLable : '确定',id:'MBEXT_Okbtn'});
		var confirmcancle_btn = new Element('input', { id:'MB_EXT_Canclebtn','type': 'button','value':cf_options.cancleLable ? cf_options.cancleLable : '取消',id:'MBEXT_Canclebtn'});
		confirmok_btn.observe('click', cf_options.okFun ? cf_options.okFun : Modalbox.hide.bindAsEventListener(Modalbox));
		confirmcancle_btn.observe('click', cf_options.cancleFun ? cf_options.cancleFun : Modalbox.hide.bindAsEventListener(Modalbox));
		confirm_div.appendChild(confirmok_btn);
		confirm_div.appendChild(confirmcancle_btn);
		
		cf_options.afterLoad = function(){
			if(cf_options.afterLoadExt){
				cf_options.afterLoadExt();
			}
			$('MB_content').appendChild(confirm_div);
			Modalbox.resizeToContent();
		};
		Modalbox.show(cf_content,cf_options);
		
	}
}