/* $Id: initialize.js 572 2008-07-23 08:34:41Z lukejee $  */
Ext.MessageBox.buttonText.yes = LANG_yes;
Ext.MessageBox.buttonText.no = LANG_no;
Ext.MessageBox.buttonText.ok = LANG_ok;
Ext.MessageBox.buttonText.cancel = LANG_cancel;

if (Ext.form.TextField) {
	Ext.apply(Ext.form.TextField.prototype, {
		minLengthText : LANG_min_length_text,
		maxLengthText : LANG_max_length_text,
		blankText     : LANG_blank_text,
		regexText     : "",
		emptyText     : null
	});
}

Date.monthNames = [
	LANG_month_1,
	LANG_month_2,
	LANG_month_3,
	LANG_month_4,
	LANG_month_5,
	LANG_month_6,
	LANG_month_7,
	LANG_month_8,
	LANG_month_9,
	LANG_month_10,
	LANG_month_11,
	LANG_month_12
];

Date.dayNames = [
	LANG_day_7,
	LANG_day_1,
	LANG_day_2,
	LANG_day_3,
	LANG_day_4,
	LANG_day_5,
	LANG_day_6
];

if (Ext.DatePicker) {
	Ext.apply(Ext.DatePicker.prototype, {
		todayText: LANG_today,
		minText: LANG_date_min_text,
		maxText: LANG_date_max_text,
		disabledDaysText  : "",
		disabledDatesText : "",
      	monthNames        : Date.monthNames,
	    dayNames          : Date.dayNames,
		nextText          : LANG_date_next_text,
		prevText          : LANG_date_prev_text,
		monthYearText     : LANG_month_year_text,
		todayTip          : LANG_date_today_tip,
		format            : LANG_date_format_text,
		okText            : LANG_ok,
		cancelText        : LANG_cancel
	});
}

Ext.form.VTypes['domainnameVal'] = /^([\w-]+\.){1,5}([A-Za-z]){2,4}$/;
Ext.form.VTypes["domainname"]=function(v){
	return Ext.form.VTypes["domainnameVal"].test(v);
};
Ext.form.VTypes["domainnameText"]=LANG_not_valid_domain_name;

Ext.form.VTypes["ipVal"] = /^([1-9][0-9]{0,1}|1[013-9][0-9]|12[0-689]|2[01][0-9]|22[0-3])([.]([1-9]{0,1}[0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])){2}[.]([1-9][0-9]{0,1}|1[0-9]{2}|2[0-4][0-9]|25[0-4])$/;
Ext.form.VTypes["netmaskVal"] = /^(128|192|224|24[08]|25[245].0.0.0)|(255.(0|128|192|224|24[08]|25[245]).0.0)|(255.255.(0|128|192|224|24[08]|25[245]).0)|(255.255.255.(0|128|192|224|24[08]|252))$/;
Ext.form.VTypes["ip"]=function(v){
	return Ext.form.VTypes["ipVal"].test(v);
};
Ext.form.VTypes["ipText"]=LANG_ip_text;
Ext.form.VTypes["netmask"]=function(v){
	return Ext.form.VTypes["netmaskVal"].test(v);
};
Ext.form.VTypes["netmaskText"]="128.0.0.0 - 255.255.255.252";

Ext.namespace('NGMP');
Ext.namespace('NGMP.form');
Ext.namespace('NGMP.plugins');
Ext.namespace('NGMP.grid');
Ext.namespace('NGMP.panel');                                                               
Ext.namespace('NGMP.data');
Ext.namespace('NGMP.state');
Ext.namespace('NGMP.dialog');
Ext.namespace('NGMP.security');
Ext.namespace('NGMP.security.digest');
Ext.namespace('NGMP.preferences');
Ext.namespace('NGMP.addressbook');
Ext.namespace('NGMP.utils');

NGMP.plugins.LogoComponent = Ext.extend(Ext.BoxComponent, {
	onRender: function(B,A) {
		this.el = B.createChild({
			tag:'div',
			cls:'ngmp-app-logo'
		});
	}
});
Ext.QuickTips.init();

NGMP.preferences.settings = {
	date_format:'Y-m-d',
	datetime_format:'Y-m-d H:i',
	time_format:'H:i',
	rpp:25
};

if (Ext.form.BasicForm) {
	Ext.form.BasicForm.prototype.waitTitle = LANG_please_wait+'...';
}

