/****************************************************************************************
SMI (Services Maintenance Interventions) est une gestion libre de maintenance et de SAV

Version 0.9.7

Copyright (C) 2006-2007  Sylvain FATOME
This program is free software; you can redistribute it and/or modify it under the terms
of the GNU General Public License as published by the Free Software Foundation; 
either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program
(in the directory docs); 
if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 
Boston, MA  02110-1301, USA.

Contact : galawa@free.fr

Web : http://smitst.homelinux.com
****************************************************************************************/

/*** 
This is the menu creation code - place it right after you body tag
Feel free to add this to a stand-alone js file and link it to your page.
**/

//Extra code to find position:
function findPos(){
  if(bw.ns4){   //Netscape 4
    x = document.layers.layerMenu.pageX
    y = document.layers.layerMenu.pageY
  }else{ //other browsers
    x=0; y=0; var el,temp
    el = bw.ie4?document.all["divMenu"]:document.getElementById("divMenu");
    if(el.offsetParent){
      temp = el
      while(temp.offsetParent){ //Looping parent elements to get the offset of them as well
        temp=temp.offsetParent; 
        x+=temp.offsetLeft
        y+=temp.offsetTop;
      }
    }
    x+=el.offsetLeft
    y+=el.offsetTop
  }
  //Returning the x and y as an array
  return [x,y]
}

// Foncion pour retrouver le chemin racine
function chemin_racine()
{
	var chemin='';
	var chemin_rel=window.location.pathname;
	
	chemin_rel=chemin_rel.substr(1,chemin_rel.length-1);

	var tab_chemin=chemin_rel.split('/');
	var port=window.location.port;
	
	if (port)
		chemin=window.location.protocol+':'+port+'//'+window.location.host;
	else
		chemin=window.location.protocol+'//'+window.location.host;
		
	for  (i=0; i<tab_chemin.length-2; i++)
	{
		chemin+='/'+tab_chemin[i];
	}
		
	return chemin;
}


pos = findPos()
chemin= chemin_racine()

//Menu object creation
oCMenu=new makeCM("oCMenu") //Making the menu object. Argument: menuname

oCMenu.frames = 0

//Menu properties   
oCMenu.pxBetween=3
//oCMenu.fromLeft=20 
// oCMenu.fromTop=0   
//Using the cm_page object to place the menu ----
oCMenu.fromLeft=pos[0]
oCMenu.fromTop=pos[1]
//We also need to "re place" the menu on resize. So:
oCMenu.onresize="pos = findPos(); oCMenu.fromLeft=pos[0]; oCMenu.fromTop=pos[1]"
oCMenu.rows=1 
oCMenu.menuPlacement="left"
                                                             
oCMenu.offlineRoot="" 
oCMenu.onlineRoot="" 
oCMenu.resizeCheck=1 
oCMenu.wait=1000
oCMenu.fillImg="cm_fill.gif"
oCMenu.zIndex=0

//Background bar properties
oCMenu.useBar=1
oCMenu.barWidth="100%"
oCMenu.barHeight=20
oCMenu.barClass="clBar"
oCMenu.barX=0 
oCMenu.barY=pos[1]
oCMenu.barBorderX=0
oCMenu.barBorderY=0
oCMenu.barBorderClass=""

//Level properties - ALL properties have to be spesified in level 0
oCMenu.level[0]=new cm_makeLevel() //Add this for each new level
oCMenu.level[0].width=115
oCMenu.level[0].height=18 
oCMenu.level[0].regClass="clLevel0"
oCMenu.level[0].overClass="clLevel0over"
oCMenu.level[0].borderX=0
oCMenu.level[0].borderY=0
oCMenu.level[0].borderClass="clLevel0border"
oCMenu.level[0].offsetX=0
oCMenu.level[0].offsetY=0
oCMenu.level[0].rows=0
oCMenu.level[0].arrow=0
oCMenu.level[0].arrowWidth=0
oCMenu.level[0].arrowHeight=0
oCMenu.level[0].align="bottom"

//EXAMPLE SUB LEVEL[1] PROPERTIES - You have to specify the properties you want different from LEVEL[0] - If you want all items to look the same just remove this
oCMenu.level[1]=new cm_makeLevel() //Add this for each new level (adding one to the number)
oCMenu.level[1].width=oCMenu.level[0].width-2
oCMenu.level[1].height=18
oCMenu.level[1].regClass="clLevel1"
oCMenu.level[1].overClass="clLevel1over"
oCMenu.level[1].borderX=1
oCMenu.level[1].borderY=1
oCMenu.level[1].arrow=chemin+"/img/flmenu.gif"
oCMenu.level[1].arrowWidth=6
oCMenu.level[1].arrowHeight=12
oCMenu.level[1].align="right" 
// oCMenu.level[1].offsetX=-(oCMenu.level[0].width-2)/2+20
oCMenu.level[1].offsetX=-5
oCMenu.level[1].offsetY=2
oCMenu.level[1].borderClass="clLevel1border"


//EXAMPLE SUB LEVEL[2] PROPERTIES - You have to spesify the properties you want different from LEVEL[1] OR LEVEL[0] - If you want all items to look the same just remove this
oCMenu.level[2]=new cm_makeLevel() //Add this for each new level (adding one to the number)
oCMenu.level[2].width=125
oCMenu.level[2].height=18
oCMenu.level[2].offsetX=0
oCMenu.level[2].offsetY=0
oCMenu.level[2].regClass="clLevel2"
oCMenu.level[2].overClass="clLevel2over"
oCMenu.level[2].borderClass="clLevel2border"
oCMenu.level[2].arrow=chemin+"/img/flmenu.gif"
oCMenu.level[2].arrowWidth=6
oCMenu.level[2].arrowHeight=12

/******************************************
Menu item creation:
myCoolMenu.makeMenu(name, parent_name, text, link, target, width, height, regImage, overImage, regClass, overClass , align, rows, nolink, onclick, onmouseover, onmouseout) 
*************************************/
oCMenu.makeMenu('top0','','&nbsp;Administration','','')
	oCMenu.makeMenu('subt001','top0','Centre d\'appels','')
		oCMenu.makeMenu('subt0010','subt001','Opérateurs','ope_lst.php','')
		oCMenu.makeMenu('subt0011','subt001','Emailing','email_maj.php?td=ope','')
		oCMenu.makeMenu('subt0012','subt001','Statistiques','ope_stat.php','')
	oCMenu.makeMenu('subt002','top0','Centre de Gestion','')
		oCMenu.makeMenu('subt0020','subt002','Coordonnées','cge_maj.php','')
		oCMenu.makeMenu('subt0021','subt002','Logo','logo_maj.php?td=cge','')
	oCMenu.makeMenu('subt003','top0','Demandes','')
		oCMenu.makeMenu('subt0030','subt003','Cat. Expéditeurs','ddec_lst.php','')
		oCMenu.makeMenu('subt0031','subt003','Destinataires Demandes','dded_lst.php','')
		oCMenu.makeMenu('subt0032','subt003','Types Demandes','ddet_lst.php','')
	oCMenu.makeMenu('subt004','top0','Humains','')
		oCMenu.makeMenu('subt0040','subt004','Civilités','civ_lst.php','')
		oCMenu.makeMenu('subt0041','subt004','Fonctions','fonc_lst.php','')
	oCMenu.makeMenu('subt005','top0','Interventions','')
		oCMenu.makeMenu('subt0050','subt005','Lieux','')
			oCMenu.makeMenu('subt00500','subt0050','Gestion','lieu_lst.php','')
			oCMenu.makeMenu('subt00501','subt0050','Icônes','icolieu_lst.php','')
		oCMenu.makeMenu('subt0051','subt005','Origines','orig_lst.php','')
		oCMenu.makeMenu('subt0052','subt005','Règlements','reg_lst.php','')
		oCMenu.makeMenu('subt0053','subt005','Statuts','')
			oCMenu.makeMenu('subt00530','subt0053','Gestion','statut_lst.php','')
			oCMenu.makeMenu('subt00531','subt0053','Icônes','icosta_lst.php','')
	oCMenu.makeMenu('subt006','top0','Préavis & Num.','num_maj.php')
	oCMenu.makeMenu('subt007','top0','Textes Types','txt_lst.php')
	oCMenu.makeMenu('subt008','top0','Mots de Passes','')
		oCMenu.makeMenu('subt0080','subt008','Agences','mdp_maj.php?cat=age','')
		oCMenu.makeMenu('subt0081','subt008','Centre de Gestion','mdp_maj.php?cat=siege','')
		oCMenu.makeMenu('subt0082','subt008','Clients','mdp_maj.php?cat=cli','')
		oCMenu.makeMenu('subt0083','subt008','Opérateurs','mdp_maj.php?cat=ope','')
		oCMenu.makeMenu('subt0084','subt008','Techniciens','mdp_maj.php?cat=tec','')
	oCMenu.makeMenu('subt009','top0','Fichiers Internes','fic_down.php')
	oCMenu.makeMenu('subt010','top0','Logs','')
		oCMenu.makeMenu('subt0100','subt010','Connexions','log_lst.php?ord=DES&tri=Date','')
		oCMenu.makeMenu('subt0101','subt010','Téléchargements','flog_lst.php?ord=DES&tri=Date','')

	oCMenu.makeMenu('subt011','top0','Données','')
		oCMenu.makeMenu('subt0111','subt011','Exportations','')
			oCMenu.makeMenu('subt01110','subt0111','Articles','exp_data.php?td=art','')
			oCMenu.makeMenu('subt01111','subt0111','Clients','exp_data.php?td=cli','')
			oCMenu.makeMenu('subt01112','subt0111','Logs','export.php?td=logs','')
		oCMenu.makeMenu('subt0112','subt011','Importations','')
			oCMenu.makeMenu('subt01120','subt0112','Articles','imp_data.php?td=art','')
			oCMenu.makeMenu('subt01121','subt0112','Catégories Matériels','imp_data.php?td=catm','')
			oCMenu.makeMenu('subt01122','subt0112','Clients','imp_data.php?td=cli','')
			oCMenu.makeMenu('subt01123','subt0112','Constructeurs/Editeurs','imp_data.php?td=mque','')
			oCMenu.makeMenu('subt01124','subt0112','Départements/Etats','imp_data.php?td=dep','')
			oCMenu.makeMenu('subt01125','subt0112','Pays','imp_data.php?td=pays','')
			oCMenu.makeMenu('subt01126','subt0112','Types licences','imp_data.php?td=tl','')
			oCMenu.makeMenu('subt01127','subt0112','Villes','imp_data.php?td=villes','')
		oCMenu.makeMenu('subt0113','subt011','Maintenance','')
			oCMenu.makeMenu('subt01130','subt0113','Clients','','')
				oCMenu.makeMenu('subt011301','subt01130','Types','maint_data.php?td=cli&tr=1','')
				oCMenu.makeMenu('subt011302','subt01130','Répertoires privés','maint_data.php?td=cli&tr=2','')
				oCMenu.makeMenu('subt011303','subt01130','Tout','maint_data.php?td=cli&tr=0','')
			oCMenu.makeMenu('subt01131','subt0113','Contrats clients','','')
				oCMenu.makeMenu('subt011311','subt01131','Signatures/Réceptions','maint_data.php?td=conc&tr=1','')
				oCMenu.makeMenu('subt011312','subt01131','Sites couverts','maint_data.php?td=conc&tr=2','')
				oCMenu.makeMenu('subt011313','subt01131','Clôtures','maint_data.php?td=conc&tr=3','')
				oCMenu.makeMenu('subt011314','subt01131','Quotas horaires','maint_data.php?td=conc&tr=4','')
				oCMenu.makeMenu('subt011315','subt01131','Tout','maint_data.php?td=conc&tr=0','')
			oCMenu.makeMenu('subt01132','subt0113','Interventions','','')
			
	oCMenu.makeMenu('subt012','top0','Bases MySQL','')
		oCMenu.makeMenu('subt0121','subt012','Sauvegardes','')
			oCMenu.makeMenu('subt01210','subt0121','Sans données','svg_data.php?td=1','')
			oCMenu.makeMenu('subt01211','subt0121','Avec données','svg_data.php?td=2','')
		oCMenu.makeMenu('subt0122','subt012','Maintenance','')
			oCMenu.makeMenu('subt01220','subt0122','Vérifier les tables','maint_sql.php?td=1','')
			oCMenu.makeMenu('subt01221','subt0122','Optimiser les tables','maint_sql.php?td=2','')
			oCMenu.makeMenu('subt01222','subt0122','Réparer les tables','maint_sql.php?td=3','')

	
oCMenu.makeMenu('top1','','&nbsp;Agences & Tech.','')
	oCMenu.makeMenu('subt110','top1','Catégories','acat_lst.php','')
	oCMenu.makeMenu('subt111','top1','Coordonnées','age_lst.php','')
	oCMenu.makeMenu('subt112','top1','Emailing','email_maj.php?td=age','')
	oCMenu.makeMenu('subt113','top1','Logos','logo_maj.php?td=age','')
	oCMenu.makeMenu('subt114','top1','Statistiques','age_stat.php','')
	oCMenu.makeMenu('subt115','top1','&nbsp;Techniciens','')
		oCMenu.makeMenu('subt1150','subt115','Gestion','tec_lst.php?td=1')
		oCMenu.makeMenu('subt1151','subt115','Emailing','email_maj.php?td=tec')
		oCMenu.makeMenu('subt1152','subt115','Statistiques','tec_stat.php')

oCMenu.makeMenu('top7','','&nbsp;Ss-Traitance','')
	oCMenu.makeMenu('subt770','top7','&nbsp;Donneurs Ordres','')
		oCMenu.makeMenu('subt7701','subt770','Coordonnées','do_lst.php','')
		oCMenu.makeMenu('subt7702','subt770','Emailing','email_maj.php?td=do','')
		oCMenu.makeMenu('subt7703','subt770','Logos','logo_maj.php?td=do','')
		oCMenu.makeMenu('subt7704','subt770','Statistiques','do_stat.php','')
		oCMenu.makeMenu('subt7705','subt770','&nbsp;Techniciens','')
			oCMenu.makeMenu('subt77051','subt7705','Gestion','tec_lst.php?td=2')
			oCMenu.makeMenu('subt77052','subt7705','Emailing','email_maj.php?td=tecd')
			oCMenu.makeMenu('subt77053','subt7705','Statistiques','tecd_stat.php')
	oCMenu.makeMenu('subt771','top7','&nbsp;Sous-Traitants','')
		oCMenu.makeMenu('subt7711','subt771','Coordonnées','st_lst.php','')
		oCMenu.makeMenu('subt7712','subt771','Emailing','email_maj.php?td=st','')
		oCMenu.makeMenu('subt7713','subt771','Logos','logo_maj.php?td=st','')
		oCMenu.makeMenu('subt7714','subt771','Statistiques','st_stat.php','')
		oCMenu.makeMenu('subt7715','subt771','Bons de travail','ot_lst.php?tx=m&ord=DES&tri=Code')
		oCMenu.makeMenu('subt7716','subt771','Spécialités','sp_lst.php?ord=DES&tri=Code')
		oCMenu.makeMenu('subt7717','subt771','&nbsp;Techniciens','')
			oCMenu.makeMenu('subt77171','subt7717','Gestion','tec_lst.php?td=3')
			oCMenu.makeMenu('subt77172','subt7717','Emailing','email_maj.php?td=tecs')
			oCMenu.makeMenu('subt77173','subt7717','Statistiques','tecs_stat.php')
	oCMenu.makeMenu('subt772','top7','Statistiques','')


oCMenu.makeMenu('top2','','&nbsp;Articles','')
	oCMenu.makeMenu('subt220','top2','Gestion','pdt_lst.php?ta=m')
	oCMenu.makeMenu('subt221','top2','Familles','fam_lst.php')
	oCMenu.makeMenu('subt222','top2','Historiques','pdtih_lst.php')
	oCMenu.makeMenu('subt223','top2','Statistiques','')

oCMenu.makeMenu('top3','','&nbsp;Clients','')
	oCMenu.makeMenu('subt330','top3','Gestion','cli_lst.php')
	oCMenu.makeMenu('subt331','top3','Catégories','cat_lst.php')
	oCMenu.makeMenu('subt332','top3','Emailing','email_maj.php?td=cli')
	oCMenu.makeMenu('subt333','top3','Statistiques','')

oCMenu.makeMenu('top4','','&nbsp;Interventions','')
	oCMenu.makeMenu('subt440','top4','Gestion','int_lst.php?ord=DES&tri=Code')
	oCMenu.makeMenu('subt441','top4','Statistiques','')

oCMenu.makeMenu('top5','','&nbsp;Contrats','')
	oCMenu.makeMenu('subt550','top5','Contrats Clients','')
		oCMenu.makeMenu('subt5500','subt550','Gestion','cocl_lst.php?ord=DES&tri=Code')
		oCMenu.makeMenu('subt5501','subt550','Relances','coclrel_maj.php')
		oCMenu.makeMenu('subt5502','subt550','Réceptions','coclrec_maj.php')
		oCMenu.makeMenu('subt5503','subt550','Renouvellements','coclren_lst.php?ord=DES&tri=Code')
	oCMenu.makeMenu('subt551','top5','Paramètres','')
		oCMenu.makeMenu('subt5510','subt551','Périodicités','per_lst.php','')
		oCMenu.makeMenu('subt5511','subt551','Contrats Types','co_lst.php','')
	oCMenu.makeMenu('subt552','top5','Statistiques','')

oCMenu.makeMenu('top6','','&nbsp;Relevés','')
	oCMenu.makeMenu('subt660','top6','Gestion','rel_lst.php')
	oCMenu.makeMenu('subt661','top6','Paramètres','')
		oCMenu.makeMenu('subt6610','subt661','Catégories Matériels','rpcat_lst.php','')
		oCMenu.makeMenu('subt6611','subt661','Etats Matériels','rpet_lst.php','')
		oCMenu.makeMenu('subt6612','subt661','Constructeurs/Editeurs','mque_lst.php','')
		oCMenu.makeMenu('subt6613','subt661','Types Licences','rltl_lst.php','')
		oCMenu.makeMenu('subt6614','subt661','Types Médias','rlmed_lst.php','')
		oCMenu.makeMenu('subt6615','subt661','Types accès/liens','rlptmta_lst.php','')
		oCMenu.makeMenu('subt6616','subt661','Log. télémaintenance','rlptml_lst.php','')
		oCMenu.makeMenu('subt6617','subt661','Modes mises à jour','rlpmm_lst.php','')
	oCMenu.makeMenu('subt662','top6','Statistiques','')

//Leave this line - it constructs the menu
oCMenu.construct()	;	
