var mainPath = '';
window.addEvent('domready', function()
{
	var mainPath = '';
	//var mainPath = 'fileadmin/templates/';
	if(typeof sIFR == "function"){
		sIFR.replaceElement("h1", mainPath+"flash/impact_uppercase.swf", "#323723", null, null, null, 5, 10, 5, 4, "offsetTop=2", "upper", "transparent");
		sIFR.replaceElement("h2", mainPath+"flash/petitaBold.swf", "#323723", null, null, null, 5, 4, 5, 4, "offsetTop=4", null, "transparent");
	}else{
		alert('not passed');
	}
	if($('contact_form'))
	{
		/* 
		focus et blur effect 
		*/
		$$('input', 'select', 'textarea').each(function(el, index)
		{
			if(el.getProperty('type') != 'submit')
			{
				el.addEvents(
				{
					'focus':function(e)
					{
						var e = new Event(e);
						e.stop();
						this.getParent().addClass('focused');
					},
					'blur':function(e)
					{
						var e = new Event(e);
						e.stop();
						this.getParent().removeClass('focused');
					}
				});
			}
		});

		/*
		validation
		*/
		var errorsContainer;
		var myFormValidation = new Validate('contact_form',{
			errorClass: 'erreur',
			validateOnBlur: false,
			showErrorsInline: true,
			label:'Envoi en cours...',
			onFail:function(els)
			{
				if(!errorsContainer)
				{
					errorsContainer = new Element('div', 
					{
						'class':'messageError'
					}).injectBefore($('contact_form'));
				}
				errorsContainer.innerHTML='';
				els.injectInside(errorsContainer);
			}
		});
		
	}
	Lightbox.init({descriptions: true, showControls: false});

	var goForIt=true;
	if($('map') && goForIt)
	{
		if (GBrowserIsCompatible()) {
			var html = '<img src="images/photos/presentation-de-notre-bois-de-chauffage/logo.jpg" alt="bois de chauffage José Pires" /><br />159, rue de la fauvette<br/>34 130 MAUGUIO <br /><br /><a href="http://www.boisdechauffage34.com/demande-achat-bois-de-chauffage-mauguio-34.php">Contactez nous</a>';
			var map = new GMap2($("map"));
			// Coords dépot : 
			var center = new GLatLng(43.619606, 3.992767);
			map.setCenter(center, 13);
			//ZOOM BTNS
			var mapControl = new GSmallZoomControl();
			map.addControl(mapControl);
			// MARKER
			var marker = new GMarker(center, {draggable: false});
			//marker.openInfoWindowHtml("Ceci est le texte");
			map.addOverlay(marker);
			GEvent.addListener(marker, "click", function()
			{
				marker.openInfoWindowHtml(html); 
			});
			marker.openInfoWindowHtml(html);
			/*
			//----> UTILISER ce code pour déplacer le point et récupérer les coordonnées.
			
			var marker = new GMarker(center, {draggable: true});
			GEvent.addListener(marker, "dragstart", function() {
				map.closeInfoWindow();
			});
			GEvent.addListener(marker, "dragend", function() {
				marker.openInfoWindowHtml("Nouvelles coordonnées :<br/>" + marker.getLatLng());
			});
			map.addOverlay(marker);
			*/
		}
	}
});

