﻿Ext.ns('com.quizzpot.tutorial');

com.quizzpot.tutorial.Msg = {
	init: function(){
		Ext.get('alert').on('click',function(){
			Ext.Msg.alert('Alert','this is an alert!');
		},this);
		
		Ext.get('confirm').on('click',function(){
			Ext.Msg.confirm('Confirm','Are you sure you want to do this?',this.callback);
		},this);
		
		Ext.get('prompt').on('click',function(){
			Ext.Msg.prompt('Prompt','What is your name?',function(btn,txt){
				alert('Welcome '+txt);
			});
		},this);
		
		Ext.get('wait').on('click',function(){
			Ext.Msg.wait('Loading... please wait!');
			window.setTimeout(function(){
				Ext.Msg.hide();
			},6000);
		},this);
		
		Ext.get('custom').on('click',function(){
			Ext.Msg.show({
				title: 'Custom',
				msg: 'this is a custom message!',
				buttons: Ext.Msg.YESNO,
				icon: 'profile',
				fn: this.callback
			});
		},this);
	},
	
	callback: function(txt){
		alert(txt);
	}
}

Ext.onReady(com.quizzpot.tutorial.Msg.init,com.quizzpot.tutorial.Msg);
