function colorSubmit(id){
	$(id).style.backgroundColor = "#DE0808";
}

function decolorSubmit(id){
	$(id).style.backgroundColor = "#949C94";
}



function setScroll() {

	var intitules = $('zone_quest').getElementsByClassName('intituleQuest');
	
	for(var i = 0; i < intitules.length; i++) {
		
		if(Element.hasClassName(intitules[i] , 'erreur')) {
			
			var ancre = document.createElement('A');
				ancre.setAttribute('name' , 'ancreErreur');
				
			intitules[i].insertBefore(ancre , intitules[i].childNodes[0]);
			

			var url = window.location.href + '#ancreErreur' ;
					
			window.location.href = url;
		
			break;

		}
	}
}


var boiteAlerte = Class.create();

boiteAlerte.prototype = {


	  initialize: function(element) {
		
		this.masque = this.createMasque();
	
		this.contenant = element;
		
		var body = document.getElementsByTagName('BODY')[0];
		body.insertBefore(this.contenant,body.firstChild);		
		
		var elementWidth = Element.getWidth(this.contenant);
		
		Element.setStyle(this.contenant,{
				position : 'absolute',
				display: 'none',
				zIndex : 900,
				left : '50%',
				marginLeft : '-' + (elementWidth/2) + 'px',
				marginTop: '200px'
					
		});
		
	
		var _this = this;
		
		Event.observe(this.masque, 'click' , function() {_this.cacher();} );
		Event.observe(this.contenant, 'click' , function() {_this.cacher();} );
		
		
		window.onscroll = function() { _this.resizeMasque(); };
		window.onresize = function() { _this.resizeMasque(); };
	
	  },
	  createMasque: function() {
		
		var body = document.getElementsByTagName('BODY')[0];
		var width = document.viewport.getWidth();
		var height = document.viewport.getHeight();
		var scrolls = document.viewport.getScrollOffsets();
		
			width += scrolls['left'];
			height += scrolls['top'];
			
		var masque = document.createElement('DIV');
						
			Element.setStyle(masque,{
					position : 'absolute',
						top : '0px',
						left : '0px',
					background : '#000',
					opacity : 0.5,
					width : width+'px',
					height : height+'px',
					zIndex : 800,
					cursor: 'pointer',
					display: 'none'
			});
			
		body.insertBefore(masque,body.firstChild);		
		
	  
		return masque;
	  },
	  resizeMasque: function() {
		
		var width = document.viewport.getWidth();
		var height = document.viewport.getHeight();
		var scrolls = document.viewport.getScrollOffsets();
		
			width += scrolls['left'];
			height += scrolls['top'];
			
			Element.setStyle(this.masque,{
					width : width+'px',
					height : height+'px'
			});	  
		  
		return;
	  },
	  cacherClick: function() {
	  
	  	var _this = this;
	  	
	  	Event.observe(this.masque, 'click' , function() {_this.cacher();} );
	  	
	  	return true;
	  },
	  afficher: function() {


		Element.show(this.masque);
		Element.show(this.contenant);
		this.resizeMasque();
		
		return;
	  },
	  cacher: function() {
	  
		Element.hide(this.masque);
		Element.hide(this.contenant);
		
		return;	  
	  
	  }

}
