function CMenu( sName, sTarget, bAdminView ) { this.sName = sName; this.aMenu = new Array(); this.sBuffer = ""; this.sTarget = sTarget; this.iFrequence = 0; this.iMaxDepth = 2; this.aImages = new Array(); this.bAdminView = bAdminView; this.sMainMenu = "MAIN MENU"; this.RotateSubMenu = function( aMenu, iId ) { for( var i=0; i'; if( this.bAdminView ) { sObject += '' + '' + '
' + '' + '' + '' + '
' ''; } if( iContentId == -1 ) { //sObject += '' + // ''; if( bSelected != 1 ) { sObject += ''; } else { sObject += ''; } sObject += sTitle + ''; sObject += '' + '' + '' + '' + '' + ''; this.iFrequence++; return sObject; } this.BuildSubMenu = function( aMenu, iDepth ) { for( var i=0; i 0 ) { if( iOpened == 1 ) { this.BuildSubMenu( aMenu[i]['submenu'], iDepth+1 ); } } } } this.BuildMenu = function() { this.PreloadImages(); this.iFrequence = 0; this.sBuffer = ""; if( this.bAdminView ) { this.sBuffer += '' + '
' + '' + '' + '' + '' + '' + '
' + '' + '' + '' + '' + '' + this.sMainMenu + '' + '
' + '
'; } this.BuildSubMenu( this.aMenu, /* depth */ 0 ); // login if( this.bAdminView ) { this.sBuffer += ''; } else { this.sBuffer += '
'; } this.sBuffer += this.GetDepthDesign( 3, -1, "Login", 1, "login", -1 ); this.sBuffer += '
'; } this.PreloadImages = function() { this.aImages = new Array(); for( var i=0; i<=2; i++ ) { this.aImages[i] = new Array(); for( var j=0; j<=this.iMaxDepth+1; j++ ) { this.aImages[i][j] = new Image(); var k; switch( j ) { case 0: k = 1; break; case 1: k = 3; break; case 2: k = 2; break; case 3: k = 4; break; } this.aImages[i][j].src = "templates/default/images/menu/" + k + "_" + (i+1) + ".gif"; } } } this.DrawDesign = function() { for( var i=0; i < this.iFrequence; i++ ) { for( var j=0; j <= this.iMaxDepth+1; j++ ) { var pTarget = document.getElementById('Menu_pImage_' + i + '_' + j); if( pTarget != null ) { if( this.aImages.length > i && this.aImages[i].length > j ) { document.getElementById('Menu_pImage_' + i + '_' + j).style.background = "url(\"" + this.aImages[i][j].src + "\")"; } else { var iIndexFreq = this.aImages.length -1; var iIndexDepth = this.aImages[iIndexFreq].length -1; document.getElementById('Menu_pImage_' + i + '_' + j).style.background = "url(" + this.aImages[iIndexFreq][j].src + ")"; } } } } } this.DrawMenu = function() { var pTarget = document.getElementById( this.sTarget ); pTarget.innerHTML = this.sBuffer; this.DrawDesign(); } }