/*	Andr\u00E9 Mar\u00E9chal web site*/dfc.app = function() {	// start of the custom web application	window.app = new App();}var app = null;App = function() {	this.sWebDbName	= window.sWebDbName;		// handles to the frames	this.frNaviTop		= frames.frNavigationTop;	this.frNaviLeft	= frames.frNavigationLeft;	this.frContent		= frames.frContent;		// user login	this.sAnonymous	= 'Anonymous';	this.sLoginUsername	= window.sStartupUserName;				// navigation	this.aNaviLeft		= new Array();	this.hNaviTop		= null;	this.hNaviLeft		= null;	// configuration for left navigator	this._hConfigTop	= null;	this._hConfigMain	= null;	this._hConfigSub	= null;	this.createLeftNavigator();	this.createTopNavigator();		// activate homepage in navigation tree	//aNavi.show();	//this.hNaviLeft.select('HOME', true);}App.prototype.createLeftNavigator = function() {	// define configurations	this._hConfigTop =		{			showExpanded:				true,			expandOnDown:				false,			selectOnDown:				false,			selectOnEnterKey:			false,			autoCollapseSiblings:		false,			collapseOnDown:			false,			keyAccess:				false,			childOffsetX:				'21px',						cssLabelContainer:			'top-cont',			cssLabel:					'top-label',			dummy: null					};		this._hConfigMain =		{			showExpanded:				false,			expandOnDown:				true,			selectOnDown:				true,			selectOnEnterKey:			true,			autoCollapseSiblings:		true,			collapseOnDown:			false,			keyAccess:				true,			childOffsetX:				'0px',						cssLabelContainer:					'main-cont',			cssLabelContainerSelected:			'main-cont-expanded',			cssLabelContainerSelectedCollapsed:	'main-cont',			cssLabelContainerExpanded:			'main-cont-expanded',			cssLabelContainerExpandedOver:		'main-cont-expanded',			cssLabel:							'main-label',			cssLabelSelected:					'main-label-selected',									cssChildContainer:					'main-child-cont',			dummy: null					};		this._hConfigSub =		{			showExpanded:				false,			expandOnDown:				true,			selectOnDown:				true,			selectOnEnterKey:			true,			autoCollapseSiblings:		true,			keyAccess:				true,									cssLabelContainer:			'sub-cont',			cssLabelContainerSelected:	'sub-cont-selected',			cssLabel:					'sub-label',						dummy: null					};			// add nodes - they are defined in page jspgNavigaton	this.createNavigationNodes();}App.prototype.onSelectLeftNavigator = function(hTreeNode) {	// callback when users selects an entry in the left navigation		var hData = hTreeNode.getData();		switch (hData.sCMD) {	case 'OpenContent':		if (hData.page) {			this.frContent.location.href = this.sWebDbName + 'vwhContent/' + hData.page		} else {			alert('error: url for "OpenContent" is not defined');		}		break;	case 'OpenAppUrl':			if (hData.url) {			this.frContent.location.href = this.sWebDbName + hData.url		} else {			alert('error: url for "OpenAppUrl" is not defined');		}		break;	}}App.prototype.createTopNavigator = function() {	var hDoc		= this.frNaviTop.document;		// create navigator container	var domParent	= hDoc.createElement('div');	domParent.className	= 'navi-top-container';		hDoc.body.appendChild(domParent);	// define horizontal tabbar	var hHBar = this.hNaviTop = new DFCHBar();		var hBtnConfig = 			{				alignVertical:		true,				showIcon:			false,				showLabel:		true,				selectOnDown:		true,				noDeselect:		true,				keyAccess:		true,								cssButtonEnabled:		'button-enabled',				cssButtonOver:			'button-over',				cssButtonOverSelected:	'button-over-selected',				cssButtonDown:			'button-down',				cssButtonSelected:		'button-selected',						cssLabelEnabled:		'button-label',				cssLabelDown:			'button-label-down',				cssLabelSelected:		'button-label-selected',									dummy:null			}	// construct horizontal tabbar	var sNaviId	= null;	var hBtn		= null;	var hVDiv		= null;	var cssVDiv	= 'vertical-divider';		sNaviId	= 'New';	this.aNaviLeft[sNaviId].create();	hBtn = new DFCButton('Nouveaut\u00E9s',		{sCMD: 'SelectNaviLeft', sId : sNaviId});	hBtn.createConfiguration(hBtnConfig);	hHBar.add(hBtn);		hVDiv	= new DFCStatic(cssVDiv);	hHBar.add(hVDiv);	sNaviId	= 'Products';	this.aNaviLeft[sNaviId].create();	hBtn = new DFCButton('Produits',		{sCMD: 'SelectNaviLeft', sId : sNaviId});	hBtn.createConfiguration(hBtnConfig);	hHBar.add(hBtn);	hVDiv	= new DFCStatic(cssVDiv);	hHBar.add(hVDiv);	sNaviId	= 'History';	this.aNaviLeft[sNaviId].create();	hBtn = new DFCButton('Historique',	{sCMD: 'SelectNaviLeft', sId : sNaviId});	hBtn.createConfiguration(hBtnConfig);	hHBar.add(hBtn);		hVDiv	= new DFCStatic(cssVDiv);	hHBar.add(hVDiv);	sNaviId	= 'SAV';	this.aNaviLeft[sNaviId].create();	hBtn = new DFCButton('SAV',			{sCMD: 'SAV', sId : sNaviId});	hBtn.createConfiguration(hBtnConfig);	hHBar.add(hBtn);		hVDiv	= new DFCStatic(cssVDiv);	hHBar.add(hVDiv);	sNaviId	= 'Contact';	this.aNaviLeft[sNaviId].create();	hBtn = new DFCButton('Contact',	{sCMD: 'SelectNaviLeft', sId : sNaviId});	hBtn.createConfiguration(hBtnConfig);	hHBar.add(hBtn);	// create horizontal tabbar	hHBar.create(this.frNaviTop, domParent);	hHBar.addEventListener('onBeforeChange',	this.onBeforeChangeTopNavigator, this);	hHBar.addEventListener('onChange',			this.onChangeTopNavigator, this);}App.prototype.onBeforeChangeTopNavigator = function(hButton) {	// callback before a user select an entry in the top navigation		var hData = hButton.getData();		// check if user has enabled cookies	if (hData.sCMD == 'SAV') {		if (navigator.cookieEnabled == false) {					// prevent selecting the SAV tab			hButton.setStatus('onBeforeCommand', false);			// load cookies warning page			this.frContent.location.href = this.sWebDbName + 'pgCookiesWarning?OpenPage';		}	}}App.prototype.onChangeTopNavigator = function(hButton) {	// callback when users select an entry in the top navigation		var hData = hButton.getData();		switch (hData.sCMD) {		case 'SelectNaviLeft':		this.selectLeftNavi(hData.sId);		break;			case 'SAV':		this.userLogin();		this.selectLeftNavi(hData.sId);	}}App.prototype.selectLeftNavi = function(sNaviId) {	// hide last selected navigator	if (this.hNaviLeft) {		this.hNaviLeft.collapseAll();		this.hNaviLeft.getDOMParent().style.visibility	= 'hidden';	}	// show/select/expand new left navigator	var hNavi		= this.hNaviLeft = this.aNaviLeft[sNaviId];		hNavi.getDOMParent().style.visibility = 'inherit';	hNavi.select(sNaviId, true);	hNavi.expand(sNaviId, true);}App.prototype.userLogin = function() {	if (this.sLoginUsername == this.sAnonymous) {		// user is not logged in		this.frContent.location.href = this.sWebDbName + 'fmUserAuthenticated?OpenForm&login';	}}