function scrollBlock(block_id, scroller_id) {
	
	if(document.getElementById(block_id).style.display == 'none') {
		
		document.getElementById(block_id).style.display = 'inline';
		document.getElementById(scroller_id).className = 'scroller minus';
	}
	else {
		document.getElementById(block_id).style.display = 'none';
		document.getElementById(scroller_id).className = 'scroller plus';
	}
}

function confirmDeleteCompetence() {
	confirm("Etes-vous sûr de vouloir supprimer la compétence :\nCompétence pas dans base ?");	
}

function tickUntickCheckbox(checkbox_id) {
	if(document.getElementById(checkbox_id).checked === true) {
		document.getElementById(checkbox_id).checked = false;
	}
	else {
		document.getElementById(checkbox_id).checked = true;
	}
}

function checkUncheckRadio(radio_id) {
	if(document.getElementById(radio_id).checked === false) {
		document.getElementById(radio_id).checked = true;
	}
}
function checkUncheckRadioWorking(radio_id,radio_id_to_close){
	$(radio_id_to_close).checked = false;
		$(radio_id).checked = true;
		
	
}

function tickUntickCheckboxAndScrollBox(checkbox_id, scroll_id) {
	if(document.getElementById(checkbox_id).checked === true) {
		document.getElementById(checkbox_id).checked = false;
		document.getElementById(scroll_id).style.display = 'none';
	}
	else {
		document.getElementById(checkbox_id).checked = true;
		document.getElementById(scroll_id).style.display = 'inline';
	}
}

function scrollBox(checkbox_id, scroll_id) {
	if(document.getElementById(checkbox_id).checked === true) {
		document.getElementById(scroll_id).style.display = 'inline';
	}
	else {
		document.getElementById(scroll_id).style.display = 'none';
	}
}

var ns6= document.getElementById && !document.all;

function restrictinput(maxlength,e,placeholder){
	if (window.event && event.srcElement.value.length >= maxlength)
		return false;
	else
		if (e.target && e.target == eval(placeholder) && e.target.value.length >= maxlength){
			var pressedkey=/[a-zA-Z0-9\.\,\/]/ ;
			if (pressedkey.test(String.fromCharCode(e.which))) e.stopPropagation();
		}
}

function countlimit(maxlength,e,placeholder){
	var theform =placeholder;
	var lengthleft = maxlength-theform.value.length;
	var placeholderobj = document.all ? document.all[placeholder] : document.getElementById(placeholder);
	if (window.event || e.target&&e.target == eval(placeholder)){
		if (lengthleft<0)
			theform.value = theform.value.substring(0,maxlength);
	}
}

function displaylimit(thename, theid, thelimit){
	var theform=(theid!="")? document.getElementById(theid) : thename
	
	
	if (document.all || navigator.userAgent.indexOf('Safari') != -1 || navigator.userAgent.indexOf('MSIE 7') != -1) {
		eval(theform).onkeypress=function() {
			return restrictinput(thelimit,event,theform)
		}
        
		eval(theform).onkeyup=function(){
			countlimit(thelimit,event,theform)
		}
		
	}
	else if (ns6){
		document.body.addEventListener('keypress', function(event) { restrictinput(thelimit,event,theform) }, true);
		document.body.addEventListener('keyup', function(event) { countlimit(thelimit,event,theform) }, true);
	}
}

function imposeMaxLength(Object, MaxLen)
{
  return (Object.value.length <= MaxLen);
}