function openSecurityTipsPage() {

	Ext.MessageBox.confirm(getword('Confirm'), getword('confirm_into_icbc_global_security'), function(btn) {
				if (btn == 'yes') {
					window.open(getword("icbc_global_security_url"));
				}
			});
}

function getBdHeight() {
	var miniHeight = 525;
	var height = getMainHeight();
	var lan = readCookie('language');
	var textSize = readCookie('textsize');

	if (textSize == '') {
		height = height < miniHeight + 46 ? miniHeight + 46 : height;
	} else if (textSize == 'large') {
		if (lan == 'en') {
			// alert(height < miniHeight + 72 ? miniHeight + 72 : height);
			height = height < miniHeight + 72 ? miniHeight + 72 : height;
		} else {
			height = height < miniHeight + 52 ? miniHeight + 52 : height;
		}
	} else if (textSize == 'extralarge') {
		if (lan == 'en') {
			// alert(height < miniHeight + 120 ? miniHeight + 120 : height);
			height = height < miniHeight + 120 ? miniHeight + 120 : height;
		} else {
			height = height < miniHeight + 58 ? miniHeight + 58 : height;
		}
	}
	// alert( height + "+20" );
	return height + 20;
}

function showMainPanel() {

	var mainpanel = new Ext.Panel({
		// height : getMainHeight(),
		height : getBdHeight(),
		// autoHeight : true,
		layout : 'border',
		border : false,
		items : [{
			xtype : 'panel',
			width : 160,
			region : 'west',
			id : 'westPanel',
			border : false,
			items : [{
				xtype : 'panel',
				// height : 164,
				height : 200,
				style : {
					// 外框和下一个区域的距离
					'padding-bottom' : '4px'
				},
				items : [{
							xtype : 'panel',
							height : 30,
							width : 158,
							title : getword('net_bank'),
							border : false,
							// 内框的填充距离
							style : {
								'padding' : '5px'
							}
						}, {
							xtype : 'panel',
							height : 80,
							border : false,
							layout : 'absolute',
							// 内框的填充距离
							style : {
								'padding' : '5px'
							},
							items : [{
										xtype : 'panel',
										width : 64,
										bodyStyle : 'background:transparent;',
										style : "z-index: 1; padding-left: 10px;",
										bodyBorder : false,
										x : -7,
										y : 6,
										html : '<div><img src="cms/apps/icbc_ca/images/e-man.gif" style="height: 54px;"></div>'
									}, new Ext.form.ComboBox({
												store : new Ext.data.SimpleStore({
															fields : ['url', 'display'],
															data : UBA.dropdowns['net_bank'].values
														}),
												displayField : 'display',
												mode : 'local',
												editable : false,
												triggerAction : 'all',
												emptyClass : 'text-align-right',
												emptyText : getword('net_bank_sign_in'),
												selectOnFocus : true,
												width : 140,
												x : 4,
												y : 23,
												listeners : {
													"select" : function(combo, record, index) {
														window.location.replace(record.get("url"));
														// window.open(record.get("url"));

													}
												}
											})]
						}, {
							xtype : 'panel',
							height : 43,
							width : 158,
							border : false,
							// 内框的填充距离
							style : {
								'padding' : '5px'
							},
							html : "<a href=\"javascript:void(0);\" onclick=\"openSecurityTipsPage()\"><img width=\"150\" height=\"25\" border=\"0\" src=\"cms/apps/icbc_ca/images/aqts_"
									+ language + ".png\"></a>"
						}, {
							xtype : 'panel',
							border : false,
							style : {
								'margin' : '0px',
								'padding-top' : '0px',
								'padding-left' : '10px'
							},
							html : getword('net_bank_tips') + "&nbsp;&nbsp;&nbsp;" + getword('faq')
							// html : getword('faq')
					}]
			}, {
				xtype : 'panel',
				style : {
					// 外框和下一个区域的距离
					'padding-bottom' : '4px'
				},
				items : [{
							xtype : 'panel',
							height : 30,
							width : 158,
							title : getword('tel_bank'),
							border : false,
							// 内框的填充距离
							style : {
								'padding' : '5px'
							}
						}, {
							xtype : 'panel',
							height : 80,
							border : false,
							layout : 'absolute',
							// 内框的填充距离
							style : {
								'padding' : '5px'
							},
							items : [{
										xtype : 'panel',
										width : 158,
										bodyBorder : false,
										x : 8,
										y : 0,
										html : '<div><img src="cms/apps/icbc_ca/images/phone_bank.jpg" style="height: 64px;"></div>'
									}]
						}]
			}, {
				xtype : 'panel',
				// 外框和下一个区域的距离
				style : {
					'padding-bottom' : '4px'
				},
				items : [{
							height : 20,
							width : 158,
							xtype : 'panel',
							title : getword('find_us'),
							border : false,
							layout : 'absolute',
							// 内框的填充距离
							style : {
								'padding' : '5px'
							}
						}, {
							height : 70,
							xtype : 'panel',
							border : false,
							layout : 'absolute',
							// 内框的填充距离
							style : {
								'padding' : '5px'
							},
							items : [new Ext.form.ComboBox({
										store : new Ext.data.SimpleStore({
													fields : ['geoCodeAddr', 'display'],
													data : UBA.dropdowns['banches'].values
												}),
										displayField : 'display',
										mode : 'local',
										editable : false,
										triggerAction : 'all',
										emptyText : getword('select_banches'),
										selectOnFocus : true,
										width : 148,
										x : 0,
										y : 15,

										listeners : {
											"select" : function(combo, record, index) {
												var addr = record.get("geoCodeAddr");
												var display = record.get("display");
												var p = display.lastIndexOf(";");
												if (p > 0) {
													display = display.substring(p + 1);
													combo.setRawValue(display);
												}
												location.href = encodeURI(location.protocol + '//' + location.host + location.pathname + '?screen=menu5.sub6.ssub1&addr=' + addr
														+ '&display=' + display);
											}
										}
									})]
						}]
			}, {
				xtype : 'panel',
				// 外框和下一个区域的距离
				style : {
					'padding-bottom' : '4px'
				},
				items : [{
							xtype : 'panel',
							width : 158,
							height : 30,
							title : getword('contact_us'),
							border : false,
							// 内框的填充距离
							style : {
								'padding' : '5px'
							}
						}, {
							xtype : 'panel',
							height : 116,
							border : false,
							// 内框的填充距离
							style : {
								'padding' : '5px'
							},
							items : [{
										xtype : 'panel',
										border : false,
										html : getword('contact_us_msg')
									}]
						}]
			}]
		}, {
			xtype : 'panel',
			style : {
				'padding-left' : '4px'
			},
			region : 'center',
			border : false,
			layout : 'border',
			items : [{
						xtype : 'panel',
						style : {
							'padding-bottom' : '4px'
						},
						region : 'north',
						height : 164,
						contentEl : 'simple-example',
						listeners : {
							"render" : function(p) {
								Ext.get("simple-example").setVisible(true);
								var carousel1 = new Ext.ux.Carousel('simple-example', {
											id : "carousel1",
											itemSelector : 'a',
											interval : 30,
											transitionDuration : 2,
											autoPlay : true,
											showPlayButton : true,
											pauseOnNavigate : true,
											freezeOnHover : true,
											transitionType : 'r_fade',
											navigationOnHover : true,
											hideNavigation : true,
											navigation2Top : 143,
											navigation2Left : 709
										});
							}
						}
					}, {
						xtype : 'panel',
						style : {
							'padding-bottom' : '0px'
						},
						border : true,
						region : 'center',
						items : [new Ext.Panel({
											id : 'news-center-panel-head',
											title : '<span style=\'line-height:19px\'>' + getword('news_center') + '</span>',
											height : 30,
											style : {
												'padding' : '0px'
											},
											border : false
										}), new Ext.Panel({
											style : {
												'padding' : '0px'
											},
											border : false,
											items : getContentListPanel({
														fields : '["path"]',
														query : '/firstcenter_' + language,
														target : '_self',
														pageSize : 5,
														showAll : true
													})
										})]
					}, {
						xtype : 'panel',
						style : {
							'padding-left' : '4px'
						},
						region : 'east',
						border : false,
						width : 220,
						items : [{
									xtype : 'panel',
									items : [{
												id : 'special-info-panel-head',
												xtype : 'panel',
												height : 30,
												title : '<span style=\'line-height:19px\'>' + getword('special_alert') + '</span>',
												style : {
													'padding' : '0px'
												},
												border : false
											}, {
												xtype : 'panel',
												border : false,
												height : 170,
												items : getSpecialAlertPanel({
															fields : '["path"]',
															query : '/specialalert_' + language,
															target : '_self',
															pageSize : 5,
															showAll : true
														})
											}],
									style : {
										'padding-bottom' : '4px'
									},
									border : true
								}, {
									xtype : 'panel',
									style : {
										'padding-bottom' : '4px'
									},
									region : 'north',
									height : 150,
									contentEl : 'right_buttom_adv',
									listeners : {
										"render" : function(p) {
											Ext.get("right_buttom_adv").setVisible(true);
											var carousel1 = new Ext.ux.Carousel('right_buttom_adv', {
														id : "carousel_right_buttom_adv",
														itemSelector : 'a',
														interval : 6,
														transitionDuration : 2,
														autoPlay : true,
														showPlayButton : true,
														pauseOnNavigate : true,
														freezeOnHover : true,
														transitionType : 'r_fade',
														navigationOnHover : true,
														hideNavigation : true,
														navigation2Top : 130,
														navigation2Left : 120
													});
										}
									}
								}]
					}]
		}]
	}).render('bd');

	if (UBA.config.showVisitAlert.present_value && UBA.config.showVisitAlert.present_value == 'true') {
		showVisitAlert();
	}
}

function showVisitAlert() {

	// 逻辑：首页提示信息带发布时间，如果系统开放了首页提示功能，如果浏览器没有发布时间，或者保存时间和当前时间不一致（有新提示发布），或者没有选择不提示首页提示，都显示首页提示信息。。。
	var lastVisitTime = readCookie('lastVisitTime');
	var dontShowThisAlertAgain = readCookie('dontShowThisAlertAgain');

	if (lastVisitTime == null || lastVisitTime == '' || lastVisitTime != getword('first_visit_alert_time') || dontShowThisAlertAgain != 'true') {

		var win = new Ext.Window({
					width : 960,
					height : 240,
//					title : '<span style="font-size:14px">&nbsp;' + getword('alert') + '</span>',
					title : '',
					plain : false,
					modal : true,
					maximizable : false,
					minimizable : false,
					resizable : false,
					items : [{
								xtype : 'panel',
								width : 950,
								height : 170,
								border : false,
								items : [{
											xtype : 'panel',
											width : 950,
											height : 150,
											border : false,
											// baseCls:'x-plain',
											html : getword('first_visit_alert_content')
										}, {
											xtype : 'panel',
											width : 950,
											height : 20,
											border : false,
											// baseCls:'x-plain',
											style : {
												'padding-left' : '10px'
											},
											items : [{
														xtype : 'checkbox',
														id : 'noalert',
														boxLabel : '<span style="font-size:14px">&nbsp;' + getword('no_alert_next_time') + '</span>'
													}]
										}]
							}],
					buttons : [{
								text : getword('close'),
								listeners : {
									click : function() {
										win.close();
									}
								}
							}],
					listeners : {
						close : function() {
							var com = Ext.getCmp('noalert');
							if (com.getValue()) {
								var date = new Date();
								var expireDays = 60;
								var thishost = top.location.hostname;
								date.setTime(date.getTime() + expireDays * 24 * 3600 * 1000);
								document.cookie = 'dontShowThisAlertAgain=true;expires=' + date.toGMTString() + ';domain=' + thishost;
								document.cookie = 'lastVisitTime=' + getword('first_visit_alert_time') + ';expires=' + date.toGMTString() + ';domain=' + thishost;
							}
						}
					}

				});
		win.show();
	}
}
