/*
 * 導覽列點選事件
 * @author 何建德
 * @date 2008/08/11
 * 
 * @string url 載入的網頁路徑
 * @bool check 載入前是否確認身分
 */

function toNaviPage(url, check) {
	if(url != "") {
		var updateContent = new Ext.UpdateManager('body_content');
		if(check) {
			Ext.Ajax.request({
    			url: "modules/user/userDataQuery.aspx?fn=userIsOnLine",
    			params: {action:'ajax_request'},
    			method: 'POST',
				success: function(response) {
					var respArray = Ext.decode(response.responseText);
					if(respArray.success == "false") {
						Ext.MessageBox.show({
							title:'訊息',
							msg:respArray.msg,
							buttons: Ext.MessageBox.OK,
							fn: function(e) {
								if(e == "ok")
									location.href = "default.aspx";
							},
							animEl: 'errorMsg'
						});	
					}
					else {
						updateContent.update({
							url: url,
							params: {action:'ajax_request'},
							method: 'POST',
							text: '載入中...',
							nocache: true,
							scripts: true	
						});
					}
				},
            	failure: function(response) {}
			});
		}
		else {
			updateContent.update({
				url: url,
				params: {action:'ajax_request'},
				method: 'POST',
				text: '載入中...',
				nocache: true,
				scripts: true	
			});
		}
	}
}