function changeImage(elementId, nameImage, onOrOff,extensie)
{
	document.getElementById(elementId).src = './images/'+nameImage+'_'+onOrOff+'.'+extensie;

}
function send(formid,array,action,functionJavascript) {
	
	$('#progressbar').show();
	
	var dataform = '';
	if(formid){
		dataform += $("#"+formid).serialize();
	}
	if (array){
		for(i=0;i<array.length;i++) {
			if(dataform != ''){
				dataform += '&';
			}
			dataform += 'bit_'+i+'='+array[i];
	        
		}
	}
	if(functionJavascript != null)
	{
		dataform += eval(functionJavascript);
	}
	
	$.ajax({
		type: 'post',
		url: action,
        data: dataform,
    }).done(function(msg) {
    	
    
    	var response = msg;
    	var matchesContent = new Array();
    	
    	matchesContent = response.match(/<\?([\d])>(.*)<\/\1\?>/g);
    	
    	var matchesDigitContent = new Array();
    	
    	var a = 0;
		
		for(var i=0; i<matchesContent.length; i++) {
			
			var matchesDigits = matchesContent[i].match(/<\?([\d])>(.*)<\/\1\?>/);
			matchesDigitContent[a] = matchesDigits[2];
			a++;
		}
    	
    	
		var matchesLocations = response.match(/<\!([\d])>(.*)<\/\1\!>/g);
    	var matchesDigitLocation = new Array();
    	var a = 0
		
		for(var i=0; i<matchesLocations.length; i++) {
			
			var matchesDigits = matchesLocations[i].match(/<\!([\d])>(.*)<\/\1\!>/);
			matchesDigitLocation[a] = matchesDigits[2];
			a++;
		}
    		
    	for(var i in matchesDigitLocation)
    	{
    		
    		if(matchesDigitLocation[i] != 'eval'){
    			$('#'+matchesDigitLocation[i]).show();
    			$('#'+matchesDigitLocation[i]).html(unescape(matchesDigitContent[i]));
    			
    			
    		}else{
    			eval(matchesDigitContent[i]);
    		}
    	}
    	
    	$('#progressbar').hide(); 
    });
	


}
function orderSerialize()
{
	return $('ol.sortable').nestedSortable('serialize');
}
function hide_box()
{
	document.getElementById("hiddenlayer").style.visibility="hidden";
	
	alert("blabla");
	document.getElementById("hiddenlayer").style.visibility="visible";
	alert("blabla");
}



