var siteClass = Class
		.create( {
			shopData : null,
			mapPlaceHolder : null,
			customEvent : {},
			lang : {
				wait : 'Veuillez patienter',
				loadingImage : 'Chargement de ta photo en cours',
				loadingSuccess : 'Votre photo est charg&eacute;e.<br />Elle sera mise en ligne apr&egrave;s v&eacute;rification.',
				ajaxError : "Une erreur syst&egrave;me est intervenue. Veuillez rafra&icirc;chir la page ou contacter l'administrateur."
			},
			initialize : function() {
			},
			initEvents : function() {
				this.initTextFields();
				var arrayNewsletterForm = $$('form.newsletterForm');
				arrayNewsletterForm.each(function(form) {
					var input = form.down('input[type=text]');
					input.setAttribute('vtype', 'email');
					Event.observe(form, 'submit', function(e) {
						Event.stop(e);
						if (!this.checkMail($F($(input))))
							return false;
						$(form).submit();
						return false;
					}.bind(this), true)
				}.bind(this))
				if ($('searchInput')) {
					Event.observe('searchArticleForm', 'submit', function(e) {
						Event.stop(e);
						if ($F('searchInput').empty()
								|| $F('searchInput') == $('searchInput')
										.getAttribute('defaultValue'))
							return;
						$('searchArticleForm').submit();
					}.bind(this), true)
				}
				Event.observe('citadiumFB', 'click', this.openFBModalWindow
						.bindAsEventListener(this), false);
				Event.observe('closeModal', 'click', function(e) {
					$('modalBg').hide();
					$('fbDisplayArea').update();
					$('modalWin').hide();
				});
				if ($('send2Friend')) {
					$('bodyElt').appendChild($('send2FriendWin'));
					$('email').setAttribute('vtype', 'email');
					$('friendemail').setAttribute('vtype', 'email');
					$('submitSend2Friend').disable();
					Event.observe('send2FriendForm', 'submit',
							this.sendFormSend2Friend.bindAsEventListener(this),
							false);
					var arrayClose = [ $('send2FriendCloseBtn'),
							$('cancelSend2Friend') ]
					arrayClose.invoke('observe', 'click', function(e) {
						Event.stop(e);
						$('modalBg').hide();
						$('send2FriendWin').hide();
						$('send2FriendWait').hide();
						$('send2FriendMessage').hide();
						$('send2FriendForm').show();
						$('send2FriendForm').reset();
					})
					$$('#send2FriendForm input[type=text]')
							.invoke(
									'observe',
									'blur',
									this.checkSend2FriendForm
											.bindAsEventListener(this));
					Event.observe('send2Friend', 'click', this.openSend2Friend
							.bindAsEventListener(this));
				}
				if ($$('.customForm.newsletter').length > 0) {
					Event.observe('contactForm', 'submit',
							this.checkNewsletterForm.bindAsEventListener(this),
							true);
				}
				if ($('blogueurWin')) {
					$('bodyElt').appendChild($('blogueurWin'));
					var buttonArray = Array();
					if ($('widgetBlogLink'))
						buttonArray.push($('widgetBlogLink'));
					if ($('widgetMySpaceLink'))
						buttonArray.push($('widgetMySpaceLink'));
					buttonArray.invoke('observe', 'click', this.openBloggerWin
							.bindAsEventListener(this), true);
					var arrayClose = [ $('blogueurWinCloseBtn'),
							$('cancelBlogueurWin') ];
					arrayClose.invoke('observe', 'click', function(e) {
						$('modalBg').hide();
						$('blogueurWin').hide();
					}, true);
					Event.observe('blogueurCode', 'focus', function(e) {
						Event.stop(e);
						$('blogueurCode').select();
					});
					Event.observe('blogueurCode', 'change', function(e) {
						Event.stop(e);
						$('blogueurCode').value = $('blogueurCode')
								.getAttribute('defaultvalue');
					});
				}
				if ($('sondageForm')) {
					$('sondageContent')
							.setStyle(
									{
										height : $('sondageContent')
												.getDimensions().height
												+ "px"
									});
					Event
							.observe(
									$('sondageForm'),
									'submit',
									function(e) {
										Event.stop(e);
										var params = $('sondageForm')
												.serialize(true);
										if (!params.voteid)
											return false;
										var waitDiv = Builder
												.node(
														'div',
														{
															className : 'ajaxLoader',
															style : "margin-top:"
																	+ ($(
																			'sondageForm')
																			.getDimensions().height / 2)
																	+ "px"
														})
										$(waitDiv).update(this.lang.wait);
										$('sondageForm').update();
										$('sondageForm').appendChild(waitDiv);
										this.ajaxRequest('/index.php', params,
												this.showResult.bind(this))
									}.bind(this), true);
				}
				$('modalBg').setOpacity(0.7);
				if ($('miniaturesDiv')) {
					$$('#miniaturesDiv div.miniPhoto').invoke('observe',
							'mouseover', this.overMini.bind(this, ''));
					$$('#miniaturesDiv div.miniPhoto').invoke('observe',
							'mouseout', this.overMini.bind(this, ''));
					$$('#miniaturesDiv div.miniPhoto img').invoke('setOpacity',
							0.8);
				}
				$$('.divArticleDroit a img').invoke("observe", 'mouseover',
						this.overMini.bind(this, ''));
				$$('.divArticleDroit a img').invoke('observe', 'mouseout',
						this.overMini.bind(this, ''));
				$$('.divArticleDroit a img').invoke('setOpacity', 0.8);
				if ($('photoListDiv')) {
					$$('#photoListDiv div.streetLookPhotoDetail').invoke(
							'observe', 'mouseover',
							this.overMini.bind(this, 'streetLookPhotoDetail'));
					$$('#photoListDiv div.streetLookPhotoDetail').invoke(
							'observe', 'mouseout',
							this.overMini.bind(this, 'streetLookPhotoDetail'));
					$$('#photoListDiv div.streetLookPhotoDetail img').invoke(
							'setOpacity', 0.8);
					$$('a.streetLookVote').invoke('observe', 'click',
							this.streetLookVote.bind(this), false);
					if ($('formStreetLook'))
						Event.observe('formStreetLook', 'submit',
								this.checkformStreetLook
										.bindAsEventListener(this), false);
					$$('#paginationArticle.streetLook a')
							.invoke(
									'observe',
									'click',
									this.streetLookPagination
											.bindAsEventListener(this), false);
				}
				
				if ($('sortFilter')) {
					document.observe("citadiumEvent:change", function(event) {
						$('streetLookFilter').submit();
					});
					this.customEvent['sortFilter'] = 'citadiumEvent:change';
				}
			},
			showResult : function(response) {
				if (!response.success)
					return $('sondageForm').update(
							'<div class="errorMsg">' + lang.ajaxError
									+ "</div>");
				$('sondageContent').update();
				response.results.responses.each(function(objResponse) {
					var divResponse = Builder.node("div", {
						className : 'responseDiv'
					});
					var divLibelle = Builder.node("div", {
						className : 'responseTitle'
					});
					$(divLibelle).update(objResponse.libelle)
					$(divResponse).appendChild(divLibelle);
					var divPercentText = Builder.node("div", {
						className : "percentageText"
					});
					$(divPercentText).update(objResponse.perc + "%");
					$(divResponse).appendChild(divPercentText);
					var spacer = Builder.node("div", {
						className : 'spacer'
					});
					$(divResponse).appendChild(spacer);
					var divPercentBg = Builder.node("div", {
						className : "percentageEmptyBar"
					});
					var divPercent = Builder.node("div", {
						className : "percentageBar",
						style : "width:" + objResponse.perc + "%"
					});
					$(divPercentBg).appendChild(divPercent);
					$(divResponse).appendChild(divPercentBg);
					$('sondageContent').appendChild(divResponse);
					var spacer = Builder.node("div", {
						className : 'spacer'
					});
					$('sondageContent').appendChild(spacer);
				});
				var divNumResult = Builder.node("div", {
					className : "numResults"
				});
				var num = response.results.totalResponses;
				$(divNumResult).update(num);
				$('sondageContent').appendChild(divNumResult);
			},
			overMini : function(className, e) {
				Event.stop(e);
				var elt = Event.findElement(e, 'div');
				if (!elt.hasClassName('miniPhoto ') && !className)
					elt = Event.findElement(e, 'div');
				else
					elt = Event.findElement(e, 'div.' + className);
				var img = elt.down('img') ? elt.down('img') : elt.up('img');
				if (e.type == 'mouseover')
					return img.setOpacity(1);
				return img.setOpacity(0.8);
			},
			openFBModalWindow : function(e) {
				Event.stop(e);
				$('modalBg').show();
				var x = ($('bodyElt').getWidth() - $('modalWin').getWidth()) / 2;
				var y = 50;
				x = x < 0 ? 0 : x;
				$('modalWin').setStyle( {
					top : y + 'px',
					left : x + 'px'
				});
				$('fbDisplayArea')
						.update(
								'<iframe src="http://www.facebook.com/plugins/likebox.php?id=278394585591&amp;width=730&amp;connections=0&amp;stream=true&amp;header=true&amp;height=430" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:740px; height:440px; margin:0px 10px" allowTransparency="true"></iframe>');
				$('modalWin').show();
			},
			initHomeEvents : function() {
				$$('.shopTab').invoke('observe', 'click',
						this.displayShopTab.bind(this))
				$$('.miniMarque img').invoke('setOpacity', 0.6);
				$$('.miniMarque').invoke('observe', 'mouseover', function(e) {
					Event.stop(e);
					var div = Event.findElement(e, 'div.miniMarque');
					div.down('a').down('img').setOpacity(1);
				});
				$$('.miniMarque').invoke('observe', 'mouseout', function(e) {
					Event.stop(e);
					var div = Event.findElement(e, 'div.miniMarque');
					div.down('a').down('img').setOpacity(0.6);
				});
				$$('.streetLookPhoto img').invoke('setOpacity', 0.8);
				$$('.streetLookPhoto').invoke(
						'observe',
						'mouseover',
						function(e) {
							Event.stop(e);
							var div = Event.findElement(e,
									'div.streetLookPhoto');
							div.down('a').down('img').setOpacity(1);
						});
				$$('.streetLookPhoto').invoke(
						'observe',
						'mouseout',
						function(e) {
							Event.stop(e);
							var div = Event.findElement(e,
									'div.streetLookPhoto');
							div.down('a').down('img').setOpacity(0.8);
						});
			},
			displayShopTab : function(e) {
				Event.stop(e);
				var div = Event.findElement(e, 'div');
				if (!div || div.hasClassName('active'))
					return;
				var eltIndex = div.id.split('_')[1];
				$('shopMap').update();
				this.setShopsMaps(eltIndex);
				$$('.shopTab.active').invoke('removeClassName', 'active');
				$$('.shopDetail.active').invoke('hide');
				div.addClassName('active');
				$('detail_' + eltIndex).addClassName('active');
				$('detail_' + eltIndex).show();
			},
			initTextFields : function() {
				$$('form input[type=text]').each(
						function(tf) {
							$(tf).setAttribute("defaultValue",
									$(tf).getAttribute("value"));
							Event.observe($(tf), 'focus', this.changeFieldState
									.bindAsEventListener(this));
							Event.observe($(tf), 'blur', this.changeFieldState
									.bindAsEventListener(this));
						}.bind(this))
				$$('form textarea').each(
						function(tf) {
							$(tf).setAttribute("defaultValue", $F(tf));
							Event.observe($(tf), 'focus', this.changeFieldState
									.bindAsEventListener(this));
							Event.observe($(tf), 'blur', this.changeFieldState
									.bindAsEventListener(this));
						}.bind(this))
			},
			stylizeForm : function(form) {
				$$('#' + form.id + ' input[type=radio]')
						.each(
								function(btn) {
									if ($('img_' + btn.id))
										return;
									Event
											.observe(
													btn,
													'change',
													function(e) {
														Event.stop(e);
														var elt = Event
																.element(e);
														$$('img.radioBtn')
																.invoke(
																		'setAttribute',
																		'src',
																		form.id == "contactForm" ? '/templates/citadiumTemplate/images/assets/contactForm/checkOff.png'
																				: '/images/assets/radioBtnOff.png')
														$(elt).checked = true;
														$('img_' + elt.id).src = form.id == "contactForm" ? '/templates/citadiumTemplate/images/assets/contactForm/checkOn.png'
																: '/images/assets/radioBtnOn.png';
													});
									var img = form.id == "contactForm" ? Builder
											.node(
													'img',
													{
														src : '/templates/citadiumTemplate/images/assets/contactForm/check'
																+ (btn.checked == true ? 'On'
																		: 'Off')
																+ '.png',
														className : 'radioBtn',
														style : 'margin-right:5px',
														id : 'img_' + btn.id,
														tabIndex : btn.tabIndex
													})
											: Builder
													.node(
															'img',
															{
																src : '/images/assets/radioBtn'
																		+ (btn.checked == true ? 'On'
																				: 'Off')
																		+ '.png',
																className : 'radioBtn',
																style : 'float:left; margin-right:5px',
																id : 'img_'
																		+ btn.id,
																tabIndex : btn.tabIndex
															});
									Event
											.observe(
													$(img),
													'click',
													function(e) {
														Event.stop(e);
														var elt = Event
																.element(e);
														$$('img.radioBtn')
																.invoke(
																		'setAttribute',
																		'src',
																		form.id == "contactForm" ? '/templates/citadiumTemplate/images/assets/contactForm/checkOff.png'
																				: '/images/assets/radioBtnOff.png')
														$(elt.id).src = form.id == "contactForm" ? '/templates/citadiumTemplate/images/assets/contactForm/checkOn.png'
																: '/images/assets/radioBtnOn.png';
														var eltIdArray = elt.id
																.split('_');
														eltIdArray.splice(0, 1);
														eltId = eltIdArray
																.join('_');
														$(eltId).checked = true;
													});
									btn.insert( {
										after : img
									});
									btn.removeAttribute('tabIndex');
									btn.setStyle( {
										position : 'absolute',
										left : '-5000px'
									});
								}.bind(this));
				if ($$('#' + form.id + ' input[type=file]').length > 0)
					$$('#' + form.id + ' input[type=file]')
							.each(
									function(input) {
										if ($('fake' + input.id)
												|| input
														.hasClassName('noCustom'))
											return;
										var inputValue = siteJS.lang.form[form.id][input.id];
										if (inputValue == null)
											inputValue = "";
										var btn = Builder.node('input', {
											type : 'button',
											value : 'Parcourir',
											className : 'fakeBtn'
										});
										var tf = Builder.node('input', {
											type : 'text',
											className : 'fakeInput',
											id : 'fake' + input.id,
											value : inputValue,
											defaultvalue : inputValue
										});
										$(input).insert( {
											after : $(tf)
										});
										$(tf).insert( {
											after : $(btn)
										});
										Event
												.observe(
														$(tf),
														'blur',
														function(e) {
															Event.stop(e);
															if ($(tf)
																	.getAttribute(
																			'value') == ''
																	|| $(tf)
																			.getAttribute(
																					'value') == $(
																			tf)
																			.getAttribute(
																					'defaultvalue')) {
																$(input)
																		.clear();
																$(tf)
																		.setValue(
																				$(
																						tf)
																						.getAttribute(
																								'defaultvalue'));
															}
														}.bind(this));
										$(input).setOpacity(0);
										$(input)
												.addClassName('customFileInput');
										Event
												.observe(
														$(input),
														'change',
														function(e) {
															Event.stop(e);
															$('fake' + input.id).value = $F(input);
														}.bind(this))
									}.bind(this));
				if ($$('#' + form.id + ' input[type=checkbox]').length > 0)
					$$('#' + form.id + ' input[type=checkbox]')
							.each(
									function(input) {
										if ($('img_' + input.id))
											return;
										var imgCheck = Builder
												.node(
														'img',
														{
															src : '/images/assets/checkbox'
																	+ (input.checked == true ? 'On'
																			: 'Off')
																	+ '.png',
															className : 'checkBox',
															style : 'float:left; margin-right:5px',
															id : 'img_'
																	+ input.id,
															tabIndex : input.tabIndex
														});
										Event
												.observe(
														input,
														'change',
														function(e) {
															Event.stop(e);
															$('img_' + input.id)
																	.setAttribute(
																			'src',
																			'/images/assets/checkbox'
																					+ (input.checked ? 'On'
																							: 'Off')
																					+ '.png');
														}.bind(this));
										Event
												.observe(
														$(imgCheck),
														'click',
														function(e) {
															Event.stop(e);
															var state = input.checked;
															$('img_' + input.id)
																	.setAttribute(
																			'src',
																			'/images/assets/checkbox'
																					+ (input.checked ? 'Off'
																							: 'On')
																					+ '.png');
															input.checked = state == false;
														}.bind(this));
										input.insert( {
											after : imgCheck
										});
										input.removeAttribute('tabIndex');
										input.setStyle( {
											position : 'absolute',
											left : '-5000px'
										});
									}.bind(this));
				Try
						.these(function() {
							$$('#' + form.id + ' select')
									.each(
											function(select) {
												if (select.tagName != "SELECT"
														|| $('ulSelect_'
																+ select.id))
													return;
												var ulSelect = Builder
														.node(
																"ul",
																{
																	className : 'ulSelect',
																	id : 'ulSelect_'
																			+ select.id
																});
												var firstLi = Builder
														.node(
																"li",
																{
																	className : 'liResult',
																	state : 0
																},
																[ Builder
																		.node(
																				"div",
																				select.options[select.selectedIndex].firstChild.nodeValue) ]);
												Event
														.observe(
																$(firstLi),
																"click",
																this.openCustomSelect
																		.bindAsEventListener(
																				this,
																				select));
												Event
														.observe(
																$(firstLi),
																'mouseout',
																function(e) {
																	Event
																			.stop(e);
																	select.timeOutId = function() {
																		$$(
																				'#'
																						+ ulSelect.id
																						+ ' div.ulDropDown')
																				.invoke(
																						'hide');
																		$$(
																				'#'
																						+ ulSelect.id
																						+ ' li.liOptions')
																				.invoke(
																						'hide');
																		firstLi
																				.setAttribute(
																						"state",
																						0);
																	}
																			.bind(
																					this)
																			.delay(
																					1);
																}.bind(this));
												Event
														.observe(
																$(firstLi),
																'mouseover',
																function(e) {
																	Event
																			.stop(e);
																	if (select.timeOutId)
																		window
																				.clearTimeout(select.timeOutId);
																}.bind(this))
												ulSelect.appendChild(firstLi);
												if (select
														.hasClassName('selectDiv')) {
													var contentLi = Builder
															.node('li');
													var contentUl = Builder
															.node('ul');
													var contentDiv = Builder
															.node(
																	'div',
																	{
																		style : 'display:none',
																		className : 'ulDropDown'
																	});
												}
												$A(select.options)
														.each(
																function(
																		option,
																		index) {
																	var li = Builder
																			.node(
																					'li',
																					{
																						style : "display:none",
																						className : 'liOptions',
																						id : 'li_'
																								+ index
																					},
																					option.firstChild.nodeValue);
																	Event
																			.observe(
																					$(li),
																					'click',
																					this.selectCustomOptions
																							.bindAsEventListener(
																									this,
																									select));
																	Event
																			.observe(
																					$(li),
																					'mouseout',
																					function(
																							e) {
																						Event
																								.stop(e);
																						$(select).timeOutId = function() {
																							$$(
																									'#'
																											+ ulSelect.id
																											+ ' div.ulDropDown')
																									.invoke(
																											'hide');
																							$$(
																									'#'
																											+ ulSelect.id
																											+ ' li.liOptions')
																									.invoke(
																											'hide');
																							$(
																									firstLi)
																									.setAttribute(
																											"state",
																											0);
																						}
																								.bind(
																										this)
																								.delay(
																										1);
																					}
																							.bind(this));
																	Event
																			.observe(
																					$(li),
																					'mouseover',
																					function(
																							e) {
																						Event
																								.stop(e);
																						if (select.timeOutId)
																							window
																									.clearTimeout(select.timeOutId);
																					}
																							.bind(this))
																	if (select
																			.hasClassName('selectDiv'))
																		contentUl
																				.appendChild(li);
																	else
																		ulSelect
																				.appendChild(li);
																}.bind(this))
												if (select
														.hasClassName('selectDiv')) {
													$(contentDiv).appendChild(
															$(contentUl));
													Event
															.observe(
																	$(contentDiv),
																	'mouseover',
																	function(e) {
																		Event
																				.stop(e);
																		if (select.timeOutId)
																			window
																					.clearTimeout(select.timeOutId);
																	}
																			.bind(this))
													$(contentLi).appendChild(
															$(contentDiv));
													$(ulSelect).appendChild(
															contentLi);
												}
												select.insert( {
													after : $(ulSelect)
												});
												select.setStyle( {
													position : 'absolute',
													left : '-5000px'
												});
											}.bind(this));
						}.bind(this));
			},
			openCustomSelect : function(e, select) {
				Event.stop(e);
				if (select.timeOutId)
					window.clearTimeout(select.timeOutId);
				select.timeOutId = null;
				var li = Event.findElement(e, 'li');
				var ul = li.up('ul');
				if (li.getAttribute("state") == 1) {
					li.setAttribute("state", 0);
					$$('#' + ul.id + ' div.ulDropDown').invoke('hide');
					$$('#' + ul.id + " li.liOptions").invoke('hide');
					return;
				}
				li.setAttribute("state", 1);
				$$('#' + ul.id + ' div.ulDropDown').invoke('show');
				$$('#' + ul.id + " li.liOptions").invoke('show');
			},
			selectCustomOptions : function(e, select) {
				Event.stop(e);
				var li = Event.findElement(e, 'li');
				var ul = Event.findElement(e, 'ul.ulSelect');
				var selectedIndex = li.id.split('_')[1];
				select.selectedIndex = parseInt(selectedIndex);
				var firstColumn = ul.down('li.liResult');
				firstColumn.down('div').update(li.firstChild.nodeValue);
				firstColumn.setAttribute("state", 0);
				$$('#' + ul.id + ' div.ulDropDown').invoke('hide');
				$$('#' + ul.id + " li.liOptions").invoke('hide');
				if (select.timeOutId)
					window.clearTimeout(select.timeOutId);
				if (this.customEvent[select.id] != undefined)
					select.fire(this.customEvent[select.id]);
			},
			changeFieldState : function(e) {
				Event.stop(e);
				var elt = Event.findElement(e, 'input');
				if (!elt)
					elt = Event.findElement(e, 'textarea');
				if (!elt)
					return;
				if (e.type == 'focus') {
					elt.addClassName('focusInput');
					if ($F(elt).empty()
							|| $F(elt) == elt.getAttribute('defaultValue'))
						elt.setValue('');
					return;
				}
				if (elt.getAttribute("vtype") == "email"
						&& !this.checkMail($F(elt))) {
					elt.removeClassName('focusInput');
					elt.setValue(elt.getAttribute('defaultValue'));
					if (elt.id == 'newsletterMail')
						elt.next('input[type=submit]').disable();
					return;
				} else if ($F(elt).empty()
						|| $F(elt) == elt.getAttribute('defaultValue')) {
					elt.removeClassName('focusInput');
					elt.setValue(elt.getAttribute('defaultValue'));
					if (elt.id == 'newsletterMail')
						elt.next('input[type=submit]').disable();
					if (elt.next('input[type=submit]', 1)
							&& !elt.hasClassName('nocheck'))
						elt.next('input[type=submit]', 1).disable();
					return;
				}
				if (elt.next('input[type=submit]', 1))
					elt.next('input[type=submit]').enable();
				if (elt.id == 'newsletterMail')
					elt.next('input[type=submit]').enable();
			},
			setShopsMaps : function(index) {
				if (GBrowserIsCompatible()) {
					address = this.shopData[index].address;
					var geocoder = new GClientGeocoder();
					geocoder.getLocations(address, this.displayMap.bind(this,
							index));
				}
			},
			displayMap : function(index, response) {
				var place = response.Placemark[0];
				latLng = new GLatLng(place.Point.coordinates[1],
						place.Point.coordinates[0]);
				var map = new GMap2(this.mapPlaceHolder);
				map.disableDragging();
				var customIcon = new GIcon(G_DEFAULT_ICON);
				customIcon.image = "/templates/citadiumTemplate/images/assets/mapIcon.png";
				customIcon.iconSize = new GSize(39, 38);
				marker = new GMarker(latLng, {
					icon : customIcon
				});
				map.addOverlay(marker);
				var url = "http://maps.google.fr/maps?f=q&source=s_q&hl=fr&geocode=&q="
						+ this.shopData[index].address
						+ "&ie=UTF8&hq=Citadium,&hnear=Paris&ll="
						+ place.Point.coordinates[1]
						+ ","
						+ place.Point.coordinates[0] + "&z=14&iwloc=B"
				GEvent.addListener(marker, 'click', function() {
					window.open(url);
				}.bind(this));
				var imgZoom = Builder
						.node(
								"a",
								{
									href : url,
									target : "_blank",
									className : "zoomMaps"
								},
								[ Builder
										.node(
												"img",
												{
													src : "/templates/citadiumTemplate/images/assets/zoomMaps.png"
												}) ]);
				var contDim = map.getContainer().getDimensions();
				$(imgZoom).setStyle( {
					left : contDim.width - 26 + 'px'
				});
				map.setCenter(latLng, 15);
				map.getContainer().appendChild(imgZoom);
			},
			streetLookVote : function(e) {
				Event.stop(e);
				var elt = Event.findElement(e, 'a');
				var bgModal = Builder.node('div', {
					className : 'modalBg',
					id : 'modal_' + elt.id
				});
				var parents = elt.ancestors();
				$(bgModal).setOpacity(0.5);
				var waitDiv = Builder.node('div', {
					className : 'ajaxLoader streetLook',
					id : 'loader_' + elt.id
				})
				$(waitDiv).update(this.lang.wait);
				parents[1].appendChild(bgModal);
				parents[1].appendChild(waitDiv);
				var params = $('streetlookVoteForm').serialize(true);
				params.itemId = elt.id.split('_')[1];
				params.task = "doVote";
				params.voteState = elt.hasClassName('star') ? -1 : 1;
				this.ajaxRequest(document.location.href, params,
						this.voteCallBack.bind(this, parents[1], elt));
			},
			voteCallBack : function(parents, elt, response) {
				parents.removeChild($('modal_' + elt.id));
				parents.removeChild($('loader_' + elt.id));
				if (response.voted == 1)
					return this.displayAlert(parents, response.message);
				var title = (!elt.hasClassName('star') ? 'je n\'aime plus '
						: 'j\'aime ')
						+ elt.id.split('_')[0];
				elt.title = title;
				if (!elt.hasClassName('star'))
					elt.addClassName('star');
				else
					elt.removeClassName('star');
				return this.displayAlert(parents, response.message);
			},
			displayAlert : function(container, msg) {
				if ($('alertDiv'))
					$('alertDiv').up('div').removeChild($('alertDiv'));
				var mainContainer = Builder
						.node(
								'div',
								{
									style : 'height:30px; position:absolute;z-index:999;top:0px; width:100%;overflow:hidden ',
									id : 'alertDiv'
								})
				var effectContainer = Builder
						.node(
								'div',
								{
									style : 'height:30px; position:absolute;z-index:999; width:100%'
								});
				var bgModal = Builder.node('div', {
					className : 'modalBg',
					style : "height:30px"
				});
				$(bgModal).setOpacity(0.5);
				effectContainer.appendChild(bgModal);
				var waitDiv = Builder
						.node(
								'div',
								{
									className : 'alertMsg',
									style : "color:white; font-size:10px; font-weight:bold; position:absolute; z-index:999; top:10px; width:100%; text-align:center;"
								})
				$(waitDiv).update(msg);
				effectContainer.appendChild(waitDiv);
				mainContainer.appendChild(effectContainer);
				$(container).appendChild(mainContainer);
				Effect.SlideUp(mainContainer, {
					delay : 4
				});
			},
			streetLookPagination : function(e) {
				Event.stop(e);
				var aEl = Event.findElement(e, 'a');
				if (aEl.hasClassName('current'))
					return;
				var params = aEl.href.toQueryParams();
				$('pageStreetLook').value = params.page;
				$('streetlookPagination').submit();
			},
			checkformStreetLook : function(e) {
				$$('.inputDiv').each(function(div) {
					var dim = div.getDimensions();
					div.setStyle( {
						height : dim.height + 'px',
						width : dim.width + 'px'
					});
				});
				Event.stop(e);
				var isFlashUpload = $('photoInput').tagName == "OBJECT";
				$$('#formStreetLook .inputError').invoke('removeClassName',
						'inputError');
				if (isFlashUpload)
					$('photoInput').displayError();
				var params = $('formStreetLook').serialize(true);
				var error = 0;
				if (params.prenom == $('prenom').getAttribute('defaultValue')) {
					error++;
					$('prenom').up('div.inputContainer').addClassName(
							'inputError');
				}
				if (!this.checkMail(params.email)) {
					error++;
					$('email').up('div.inputContainer').addClassName(
							'inputError');
				}
				var regImage = /^\S+\.(jpg|jpeg)$/;
				photo = isFlashUpload ? $('photoInput').getFileValue()
						: params.photo;
				if (!regImage.exec(photo.toLowerCase())) {
					error++;
					if (!isFlashUpload)
						$('photo').up('div.inputContainer').addClassName(
								'inputError');
					else
						$('photoInput').displayError(true);
				}
				if (!params.sexe) {
					error++;
					$('fRadio').previous('div').addClassName('inputError');
				}
				if (!params.checkValid) {
					error++;
					$('checkValid').next('label').addClassName('inputError');
				}
				if (error > 0)
					return;
				$$('.inputDiv div.contInput').invoke('hide');
				if (isFlashUpload)
					$('photoInput').submitForm(params);
				return;
				$('formInputs').hide();
				$('formLoader').show();
				this.pe = new PeriodicalExecuter(this.ajaxRequest(
						"/inc/getFakeUploadProgress.php", {},
						this.updateProgress.bind(this)), 2);
			},
			updateProgress : function(response) {
				this.pe.stop();
				var progress = response.progress < 100 ? response.progress
						: 100;
				$('progressBar').setStyle( {
					width : Math.round(progress / 100 * 406) + "px"
				});
				$('pourcLoad').update(progress);
				if (progress < 100)
					return this.pe = new PeriodicalExecuter(this.ajaxRequest(
							"/inc/getFakeUploadProgress.php", {},
							this.updateProgress.bind(this)), 2);
				$('formLoader').update(
						this.lang.loadingSuccess + '<br /><br />');
				var btnOK = Builder.node('a', {
					href : "#",
					className : 'linkBackForm'
				}, 'OK')
				Event.observe($(btnOK), 'click', function(e) {
					Event.stop(e);
					$('formLoader').hide();
					$$('.inputDiv').invoke('show');
					$('formStreetLook').reset();
				});
				$('formLoader').appendChild(btnOK);
			},
			uploadCallback : function() {
				$('formInputs').hide();
				$('formLoader').show();
				$('formLoader').update(
						this.lang.loadingSuccess + '<br /><br />');
				var btnOK = Builder.node('a', {
					href : "#",
					className : 'linkBackForm'
				}, 'OK')
				Event.observe($(btnOK), 'click', function(e) {
					Event.stop(e);
					$('formLoader').hide();
					$('formInputs').show();
					$$('.inputDiv div.contInput').invoke('show');
					$$('#formStreetLook img.radioBtn').invoke('setAttribute',
							'src', '/images/assets/radioBtnOff.png');
					this.createSwfObject(this.streetLookUploader);
					$$('#formStreetLook img.checkBox').invoke('setAttribute',
							'src', '/images/assets/checkboxOff.png');
					$('formStreetLook').reset();
				}.bind(this));
				$('formLoader').appendChild(btnOK);
			},
			ajaxRequest : function(url, params, callBack) {
				var callback = callBack || function(response) {
					console.log(response);
				};
				new Ajax.Request(url, {
					method : 'post',
					parameters : params,
					sanitizeJSON : true,
					onSuccess : function(response) {
						if (!response.headerJSON) {
							return callBack(response.responseText.evalJSON());
						}
						return callback(response.responseJSON);
					}
				});
			},
			createSwfObject : function(swfObj) {
				swfObj
						.each(function(swf) {
							if (!swf.attributes)
								swf.attributes = {};
							swfobject
									.embedSWF(
											swf.movie,
											swf.targetID,
											swf.dim.width,
											swf.dim.height,
											"9.0.0",
											"/templates/citadiumTemplate/_js/swfobject/expressInstall.swf",
											swf.flashvars, swf.attributes);
						});
			},
			openSend2Friend : function(e) {
				Event.stop(e);
				var x = ($('bodyElt').getWidth() - $('send2FriendWin')
						.getWidth()) / 2;
				var y = 200;
				x = x < 0 ? 0 : x;
				$('send2FriendWin').setStyle( {
					top : y + 'px',
					left : x + 'px',
					position : 'fixed',
					zIndex : 999
				});
				$('send2FriendWin').show();
				$('modalBg').show();
			},
			sendFormSend2Friend : function(e) {
				Event.stop(e);
				if (!this.checkSend2FriendForm(e))
					return;
				dim = $('send2FriendDiv').getDimensions();
				$('send2FriendDiv').setStyle( {
					width : dim.width + 'px',
					height : dim.height + 'px'
				})
				var params = $('send2FriendForm').serialize(true);
				$('send2FriendForm').hide();
				$('send2FriendWait').show();
				params.fromURL = document.location.href;
				params.title = document.title;
				this.ajaxRequest('/index.php', params, function(response) {
					$('send2FriendMessage').update(response.message);
					$('send2FriendMessage').show();
					$('send2FriendWait').hide();
				})
			},
			checkSend2FriendForm : function(e) {
				Event.stop(e);
				var isGood = false;
				var erreur = 0;
				$$('#send2FriendForm input[type=text]').each(
						function(elt) {
							if ($F(elt) == $(elt).getAttribute('defaultvalue')
									|| $(elt).getAttribute('vtype') == 'email'
									&& !this.checkMail($F(elt)))
								erreur++;
						}.bind(this))
				if (erreur > 0) {
					$('submitSend2Friend').disable();
					return false;
				}
				$('submitSend2Friend').enable();
				return true;
			},
			openBloggerWin : function(e) {
				Event.stop(e);
				var elt = Event.findElement(e, 'a');
				var langItem = this.lang.blogger[elt.id];
				var imgParams = $('blogTitle').getAttribute('src')
						.toQueryParams();
				imgParams.text = encodeURIComponent(langItem.title);
				$('blogTitle').setAttribute(
						'src',
						'/inc/citadiumTitle.php?'
								+ $H(imgParams).toQueryString())
				$('copyPasteText').update(langItem.copyText);
				$('blogueurCode').value = '<iframe src="'
						+ this.lang.blogger.link
						+ '?feed=blog&lang='
						+ this.lang.currLang
						+ '" scrolling="no" frameborder="no" style="width:286px; height:400px"></iframe>';
				$('blogueurCode').setAttribute('defaultvalue',
						$F('blogueurCode'));
				var x = ($('bodyElt').getWidth() - $('blogueurWin').getWidth()) / 2;
				var y = 200;
				x = x < 0 ? 0 : x;
				$('blogueurWin').setStyle( {
					top : y + 'px',
					left : x + 'px',
					position : 'fixed',
					zIndex : 999
				});
				$('blogueurWin').show();
				$('modalBg').show();
				$('blogueurCode').focus();
				$('blogueurCode').activate();
			},
			checkNewsletterForm : function(e) {
				Event.stop(e);
				var params = $('contactForm').serialize(true);
				var erreur = 0;
				$$('div.inputError').invoke('removeClassName', 'inputError');
				if (params.prenom == $('contact_prenom').getAttribute(
						'defaultvalue')) {
					$('contact_prenom').up('div').addClassName('inputError');
					erreur++;
				}
				if (params.nom == $('contact_nom').getAttribute('defaultvalue')) {
					$('contact_nom').up('div').addClassName('inputError');
					erreur++;
				}
				if (!this.checkMail(params.email)) {
					$('contact_email').up('div').addClassName('inputError');
					erreur++;
				}
				if (params.cp == $('contact_codepostal').getAttribute(
						'defaultvalue')) {
					$('contact_codepostal').up('div')
							.addClassName('inputError');
					erreur++;
				}
				if (params.optin == undefined) {
					$('optin_no').up('div').addClassName('inputError');
					erreur++;
				}
				if (params.ville == $('contact_ville').getAttribute(
						'defaultValue'))
					params.ville = "";
				if (erreur > 0)
					return;
				params.format = 'raw';
				dim = $('contactForm').getDimensions();
				$('contactForm').setStyle( {
					width : dim.width + 'px',
					height : dim.height + 'px'
				});
				var node = Builder.node('div', {
					className : 'ajaxLoader',
					style : 'margin-top:50px; font-weight:bold;width:200px'
				});
				$(node).update('Merci de patienter');
				$('contactForm').update();
				$('contactForm').appendChild(node);
				this.ajaxRequest($('contactForm').action, params,
						this.processNewsletterForm.bind(this));
			},
			processNewsletterForm : function(response) {
				var node = Builder
						.node(
								'div',
								{
									style : 'margin:auto;margin-top:50px; font-weight:bold;text-align:center; width:300px; '
								});
				$(node).update(response.message);
				$('contactForm').update();
				$('contactForm').appendChild(node);
			},
			checkContactForm : function(e) {
				Event.stop(e);
				var dim = $('contactForm').getDimensions();
				$('contactForm').setStyle( {
					width : dim.width + 'px',
					height : dim.height + 'px'
				});
				$$('#contactForm div.inputError').invoke('removeClassName',
						'inputError');
				this.contactFieldsObj.required.each(function(elt) {
					if ($F(elt).empty()
							|| $F(elt) == $(elt).getAttribute('defaultValue'))
						$('div' + elt).addClassName('inputError');
					if ($(elt).tagName == "SELECT"
							&& ($F(elt) == -1 || $F(elt) == '#'))
						$('div' + elt).addClassName('inputError');
				}.bind(this));
				if ($$('#contactForm div.inputError').length > 0)
					return;
				this.contactFieldsObj.emailCheck.each(function(elt) {
					if (!this.checkMail($F(elt)))
						$('div' + elt).addClassName('inputError');
				}.bind(this));
				if ($$('#contactForm div.inputError').length > 0)
					return;
				$('contactForm').setAttribute("target", "_hiddenFrame");
				$('ajaxDiv').addClassName('ajaxLoader');
				$('ajaxDiv').setStyle( {
					width : '200px',
					fontWeight : 'bold'
				});
				if ($F('aics_fichier') != $('fakeaics_fichier').getAttribute(
						'defaultvalue')
						&& $F('aics_fichier') != '') {
					$('contactForm').action = 'index.php?option=com_aicontactsafe&field=aics_fichier&r_id='
							+ $F('r_id') + '&format=raw';
					$('task').value = 'uploadFile';
					$('contactForm').hide();
					$('ajaxDiv').update(this.lang.contactForm.loadPicture);
					$('ajaxDiv').show();
					return $('contactForm').submit();
				}
				this.submitContactForm();
			},
			endUploadFile : function(pf, file_field, attachment_name,
					attachment_id, error_type, error_message) {
				error_type = parseInt(error_type);
				switch (error_type) {
				case 0:
					var input = Builder.node('input', {
						type : 'hidden',
						name : file_field + '_attachment_name',
						value : attachment_name
					});
					$('contactForm').appendChild(input);
					var input = Builder.node('input', {
						type : 'hidden',
						name : file_field + '_attachment_id',
						value : attachment_id
					});
					$('contactForm').appendChild(input);
					break;
				case 1:
					break;
				case 2:
					break;
				case 3:
					break;
				}
				this.submitContactForm();
			},
			submitContactForm : function() {
				$('task').setValue('ajaxform');
				$('use_ajax').setValue('1');
				var params = $('contactForm').serialize(true);
				this.contactFieldsObj.fields.each(function(field) {
					if (params[field] == $(field).getAttribute('defaultvalue')
							|| params[field] == '#')
						params[field] = '';
				}.bind(this));
				$('contactForm').action = '/index.php';
				$('contactForm').hide();
				$('ajaxDiv').update(this.lang.contactForm.sendForm);
				$('ajaxDiv').show();
				this.ajaxRequest('/index.php', params, function(response) {
					$('ajaxDiv').removeClassName('ajaxLoader');
					$('ajaxDiv').setStyle( {
						fontWeight : 'normal',
						width : 'auto',
						textAlign : 'center'
					});
					$('ajaxDiv').update(
							this.lang.contactForm.sendComplete
									+ '<br /><br /><a href=\"/\"><b>'
									+ this.lang.contactForm.back + '</b></a>');
				}.bind(this));
			},
			checkMail : function(email) {
				var reg = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]{2,}[.][a-z]{2,3}$/;
				return (reg.exec(email) != null)
			}
		});
if (typeof console != "object") {
	var console = {
		log : function(text) {
			return;
		}
	}
}
