
/**
 * ComboX 1.1 - http://www.unmecduweb.com
 * 
 * Designez vos ComboBox !
 *
 * Copyright (c) 2008 Normand Fabien (akimedia.eu)
 * Date: 2010-07-09
 */
 var Z=500;
 var I = 0;
(function($){
		  //initialistation dex variables globales
	var Current = new Array(); //elm survolé
	var Eselect = new Array(); //elm selectionné
	var HauLi=new Array();; //hauteur li
	Z=Z-2;
	var W = new Array(); //largeur de la combobox
	var H = new Array();
	var Mar = new Array();
	var PosCF = new Array(); //position curseur initial fermé
	var PosCO= new Array(); //position curseur initial ouvert
	var NbrElmLi= new Array(); //nombre elm de la liste
	var CallBack;
	
	$.fn.combox = function(param){
        param = jQuery.extend({
            width: 'auto',
			fontSize: '18px',
			padding: 4,
			textIndent : '7px',
			label:"tamereenshort",
			onChange:function(){}
		}, param);
        function comboGo(selec){	
			//création de la combox
			createCombox(selec, param);
				
		}
		comboGo($(this));
			
		
		return this;
    }
	/////////////////////////////////////
	/////////CREATION COMBOX/////////////
	/////////////////////////////////////
			function createCombox(selec, param){
				selec.each(function(index, elmCombo){
					
					
					///////////////////////////////////////
					//////INITIALISATION DES VARIABLES////////
					////////////////////////////////////////////
					W[I] = param.width;
					Mar[I] = param.padding;
					CallBack = param.onChange;
					
					var comboxC = createComboxDOM(I, elmCombo, param);
					
					var headerC = comboxC.children('.combox_headerC');
					var elmSelectC = comboxC.children('.combox_headerC').children('.combox_elmSelectC');
					
					var inputSearch = comboxC.children('.combox_headerC').children('.combox_elmSelectC').children('.combox_inputSearch');
					var elmSelect = comboxC.children('.combox_headerC').children('.combox_elmSelectC').children('.combox_elmSelect');
					var curseur =comboxC.children('.combox_headerC').children('.combox_curseur') ;
					var listeC = comboxC.children('.combox_listeC');
					var value = $(headerC).nextAll('.combox_value');
					
					
					
					//////////COMBOXC et font size/////////
					comboxC.css('font-size', param.fontSize);	
					if(elmSelect.html()=="")elmSelect.html('niche');
					var tmp_h = elmSelect.height();
					if(elmSelect.html()=="niche")elmSelect.html('');
					/*while(elmSelect.height()===0){
						elmSelect.height(listeC.children(':eq('+i+')').height());
						i++;
					}*/
					listeC.children().height(tmp_h);
					elmSelect.height(tmp_h)
					H[I] = tmp_h;
					HauLi[I]= tmp_h;
					
					/////////HEADERC//////////
					headerC.width(W[I]);
					
					headerC.height(H[I]);
					
					headerC.css('margin', Mar[I]+"px");
					
					////////ELEMSELECTC///////
					elmSelectC.width(W[I]-25); //marge pour le CURSEUR et le ELMSELECTC 10px 
					elmSelectC.height(H[I]);
					
					
					
					comboxC.width(W[I]+Mar[I]*2);
					comboxC.height(H[I]+Mar[I]*2);
					
					
						
					
					///////LISTEC////////////////
					listeC.width(W[I]);
					
					listeC.css('margin-top', "-"+Mar[I]+"px");//////////////////////A VOIR
					
					listeC.css('padding', Mar[I]+"px");////////////////////A VOIR
					
					//////TEXT INDENT////////////
					listeC.children('li').css('padding-left', param.textIndent);
					
					elmSelect.css('padding-left', param.textIndent);
					
					inputSearch.css('padding-left', param.textIndent);
			
					/////////////CURSEUR///////////////////
					
					
					PosCF[I] = - (H[I]/2 + 4);
					PosCO[I] =  PosCF[I]+HauLi[I]; 
					var tmp_marL = W[I]-15 + (Mar[I]-4); //CURSEUR toujours à 4px de la bordure
					curseur.css('margin-left', tmp_marL+'px').css('margin-top', PosCF[I]+'px');
					
					
					////////////////Z-INDEX///////////////				
					Z = (Z-3);
					
					listeC.css('z-index', Z);
					
					Z++;
					
					headerC.css('z-index', Z);
					curseur.css('z-index', Z);
					
					////////////////////REDIMENSIONEMENT DE LA BOX//////////////////////
					if (W[I]!='auto'){
						
						listeC.children('.combox_elm').each(function(){
							if(($(this).children('.combox_elmA').width() >= elmSelectC.width())){
							
								$(this).children('.combox_elmA').attr('title', $(this).html());
							
								$(this).children('.combox_elmA').tooltip({
									 showURL: false 	
								});
							}
							var tmp_y=2;
							
							while ($(this).children('.combox_elmA').width() >= elmSelectC.width()){
								
								$(this).children('.combox_elmA').html($(this).children('.combox_elmA').html().substring(0, $(this).children('.combox_elmA').html().length-tmp_y )+ "...");
								tmp_y++;	
								
							}
							
						});
						
						/////////////////////////////COULEUR DES TEXTES/////////////////
						
						
						//si largeur supérieur a celle demandé on calcule la largeur de l'élément et son nbr de caractère ensuite *enX et on enlève les caractères
						
						var tmp_y=2;
						while (elmSelect.width()+parseInt(elmSelect.css('padding-left')) >= elmSelectC.width()){
							elmSelect.html(elmSelect.html().substring(0, elmSelect.html().length-tmp_y )+ "...");
							tmp_y++;
						}
						
						
						
					}
					
					//////////////////////ECOUTE DU CLICK SUR LA COMBOX////////////////////////					
					headerC.bind('click', function (evt){
						
						if($(evt.target).attr('class') != ('combox_inputSearch')){
							//si element deja ouvert
							$('.combox_select_form_design ul li').unbind('mouseover');
						
							if ($(this).attr('rel')==='open'){
								openCombox($(this));
							}else{
							//si pas ouvert on ferme ceux qui le sont avant de l'ouvrir
								$('.combox_headerC[rel="open"]').each(function (index, comb){
									closeCombox($(this));	
									
								});
								openCombox($(this));
							}
						}
					});
				//////////////////////ECOUTE DE LA NAVIGATION CLAVIER SUR LA COMBOX///////////////////////
					inputSearch.bind('focus', function(){;
						
						if (headerC.attr('rel')==='open'){
							
						}else{
							$('.combox_headerC[rel="open"]').each(function (index, comb){
									closeCombox($(this));	
							});
							openCombox(headerC);
						}
					});
					listeC.css('display', 'none');
					
					if(I==0){clickOut();}
					I++;	
				
				});	
				
			
			}
			////////////////fonction debug//////
			
			function addslashes(ch) {
				ch = ch.replace(/\\/g,"\\\\");
				ch = ch.replace(/\'/g,"\'");
				ch = ch.replace(/\"/g,"\'");
				return ch
			}
			
			function clickOut(){
				$('*').click(function (evt){
				//on verifie qu'on a pas cliqué sur la combobox
				  if(($(evt.target).attr('class') !== 'combox_headerC' ) && ($(evt.target).attr('class')!=='combox_elmSelectC') && ($(evt.target).attr('class')!=='combox_inputSearch') && ($(evt.target).attr('class')!=='combox_elmSelect') && ($(evt.target).attr('class')!=='imgdemerde') && ($(evt.target).attr('id')!=='canvas') && $(evt.target).attr('class')!== ('combox_curseur')  ){
						
						//on supprime le mouseover sur la liste
						$('.combox_select_form_design ul li').unbind('mouseover');
						$('.combox_headerC[rel="open"]').each(function (index){
							closeCombox($(this));
		
						});
					}
				});	
			}
			function createComboxDOM(index, elmCombo, param){
				//////Variable pour elmSelect
					Current[index]= 0;
					Eselect[index] = 0;
					
					/////////////////////////////////////////////////////////
					////////MISE EN PLACE DU CODE HTML DE LA COMBOX//////////
					/////////////////////////////////////////////////////////
					$(elmCombo).wrap("<div class='combox_select_form_design'></div>");
					
					///COMBOXC devient la div conteneur de la combox
					var comboxC = $(elmCombo).parent('.combox_select_form_design');
									
						
					var tmp_elmSelect = "<div class='combox_headerC' rel='close'><div class='combox_elmSelectC'><input class='combox_inputSearch' type='text' value='' onkeyup='$(this).keyyp({evt:event.keyCode})' onkeydown='if(event.keyCode===9 || event.keyCode===13){$(this).saveElm()};' /><span class='combox_elmSelect'>";
					
					
					///////////////////////////////////////////A REVOIR POUR ELM SELECTIONNER AU DEMARRAGE///////////////////////////
					///Attribut selectionner dans le select
					var tmp_elmSelected = "";
					
					var tmp_selected = '';
					
					var tmp_elmSelectLi="";
					
					//PARSE LES ELEMENTS DU SELECT
					$(elmCombo).children().each(function (tmp_index){
						if($(this).attr('class')=='selected'){
							tmp_elmSelected= $(this).html();
							tmp_selected = $(this).attr('value');
							Eselect[index] = tmp_index;//La fleche est en face de l'element selected
						}
						
						
						var tmp_value = addslashes($(this).attr('value'));
						var tmp_html = addslashes($(this).html());
						if($(this).attr('class')!='undefined'){
							var tmp_class= $(this).attr('class');	
						}
						tmp_elmSelectLi+= "<li class=\""+tmp_class+" combox_elm\"><span rel=\""+tmp_value+"\" class=\"combox_elmA\"  >"+tmp_html+"</span></li>";	
					});
					
					if(param.label!='tamereenshort'){
						tmp_elmSelected  = param.label;
					}
					tmp_elmSelect+= tmp_elmSelected+"</span></div><div class='combox_curseur'><img class='imgdemerde' src='"+domain+"/files/design/fleche.png' alt='' /></div></div><ul class='combox_listeC'>"+tmp_elmSelectLi;
					
					tmp_elmSelect+="</ul> <input name='"+comboxC.children().attr('name')+"' class='combox_value' type='hidden' value='"+tmp_selected+"'  />";
					
					
					
					/////////////////////////////////// REDIMENSIONEMENT EN FONCTION LARGEUR AUTO/////////////////	
					//récuperation de la largeur du select
					if(W[I] === 'auto'){
						
						W[I] = $(elmCombo).width() + parseInt(0+$(elmCombo).css('margin-right')) + parseInt(0+$(elmCombo).css('margin-left')) +  parseInt(0+$(elmCombo).css('border-right-width')) +  parseInt(0+$(elmCombo).css('border-left-width')) + parseInt(0+$(elmCombo).css('padding-right')) + parseInt(0+$(elmCombo).css('padding-left'));
						W[I] =W[I]+10;
						
					}
					
					
					//mise en place de la combobox
					comboxC.html(tmp_elmSelect);
					return(comboxC)	
			}
			function closeCombox(headerC){//Initialisation des variables global (voir en tete)
				var elmSelectC = $(headerC).children('.combox_elmSelectC');
				var inputSearch = $(headerC).children('.combox_elmSelectC').children('.combox_inputSearch');
				var elmSelect = $(headerC).children('.combox_elmSelectC').children('.combox_elmSelect');
				var curseur = $(headerC).children('.combox_curseur') ;
				var listeC = $(headerC).next('.combox_listeC');
				var value = $(headerC).nextAll('.combox_value');
				var i = $(headerC).parent('.combox_select_form_design').index('.combox_select_form_design');
				
				listeC.slideUp();
				curseur.animate({marginTop : PosCF[i]+'px'}, 200);
				curseur.children().rotate(-90);
				inputSearch.attr('value','');
				inputSearch.css('height', '1px').css('color', '#FFF');
				elmSelect.css('display', 'block');
				listeC.children('li').css('display','block').css('visibility', 'visible');
				$(headerC).attr('rel', 'close');
				
				
			}
			
			function openCombox(headerC){
				//Initialisation des variables global (voir en tete)
				var elmSelectC = $(headerC).children('.combox_elmSelectC');
				var inputSearch = $(headerC).children('.combox_elmSelectC').children('.combox_inputSearch');
				var elmSelect = $(headerC).children('.combox_elmSelectC').children('.combox_elmSelect');
				var curseur = $(headerC).children('.combox_curseur') ;
				var listeC = $(headerC).next('.combox_listeC');
				var value = $(headerC).nextAll('.combox_value');
				var i = headerC.parent('.combox_select_form_design').index('.combox_select_form_design');
				
				
				/////////////////////////////INTITIALISATION DES VARIABLES CURRENT ET ESELECT//////////////////////
				if (typeof(Eselect[i]) === 'undefined'){
					Eselect[i]=0;
					Current[i]=0;
				}
					
				/////////////////////////// OUVERTURE SI COMBOX FERME///////////////////////////////
				if( $(headerC).attr('rel')==='close'){
					//variable current determine position du CURSEUR
					Current[i] = Eselect[i];
					//rotation du CURSEUR
					curseur.children().rotate(90);
					
					//margin top CURSEUR	
					curseur.animate({marginTop : PosCO[i] + HauLi[i]*Eselect[i]+'px'});
					
					//déroule la liste des elm
					listeC.slideDown();
					
					//la combox prend l'attribut open
					$(headerC).attr('rel', 'open');
					
					inputSearch.focus();
					//nombre elm de la liste
					NbrElmLi[i]=listeC.children('li').length;
						
					
						
					survol($(headerC));
						
				////////////////////////////// Si COMBOX OUVERTE FERMETURE //////////////////////////////////////////////
				}else if ($(headerC).attr('rel')==='open'){
					closeCombox(headerC);
				}
			}
			
			/////////////////////////////////SURVOL DES ELMENTS DE LA LISTE. !!!!COMBOX OPEN/////////////////////////////
			function survol(headerC){
				//Initialisation des variables global (voir en tete)
				var elmSelectC = $(headerC).children('.combox_elmSelectC'); 
				var inputSearch = $(headerC).children('.combox_elmSelectC').children('.combox_inputSearch');
				var elmSelect = $(headerC).children('.combox_elmSelectC').children('.combox_elmSelect');
				var curseur = $(headerC).children('.combox_curseur') ;
				var listeC = $(headerC).next('.combox_listeC');
				var value = $(headerC).nextAll('.combox_value');
				var i = headerC.parent('.combox_select_form_design').index('.combox_select_form_design');
				
				listeC.children('li').unbind('mouseover');
				listeC.children('li').unbind('click');
				
				listeC.children("li:visible").each(function(index, elm) {
					//DEPLACEMENT DU CURSEUR AU SURVOL DES ELM DE LA LISTE /////////////////////////////////////////////////////A VOIR
					$(elm).bind('mouseover', function(){
						Current[i]=index;
						var tmp_margin = (index%(NbrElmLi[i]))*HauLi[i]+PosCO[i] ;	
						curseur.animate({marginTop : tmp_margin+'px'}, 50);
					});
					
					if(!$(elm).hasClass('disabled')){
						$(elm).bind('click', function(){
							$('.combox_select_form_design ul li').unbind('mouseover');////////////////////////////////////////A VOIR
							
							////////////ELMSELECT PREND LA VALEUR DE ELM SELECTIONNER/////////////////
							elmSelect.html($(this).children(':first').html());
							
							var tmp_y=2;
							while (elmSelect.width()+parseInt(elmSelect.css('padding-left')) >= elmSelectC.width()){
								elmSelect.html(elmSelect.html().substring(0, elmSelect.html().length-tmp_y )+ "...");
								tmp_y++;
							}
							///////////////INPUT PREND LA VALUE DE ELM SELECTIONNER///////////////
							value.attr('value' , $(this).children('.combox_elmA').attr('rel') );
							
							CallBack($(this).children('.combox_elmA').attr('rel'), headerC.parent('.combox_select_form_design'));
							Eselect[i] = $(elm).index();
										
							if ($(this).parent().prev().attr('rel')==='open'){
								
								closeCombox($(this).parent().prev());	
							}
					
						});
					}
								
								
				});
			}
			
			function navigationCombox(headerC, i, e){
				//////INITIALISATION DES VARIABLES////////
        				
				var elmSelectC = $(headerC).children('.combox_elmSelectC'); 
				var inputSearch = $(headerC).children('.combox_elmSelectC').children('.combox_inputSearch');
				var elmSelect = $(headerC).children('.combox_elmSelectC').children('.combox_elmSelect');
				var curseur = $(headerC).children('.combox_curseur') ;
				var listeC = $(headerC).next('.combox_listeC');
				var value = $(headerC).nextAll('.combox_value');
				
				
				
						////////////FLECHE HAUT//////////////
						if (e.evt === 38){
							if (Current[i]==0){
								Current[i]=NbrElmLi[i]-1;
							}else{
								Current[i]--;
							}
						//////////FLECHE BAS////////////////
						}else if(e.evt === 40){
							if (Current[i]=== NbrElmLi[i]-1){
								Current[i]=0;
							}else{
								Current[i]++;
							}
						}
						/////////////Calcul TMP_MARGIN en fonction Aaction fleche
						var tmp_margin = Current[i]*HauLi[i] + PosCO[i];
						
						curseur.animate({marginTop : tmp_margin+'px'}, 50);
						
						elmSelect.html(listeC.children('li:visible:eq('+Current[i]+')').children(':first').html());
						
						inputSearch.css('height', '1px').css('color', '#FFF');
						elmSelect.css('display', 'block');
						
						var tmp_y=2;
						while (elmSelect.width()+parseInt(elmSelect.css('padding-left')) >= elmSelectC.width()){
							elmSelect.html(elmSelect.html().substring(0, elmSelect.html().length-tmp_y )+ "...");
							tmp_y++;
						}
									
						value.attr('value' , listeC.children('li:visible:eq('+Current[i]+')').attr('title') );
						
										
				
			}
			
			function searchCombox(headerC, i, e){
				//////INITIALISATION DES VARIABLES////////
        				
				var elmSelectC = $(headerC).children('.combox_elmSelectC'); 
				var inputSearch = $(headerC).children('.combox_elmSelectC').children('.combox_inputSearch');
				var elmSelect = $(headerC).children('.combox_elmSelectC').children('.combox_elmSelect');
				var curseur = $(headerC).children('.combox_curseur') ;
				var listeC = $(headerC).next('.combox_listeC');
				var value = $(headerC).nextAll('.combox_value');
				
				///////////////////////////////////
				///////TOUCHE CLAVIER////////////////
				///////////////////////////////////
				//si événement clavier touche on parse le contenu des li
				
				
				//cache le ELMSELECT
				elmSelect.css('display', 'none');
				///////////////////INPUTSEARCH VISIBLE///////////////////
				inputSearch.css('height', '23px').css('width', W[i]+'px').css('color', '#000');
				var tmp_keyValue = inputSearch.attr('value');
				
				var tmp_findLi=0;
				

				listeC.children("li").each(function(index, elmLi) {
					if (tmp_keyValue == $(elmLi).children(':first').html().substring(0, tmp_keyValue.length).toLowerCase() || tmp_keyValue == $(elmLi).children(':first').html().substring(0, tmp_keyValue.length).toUpperCase() || tmp_keyValue == $(elmLi).children(':first').html().substring(0, tmp_keyValue.length-1)){
					
					
						$(elmLi).css('display','block').css('visibility', 'visible');
						tmp_findLi++;
						//les li correspondant sont visible, et on compte le nombre
						
						//les autres sont rendu invisible
					}else{
						$(elmLi).css('display','none').css('visibility', 'hidden');
					}
				
				});
				NbrElmLi[i]= tmp_findLi;
				if (tmp_findLi==0){
					NbrElmLi[i] = listeC.children("li").length;
					listeC.children("li").css('display','block').css('visibility', 'visible');
				}
				Current[i]=0;
				curseur.animate({marginTop : PosCO[i]+'px'}, 50);
				survol(headerC);
				
				
			}
			$.fn.keyyp = function (e){
				e = jQuery.extend({
            		evt: 0
        		}, e);
				
				//////INITIALISATION DES VARIABLES////////
        		var inputSearch = $(this);
				var headerC = $(this).parent('.combox_elmSelectC').parent('.combox_headerC');
				
				if (headerC.attr('rel')==='open'){
					//////////INDEX = I//////////////////////
					var i = headerC.parent('.combox_select_form_design').index('.combox_select_form_design');
					
					//Si clique sur enter aucune action
					
					if(e.evt!=13 && e.evt!=9){
						if (e.evt === 38 || e.evt === 40){
							navigationCombox(headerC, i, e);
						}else{
							searchCombox(headerC,i, e);
						}
					}
				}
					
				
			}
			
			$.fn.saveElm = function (){
				log($(this));
				//au clique sur tab et entré cette fonction est lancé
				//on enregistre dans le span l'élément current et on ferme la combobox
				var inputSearch = $(this);
				var headerC = $(this).parent('.combox_elmSelectC').parent('.combox_headerC');
				var elmSelectC = headerC.children('.combox_elmSelectC'); 
				var elmSelect = headerC.children('.combox_elmSelectC').children('.combox_elmSelect');
				var curseur = headerC.children('.combox_curseur') ;
				var listeC = headerC.next('.combox_listeC');
				var value = headerC.nextAll('.combox_value');
				
				if(!listeC.children('li:visible:eq('+Current[headerC.parent().index('.combox_select_form_design')]+')').hasClass('disabled')){
						
					if (headerC.attr('rel')==='open'){
					
						elmSelect.html(listeC.children('li:visible:eq('+Current[headerC.parent().index('.combox_select_form_design')]+')').children(':first').html());
						
						var tmp_y=2;
						while (elmSelect.width()+parseInt(elmSelect.css('padding-left')) >= elmSelectC.width()){
							elmSelect.html(elmSelect.html().substring(0, elmSelect.html().length-tmp_y )+ "...");
							tmp_y++;
						}
											
						value.attr('value' , listeC.children('li:visible:eq('+Current[headerC.parent().index('.combox_select_form_design')]+')').children().attr('rel') );
						
						CallBack(listeC.children('li:visible:eq('+Current[headerC.parent().index('.combox_select_form_design')]+')').children().attr('rel'), headerC.parent('.combox_select_form_design'));
						
						Eselect[headerC.parent().index('.combox_select_form_design')] = listeC.children('li').index(listeC.children('li:visible:eq('+Current[headerC.parent().index('.combox_select_form_design')]+')'));
					
						closeCombox(headerC);	
						
					}
				}
				//this).parent().nextAll('.combox_valueForm').trigger('newVal');			
			}
			//rend la combox disabled
			$.fn.disabledCombox = function(){
				var headerC = $(this).children('.combox_headerC');
				var inputSearch = $(headerC).children('.combox_elmSelectC').children('.combox_inputSearch');
				var elmSelectC = headerC.children('.combox_elmSelectC'); 
				var elmSelect = headerC.children('.combox_elmSelectC').children('.combox_elmSelect');
				var curseur = headerC.children('.combox_curseur') ;
				var listeC = headerC.next('.combox_listeC');
				var value = headerC.nextAll('.combox_value');
				
				headerC.unbind('click');//empeche click sur la combox
				inputSearch.unbind('focus');//empeche navigation clavier
				
				inputSearch.attr('disabled', 'disabled');//empeche navigation clavier
				
				value.after('<input type="text" name="'+value.attr('name')+'" value="'+value.attr('value')+'" class="tmp_combox_value" style="display:none" disabled="disabled" />');//transform value en input text pour le disabled
				value.remove();
			}
			//réactive la combox après un disabled
			$.fn.activeCombox = function(){
				
				var headerC = $(this).children('.combox_headerC');
				var inputSearch = $(headerC).children('.combox_elmSelectC').children('.combox_inputSearch');
				var elmSelectC = headerC.children('.combox_elmSelectC'); 
				var elmSelect = headerC.children('.combox_elmSelectC').children('.combox_elmSelect');
				var curseur = headerC.children('.combox_curseur') ;
				var listeC = headerC.next('.combox_listeC');
				var tmp_value = headerC.nextAll('.tmp_combox_value');
				
				tmp_value.after('<input type="hidden" name="'+tmp_value.attr('name')+'" value="'+tmp_value.attr('value')+'" class="combox_value" />'); //transform value en input hidden pour le dédisabled
				tmp_value.remove();
				
				inputSearch.removeAttr('disabled');//empeche navigation clavier
				
				headerC.unbind('click');//empeche click sur la combox
				inputSearch.unbind('focus');//empeche navigation clavier
				
				//////////////////////ECOUTE DU CLICK SUR LA COMBOX////////////////////////					
				headerC.bind('click', function (evt){
					
					if($(evt.target).attr('class') != ('combox_inputSearch')){
						//si element deja ouvert
						$('.combox_select_form_design ul li').unbind('mouseover');
					
						if ($(this).attr('rel')==='open'){
							openCombox($(this));
						}else{
						//si pas ouvert on ferme ceux qui le sont avant de l'ouvrir
							$('.combox_headerC[rel="open"]').each(function (index, comb){
								closeCombox($(this));	
								
							});
							openCombox($(this));
						}
					}
				});
			//////////////////////ECOUTE DE LA NAVIGATION CLAVIER SUR LA COMBOX///////////////////////
				inputSearch.bind('focus', function(){;
					
					if (headerC.attr('rel')==='open'){
						
					}else{
						$('.combox_headerC[rel="open"]').each(function (index, comb){
								closeCombox($(this));	
						});
						openCombox(headerC);
					}
				});	
			}
					
})(jQuery);

