
////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
////////////////////              special input                        /////////////
////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////
/*function pour préremplir un input. celui ci disparait quand l'utilisateur clique dessus.*/
var autoPopulate = {
	sInputClass:'populate', // Class name for input elements to autopopulate
	/**
	 * Main function
	 */
	init:function() {
		// Check for DOM support
		if (!document.getElementById || !document.createTextNode) {return;}
		// Find all input elements with the given className
		var arrInputs = document.getElementsByClassName(autoPopulate.sInputClass);
		var iInputs = arrInputs.length;
		var oInput;
		for (var i=0; i<iInputs; i++) {
			oInput = arrInputs[i];
			// Make sure it's a text input
			if( oInput.type != 'text' && oInput.type != 'password') { continue; }
			// If value is empty and title is not, assign title to value
			if ((oInput.value == '') && (oInput.title != '') || oInput.value != oInput.title) { autoPopulate.setInput(oInput) }
            else { 
                 oInput.style.color = '#646464'; 
            }
			// Add event handlers for focus and blur
			autoPopulate.addEvent(oInput, 'focus', function() {
				// If value and title are equal on focus, clear value
				if (this.value == this.title) {
					this.value = '';
                    this.style.color = '#646464';
					this.select(); // Make input caret visible in IE
				}
			});
			oInput.style.background = '#fff';
			oInput.style.border = 'solid 1px #646464';
			autoPopulate.addEvent(oInput, 'blur', function() {
				// If the field is empty on blur, assign title to value
				if (!this.value.length) { autoPopulate.setInput(this) }
			});
		}
	},
  
  setInput:function(obj) {
      obj.value = obj.title; obj.style.color = '#AAAAAA';
  },

	addEvent:function(obj, type, fn) {
		if (obj.addEventListener)
			obj.addEventListener(type, fn, false);
		else if (obj.attachEvent) {
			obj["e"+type+fn] = fn;
			obj[type+fn] = function() {obj["e"+type+fn](window.event);}
			obj.attachEvent("on"+type, obj[type+fn]);
		}
	}
};
autoPopulate.addEvent(window, 'load', autoPopulate.init); 

/////////////////////////////////////////////////////////////
function ddpanelOpen(comment,open,close){
    document.getElementById(close).style.display='none';
    document.getElementById(open).style.display='';
    document.getElementById(comment).style.display='';
}

function ddpanelClose(comment,open,close){
    document.getElementById(close).style.display='';
    document.getElementById(open).style.display='none';
    document.getElementById(comment).style.display='none';
}
