var PHPKOD_IMG_ACCEPT_SMALL_SRC = ICO_PATH + 'small/accept.png';
var PHPKOD_IMG_DENY_SMALL_SRC = ICO_PATH + 'small/deny.gif';
var AX_appController = Class.create();
AX_appController.prototype = {
	
	// Conteneur des frames
	frames: null,
	// Timer pour le controller de connexion
	timer: null,
	
	options:{//set all the options here
	},
	
	initialize: function(options){
		// on lance le controlleur de frames
		this.frames = new AX_appFrameController();
		// on instancie le timer de controle de la connexion
		this.timer = new AX_connexionController();
		// On lance un évènement come quoi le programme est pret
		document.fire('dom:axloaded');

	},
	
	getFrame: function(){
		return this.frames;
	},
	
	includeScript: function(src, attributes)
		{
			try {
				attributes = attributes || {};
				attributes.type = "text/javascript";
				attributes.src = src;
		 
				var script = document.createElement("script");
				for(aName in attributes)
					script[aName] = attributes[aName];
		 
				document.body.appendChild(script);
				return true;
			} catch(e) { return false; }
			
		}
};
var AX_appFrameController = Class.create();
AX_appFrameController.prototype = {

	display:'standard',		// set actual display mode
	
	topframe: null,			// Haut du programme (widget, logo...)
	mainframe: null,		// Contenu du programme (tabs, menus etc...)
	tabframe: null,			// Menu Tabs
	tablayerframe: null,	// Contenu des tabs (layers)
	tabs: [],
	maintab: null,			// Tab en cours
	ism:null,
	
	constantes: {
		
		PATH: '',
		HTTP_LOGIN_PATH: '',
		HTTP_TPL_PATH: '',
		HTTP_PLUGIN_PATH: '',
		ICO_PATH: '',
		IDS: '',
		
	},
	
	options: {
	},
	
	initialize: function(constantes,options){
	
		this.topframe = $('MASTER_TOP');
		this.mainframe = $('MASTER_CONTENT');
		this.tabframe = $('MAIN_MENU_TOP');
		this.tablayerframe = $('MASTER_FRAMES');
		this.tabs[0] = new AX_appTabController('MASTER_FRAME_0');
		this.ism = new AX_appIsmController;
		this.maintab = this.tabs[0];
		return this;
	
	},
	
	tab: function(i){
		
		var k = i | 0;
		return this.tabs[k];
		
	},
	
	switchFs: function()
		{
			switch(this.display)
				{
					case 'standard' :	this.minimize(); break;
					case 'minimize' : 	
					default			:	this.standard(); break;
				}
		},
	
	minimize: function()
		{
			this.maintab.menu.style.display = 'none';
			this.topframe.style.display = 'none';
			this.tabframe.style.display = 'none';
			this.display = 'minimize';
		},
	
	standard: function()
		{
			this.maintab.menu.style.display = 'block';
			this.topframe.style.display = 'block';
			this.tabframe.style.display = 'block';
			this.display = 'standard';
		},

};
var AX_appTabController = Class.create();
AX_appTabController.prototype = {

	id: null,
	tab:null,
	top:null,
	menu:null,
	main:null,	
	
	options:{

	},
	
	initialize: function(id){
		this.tab = $(id);
		this.id = id;
		//alert(this.id);
		this.top = this.tab.childNodes[1];
		this.menu = this.tab.childNodes[3];
		this.main = this.tab.childNodes[5];
		this.resize();
	},
	
	// Met a jour la hauteur des layers
	resize:function(){
		
		var OffsetScreenHeight = $(document.body).getHeight();
		var topOffsetHeight = $('MASTER_TOP').getHeight();
		topOffsetHeight += $('MAIN_MENU_TOP').getHeight();
		topOffsetHeight += $('MASTER_MAIN_MENU').getHeight();
		topOffsetHeight += 44;
		var finalHeight = OffsetScreenHeight - topOffsetHeight;
		$(this.id+'_MENU').setAttribute('style','height:'+finalHeight+'px;');
		$(this.id+'_BODY').setAttribute('style','height:'+finalHeight+'px;');
		
	},
	
	switchMenu: function(int){
		
		$(this.id+'_1_0').style.display = (int == 0) ? 'block' : 'none';
		$(this.id+'_1_1').style.display = (int == 1) ? 'block' : 'none';
		
	}

};

var AX_connexionController = Class.create();
AX_connexionController.prototype = {
	
	// Le timer
	ctimer: null,
	// Le décompte de temps
	cinterval: null,
	// Le nb de sec restante avant expiration
	climit: 60,
	// Le temps de connexion avant expiration du cookie, en secondes
	cCookieTime: 1600,
	// ce qu'on enleve en période de sécurité
	cMinusCookie: 600,
	
	initialize: function(){
		var cTime = ( ( this.cCookieTime - this.cMinusCookie ) * 1000 );
		this.ctimer = setTimeout("Ax.timer.askTimeOut()", cTime);
	},
	
	askTimeOut: function(){
		MkAsk('Votre session va expirer prochainement.<br />Souhaitez-vous prolonger la session ?<br />Temps restant : <span id="timerOutExpire">60</span> s','Ax.timer.continueSession();','Ax.timer.closeSession();',false);
		this.cinterval = window.setInterval("Ax.timer.nextInterval();",1000);
	},
	
	nextInterval: function(){
		this.climit = this.climit-1;
		if(this.climit == 0)
			{
				this.resetInterval();
				this.closeSession();
			}
		else
			{
				$('timerOutExpire').innerHTML = this.climit;
			}
	},
	
	continueSession: function(){
		if(this.cinterval)
			{
				this.resetInterval();
			}
		xajax_AX_timerSession();
		C_close();
		MkProgress('Prolongation de la session en cours...');
	},
	
	closeSession: function(){
		if(this.cinterval)
			{
				this.resetInterval();
			}
		C_close();
		MkProgress('Fermeture de la session en cours...');
		window.location = '/logout.php?IDS='+apcphpkod.constantes.IDS;
	},
	
	resetInterval: function(){
		this.climit = 60;
		window.clearInterval(this.cinterval);
		this.cinterval = null;
	},
	
	timerReset: function(){
		this.initialize();
	}
	
};

var AX_appIsmController = Class.create();
AX_appIsmController.prototype = {

	// Statement
	statment: 'init',	
	// Main widget layer
	l: null,
	f: null,
	img : null,
	txt : null,
	handler: null,
	
	user : null,
	lu:[],
	
	// Liste des utilisateurs connectes
	plist: null,
	mplist:[],
	// Liste des messages
	mlist: null,
	mfrm: [],
	
	_open:false,
	
	countmsg:0,
	countu:0,
	
	options:{

	},
	
	initialize: function(){
		this.l = $('WIDGET_ISM');
		this.f = $('WIDGET_USER_ISM');
		this.handler = $('TOP_PROMPT');
		this.img = $('TOP_PROMPT_IMG');
		this.txt = $('TOP_PROMPT_MSG');
		this.plist = $('ISM_U_LIST');
		this.mlist = $('WIDGET_USER_ISM_M');
		this.statment = 'init';
		this.handler.onclick = function(){ Ax.getFrame().ism.open(); };
		this.user = apcphpkod.constantes.ADMIN_USER_ID;
		// On créé la première div dans la liste des messages, pour afficher les erreurs etc...
		var f = document.createElement('div');
		f.className = 'ISM_MFRM home';
		this.mlist.appendChild(f);
		this.mfrm[0] = f;
		
		this.disp();
		this.queryMsg();
		//alert('Ism initialized');
	},
	
	disp : function(msg){
		var _img;
		var _msg;
		switch(this.statment)
			{
				case 'init'		:	_img = 'mail_info.png'; 
									_msg = 'Veuillez patienter...'; 
									break;
				case 'refresh' 	: 	_img = 'mail_receive.png'; 
									_msg = 'Patientez...'; 
									break;
				case 'wait'		:	if(!this.countmsg)
										{
											_msg = 'Aucun message';
											_img = 'mail.png';
										}
									else
										{
											_msg = 'Vous avez '+this.countmsg+' message';
											if(this.countmsg > 1)
												_msg+='s';
											_img = 'mail_accept.png';
										}
									break;
				default			:	_img = 'mail_warning.png'; 
									_msg = 'Error'; 
									break;
			}
		this.img.src = window.apcphpkod.constantes.ICO_PATH+'small/'+_img;
		this.txt.innerHTML = _msg;
	},
	
	/*
	 * Retour de la requete Ajax
	 */
	q: function(ls, lu){
		// Un liste les utilisateurs
		this.countu = 0;
		if(lu)
			{
				lu.each(this.Uparse.bind(this))
			}
		// On remet a 0 les pages de message
		if(this.mfrm)
			{
				this.mfrm.each(function(e){
						if(!e['id'])
							return;
						e.resetMsg();
						});
			}
		// On affiche les messages...
		this.countmsg = 0;
		if(ls && ls.size() > 0)
			{
				ls.each(this.Qparse.bind(this))
				
				if(this.mfrm && this._open === true)
					{
						var o = ls.last();
						var u = (o['to'] !== this.user) ? o['to'] : o['from'];
						this.msgfrm(u).focus();
					}
			} 
			
		if(!this.mplist['970001'])
			{
				// et on créer l'utilisateur Support
				var u = {num_live:'970001',nom:'',prenom:'Support',icon:'users_comments.png',online:0};
				if( this.lu['970001'] )
					u['online'] = this.lu['970001']['online'];
				var s = new AX_IsmLiUser(u);
				this.mplist['970001'] = s;
			}
		this.statment = 'wait';
		this.disp();
	},
	
	// Retourne les infos sur un utiilisateur
	getUser: function(id){
		return this.lu[id] ? this.lu[id] : {num_live:id};
	},
	
	// On parsde les utilisateurs
	Uparse: function(u){
		
		this.lu[u['num_live']] = u;
		
		if(u['num_live'] === this.user)
			return;
		
		if(!this.mplist[u['num_live']])
			{
				this.countu+=1;
				this.mkUsrLi(u);
			}
		else
			{
				this.mplist[u['num_live']].refresh(u);
			}
	},
	
	// On parse les messages
	Qparse: function(o)
		{
			var dest = o['to'];
			var from = o['from'];
			if(from != this.user)
				this.countmsg+=1;
			
			if(this._open !== true)
				return;
			
			var u = (dest !== this.user) ? dest : from;
			if(!this.mplist[u])
				this.mkUsrLi(this.getUser(u));

			//alert(Ax.getFrame().ism.msgfrm(u));
			Ax.getFrame().ism.msgfrm(u).addMsg(o);
		},
	
	err: function(msg){
		var o = '<div class="error">';
		o+= '<p align="center"><img src="'+apcphpkod.constantes.ICO_PATH+'large/comment_remove.png"></p>';
		o+= '<p align="center">'+msg+'</p>';
		o+= '</div>';
		this.msgfrm(0).innerHTML = o;
		this.statment = 'error';
		this.disp();
	},
	
	queryMsg: function(){
		this.statment = 'refresh';
		this.disp();
		xajax_getIsm(window.apcphpkod.constantes.IDS);
	},
	
	open: function(){
		Effect.BlindDown(this.f);
		this._open = true;
		this.handler.onclick = function(){ Ax.getFrame().ism.close(); };
		this.queryMsg();
	},
	
	close: function(){
		this.f.style.display = 'none';
		this.handler.onclick = function(){ Ax.getFrame().ism.open(); };
		this._open = false;
	},
	
	msgfrm: function(id){
		return this.mfrm[id] ? this.mfrm[id] : this.mkFrm(id);
	},
	
	mkFrm: function(id){
		if(!id)
			alert('Empty id for building frame on Ax_appsIsmController');
		var o = new AX_IsmFrm(id);
		this.mfrm[id] = o;
		return o;
	},
	
	mkUsrLi:function(u){
		var l = new AX_IsmLiUser(u);
		this.mplist[u['num_live']] = l;
	},
	// envoi un message
	send:function(to, val){
		if(!val)
			alert('Empty message');
		this.Qparse({from:this.user,to:to,msg:val});
		xajax_ism_send(apcphpkod.constantes.IDS, to, val);
	}
};

var AX_IsmLiUser = Class.create();
AX_IsmLiUser.prototype = {

	id : null,

	u: null,
	l: null,
	online: false,
	
	initialize: function(u){
		this.id = u['num_live'];
		this.online = u['online'];
		var l = document.createElement('li');
		this.l = l;
		this.u = u;
		this.buildLi();
		this.l.onclick = this.clik.bind(this);
		if(this.online == true)
			Insertion.Top(Ax.getFrame().ism.plist, this.l);
		else
			Ax.getFrame().ism.plist.appendChild(l);
	},
	
	buildLi:function(){
		var dsp = this.u['prenom'] ? this.u['prenom']+' '+this.u['nom'] : this.u['num_live'];
		var ol = (this.u['online']==1) ? true: false;
		var icon = this.u['icon'] ? this.u['icon'] : (ol ? 'user_comment.png' : 'user_1.png');
		var infop = (this.id === '970001') ? 'Support' : '&nbsp;';
		this.l.innerHTML = '<img src="'+apcphpkod.constantes.ICO_PATH+'normal/'+icon+'" align="left" vspace="5">';
		this.l.innerHTML += '<span class="level">'+infop+'</span>';
		this.l.innerHTML += '<span class="name">'+dsp+'</span>';
		this.l.innerHTML += '<span class="state">'+(ol?'En ligne':'Hors ligne')+'</span>';
	},
	
	clik: function(){
		Ax.getFrame().ism.msgfrm(this.id).focus();
	},

	focus: function(){
		this.l.className = 'active';
	},
	
	hide:function(){
		this.l.className = '';
	},
	
	refresh: function(u){
		if(u['online'] !== this.online)
			{
				this.u = u;
				this.online = u['online'];
				this.buildLi();
				Insertion.Top(Ax.getFrame().ism.plist, this.l);
			}
	}

};

var AX_IsmFrm = Class.create();
AX_IsmFrm.prototype = {
	
	id:null,
	
	frm:null,
	mfrm:null,
	
	i:null,
	
	_from:null,
	
	_msgtmp:null,
	
	_open:false,
	
	initialize: function(id){
		
		this.id = id;
		this.frm = document.createElement('div');
		this.frm.className = 'ISM_MFRM';
		this.frm.id = 'ISM_MSG_'+id;
		this.frm.style.display = 'none';
		this.mfrm = document.createElement('div');
		this.mfrm.className = 'ISM_MSG';
		var ip = document.createElement('div');
		ip.className = 'ISM_INP';
		this.i = document.createElement('input');
		this.i.type = 'text';
		this.i.onkeypress = this.key.bind(this);
		this.i.maxlength = 255;
		
		var lk = document.createElement('span');
		lk.className = 'actionTools';
		var la = document.createElement('a');
		la.href= 'javascript:void(0);';
		la.onclick = this.eraseAll.bind(this);
		la.innerHTML = 'Effacer la discussion';
		lk.appendChild(la);
		ip.appendChild(lk);
		ip.appendChild(this.i);
		this.frm.appendChild(this.mfrm);
		this.frm.appendChild(ip);
		Ax.getFrame().ism.mlist.appendChild(this.frm);
		return this;
		alert('la');
	},
	
	eraseAll: function(){
		xajax_ism_delFromSender(apcphpkod.constantes.IDS,this.id);
		//this.resetMsg();
	},
	
	key: function(e){
		
		var myevent=window.Event?e:event;
		var ascii=window.Event?e.which:event.keyCode;
		if(myevent.keyCode == 13)	
			{
				Ax.getFrame().ism.send(this.id,this.i.value);
				this.i.value = '';
			}
	},
	
	hide: function(){
		this.frm.style.display = 'none';
		this._open = false;
	},
	
	focus: function(){
		Ax.getFrame().ism.mfrm.each(function(e){ e.hide(); });
		Ax.getFrame().ism.mplist.each(function(e){ e.hide(); });
		Ax.getFrame().ism.mplist[this.id].focus();
		this.frm.style.display = 'block';
		this.i.focus();
		this._open = true;
		if(Ax.getFrame().ism._open === true)
			this.refresh();
	},
	
	// Remet a 0 la page des messages...
	resetMsg: function(){
		this.mfrm.innerHTML = '';
		this._from = null;
		this.i.focus();
	},
	
	addMsg: function(m){
		
		if(this._from != m['from'])
			{
				var u = Ax.getFrame().ism.lu[m['from']];
				if(u)
					var name = u['prenom'] + ' '+ u['nom'];
				else
					var name = m['from'];
				this.mfrm.innerHTML += '<span class="isminfos">'+name+''+(m['send']?' ,'+m['send']:'')+'</span>';
			}
		var cl = (m['from'] == this.id) ? 'u' : 'i';
		cl += ' '+(m['id']?'sent':'send');
		this.mfrm.innerHTML += '<div class="ismmsg '+cl+'" id="'+(m['id']?'ISM_MSG_'+m['id']:'ISM_MSG_'+this.id+'_send')+'">'
							  +'<span class="quote">'+m['msg']+'</span>';
							  +'</div>';
		this._from = m['from'];
		
	},
	
	sok: function(id){
		$('ISM_MSG_'+this.id+'_send').id = 'ISM_MSG_'+id;
		$('ISM_MSG_'+id).className = 'sent';
	},
	
	serr: function(e){
		this.mfrm.innerHTML += '<span class="ismerr">Votre message n\'a pas pu etre envoye : '+e+'</span>';
	},
	
	refresh: function(){
		if(this._open !== true)
			return;
		xajax_getIsm(apcphpkod.constantes.IDS, this.id);
		window.setTimeout(this.refresh.bind(this),10000);
	},
	
	q: function(ls){
		this.resetMsg();
		ls.each(this.addMsg.bind(this))
	},
	
};

var Ax;
document.observe('dom:loaded', function () {
try{
	document.fire('dom:axinit');
	Ax = new AX_appController();
} catch(e){
	//alert(e);
}
});

/*
New phpkod versionning
*/
window.phpkod = 
	{
		// L'objet script du head a utiliser pour les appels ajax cross-domain
		version : '0.1'
	};
/*
/* Initialize Tools phpkod class
*/
window.phpkod.tools = 
	{
		
		checkEmail: function(email)
			{
				var place = email.indexOf("@",1);
				var point = email.indexOf(".",place+1);
				if ((place > -1)&&(email.length >2)&&(point > 1))
					{
						return true;
					}
				else
					{
						return false;
					}
			},
			
		checkTelNumber: function(tel)
			{
				var reg = new RegExp("[0-9\.]{10,16}","g");
				if(!reg.test(tel))
					return false;
				//if(tel.length < 10)
				//	return false;
				return true;
			}
		
		
	};
/*
/* Initialize Modules phpkod class
*/
window.phpkod.modules = {};
/*
/* Initialize Plugins phpkod class
*/
window.phpkod.plugins = {};





/*--------------------------------------------------------------------------------------------*/
/*--------------------------- Common.js ------------------------------------------------------*/
document.onkeypress = ManageEvent;
function ManageEvent(e){
	var myevent=window.Event?e:event;
	var ascii=window.Event?e.which:event.keyCode;
    var letter = String.fromCharCode(ascii);
	var IDS = apcphpkod.constantes.IDS;
	var PATH = apcphpkod.constantes.PATH;
	var LOGIN_PATH = apcphpkod.constantes.HTTP_LOGIN_PATH;
	if(myevent.ctrlKey == true){
	
		switch(letter){
		
			case 'k'	:	MkFrame(LOGIN_PATH + 'admin/MyConf/MyConf.php?IDS='+IDS,'MyConf',650,480); break;// elements de configuration
			case 'q'	:	MkFrame(LOGIN_PATH + 'admin/Search/index.php?IDS='+IDS,'MyConf',650,480); break;// elements de configuration
			case 'f'	:	parent.C_close(); break;// elements de configuration


		}
		
		return;
	
	}
	//alert(event.keyCode);
    //alert("Vous venez de frapper la lettre " + letter + "\ncode decimal de la touche : " + ascii )
}
function changesrc(id,src){
	document.getElementById(id).src = src;
}

/* Pour la foncton spanMenu();
*/
var old_sel = new Object;
old_sel.btn = '';
old_sel.action = '';
old_sel.mouseOver = '';
old_sel.mouseOut = '';
function spanMenu_select( id ){

	/* on verif si il y a un ancien vutton */
	if(old_sel.btn != null && old_sel.btn != ''){
	
		var o = document.getElementById( old_sel.btn );
		var _o= o.getElementsByTagName( 'a' )[0];;
		var oa = _o.attributes;
		if(oa != null){
			oa.onClick.value = old_sel.action;
			oa.onMouseover.value = old_sel.mouseOver;
			oa.onMouseout.value = old_sel.mouseOut;
			spanMenu_out( old_sel.btn );
		}
	}
	
	var d = document.getElementById( id );
	d.className = 'spanMenu selected';
	
	/* on efface les actions sur la presente */
	var _a = d.getElementsByTagName( 'a' )[0];
	old_sel.btn = id;
	old_sel.action = _a.attributes.onClick.value;
	old_sel.mouseOver = _a.attributes.onMouseover.value;
	old_sel.mouseOut = _a.attributes.onMouseout.value;
	_a.attributes.onClick.value = '';
	_a.attributes.onMouseover.value = '';
	_a.attributes.onMouseout.value = '';

}
function spanMenu_over( id ){

	var d = document.getElementById( id );
	d.className = 'spanMenu over';

}
function spanMenu_out( id ){

	var d = document.getElementById( id );
	d.className = 'spanMenu';

}
function btnclean( spry_id ){
	var div = document.getElementById(spry_id+'_jsMenu');
	var col = div.getElementsByTagName('span');
	for(i=0;i<col.length;i++){
		col[i].className = 'spanMenu';
	}


}
/*
Fonction pour affichier une dic et mettre ne cache la div actuelle.
les boutons doivent avoir le meme id que la layer + _btn en suffixe.
*/
function displayLayer( id , id_main_layer , id_spry ){
	
	// on clean les autres
	undisplayLayers( id_main_layer );

	if(id_spry != 'undefined'){
		//btnclean( id_spry );
	}
	
	/*if(c_layer != '' && c_layer != null){
		var elem = document.getElementById( c_layer );
		if(elem != null)
			elem.style.display = 'none';
	}*/
	if(typeof(id) == 'object'){
	
		for(i=0;i<id.length;i++){
			target = document.getElementById( id[i] );
			target.style.display = 'block';
		}
		
		var btn = document.getElementById( id[0] + '_btn' );
		if(btn != null){
			spanMenu_select( id[0] + '_btn' );
		}

	} else {
		target = document.getElementById( id );
		target.style.display = 'block';
		c_layer = id;
		var btn = document.getElementById( id + '_btn' );
		if(btn != null){
			spanMenu_select( id + '_btn' );
		}
	}
	// on met en exerg le boutton si il existe
	
}
/*
Fonction pour masquer toutes les div contenues dans le div prinvipal
*/
function undisplayLayers( id ){
	
	var main = document.getElementById( id );
	if(main == null)
		alert('Div manquante pour l\'id '+id);
	var divs = main.getElementsByTagName('div');
	for( i=0 ; i<divs.length ; i++ ){
		_c = divs[i];
		if(_c.className == 'jsFrame'){
			_c.style.display = 'none';
		}
	}
	
}

function updatefromUpload( file , upload_dir , name ){

	document.getElementById( 'INPUT_' + name ).value = file;

}

function MkButton( name , onclick , disabled , nodisable ){
	
	
	var ext = '.png';
	var HTTP_ADMIN_TPL_PATH = apcphpkod.constantes.HTTP_TPL_PATH+'admin/';
	
	if( disabled == true || onclick == '' )
		var o = '<img name="'+name+'" src="'+HTTP_ADMIN_TPL_PATH+'buttons/'+name+'_disabled'+ext+'" />';
	else{
		var o  = '';
		o += '<img name="'+name+'" src="'+HTTP_ADMIN_TPL_PATH+'buttons/'+name+ext+'"';
		o += ' onmouseover="javascript:this.src=\''+HTTP_ADMIN_TPL_PATH+'buttons/'+name+'_over'+ext+'\';"';
		o += ' onmouseout="javascript:this.src=\''+HTTP_ADMIN_TPL_PATH+'buttons/'+name+ext+'\';"';
		o += ' onclick="'+onclick;
		o += nodisable ? '' : ' desactivate(this);';
		o += '" />';
	}
	return o;
	
	
}
function sendCalEvent(Myevent,id,value){

	if(Myevent.keyCode == 13){
		MkProgress('Chargement du calendrier');
		xajax__callfromInPlace(id,value)
	}
	return false;
	
}

function switchFullScreen(){
}

/*
/* function selectAllCk
/* selectionne tous les checkbox d'une div donnée
*/
function select_all_checkbox(container_id){
	
	var container = $(container_id);
	var ck = container.getElementsByTagName('input');
	for(var i=0; i<ck.length; i++){
		
			k = ck[i];
			if(k.attributes.type.value == 'checkbox')
				k.checked = true;
		
		}
	
}
// Efface un plopmenu
function fadeplop( id, timeout )
	{
		
	}
// Efface tous les plopsmenu
function fadeAllPlop( timeout )
	{
		
	}

function setParentFullHeight(divId)
	{
		
		var topOffsetHeight = $(divId).parent.getHeight();
		$(divId).setAttribute('style','height:'+topOffsetHeight+'px;');

		
	}