/*$(document).ready(function(){
	$.ajax({
		type: "GET",
		url: start_url+"/catalog/xml_filter_creator.php?IdCategory="+idcategory,
		dataType: "xml",
		success: function(xml) {
			var myHtml = "";
			$(xml).find('formulaire').each(function(){
			
				$(this).find('elementForm').each(function(){
					var id   = $(this).attr('idintitule_title');
					var name = $(this).attr('intitule_title');
					var type = $(this).attr('type');
					
					myHtml += "<li><div id='myFilterFieldsTitle'>"+name+"</div>";
					myHtml += "<div id='myFilterFieldsElement'>";
					
					var beginName = "";
					
					if(id == 'sscategory' || id == 'color' || id == 'brand'){
						beginName = '';
					}else{
						beginName = 'idIntituleValue_';
					}
					
					
					if(type=='select'){
						myHtml += "<select name='"+beginName+id+"' id='"+beginName+id+"' onchange='createCenterElements(0);'><option value=''>Sélectionner</option>";
					}
					
					if(type=='ulli'){
						myHtml += "<ul id='ul_"+beginName+id+"'><input type='hidden' name='"+beginName+id+"' id='"+beginName+id+"' value='' />";
					}
					
					if(type=='multiple'){
						myHtml += "<ul id='ul_"+beginName+id+"'>";
					}

					$(this).find('row').each(function(){
					
						var rowName = $(this).text();
						var rowId	= $(this).attr('id');
						
						if(type=="checkbox"){
							myHtml += "<input type='checkbox' name='"+ beginName + id + "[]' value='" + rowId + "'>"+rowName;
						}
						
						if(type=="select"){
							myHtml += "<option value='"+rowId+"'>"+rowName+"</option>";
						}
						
						if(type=='ulli'){
							myHtml += "<li id=\"li_"+beginName+id+rowId+"\" onmouseover='MouseOver(this);' onmouseout='MouseOut(this);'><a href='#' onclick='fillInputElementToForm(\""+beginName+id+"\",\""+rowId+"\");return false;'>"+rowName+"</a></li>";
						}
						
						if(type=='multiple'){
							myHtml += "<li id=\"li_"+beginName+id+rowId+"\" onclick='SelectLineMultiple(this); return false;' onmouseover='MouseOver(this);' onmouseout='MouseOut(this);'>"+"<div style='display:none;'><input type='checkbox' name='"+ beginName + id + "' value='" + rowId + "'></div>"+"<a href='#' onclick='return false;'>"+rowName+"</a></li>";
						}										
					});
					
					if(type=='ulli'){
						myHtml += "</ul>";
					}
					
					if(type=='multiple'){
						myHtml += "</ul>";
						myHtml += "<input type='submit' value='Valider' onclick=\"$('#page').val(0);\"/><div style='clear:both;'></div>";
					}
					
					if(type=='select'){
						myHtml += "</select>";
					}
						
					myHtml += "</div>";
					myHtml += "</li>";
				});
				
			});
			
			$('#myFilterFields').html(myHtml);
		

			if( prefilteredArray.length > 0 ){
				for(value in prefilteredArray){
					if(prefilteredArray[value].length > 0){
						var myStrong = prefilteredArray[value];
					
						if(myStrong.constructor == Array){
							var cbxs = document.getElementById('filterForm').elements[value];
							for(a = 0 ; a < myStrong.length ; a++){
								for( i = 0 ; i < cbxs.length ; i++){
									if(cbxs[i].value == myStrong[a]){
										cbxs[i].checked = true;
										$('#li_'+value+cbxs[i].value).addClass('sel');
									}
								}
							}
						}else{
							$('#'+value).val(myStrong);
							$('#li_'+value+myStrong).addClass('sel');
						}	
					}
				}

				$('#filterForm').ajaxSubmit( options );

			}							
		}
	});
	

	var options = {
		beforeSubmit: 	preSubmitCallBack,
		success:		postSubmitCallback  // post-submit callback
			
	};


	
	$('#filterForm').ajaxForm( options );


});
			

function createCenterElements(page){
	
	$('#page').val(page);
	
	$('#filterForm').ajaxSubmit( { 
		beforeSubmit: 	preSubmitCallBack,
		success:		postSubmitCallback  // post-submit callback
		
	} ); 
}

function preSubmitCallBack(){
			
	$.blockUI({

		message: "<div style='text-align:center'><img src='"+start_url+"/mim/ajax-loader.gif'/><br/>Recherche en cours</div>",
		css: { padding: '15px', cursor: 'pointer', 'font-weight': 'bold', 'font-family': 'Arial, Helvetica, sans-serif', 'color': '#586065', '-webkit-border-radius': '10px', '-moz-border-radius': '10px' },
		fadeIn: 0, 
		fadeOut: 700
			
	}); 				
}

function postSubmitCallback( responseText, statusText ){
	$.unblockUI();
	if( responseText.length == 0 ){
		$('#catResults').html("Les critères sélectionnés ne renvoient aucun résultat");
	}else{
		$('#catResults').html(responseText);
	}
}

function fillInputElementToForm( elementId, valueToFill ){
	
	$("#ul_"+elementId).find('li').each(function(){
	
		$(this).hasClass('sel')?$(this).removeClass( 'sel' ):'';
		
	});
	if(document.getElementById(elementId).value == valueToFill){
		$("#li_"+elementId+valueToFill).removeClass( 'sel' );
		document.getElementById(elementId).value = "";
	}else{
		$("#li_"+elementId+valueToFill).toggleClass( 'sel' );
		document.getElementById(elementId).value = valueToFill;

	}
	
	createCenterElements(0);
}


function SelectLineMultiple(elt){
	$(elt).toggleClass('sel');
	var arCheckBox = $(elt).children('div').children('input');
	arCheckBox[0].checked=($(elt).hasClass('sel'));
}
*/
function MouseOver(elt){
	$(elt).addClass('mov');
}

function MouseOut(elt){
	$(elt).toggleClass('mov');
}
