/**
 * Copyright 2009-2011 | Fabrice Creuzot (luigifab) <code~luigifab~info>
 * (2.4.1) http://www.luigifab.info/apijs
 *
 * This program is free software, you can redistribute it or modify
 * it under the terms of the GNU General Public License (GPL) as published
 * by the free software foundation, either version 2 of the license, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but without any warranty, without even the implied warranty of
 * merchantability or fitness for a particular purpose. See the
 * GNU General Public License (GPL) for more details.
 */
function Dialogue() {
	this.offset = 0;
	this.hiddenPage = false;
	this.dialogType = null;
	this.image = null;
	this.timer = null;
	this.timerbis = null;
	this.callback = null;
	this.params = null;
	this.fragment = null;
	this.elemA = null;
	this.elemB = null;
	this.elemC = null;
	this.elemD = null;
	this.dialogInformation = function (title, text, icon) {
		if ((typeof title === 'string') && (typeof text === 'string')) {
			this.setupDialogue('information', icon);
			this.htmlParent(false);
			this.htmlTitle(title);
			this.htmlText(text);
			this.htmlButtonOk();
			this.showDialogue();
			document.getElementById('box').lastChild.firstChild.focus();
		}
		else if (apijs.config.debug) {
			this.dialogInformation(apijs.i18n.translate('debugInvalidCall'), '[pre]TheDialogue » dialogInformation[br]➩ (string) title : ' + title + '[br]➩ (string) text : ' + text + '[br]➩ (string) icon : ' + icon + '[/pre]');
		}
	};
	this.dialogConfirmation = function (title, text, callback, params, icon) {
		if ((typeof title === 'string') && (typeof text === 'string') && (typeof callback === 'function') && (typeof params !== 'undefined')) {
			this.setupDialogue('confirmation', icon);
			this.htmlParent(false);
			this.htmlTitle(title);
			this.htmlText(text);
			this.htmlButtonConfirm('button');
			this.callback = callback;
			this.params = params;
			this.showDialogue();
			document.getElementById('box').lastChild.firstChild.focus();
		}
		else if (apijs.config.debug) {
			if ((typeof callback === 'function') && (typeof callback.name === 'string') && (callback.name.length > 0))
				callback = callback.name;
			this.dialogInformation(apijs.i18n.translate('debugInvalidCall'), '[pre]TheDialogue » dialogConfirmation[br]➩ (string) title : ' + title + '[br]➩ (string) text : ' + text + '[br]➩ (function) callback : ' + callback + '[br]➩ (object) params : ' + params + '[br]➩ (string) icon : ' + icon + '[/pre]');
		}
	};
	this.dialogFormOptions = function (title, text, callback, params, action, icon) {
		if ((typeof title === 'string') && (typeof text === 'string') && (typeof callback === 'function') && (typeof params !== 'undefined') && (typeof action === 'string')) {
			this.setupDialogue('options', icon);
			this.htmlFormParent(action);
			this.htmlTitle(title);
			this.htmlText(text);
			this.htmlButtonConfirm('submit');
			this.callback = callback;
			this.params = params;
			this.showDialogue();
		}
		else if (apijs.config.debug) {
			if ((typeof callback === 'function') && (typeof callback.name === 'string') && (callback.name.length > 0))
				callback = callback.name;
			this.dialogInformation(apijs.i18n.translate('debugInvalidCall'), '[pre]TheDialogue » dialogFormOptions[br]➩ (string) title : ' + title + '[br]➩ (string) text : ' + text + '[br]➩ (function) callback : ' + callback + '[br]➩ (object) params : ' + params + '[br]➩ (string) action : ' + action + '[br]➩ (string) icon : ' + icon + '[/pre]');
		}
	};
	this.dialogFormUpload = function (title, text, data, key, icon) {
		if ((typeof title === 'string') && (typeof text === 'string') && (typeof key === 'string') && (typeof data === 'string')) {
			this.setupDialogue('upload', icon);
			this.htmlFormParent(apijs.config.dialogue.fileUpload, 'multipart/form-data', 'iframeUpload.' + key);
			this.htmlTitle(title);
			this.htmlText(text);
			this.htmlFormUpload(data, key);
			this.htmlButtonConfirm('submit');
			this.showDialogue();
			window.setTimeout(function () { document.getElementById('box').getElementsByTagName('input')[1].focus(); }, 0);
		}
		else if (apijs.config.debug) {
			this.dialogInformation(apijs.i18n.translate('debugInvalidCall'), '[pre]TheDialogue » dialogFormUpload[br]➩ (string) title : ' + title + '[br]➩ (string) text : ' + text + '[br]➩ (string) data : ' + data + '[br]➩ (string) key : ' + key + '[br]➩ (string) icon : ' + icon + '[/pre]');
		}
	};
	this.dialogProgress = function (title, text) {
		if ((typeof title === 'string') && (typeof text === 'string')) {
			this.setupDialogue('progress');
			this.htmlParent(false);
			this.htmlTitle(title);
			this.htmlText(text);
			this.htmlProgressBar();
			this.showDialogue();
			this.timer = window.setTimeout(apijs.dialogue.htmlLinkReload, 30000);
		}
		else if (apijs.config.debug) {
			this.dialogInformation(apijs.i18n.translate('debugInvalidCall'), '[pre]TheDialogue » dialogProgress[br]➩ (string) title : ' + title + '[br]➩ (string) text : ' + text + '[/pre]');
		}
	};
	this.dialogWaiting = function (title, text, time) {
		if ((typeof title === 'string') && (typeof text === 'string')) {
			this.setupDialogue('waiting');
			this.htmlParent(false);
			this.htmlTitle(title);
			this.htmlText(text);
			this.showDialogue();
			this.timer = window.setTimeout(apijs.dialogue.htmlLinkReload, (typeof time === 'number') ? time : 6000);
		}
		else if (apijs.config.debug) {
			this.dialogInformation(apijs.i18n.translate('debugInvalidCall'), '[pre]TheDialogue » dialogWaiting[br]➩ (string) title : ' + title + '[br]➩ (string) text : ' + text + '[br]➩ (number) time : ' + time + '[/pre]');
		}
	};
	this.dialogPhoto = function (width, height, url, name, date, legend, slideshow) {
		if ((typeof width === 'number') && (typeof height === 'number') && (typeof url === 'string') && (typeof name === 'string') && (typeof date === 'string') && (typeof legend === 'string')) {
			if ((typeof slideshow === 'boolean') && (slideshow === true)) {
				this.setupDialogue('photo slideshow');
				this.htmlParent(true);
			}
			else {
				this.setupDialogue('photo');
				this.htmlParent(false);
			}
			this.htmlPhoto(width, height, url, name, date, legend);
			this.htmlButtonClose();
			this.htmlButtonNavigation();
			this.showDialogue();
			this.loadImage(width, height, url);
		}
		else if (apijs.config.debug) {
			this.dialogInformation(apijs.i18n.translate('debugInvalidCall'), '[pre]TheDialogue » dialogPhoto[br]➩ (number) width : ' + width + '[br]➩ (number) height : ' + height + '[br]➩ (string) url : ' + url + '[br]➩ (string) name : ' + name + '[br]➩ (string) date : ' + date + '[br]➩ (string) legend : ' + legend + '[/pre]');
		}
	};
	this.dialogVideo = function (url, name, date, legend, slideshow) {
		if ((typeof url === 'string') && (typeof name === 'string') && (typeof legend === 'string') && (typeof legend === 'string')) {
			if ((typeof slideshow === 'boolean') && (slideshow === true)) {
				this.setupDialogue('video slideshow');
				this.htmlParent(true);
			}
			else {
				this.setupDialogue('video');
				this.htmlParent(false);
			}
			this.htmlVideo(url, name, date, legend);
			this.htmlButtonClose();
			this.htmlButtonNavigation();
			this.showDialogue();
		}
		else if (apijs.config.debug) {
			this.dialogInformation(apijs.i18n.translate('debugInvalidCall'), '[pre]TheDialogue » dialogVideo[br]➩ (string) url : ' + url + '[br]➩ (string) name : ' + name + '[br]➩ (string) date : ' + date + '[br]➩ (string) legend : ' + legend + '[/pre]');
		}
	};
	this.actionClose = function (all) {
		if (all) {
			apijs.dialogue.deleteDialogue(true);
			apijs.dialogue.showPage();
		}
		else {
			apijs.dialogue.deleteDialogue(false);
		}
	};
	this.actionConfirm = function () {
		var result = false;
		if (this.dialogType.indexOf('confirmation') > -1) {
			this.dialogType += ' lock';
			if (!apijs.config.dialogue.savingDialog) {
				this.elemA = document.createElement('p');
				this.elemA.setAttribute('class', 'saving');
				this.elemA.appendChild(document.createTextNode(apijs.i18n.translate('operationInProgress')));
				document.getElementById('box').removeChild(document.getElementById('box').lastChild);
				document.getElementById('box').lastChild.setAttribute('class', 'novisible');
				document.getElementById('box').appendChild(this.elemA);
				this.timer = window.setTimeout(apijs.dialogue.htmlLinkReload, 6000);
			}
			else {
				this.dialogWaiting(document.getElementById('box').firstChild.firstChild.nodeValue, apijs.i18n.translate('operationInProgress'));
			}
			if (apijs.config.dialogue.savingTime > 500) {
				this.timerbis = window.setTimeout(function () {
					if (typeof apijs.dialogue.callback === 'function')
						apijs.dialogue.callback(apijs.dialogue.params);
				}, apijs.config.dialogue.savingTime);
			}
			else {
				apijs.dialogue.callback(apijs.dialogue.params);
			}
			result = true;
		}
		else if (this.dialogType.indexOf('options') > -1) {
			if (apijs.dialogue.callback(apijs.dialogue.clone(apijs.dialogue.params)) === true) {
				this.dialogType += ' lock';
				this.elemA = document.createElement('p');
				this.elemA.setAttribute('class', 'saving');
				this.elemA.appendChild(document.createTextNode(apijs.i18n.translate('operationInProgress')));
				document.getElementById('box').removeChild(document.getElementById('box').lastChild);
				document.getElementById('box').lastChild.setAttribute('class', 'novisible');
				document.getElementById('box').appendChild(this.elemA);
				this.timer = window.setTimeout(apijs.dialogue.htmlLinkReload, 6000);
				if (apijs.config.dialogue.savingTime > 500) {
					this.timerbis = window.setTimeout(function () {
						if (document.getElementById('box') && (document.getElementById('box').nodeName.toLowerCase() === 'form'))
							document.getElementById('box').submit();
					}, apijs.config.dialogue.savingTime);
				}
				else {
					result = true;
				}
			}
		}
		else if (this.dialogType.indexOf('upload') > -1) {
			if ((typeof Upload === 'function') && (apijs.upload instanceof Upload)) {
				if (apijs.upload.actionConfirm() === true) {
					this.dialogType += ' lock';
					result = true;
				}
			}
			else if (apijs.config.debug) {
				this.dialogInformation(apijs.i18n.translate('debugInvalidUse'), '[pre]TheDialogue » actionConfirm[br]➩ TheUpload ' + apijs.i18n.translate('debugNotExist') + '[/pre]');
			}
		}
		return result;
	};
	this.actionKey = function (ev) {
		if (apijs.config.debugkey) {
			ev.preventDefault();
			apijs.dialogue.dialogInformation(apijs.i18n.translate('debugKeyDetected'), '[pre]TheDialogue » actionKey[br]' + apijs.i18n.translate('debugKeyCode', ev.keyCode) + '[/pre]');
		}
		else if ((ev.keyCode !== 27) && (ev.keyCode !== 35) && (ev.keyCode !== 36) && (ev.keyCode !== 37) && (ev.keyCode !== 39)) {
			return;
		}
		else if (ev.keyCode === 27) {
			if ((apijs.dialogue.dialogType.indexOf('waiting') > -1) || (apijs.dialogue.dialogType.indexOf('progress') > -1) ||
			 (apijs.dialogue.dialogType.indexOf('lock') > -1)) {
				ev.preventDefault();
			}
			else {
				ev.preventDefault();
				apijs.dialogue.actionClose(true);
			}
		}
		else if (apijs.dialogue.dialogType.indexOf('slideshow') > -1) {
			if (ev.keyCode === 35) {
				ev.preventDefault();
				apijs.slideshow.actionLast();
			}
			else if (ev.keyCode === 36) {
				ev.preventDefault();
				apijs.slideshow.actionFirst();
			}
			else if (ev.keyCode === 37) {
				ev.preventDefault();
				apijs.slideshow.actionPrev();
			}
			else if (ev.keyCode === 39) {
				ev.preventDefault();
				apijs.slideshow.actionNext();
			}
		}
	};
	this.setupDialogue = function (type, icon) {
		var actionHidden = false, actionShow = false, id = null;
		if (this.dialogType !== null) {
			if (this.dialogType.indexOf('slideshow') > -1) {
					if (!this.hiddenPage && apijs.config.dialogue.hiddenPage)
						actionHidden = true;
					else if (this.hiddenPage && !apijs.config.dialogue.hiddenPage)
						actionShow = true;
			}
			else {
				if (!this.hiddenPage && apijs.config.dialogue.hiddenPage)
					actionHidden = true;
				else if (this.hiddenPage && !apijs.config.dialogue.hiddenPage)
					actionShow = true;
			}
		}
		else {
			if (type.indexOf('slideshow') > -1) {
				if (!this.hiddenPage && apijs.config.slideshow.hiddenPage)
					actionHidden = true;
			}
			else {
				if (!this.hiddenPage && apijs.config.dialogue.hiddenPage)
					actionHidden = true;
			}
		}
		if ((this.dialogType !== null) && (this.dialogType.indexOf('slideshow') > -1)) {
			this.deleteDialogue(false);
			document.getElementById('dialogue').setAttribute('class', document.getElementById('dialogue').getAttribute('class').replace(' slideshow', ''));
		}
		else if (this.dialogType !== null) {
			this.deleteDialogue(false);
		}
		if (actionHidden) {
			if ((window.pageYOffset > 0) || (this.offset > 0))
				this.offset = window.pageYOffset;
			for (id in apijs.config.dialogue.blocks) if (apijs.config.dialogue.blocks.hasOwnProperty(id))
				document.getElementById(apijs.config.dialogue.blocks[id]).setAttribute('class', 'nodisplay');
		}
		else if (actionShow) {
			this.showPage();
		}
		if (apijs.config.navigator)
			document.addEventListener('keydown', apijs.dialogue.actionKey, false);
		this.dialogType = (typeof icon !== 'string') ? type : (type + ' ' + icon);
		this.hiddenPage = (actionHidden || this.hiddenPage) ? true : false;
		this.fragment = document.createDocumentFragment();
	};
	this.showDialogue = function () {
		if (document.getElementById('dialogue')) {
			this.fragment.firstChild.setAttribute('class', this.fragment.firstChild.getAttribute('class').replace('init', 'actif'));
			document.getElementById('dialogue').appendChild(this.fragment.firstChild.firstChild);
		}
		else if (!apijs.config.transition) {
			this.fragment.firstChild.setAttribute('class', this.fragment.firstChild.getAttribute('class').replace('init', 'actif'));
			document.getElementsByTagName('body')[0].appendChild(this.fragment);
		}
		else {
			document.getElementsByTagName('body')[0].appendChild(this.fragment);
			window.setTimeout(function () { document.getElementById('dialogue').setAttribute('class', document.getElementById('dialogue').getAttribute('class').replace('init', 'actif')); }, 1);
		}
	};
	this.deleteDialogue = function (total) {
		if (this.timer)
			clearTimeout(this.timer);
		if (apijs.config.navigator)
			document.removeEventListener('keydown', apijs.dialogue.actionKey, false);
		if (apijs.config.navigator && (document.getElementById('dialogue').getElementsByTagName('video').length > 0)) {
			if (typeof document.getElementById('dialogue').getElementsByTagName('video')[0].pause === 'function')
				document.getElementById('dialogue').getElementsByTagName('video')[0].pause();
		}
		if (apijs.config.transition && total) {
			document.getElementById('dialogue').setAttribute('class', document.getElementById('dialogue').getAttribute('class').replace('actif', 'deleting lock'));
			if (typeof document.getElementById('dialogue').style.transitionDuration === 'string')
				document.getElementById('dialogue').addEventListener('transitionEnd', function () { document.getElementById('dialogue').parentNode.removeChild(document.getElementById('dialogue')); }, false);
			else if (typeof document.getElementById('dialogue').style.OTransitionDuration === 'string')
				document.getElementById('dialogue').addEventListener('OTransitionEnd', function () { document.getElementById('dialogue').parentNode.removeChild(document.getElementById('dialogue')); }, false);
			else if (typeof document.getElementById('dialogue').style.MozTransitionDuration === 'string')
				document.getElementById('dialogue').addEventListener('transitionend', function () { document.getElementById('dialogue').parentNode.removeChild(document.getElementById('dialogue')); }, false);
			else if (typeof document.getElementById('dialogue').style.webkitTransitionDuration === 'string')
				document.getElementById('dialogue').addEventListener('webkitTransitionEnd', function () { document.getElementById('dialogue').parentNode.removeChild(document.getElementById('dialogue')); }, false);
		}
		else if (total) {
			document.getElementById('dialogue').parentNode.removeChild(document.getElementById('dialogue'));
		}
		else {
			document.getElementById('box').parentNode.removeChild(document.getElementById('box'));
		}
		this.dialogType = null;
		this.image = null;
		this.timer = null;
		this.fragment = null;
		this.elemA = null;
		this.elemB = null;
		this.elemC = null;
		this.elemD = null;
	};
	this.showPage = function () {
		if (document.getElementById('iframeUpload'))
			document.getElementById('iframeUpload').parentNode.removeChild(document.getElementById('iframeUpload'));
		if (this.hiddenPage) {
			for (var id in apijs.config.dialogue.blocks) if (apijs.config.dialogue.blocks.hasOwnProperty(id))
				document.getElementById(apijs.config.dialogue.blocks[id]).removeAttribute('class');
			window.scrollBy(0, this.offset);
		}
		this.offset = 0;
		this.hiddenPage = false;
		if (this.timerbis)
			clearTimeout(this.timerbis);
		this.timerbis = null;
		this.callback = null;
		this.params = null;
	};
	this.checkSize = function (width, height) {
		if ((width > (window.innerWidth - 150)) || (height > (window.innerHeight - 110)))
			return true;
		else
			return false;
	};
	this.updateSize = function (width, height, url) {
		var infoMedia = null, infoWindow = null, mimeTypes = null;
		infoMedia = { width: width, height: height, id: url.slice((url.lastIndexOf('/') + 1), url.lastIndexOf('.')), mime: null };
		infoWindow = { width: window.innerWidth, height: window.innerHeight };
		mimeTypes = {
			ogv: 'video/ogg', webm: 'video/webm',
			jpg: 'image/jpeg', jpeg: 'image/jpeg',
			png: 'image/png', gif: 'image/gif',
			svg: 'image/svg+xml'
		};
		infoMedia.mime = url.slice(url.lastIndexOf('.') + 1);
		if (infoMedia.mime in mimeTypes)
			infoMedia.mime = mimeTypes[infoMedia.mime];
		if (this.checkSize(width, height)) {
			infoWindow.width -= 150;
			infoWindow.height -= 110;
			if (infoMedia.width > infoWindow.width) {
				infoMedia.height = Math.floor(infoMedia.height * (infoWindow.width / infoMedia.width));
				infoMedia.width = infoWindow.width;
				if (infoMedia.height > infoWindow.height) {
					infoMedia.width = Math.floor(infoMedia.width * (infoWindow.height / infoMedia.height));
					infoMedia.height = infoWindow.height;
				}
			}
			else if (infoMedia.height > infoWindow.height) {
				infoMedia.width = Math.floor(infoMedia.width * (infoWindow.height / infoMedia.height));
				infoMedia.height = infoWindow.height;
				if (infoMedia.width > infoWindow.width) {
					infoMedia.height = Math.floor(infoMedia.height * (infoWindow.width / infoMedia.width));
					infoMedia.width = infoWindow.width;
				}
			}
		}
		this.fragment.firstChild.firstChild.style.width = infoMedia.width + 'px';
		this.fragment.firstChild.firstChild.style.marginLeft = parseInt(-(infoMedia.width + 20) / 2, 10) + 'px';
		this.fragment.firstChild.firstChild.style.marginTop = parseInt(-(infoMedia.height + 65) / 2, 10) + 'px';
		return infoMedia;
	};
	this.loadImage = function (width, height, url) {
		if (apijs.config.navigator && apijs.config.dialogue.showLoader) {
			this.image = new Image(width, height);
			this.image.src = url;
			this.image.addEventListener('load', function () {
				if (document.getElementById('topho')) {
					document.getElementById('topho').removeAttribute('class');
					document.getElementById('topho').setAttribute('src', apijs.dialogue.image.src);
				}
			}, false);
			this.image.addEventListener('error', function () {
				if (document.getElementById('topho')) {
					if (document.getElementById('topho').getAttribute('class').indexOf('resized') > -1) {
						var img = document.getElementById('topho').cloneNode(true);
						document.getElementById('topho').parentNode.parentNode.removeChild(document.getElementById('topho').parentNode);
						document.getElementById('box').firstChild.firstChild.appendChild(img);
					}
					if (apijs.config.dialogue.savePhoto)
						document.getElementById('box').firstChild.lastChild.removeChild(document.getElementById('box').firstChild.lastChild.lastChild);
					document.getElementById('topho').setAttribute('class', 'error_' + apijs.config.lang);
				}
			}, false);
		}
		else {
			document.getElementById('topho').removeAttribute('class');
			document.getElementById('topho').setAttribute('src', url);
		}
	};
	this.clone = function (data) {
		if ((typeof data !== 'object') || (data === null))
			return data;
		var key = null, newData = new data.constructor();
		for (key in data)
			newData[key] = apijs.dialogue.clone(data[key]);
		return newData;
	};
	this.htmlParent = function (slideshow) {
		this.elemA = document.createElement('div');
		this.elemA.setAttribute('class', ((slideshow) ? 'init slideshow' : 'init'));
		this.elemA.setAttribute('id', 'dialogue');
		this.elemB = document.createElement('div');
		this.elemB.setAttribute('class', this.dialogType);
		this.elemB.setAttribute('id', 'box');
		this.elemA.appendChild(this.elemB);
		this.fragment.appendChild(this.elemA);
	};
	this.htmlFormParent = function (action, enctype, target) {
		this.elemA = document.createElement('div');
		this.elemA.setAttribute('class', 'init');
		this.elemA.setAttribute('id', 'dialogue');
		this.elemB = document.createElement('form');
		this.elemB.setAttribute('action', action);
		this.elemB.setAttribute('method', 'post');
		if (typeof enctype === 'string')
			this.elemB.setAttribute('enctype', enctype);
		if (typeof target === 'string')
			this.elemB.setAttribute('target', target);
		this.elemB.setAttribute('onsubmit', 'return apijs.dialogue.actionConfirm();');
		this.elemB.setAttribute('class', this.dialogType);
		this.elemB.setAttribute('id', 'box');
		this.elemA.appendChild(this.elemB);
		this.fragment.appendChild(this.elemA);
	};
	this.htmlTitle = function (title) {
		this.elemA = document.createElement('h1');
		this.elemA.appendChild(document.createTextNode(title));
		this.fragment.firstChild.firstChild.appendChild(this.elemA);
	};
	this.htmlText = function (data) {
		var bbcode = new BBcode();
		bbcode.init(data);
		bbcode.exec();
		this.fragment.firstChild.firstChild.appendChild(bbcode.get());
	};
	this.htmlButtonOk = function () {
		this.elemA = document.createElement('div');
		this.elemA.setAttribute('class', 'control');
			this.elemB = document.createElement('button');
			this.elemB.setAttribute('type', 'button');
			this.elemB.setAttribute('onclick', 'apijs.dialogue.actionClose(true);');
			this.elemB.setAttribute('class', 'confirm');
			this.elemB.appendChild(document.createTextNode(apijs.i18n.translate('buttonOk')));
		this.elemA.appendChild(this.elemB);
		this.fragment.firstChild.firstChild.appendChild(this.elemA);
	};
	this.htmlButtonConfirm = function (type) {
		this.elemA = document.createElement('div');
		this.elemA.setAttribute('class', 'control');
			this.elemB = document.createElement('button');
			this.elemB.setAttribute('type', type);
			this.elemB.setAttribute('class', 'confirm');
			if (type !== 'submit')
				this.elemB.setAttribute('onclick', 'apijs.dialogue.actionConfirm();');
			this.elemB.appendChild(document.createTextNode(apijs.i18n.translate('buttonConfirm')));
		this.elemA.appendChild(this.elemB);
			this.elemB = document.createElement('button');
			this.elemB.setAttribute('type', 'button');
			this.elemB.setAttribute('class', 'cancel');
			this.elemB.setAttribute('onclick', 'apijs.dialogue.actionClose(true);');
			this.elemB.appendChild(document.createTextNode(apijs.i18n.translate('buttonCancel')));
		this.elemA.appendChild(this.elemB);
		this.fragment.firstChild.firstChild.appendChild(this.elemA);
	};
	this.htmlButtonNavigation = function () {
		var txt = ((apijs.config.dialogue.imagePrev === null) || (apijs.config.dialogue.imageNext === null)) ? true : false;
		this.elemA = document.createElement('div');
		this.elemA.setAttribute('class', 'navigation ' + ((txt) ? 'txt' : 'img'));
			this.elemB = document.createElement('button');
			this.elemB.setAttribute('type', 'button');
			this.elemB.setAttribute('disabled', 'disabled');
			this.elemB.setAttribute('onclick', 'apijs.slideshow.actionPrev();');
			this.elemB.setAttribute('id', 'prev');
			if (txt) {
				this.elemB.appendChild(document.createTextNode(apijs.i18n.translate('buttonPrev')));
			}
			else {
				this.elemC = document.createElement('img');
				this.elemC.setAttribute('src', apijs.config.dialogue.imagePrev.src);
				this.elemC.setAttribute('width', apijs.config.dialogue.imagePrev.width);
				this.elemC.setAttribute('height', apijs.config.dialogue.imagePrev.height);
				this.elemC.setAttribute('alt', apijs.i18n.translate('buttonPrev'));
				this.elemB.appendChild(this.elemC);
			}
		this.elemA.appendChild(this.elemB);
			this.elemB = document.createElement('button');
			this.elemB.setAttribute('type', 'button');
			this.elemB.setAttribute('disabled', 'disabled');
			this.elemB.setAttribute('onclick', 'apijs.slideshow.actionNext();');
			this.elemB.setAttribute('id', 'next');
			if (txt) {
				this.elemB.appendChild(document.createTextNode(apijs.i18n.translate('buttonNext')));
			}
			else {
				this.elemC = document.createElement('img');
				this.elemC.setAttribute('src', apijs.config.dialogue.imageNext.src);
				this.elemC.setAttribute('width', apijs.config.dialogue.imageNext.width);
				this.elemC.setAttribute('height', apijs.config.dialogue.imageNext.height);
				this.elemC.setAttribute('alt', apijs.i18n.translate('buttonNext'));
				this.elemB.appendChild(this.elemC);
			}
		this.elemA.appendChild(this.elemB);
		this.fragment.firstChild.firstChild.appendChild(this.elemA);
	};
	this.htmlButtonClose = function () {
		this.elemA = document.createElement('div');
		this.elemA.setAttribute('class', 'close');
			this.elemB = document.createElement('button');
			this.elemB.setAttribute('type', 'button');
			this.elemB.setAttribute('onclick', 'apijs.dialogue.actionClose(true);');
			this.elemB.setAttribute('class', 'close');
			if (apijs.config.dialogue.imageClose !== null) {
				this.elemC = document.createElement('img');
				this.elemC.setAttribute('src', apijs.config.dialogue.imageClose.src);
				this.elemC.setAttribute('width', apijs.config.dialogue.imageClose.width);
				this.elemC.setAttribute('height', apijs.config.dialogue.imageClose.height);
				this.elemC.setAttribute('alt', apijs.i18n.translate('buttonClose'));
				this.elemB.appendChild(this.elemC);
			}
			else {
				this.elemB.appendChild(document.createTextNode(apijs.i18n.translate('buttonClose')));
			}
		this.elemA.appendChild(this.elemB);
		this.fragment.firstChild.firstChild.appendChild(this.elemA);
	};
	this.htmlLinkReload = function () {
		this.elemA = document.createElement('p');
		this.elemA.setAttribute('class', 'reload');
		this.elemA.appendChild(document.createTextNode(apijs.i18n.translate('operationTooLong')));
			this.elemB = document.createElement('a');
			this.elemB.setAttribute('href', location.href);
			this.elemB.appendChild(document.createTextNode(apijs.i18n.translate('reloadLink')));
		this.elemA.appendChild(this.elemB);
		this.elemA.appendChild(document.createTextNode('.'));
			this.elemB = document.createElement('br');
		this.elemA.appendChild(this.elemB);
		this.elemA.appendChild(document.createTextNode(apijs.i18n.translate('warningLostChange')));
		document.getElementById('box').appendChild(this.elemA);
	};
	this.htmlFormUpload = function (data, key) {
		this.elemA = document.createElement('iframe');
		if (apijs.config.navigator)
			this.elemA.setAttribute('src', apijs.config.dialogue.imageUpload.src);
		this.elemA.setAttribute('name', 'iframeUpload.' + key);
		this.elemA.setAttribute('id', 'iframeUpload');
		document.getElementsByTagName('body')[0].appendChild(this.elemA);
		this.elemA = document.createElement('div');
			this.elemB = document.createElement('input');
			this.elemB.setAttribute('type', 'hidden');
			this.elemB.setAttribute('name', 'APC_UPLOAD_PROGRESS');
			this.elemB.setAttribute('value', key);
		this.elemA.appendChild(this.elemB);
			this.elemB = document.createElement('input');
			this.elemB.setAttribute('type', 'file');
			this.elemB.setAttribute('name', data);
			this.elemB.setAttribute('onchange', "document.getElementById('box').lastChild.firstChild.focus();");
		this.elemA.appendChild(this.elemB);
		this.fragment.firstChild.firstChild.appendChild(this.elemA);
	};
	this.htmlProgressBar = function () {
		if (apijs.config.navigator) {
			this.elemA = document.createElement('object');
			this.elemA.setAttribute('data', apijs.config.dialogue.imageUpload.src);
			this.elemA.setAttribute('type', 'image/svg+xml');
			this.elemA.setAttribute('width', apijs.config.dialogue.imageUpload.width);
			this.elemA.setAttribute('height', apijs.config.dialogue.imageUpload.height);
			this.elemA.setAttribute('id', 'progressbar');
			this.fragment.firstChild.firstChild.appendChild(this.elemA);
		}
		else if (!apijs.config.navigator) {
			this.elemA = document.createElement('embed');
			this.elemA.setAttribute('src', apijs.config.dialogue.imageUpload.src);
			this.elemA.setAttribute('type', 'image/svg+xml');
			this.elemA.setAttribute('wmode', 'transparent');
			this.elemA.setAttribute('width', apijs.config.dialogue.imageUpload.width);
			this.elemA.setAttribute('height', apijs.config.dialogue.imageUpload.height);
			this.elemA.setAttribute('id', 'progressbar');
			this.fragment.firstChild.firstChild.appendChild(this.elemA);
		}
	};
	this.htmlPhoto = function (width, height, url, name, date, legend) {
		var infoPhoto = this.updateSize(width, height, url);
		this.elemA = document.createElement('dl');
			this.elemB = document.createElement('dt');
				if (apijs.config.dialogue.showFullsize && this.checkSize(width, height)) {
					this.elemC = document.createElement('a');
					this.elemC.setAttribute('href', url);
					this.elemC.setAttribute('onclick', 'window.open(this.href); this.blur(); return false;');
						this.elemD = document.createElement('img');
						this.elemD.setAttribute('width', infoPhoto.width);
						this.elemD.setAttribute('height', infoPhoto.height);
						this.elemD.setAttribute('alt', '');
						this.elemD.setAttribute('class', 'loading resized');
						this.elemD.setAttribute('id', 'topho');
					this.elemC.appendChild(this.elemD);
					this.elemC.appendChild(document.createElement('span'));
				}
				else {
					this.elemC = document.createElement('img');
					this.elemC.setAttribute('width', infoPhoto.width);
					this.elemC.setAttribute('height', infoPhoto.height);
					this.elemC.setAttribute('alt', '');
					this.elemC.setAttribute('class', 'loading');
					this.elemC.setAttribute('id', 'topho');
				}
			this.elemB.appendChild(this.elemC);
		this.elemA.appendChild(this.elemB);
			this.elemB = document.createElement('dd');
				if ((name !== 'false') || (date !== 'false')) {
					this.elemC = document.createElement('span');
					if ((name !== 'false') && (name !== 'auto') && (date !== 'false'))
						this.elemC.appendChild(document.createTextNode(name + ' (' + date + ')'));
					else if ((name !== 'false') && (name !== 'auto'))
						this.elemC.appendChild(document.createTextNode(name));
					else if ((name === 'auto') && (date !== 'false'))
						this.elemC.appendChild(document.createTextNode(infoPhoto.id + ' (' + date + ')'));
					else if (name === 'auto')
						this.elemC.appendChild(document.createTextNode(infoPhoto.id));
					else if (date !== 'false')
						this.elemC.appendChild(document.createTextNode('(' + date + ')'));
					this.elemB.appendChild(this.elemC);
				}
				this.elemB.appendChild(document.createTextNode(' ' + legend + ' '));
				if (apijs.config.dialogue.savePhoto) {
					this.elemC = document.createElement('a');
					this.elemC.setAttribute('href', apijs.config.dialogue.filePhoto + '?id=' + infoPhoto.id);
					this.elemC.setAttribute('type', infoPhoto.mime);
					this.elemC.setAttribute('class', 'download');
					this.elemC.appendChild(document.createTextNode(apijs.i18n.translate('downloadLink')));
					this.elemB.appendChild(this.elemC);
				}
		this.elemA.appendChild(this.elemB);
		this.fragment.firstChild.firstChild.appendChild(this.elemA);
	};
	this.htmlVideo = function (url, name, date, legend) {
		var infoVideo = this.updateSize(apijs.config.dialogue.videoWidth, apijs.config.dialogue.videoHeight, url), novideo = null;
		this.elemA = document.createElement('dl');
			this.elemB = document.createElement('dt');
				this.elemC = document.createElement('video');
				this.elemC.setAttribute('src', url);
				this.elemC.setAttribute('width', infoVideo.width);
				this.elemC.setAttribute('height', infoVideo.height);
				this.elemC.setAttribute('controls', 'controls');
				if (apijs.config.dialogue.videoAutoplay)
					this.elemC.setAttribute('autoplay', 'autoplay');
				if (typeof this.elemC.pause !== 'function') {
					novideo = new BBcode();
					novideo.init(apijs.i18n.translate('browserNoVideo'));
					novideo.exec();
					this.elemC.appendChild(novideo.get());
					this.elemC.style.width = infoVideo.width;
					this.elemC.style.height = infoVideo.height;
				}
			this.elemB.appendChild(this.elemC);
		this.elemA.appendChild(this.elemB);
			this.elemB = document.createElement('dd');
				if ((name !== 'false') || (date !== 'false')) {
					this.elemC = document.createElement('span');
					if ((name !== 'false') && (name !== 'auto') && (date !== 'false'))
						this.elemC.appendChild(document.createTextNode(name + ' (' + date + ')'));
					else if ((name !== 'false') && (name !== 'auto'))
						this.elemC.appendChild(document.createTextNode(name));
					else if ((name === 'auto') && (date !== 'false'))
						this.elemC.appendChild(document.createTextNode(infoVideo.id + ' (' + date + ')'));
					else if (name === 'auto')
						this.elemC.appendChild(document.createTextNode(infoVideo.id));
					else if (date !== 'false')
						this.elemC.appendChild(document.createTextNode('(' + date + ')'));
					this.elemB.appendChild(this.elemC);
				}
				this.elemB.appendChild(document.createTextNode(' ' + legend + ' '));
				if (apijs.config.dialogue.saveVideo) {
					this.elemC = document.createElement('a');
					this.elemC.setAttribute('href', apijs.config.dialogue.fileVideo + '?id=' + infoVideo.id);
					this.elemC.setAttribute('type', infoVideo.mime);
					this.elemC.setAttribute('class', 'download');
					this.elemC.appendChild(document.createTextNode(apijs.i18n.translate('downloadLink')));
					this.elemB.appendChild(this.elemC);
				}
		this.elemA.appendChild(this.elemB);
		this.fragment.firstChild.firstChild.appendChild(this.elemA);
	};
}
function Slideshow() {
	this.media = null;
	this.totals = null;
	this.presentation = null;
	this.init = function () {
		this.media = { album: null, number: null, first: null, prev: null, next: null, last: null };
		this.totals = [];
		this.presentation = [];
		for (var i = 0, j = 0, id = null; document.getElementById(apijs.config.slideshow.ids + '.' + i) !== null; i++) {
			id = apijs.config.slideshow.ids + '.' + i + '.999';
			this.presentation[i] = (document.getElementById(id)) ? 0 : false;
			if (document.getElementById(id)) {
				if (apijs.config.navigator)
					document.getElementById(id).addEventListener('click', apijs.slideshow.showMedia, false);
				else
					document.getElementById(id).setAttribute('onclick', "apijs.slideshow.showMedia(this.getAttribute('id')); return false;");
			}
			for (j = 0; document.getElementById(apijs.config.slideshow.ids + '.' + i + '.' + j) !== null; j++) {
				id = apijs.config.slideshow.ids + '.' + i + '.' + j;
				if (apijs.config.navigator) {
					if (apijs.config.slideshow.hoverload && (this.presentation[i] !== false)) {
						document.getElementById(id).addEventListener('click', apijs.slideshow.showMedia, false);
						document.getElementById(id).addEventListener('mouseover', apijs.slideshow.showMedia, false);
					}
					else {
						document.getElementById(id).addEventListener('click', apijs.slideshow.showMedia, false);
					}
				}
				else {
					if (apijs.config.slideshow.hoverload && (this.presentation[i] !== false)) {
						document.getElementById(id).setAttribute('onclick', "apijs.slideshow.showMedia(this.getAttribute('id')); return false;");
						document.getElementById(id).setAttribute('onmouseover', "apijs.slideshow.showMedia(this.getAttribute('id')); return false;");
					}
					else {
						document.getElementById(id).setAttribute('onclick', "apijs.slideshow.showMedia(this.getAttribute('id')); return false;");
					}
				}
				this.totals[i] = j;
			}
		}
	};
	this.showMedia = function (ev) {
		var thisMedia = { id: null, url: null, alt: null, num: 0, name: null, date: null, legend: null, width: null, height: null }, tmp = null;
		if (typeof ev !== 'string') {
			ev.preventDefault();
			thisMedia.id = this.getAttribute('id');
			thisMedia.url = this.getAttribute('href');
			thisMedia.alt = this.firstChild.getAttribute('alt').split('|');
			tmp = thisMedia.id.split('.');
			thisMedia.album = parseInt(tmp[1], 10);
			thisMedia.number = parseInt(tmp[2], 10);
		}
		else {
			thisMedia.id = ev;
			thisMedia.url = document.getElementById(thisMedia.id).getAttribute('href');
			thisMedia.alt = document.getElementById(thisMedia.id).firstChild.getAttribute('alt').split('|');
			tmp = thisMedia.id.split('.');
			thisMedia.album = parseInt(tmp[1], 10);
			thisMedia.number = parseInt(tmp[2], 10);
		}
		if ((apijs.slideshow.presentation[thisMedia.album] !== false) && ((thisMedia.alt.length > 1) || (thisMedia.alt.length < 7))) {
			if ((typeof ev !== 'string') && this.firstChild.hasAttribute('class') && (this.firstChild.getAttribute('class').indexOf('actif') > -1))
				return;
			if ((apijs.dialogue.dialogType === null) && ((thisMedia.alt.length === 6) || (thisMedia.alt.length === 4)))
				apijs.slideshow.updatePresentation(thisMedia);
			else if ((apijs.dialogue.dialogType === null) && ((thisMedia.alt.length === 5) || (thisMedia.alt.length === 3))) {
				thisMedia.number = apijs.slideshow.presentation[thisMedia.album];
				apijs.slideshow.showDialogue(thisMedia);
			}
			else {
				apijs.slideshow.updatePresentation(thisMedia);
				apijs.slideshow.showDialogue(thisMedia);
			}
		}
		else if ((thisMedia.alt.length === 5) || (thisMedia.alt.length === 3)) {
			apijs.slideshow.showDialogue(thisMedia);
			document.getElementById('dialogue').setAttribute('onclick', "if (Event.element(event).id === 'dialogue') { apijs.dialogue.actionClose(true); }");
		}
		else if (apijs.config.debug)
			apijs.dialogue.dialogInformation(apijs.i18n.translate('debugInvalidUse'), '[pre]TheSlideshow » showMedia[br]' + apijs.i18n.translate('debugNotRecognizedAltAttribute') + '[/pre]');
	};
	this.updatePresentation = function (thisMedia) {
		var id = null, tag = null, i = 0;
		if ((thisMedia.alt.length === 6) && (thisMedia.alt[0].length > 0) && (thisMedia.alt[1].length > 0) && (thisMedia.alt[2].length > 0) &&
		 (thisMedia.alt[3].length > 0) && (thisMedia.alt[4].length > 0)) {
			id = apijs.config.slideshow.ids + '.' + thisMedia.album;
			document.getElementById(id + '.999').setAttribute('href', document.getElementById(thisMedia.id).getAttribute('href'));
			document.getElementById(id + '.999').firstChild.setAttribute('src', thisMedia.alt.shift());
			document.getElementById(id + '.999').firstChild.setAttribute('alt', thisMedia.alt.join('|'));
			for (tag = document.getElementById(id).getElementsByTagName('img'), i = 0; i < tag.length; i++) {
				if (tag[i].hasAttribute('class') && (tag[i].getAttribute('class').indexOf('actif') > -1))
					tag[i].removeAttribute('class');
			}
			document.getElementById(thisMedia.id).firstChild.setAttribute('class', 'actif');
			this.presentation[thisMedia.album] = thisMedia.number;
		}
		else if (apijs.config.debug && (thisMedia.alt.length === 6)) {
			apijs.dialogue.dialogInformation(apijs.i18n.translate('debugInvalidAltAttribute'), '[pre]TheSlideshow » changePhoto[br]➩ (string) url : ' + thisMedia.alt[0] + '[br]➩ (number) width : ' + thisMedia.alt[1] + '[br]➩ (number) height : ' + thisMedia.alt[2] + '[br]➩ (string) date : ' + thisMedia.alt[3] + '[br]➩ (string) legend : ' + thisMedia.alt[4] + '[/pre]');
		}
		else if ((thisMedia.alt.length === 4) && (thisMedia.alt[0].length > 0) && (thisMedia.alt[1].length > 0) && (thisMedia.alt[2].length > 0)) {
			id = apijs.config.slideshow.ids + '.' + thisMedia.album;
			document.getElementById(id + '.999').setAttribute('href', document.getElementById(thisMedia.id).getAttribute('href'));
			document.getElementById(id + '.999').firstChild.setAttribute('src', thisMedia.alt.shift());
			document.getElementById(id + '.999').firstChild.setAttribute('alt', thisMedia.alt.join('|'));
			for (tag = document.getElementById(id).getElementsByTagName('img'), i = 0; i < tag.length; i++) {
				if (tag[i].hasAttribute('class') && (tag[i].getAttribute('class').indexOf('actif') > -1))
					tag[i].removeAttribute('class');
			}
			document.getElementById(thisMedia.id).firstChild.setAttribute('class', 'actif');
			this.presentation[thisMedia.album] = thisMedia.number;
		}
		else if (apijs.config.debug && (thisMedia.alt.length === 4)) {
			apijs.dialogue.dialogInformation(apijs.i18n.translate('debugInvalidAltAttribute'), '[pre]TheSlideshow » changePhoto[br]➩ (string) url : ' + thisMedia.alt[0] + '[br]➩ (string) date : ' + thisMedia.alt[1] + '[br]➩ (string) legend : ' + thisMedia.alt[2] + '[/pre]');
		}
	};
	this.showDialogue = function (thisMedia) {
		if ((thisMedia.alt.length === 5) && (thisMedia.alt[0].length > 0) && (thisMedia.alt[1].length > 0) && (thisMedia.alt[2].length > 0) &&
		 (thisMedia.alt[3].length > 0)) {
			thisMedia.name = thisMedia.alt[2];
			thisMedia.date = thisMedia.alt[3];
			thisMedia.legend = thisMedia.alt[4];
			thisMedia.width = parseInt(thisMedia.alt[0], 10);
			thisMedia.height = parseInt(thisMedia.alt[1], 10);
			if (apijs.dialogue.dialogType !== null)
				apijs.dialogue.actionClose(false);
			apijs.dialogue.dialogPhoto(thisMedia.width, thisMedia.height, thisMedia.url, thisMedia.name, thisMedia.date, thisMedia.legend, true);
			this.showNavigation(thisMedia.album, thisMedia.number);
		}
		else if (apijs.config.debug && (thisMedia.alt.length === 5)) {
			apijs.dialogue.dialogInformation(apijs.i18n.translate('debugInvalidAltAttribute'), '[pre]TheSlideshow » showMedia[br]➩ (number) width : ' + thisMedia.alt[0] + '[br]➩ (number) height : ' + thisMedia.alt[1] + '[br]➩ (string) date : ' + thisMedia.alt[2] + '[br]➩ (string) legend : ' + thisMedia.alt[3] + '[/pre]');
		}
		else if ((thisMedia.alt.length === 3) && (thisMedia.alt[0].length > 0) && (thisMedia.alt[1].length > 0)) {
			thisMedia.name = thisMedia.alt[0];
			thisMedia.date = thisMedia.alt[1];
			thisMedia.legend = thisMedia.alt[2];
			if (apijs.dialogue.dialogType !== null)
				apijs.dialogue.actionClose(false);
			apijs.dialogue.dialogVideo(thisMedia.url, thisMedia.name, thisMedia.date, thisMedia.legend, true);
			this.showNavigation(thisMedia.album, thisMedia.number);
		}
		else if (apijs.config.debug && (thisMedia.alt.length === 3)) {
			apijs.dialogue.dialogInformation(apijs.i18n.translate('debugInvalidAltAttribute'), '[pre]TheSlideshow » showMedia[br]➩ (string) date : ' + thisMedia.alt[0] + '[br]➩ (string) legend : ' + thisMedia.alt[1] + '[/pre]');
		}
	};
	this.showNavigation = function (album, number) {
		if ((apijs.dialogue.dialogType.indexOf('photo') > -1) || (apijs.dialogue.dialogType.indexOf('video') > -1)) {
			this.media.album = album;
			this.media.number = number;
			this.media.first = apijs.config.slideshow.ids + '.' + this.media.album + '.0';
			this.media.prev = apijs.config.slideshow.ids + '.' + this.media.album + '.' + (this.media.number - 1);
			this.media.next = apijs.config.slideshow.ids + '.' + this.media.album + '.' + (this.media.number + 1);
			this.media.last = apijs.config.slideshow.ids + '.' + this.media.album + '.' + this.totals[this.media.album];
			if (document.getElementById(this.media.prev))
				document.getElementById('prev').removeAttribute('disabled');
			else
				this.media.prev = null;
			if (document.getElementById(this.media.next))
				document.getElementById('next').removeAttribute('disabled');
			else
				this.media.next = null;
		}
	};
	this.actionFirst = function () {
		if ((this.media !== null) && (this.media.number > 0) && (this.media.number <= this.totals[this.media.album]))
			this.showMedia(this.media.first);
	};
	this.actionPrev = function () {
		if ((this.media !== null) && (this.media.prev !== null) && (this.media.number > 0))
			this.showMedia(this.media.prev);
	};
	this.actionNext = function () {
		if ((this.media !== null) && (this.media.next !== null) && (this.media.number < this.totals[this.media.album]))
			this.showMedia(this.media.next);
	};
	this.actionLast = function () {
		if ((this.media !== null) && (this.media.number >= 0) && (this.media.number < this.totals[this.media.album]))
			this.showMedia(this.media.last);
	};
}
function Upload() {
	this.extensions = null;
	this.callback = null;
	this.params = null;
	this.key = null;
	this.svgTimer = null;
	this.svgDirection = 0;
	this.svgWaiting = 0;
	this.apcTimer = null;
	this.apcWaiting = 0;
	this.sendFile = function (title, maxsize, extensions, callback, params, data, icon) {
		if ((typeof title === 'string') && (typeof maxsize === 'number') && (typeof extensions === 'object') && (typeof callback === 'function') && (typeof params !== 'undefined') && (typeof data === 'string') && (extensions !== null)) {
			this.extensions = extensions;
			this.callback = callback;
			this.params = params;
			this.key = uniqid();
			apijs.dialogue.dialogFormUpload(title, this.prepareText(maxsize), data, this.key, icon);
		}
		else if (apijs.config.debug) {
			if ((typeof callback === 'function') && (typeof callback.name === 'string') && (callback.name.length > 0))
				callback = callback.name;
			apijs.dialogue.dialogInformation(apijs.i18n.translate('debugInvalidCall'), '[pre]TheUpload » sendFile[br]➩ (string) title : ' + title + '[br]➩ (number) maxsize : ' + maxsize + '[br]➩ (array) extensions : ' + extensions + '[br]➩ (funcion) callback : ' + callback + '[br]➩ (object) params : ' + params + '[br]➩ (string) data : ' + data + '[br]➩ (string) icon : ' + icon + '[/pre]');
		}
	};
	this.deleteFile = function (title, text, callback, params, key, icon) {
		if ((typeof title === 'string') && (typeof text === 'string') && (typeof callback === 'function') && (typeof params !== 'undefined') && (typeof key === 'string')) {
			this.callback = callback;
			this.params = params;
			icon = (typeof icon !== 'string') ? 'delete' : icon;
			apijs.dialogue.dialogConfirmation(title, text, apijs.upload.actionDelete, key, icon);
		}
		else if (apijs.config.debug) {
			if ((typeof callback === 'function') && (typeof callback.name === 'string') && (callback.name.length > 0))
				callback = callback.name;
			apijs.dialogue.dialogInformation(apijs.i18n.translate('debugInvalidCall'), '[pre]TheUpload » deleteFile[br]➩ (string) title : ' + title + '[br]➩ (string) text : ' + text + '[br]➩ (funcion) callback : ' + callback + '[br]➩ (object) params : ' + params + '[br]➩ (string) key : ' + key + '[br]➩ (string) icon : ' + icon + '[/pre]');
		}
	};
	this.prepareText = function (maxsize) {
		var text = null, extensions = null, lastExtension = null;
		extensions = apijs.dialogue.clone(this.extensions);
		lastExtension = extensions.pop();
		if (lastExtension === '*') {
			text = apijs.i18n.translate('uploadAllType', maxsize);
		}
		else if (extensions.length < 1) {
			text = apijs.i18n.translate('uploadOneType', lastExtension, maxsize);
		}
		else {
			extensions = extensions.join(', ');
			text = apijs.i18n.translate('uploadMultiType', extensions, lastExtension, maxsize);
		}
		return text;
	};
	this.actionConfirm = function () {
		var filename = document.getElementById('box').getElementsByTagName('input')[1].value;
		var result = false, extensions = null, lastExtension = null;
		extensions = apijs.dialogue.clone(this.extensions);
		lastExtension = extensions.pop();
		if (filename.length < 1) {
			document.getElementById('box').getElementsByTagName('input')[1].focus();
		}
		else if ((lastExtension !== '*') && !in_array(filename.slice(filename.lastIndexOf('.') + 1).toLowerCase(), this.extensions)) {
			if (extensions.length < 1) {
				apijs.dialogue.dialogInformation(document.getElementById('box').firstChild.firstChild.nodeValue, apijs.i18n.translate('uploadBadOneType', filename, lastExtension), 'eeupload');
			}
			else {
				extensions = extensions.join(', ');
				apijs.dialogue.dialogInformation(document.getElementById('box').firstChild.firstChild.nodeValue, apijs.i18n.translate('uploadBadMultiType', filename, extensions, lastExtension), 'eeupload');
			}
		}
		else {
			result = true;
			document.getElementById('iframeUpload').setAttribute('onload', 'apijs.upload.endUpload();');
			window.setTimeout(apijs.upload.startUpload, 1);
		}
		return result;
	};
	this.actionDelete = function (key) {
		var xhr = new XMLHttpRequest();
		xhr.onreadystatechange = function () {
			if ((xhr.readyState === 4) && (xhr.status === 200)) {
				try {
					var result = null, status = null, message = null, icon = null;
					result = xhr.responseXML;
					status = result.getElementsByTagName('status')[0].firstChild.nodeValue;
					message = result.getElementsByTagName('message')[0].firstChild.nodeValue;
					icon = (status === 'success') ? 'information' : 'error';
					apijs.dialogue.dialogInformation(document.getElementById('box').firstChild.firstChild.nodeValue, message, icon);
					if (status === 'success')
						apijs.upload.callback(apijs.upload.params);
				}
				catch (ee) {
					if (apijs.config.debug)
						alert(ee);
				}
			}
			else if ((xhr.readyState === 4) && (xhr.status !== 200)) {
				apijs.dialogue.dialogInformation(document.getElementById('box').firstChild.firstChild.nodeValue, apijs.i18n.translate('deleteNotFound', xhr.status, xhr.statusText), 'error');
			}
		};
		if ((/customer\/account\/edit/.test(document.URL)) && (/\//.test(key)))
			apijs.config.dialogue.fileUpload = 'http://www.strip-for-you.com/index.php/customer/account/deleteImage';
		xhr.open('GET', apijs.config.dialogue.fileUpload + '?delete=' + key, true);
		xhr.send(null);
		if ((/customer\/account\/edit/.test(document.URL)) && (/\//.test(key)))
			apijs.config.dialogue.fileUpload = 'http://www.strip-for-you.com/uploader/uploadfile.php';
	};
	this.startUpload = function () {
		apijs.dialogue.dialogProgress(document.getElementById('box').firstChild.firstChild.nodeValue, apijs.i18n.translate('uploadInProgress'));
		apijs.upload.svgDirection = 0;
		apijs.upload.svgWaiting = 10;
		apijs.upload.apcWaiting = 10;
		apijs.upload.svgTimer = window.setInterval(apijs.upload.animGeneric, 50);
		apijs.upload.apcTimer = window.setTimeout(apijs.upload.uploadRealTime, 1000);
	};
	this.uploadRealTime = function () {
		if (apijs.upload.apcWaiting < 1)
			return;
		var xhr = new XMLHttpRequest();
		xhr.onreadystatechange = function () {
			if ((xhr.readyState === 4) && (xhr.status === 200)) {
				try {
					var result = null, status = null, rate = null, percent = null;
					result = xhr.responseXML;
					status = result.getElementsByTagName('status')[0].firstChild.nodeValue;
					if (status === 'uploading') {
						if (apijs.upload.svgTimer)
							clearInterval(apijs.upload.svgTimer);
						rate = parseInt(result.getElementsByTagName('rate')[0].firstChild.nodeValue, 10);
						percent = parseInt(result.getElementsByTagName('percent')[0].firstChild.nodeValue, 10);
						if ((percent > 0) && (percent < 100)) {
							apijs.upload.animToValue(percent, rate);
							apijs.upload.apcTimer = window.setTimeout(apijs.upload.uploadRealTime, 1000);
						}
					}
					else if ((status === 'false') && (apijs.upload.apcWaiting > 0)) {
						apijs.upload.apcWaiting -= 1;
						apijs.upload.apcTimer = window.setTimeout(apijs.upload.uploadRealTime, 1000);
					}
				}
				catch (ee) {
					if (apijs.config.debug)
						alert(ee);
				}
			}
		};
		xhr.open('GET', apijs.config.dialogue.fileUpload + '?realtime=' + apijs.upload.key, true);
		xhr.send(null);
	};
	this.endUpload = function () {
		if (this.apcTimer)
			clearTimeout(this.apcTimer);
		if (this.svgTimer)
			clearInterval(this.svgTimer);
		this.extensions = null;
		this.svgTimer = null;
		this.svgDirection = 0;
		this.svgWaiting = 0;
		this.apcTimer = null;
		this.apcWaiting = 0;
		try {
			var result = null, status = null, message = null;
			if (apijs.config.navigator) {
				result = window.frames['iframeUpload.' + this.key].document;
				status = result.getElementsByTagName('status')[0].firstChild.nodeValue;
				message = result.getElementsByTagName('message')[0].firstChild.nodeValue;
			}
			else {
				result = window.frames['iframeUpload.' + this.key].document.documentElement.getElementsByTagName('body')[0].innerHTML;
				result = result.replace(/[\s\r\n\t]|<[^>]+>|&[a-z]+;/g, '');
				result = result.replace('?xmlversion="1.0"encoding="utf-8"?', '');
				status = (/status(.+)\/status/i).test(result);
				status = RegExp.$1;
				message = (/message(.+)\/message/i).test(result);
				message = RegExp.$1;
			}
			if (document.getElementById('progressbar') && (typeof document.getElementById('progressbar').getSVGDocument !== 'undefined') &&
			 (navigator.userAgent.indexOf('MSIE') < 0)) {
				document.getElementById('iframeUpload').removeAttribute('onload');
				document.getElementById('iframeUpload').setAttribute('src', apijs.config.dialogue.imageUpload.src);
			}
			if (status === 'success') {
				this.animToValue(100);
				window.setTimeout(function () { apijs.upload.callback(apijs.upload.key, apijs.upload.params); }, 1000);
			}
			else {
				apijs.dialogue.dialogInformation(document.getElementById('box').firstChild.firstChild.nodeValue, message, 'eeupload');
			}
		}
		catch (ee) {
			apijs.dialogue.dialogInformation(document.getElementById('box').firstChild.firstChild.nodeValue, '[pre]' + ee + '[/pre]', 'eeupload');
		}
	};
	this.animGeneric = function () {
		if ((apijs.upload.svgWaiting < 1) || !document.getElementById('progressbar')) {
			clearInterval(apijs.upload.svgTimer);
		}
		else if (document.getElementById('progressbar') && (typeof document.getElementById('progressbar').getSVGDocument === 'undefined')) {
			apijs.upload.svgWaiting -= 1;
		}
		else if (document.getElementById('progressbar') && (typeof document.getElementById('progressbar').getSVGDocument !== 'undefined') && (document.getElementById('progressbar').getSVGDocument().getElementsByTagName('rect')[0] || document.getElementById('progressbar').getSVGDocument().rootElement)) {
			var rect = (apijs.config.navigator) ? document.getElementById('progressbar').getSVGDocument().getElementsByTagName('rect')[0] : document.getElementById('progressbar').getSVGDocument().rootElement.getElementsByTagName('rect').item(0);
			if (apijs.upload.svgDirection === 0) {
				rect.setAttribute('x', parseInt(rect.getAttribute('x'), 10) + 5);
				if (parseInt(rect.getAttribute('x'), 10) >= 250)
					apijs.upload.svgDirection = 1;
			}
			else {
				rect.setAttribute('x', parseInt(rect.getAttribute('x'), 10) - 5);
				if (parseInt(rect.getAttribute('x'), 10) <= 0)
					apijs.upload.svgDirection = 0;
			}
		}
	};
	this.animToValue = function (value, rate) {
		if (document.getElementById('progressbar') && (typeof document.getElementById('progressbar').getSVGDocument !== 'undefined')) {
			var rect = null, text = null;
			rect = (apijs.config.navigator) ? document.getElementById('progressbar').getSVGDocument().getElementsByTagName('rect')[0] : document.getElementById('progressbar').getSVGDocument().rootElement.getElementsByTagName('rect').item(0);
			text = (apijs.config.navigator) ? document.getElementById('progressbar').getSVGDocument().getElementsByTagName('text')[0] : document.getElementById('progressbar').getSVGDocument().rootElement.getElementsByTagName('text').item(0);
			if ((typeof rate === 'number') && (value < 100)) {
				if (rect.getAttribute('x') !== '0')
					rect.setAttribute('x', '0');
				rect.setAttribute('width', value * 3);
				text.firstChild.replaceData(0, text.firstChild.length, apijs.i18n.translate('uploadRate', value, rate));
			}
			else if (value < 100) {
				rect.setAttribute('width', value * 3);
				text.firstChild.replaceData(0, text.firstChild.length, value + '%');
			}
			else {
				rect.setAttribute('x', '0');
				rect.setAttribute('width', '301');
				text.firstChild.replaceData(0, text.firstChild.length, '100%');
			}
		}
	};
}
function BBcode() {
	this.bbcode = null;
	this.object = null;
	this.fragment = null;
	this.init = function (data, smileys) {
		this.object = { tag: 'div', content: [] };
		this.object['class'] = 'bbcode';
		this.bbcode = (data[0] !== '[') ? '[p]' + data + '[/p]' : data;
	};
	this.exec = function () {
		this.readData(this.bbcode, 0);
		this.fragment = document.createDocumentFragment();
		this.fragment.appendChild(this.createDomFragment(this.object));
	};
	this.get = function () {
		return this.fragment;
	};
	this.readData = function (data, level) {
		var element = null, attributes = null, content = null, text = null, other = null, cut = 0;
		if ((data[0] !== '[') && ((cut = data.search(/\[([a-z1-6]+)(?: [a-z:]+=["'][^"']*["'])*\]/)) > -1)) {
			text = data.slice(0, cut);
			this.readData(text, level);
			other = data.slice(cut);
			if ((cut = other.indexOf('[/' + RegExp.$1 + ']')) > -1) {
				element = other.slice(0, cut + RegExp.$1.length + 3);
				other = other.slice(cut + RegExp.$1.length + 3);
				this.readData(element, level);
			}
			if (/^(\[(?:area|br|col|hr|iframe|img|input|param)(?: [a-z:]+=["'][^"']*["'])*\])/.test(other)) {
				element = other.slice(0, RegExp.$1.length);
				other = other.slice(RegExp.$1.length);
				this.readData(element, level);
			}
			if (other.length > 0)
				this.readData(other, level);
		}
		else if (/^\[(area|br|col|hr|iframe|img|input|param)((?: [a-z:]+=["'][^"']*["'])*)\]/.test(data)) {
			element = RegExp.$1;
			attributes = RegExp.$2;
			other = data.slice(2 + element.length + attributes.length);
			this.addElement(element, attributes, level);
			if (other.length > 0)
				this.readData(other, level);
		}
		else if (/^\[([a-z1-6]+)((?: [a-z:]+=["'][^"']*["'])*)\]/.test(data)) {
			element = RegExp.$1;
			attributes = RegExp.$2;
			cut = data.indexOf('[/' + element + ']');
			content = data.slice(2 + element.length + attributes.length, cut);
			other = data.slice(3 + element.length + cut);
			this.addElement(element, attributes, level);
			this.readData(content, level + 1);
			if (other.length > 0)
				this.readData(other, level);
		}
		else {
			this.addElement(data, null, level);
		}
	};
	this.addElement = function (data, attributes, level) {
		var directlink = null, attr = null, name = null, value = null;
		directlink = this.getContentNode(this.object, 0, level);
		if (attributes !== null) {
			if (directlink.hasOwnProperty('content'))
				directlink.content.push({ tag: data });
			else
				directlink.content = [{ tag: data }];
			if (attributes.length > 5) {
				attributes = attributes.slice(1, -1).split(/["'] /);
				for (attr in attributes) if (attributes.hasOwnProperty(attr)) {
					name = attributes[attr].slice(0, attributes[attr].indexOf('='));
					value = attributes[attr].slice(attributes[attr].indexOf('=') + 2);
					if (directlink.hasOwnProperty('content'))
						directlink.content[directlink.content.length - 1][name] = value;
					else
						directlink[name] = value;
				}
			}
		}
		else {
			if (directlink.hasOwnProperty('content'))
				directlink.content.push({ text: data });
			else
				directlink.content = [{ text: data }];
		}
	};
	this.getContentNode = function (dom, level, maxlevel) {
		if ((dom.content.length < 1) || (maxlevel < 1))
			return dom;
		for (var i = dom.content.length - 1; i >= 0; i--) {
			if (dom.content[i].hasOwnProperty('content') && (++level < maxlevel))
				return this.getContentNode(dom.content[i], level, maxlevel);
			else
				return dom.content[i];
		}
	};
	this.createDomFragment = function (data) {
		var tag = null, attr = null, elem = 0;
		if (data.hasOwnProperty('tag'))
			tag = document.createElement(data.tag);
		else
			return document.createTextNode(data.text);
		for (attr in data) if (data.hasOwnProperty(attr)) {
			if (attr === 'text')
				tag.appendChild(document.createTextNode(data[attr]));
			if ((attr !== 'tag') && (attr !== 'text') && (attr !== 'content'))
				tag.setAttribute(attr, data[attr]);
			if ((data.tag === 'a') && (attr === 'class') && (data[attr].indexOf('popup') > -1) && (typeof openTab === 'function')) {
				if (apijs.config.navigator)
					tag.addEventListener('click', openTab, false);
				else
					tag.setAttribute('onclick', 'window.open(this.href); return false;');
			}
		}
		if (data.hasOwnProperty('content')) {
			for (elem = 0; elem < data.content.length; elem++)
				tag.appendChild(this.createDomFragment(data.content[elem]));
		}
		return tag;
	};
}
function Internationalization() {
	this.data = [];
	this.data.en = {
		buttonOk: "Ok",
		buttonCancel: "Cancel",
		buttonConfirm: "Confirm",
		buttonClose: "Close",
		buttonPrev: "Previous",
		buttonNext: "Next",
		downloadLink: "Download",
		operationTooLong: "This operation is too long ? ",
		warningLostChange: "Warning : all changes in progress will be lost.",
		reloadLink: "Reload this page",
		operationInProgress: "Operation in progress...",
		uploadInProgress: "Upload in progress...",
		savingInProgress: "Saving...",
		uploadRate: "§% (§ kB/s)",
		uploadAllType: "All files are accepted.[br]Maximum size : § [abbr title='Megabyte']MB[/abbr].",
		uploadOneType: "Accepted file format : §.[br]Maximum size : § [abbr title='Megabyte']MB[/abbr].",
		uploadMultiType: "Accepted file formats : § and §.[br]Maximum size : § [abbr title='Megabyte']MB[/abbr].",
		uploadBadOneType: "[p]It is impossible to send the file because the file format proposed isn't allowed.[/p][p]➩ Proposed file : [strong]§[/strong][br]➩ Accepted file format : §.[/p]",
		uploadBadMultiType: "[p]It is impossible to send the file because the file format proposed isn't allowed.[/p][p]➩ Proposed file : [strong]§[/strong][br]➩ Accepted file formats : § and §.[/p]",
		deleteNotFound: "Unfortunately, it is currently impossible to delete requested file (Error § : §).",
		browserNoVideo: "[p]Your browser doesn't support the <video> tag.[br]Remember to upgrade your browser.[/p][ul][li][a href='http://www.google.com/chrome?hl=en' class='popup']Chrome 3.0+[/a][/li][li][a href='http://www.mozilla-europe.org/en/firefox/' class='popup']Firefox 3.5+[/a][/li][li][a href='http://windows.microsoft.com/en-US/internet-explorer/products/ie/home' class='popup']Internet Explorer 9.0+[/a][/li][li][a href='http://www.konqueror.org/' class='popup']Konqueror 4.4+[/a][/li][li][a href='http://www.opera.com/' class='popup']Opera 10.50+[/a][/li][li][a href='http://www.apple.com/safari/' class='popup']Safari 3.1+[/a][/li][/ul]",
		debugInvalidCall: "(debug) Invalid call",
		debugInvalidUse: "(debug) Invalid use",
		debugUnknownAction: "(debug) Unknown action",
		debugKeyDetected: "(debug) Key detected",
		debugKeyCode: "Code of the seizure key : §",
		debugInvalidAltAttribute: "(debug) Invalid alt attribute",
		debugNotRecognizedAltAttribute: "The alt attribute of the image wasn't recognized",
		debugNotExist: "doesn't exist (unlikely error)"
	};
	this.data.fr = {
		buttonOk: "Ok",
		buttonCancel: "Annuler",
		buttonConfirm: "Valider",
		buttonClose: "Fermer",
		buttonPrev: "Précédent",
		buttonNext: "Suivant",
		downloadLink: "Télécharger",
		operationTooLong: "Cette opération prend trop de temps ? ",
		warningLostChange: "Attention : toutes les modifications en cours seront perdues.",
		reloadLink: "Rechargez la page",
		operationInProgress: "Opération en cours...",
		uploadInProgress: "Envoi du fichier en cours...",
		savingInProgress: "Enregistrement en cours...",
		uploadRate: "§% (§ ko/s)",
		uploadAllType: "Tous les fichiers sont acceptés.[br]Taille maximale : § [abbr title='Mégaoctet']Mo[/abbr].",
		uploadOneType: "Format de fichier accepté : §.[br]Taille maximale : § [abbr title='Mégaoctet']Mo[/abbr].",
		uploadMultiType: "Formats de fichier acceptés : § et §.[br]Taille maximale : § [abbr title='Mégaoctet']Mo[/abbr].",
		uploadBadOneType: "[p]Il est impossible d'envoyer le fichier car le format du fichier proposé n'est pas autorisé.[/p][p]➩ Fichier proposé : [strong]§[/strong][br]➩ Format de fichier accepté : §.[/p]",
		uploadBadMultiType: "[p]Il est impossible d'envoyer le fichier car le format du fichier proposé n'est pas autorisé.[/p][p]➩ Fichier proposé : [strong]§[/strong][br]➩ Formats de fichier acceptés : § et §.[/p]",
		deleteNotFound: "Malheureusement, il est actuellement impossible de supprimer le fichier demandé (Erreur § : [span xml:lang='en']§[/span]).",
		browserNoVideo: "[p]Votre navigateur ne supporte pas la balise <video>.[br]Pensez à mettre à jour votre navigateur.[/p][ul][li][a href='http://www.google.com/chrome?hl=fr' class='popup']Chrome 3.0+[/a][/li][li][a href='http://www.mozilla-europe.org/fr/firefox/' class='popup']Firefox 3.5+[/a][/li][li][a href='http://windows.microsoft.com/fr-FR/internet-explorer/products/ie/home' class='popup']Internet Explorer 9.0+[/a][/li][li][a href='http://www.konqueror.org/' class='popup']Konqueror 4.4+[/a][/li][li][a href='http://www.opera.com/' class='popup']Opera 10.50+[/a][/li][li][a href='http://www.apple.com/fr/safari/' class='popup']Safari 3.1+[/a][/li][/ul]",
		debugInvalidCall: "(debug) Appel invalide",
		debugInvalidUse: "(debug) Utilisation invalide",
		debugUnknownAction: "(debug) Action inconnue",
		debugKeyDetected: "(debug) Touche détectée",
		debugKeyCode: "Code de la touche saisie : §",
		debugInvalidAltAttribute: "(debug) Attribut alt invalide",
		debugNotRecognizedAltAttribute: "L'attribut alt de l'image n'a pas été reconnu",
		debugNotExist: "n'existe pas (erreur improbable)"
	};
	this.init = function () {
		if (apijs.config.autolang) {
			var autolang = null;
			if (document.getElementsByTagName('html')[0].getAttribute('xml:lang'))
				autolang = document.getElementsByTagName('html')[0].getAttribute('xml:lang').slice(0, 2);
			else if (document.getElementsByTagName('html')[0].getAttribute('lang'))
				autolang = document.getElementsByTagName('html')[0].getAttribute('lang').slice(0, 2);
			if ((typeof autolang === 'string') && this.data.hasOwnProperty(autolang))
				apijs.config.lang = autolang;
			else if ((typeof apijs.config.lang !== 'string') || !this.data.hasOwnProperty(apijs.config.lang))
				apijs.config.lang = 'en';
		}
		else if ((typeof apijs.config.lang !== 'string') || !this.data.hasOwnProperty(apijs.config.lang)) {
			apijs.config.lang = 'en';
		}
	};
	this.translate = function (word) {
		if (typeof this.data[apijs.config.lang][word] !== 'string') {
			return word;
		}
		else if (arguments.length > 1) {
			var i = 0, arg = 1, translation = '', data = '';
			for (data = this.data[apijs.config.lang][word].split('§'); i < data.length; i++)
				translation += (arg < arguments.length) ? data[i] + arguments[arg++] : data[i];
			return translation;
		}
		else {
			return this.data[apijs.config.lang][word];
		}
	};
	this.changeLang = function (lang) {
		if ((typeof lang === 'string') && this.data.hasOwnProperty(lang)) {
			apijs.config.lang = lang;
			return true;
		}
		else {
			return false;
		}
	};
}/**
 * Copyright 2010 | Kevin van Zonneveld
 * http://phpjs.org/
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the software),
 * to deal in the software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 * or sell copies of the software, and to permit persons to whom the
 * software is furnished to do so, subject to the following conditions.
 *
 * The software is provided as is, without warranty of any kind, express
 * or implied, including but not limited to the warranties of
 * merchantability, fitness for a particular purpose and noninfringement.
 *
 * In no event the authors or copyright holders be liable for any claim, damages
 * or other liability, whether in an action of contract, tort or otherwise,
 * arising from, out of or in connection with the software or the use or
 * other dealings in the software.
 *
 * See the MIT license for more details.
 */
function str_shuffle(data) {
	var result = '', rand = 0;
	while (data.length > 0) {
		rand = Math.floor(Math.random() * data.length);
		result += data[rand];
		data = data.substring(0, rand) + data.substr(rand + 1);
	}
	return result;
}
function in_array(data, array) {
	for (var key in array) {
		if (array[key] === data)
			return true;
	}
	return false;
}
function ucwords(data) {
	return data.replace(/^(.)|\s(.)/g, function ($1) { return $1.toUpperCase(); } );
}
function uniqid() {
	return str_shuffle('958753cfb564e097e2f9121a43da98708727f30365b1da846cc6fae22afe7ebcbda4030bd81f1e4d0615b96358dc294c').substr(0, 8);
}
/**
 * Copyright 2010-2011 | Dacrydium
 * (1.2.0) http://www.dacrydium.fr/
 *
 * This program is free software, you can redistribute it or modify
 * it under the terms of the GNU General Public License (GPL) as published
 * by the free software foundation, either version 2 of the license, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but without any warranty, without even the implied warranty of
 * merchantability or fitness for a particular purpose. See the
 * GNU General Public License (GPL) for more details.
 */
var Translator = new Translate({"Please select an option.":"S\u00e9lectionnez une option","This is a required field.":"Ce champ est obligatoire.","Please enter a valid number in this field.":"Veuillez saisir un nombre valide.","Please use letters only (a-z) in this field.":"Veuillez utiliser uniquement des lettres (a-z) dans ce champ.","Please use only letters (a-z), numbers (0-9) or underscore(_) in this field, first character should be a letter.":"Veuillez utiliser uniquement des lettres (a-z), des chiffres (0-9) ou underscore (_) dans ce champ, en commen\u00e7ant par une lettre.","Please use only letters (a-z) or numbers (0-9) only in this field. No spaces or other characters are allowed.":"Veuillez utiliser uniquement des lettres (a-z) ou des chiffres (0-9) dans ce champ. Les espaces et autres caract\u00e8res ne sont pas autoris\u00e9s.","Please use only letters (a-z) or numbers (0-9) or spaces and # only in this field.":"Veuillez utiliser uniquement des lettres (a-z), des chiffres (0-9), des espaces ou des di\u00e8ses (#) dans ce champ.","Please enter a valid phone number. For example (123) 456-7890 or 123-456-7890.":"Veuillez saisir un num\u00e9ro de t\u00e9l\u00e9phone valide.","Please enter a valid date.":"Veuillez saisir une date valide.","Please enter a valid email address. For example johndoe@domain.com.":"Veuillez saisir une adresse email valide. Par exemple gerard.manvussat@domaine.com","Please enter 6 or more characters.":"Veuillez saisir au moins 6 caract\u00e8res.","Please make sure your passwords match.":"V\u00e9rifiez que vos mots de passe concordent.","Please enter a valid URL. For example http:\/\/www.example.com or www.example.com":"Veuillez saisir une URL valide. Par exemple http:\/\/www.exemple.com ou www.exemple.com","Please enter a valid social security number. For example 123-45-6789.":"Veuillez saisir un num\u00e9ro de s\u00e9curit\u00e9 sociale valide. Par exemple 123-45-6789.","Please enter a valid zip code. For example 90602 or 90602-1234.":"Veuillez saisir un code postal valide. Par exemple 92100.","Please enter a valid zip code.":"Veuillez saisir un code postal valide.","Please use this date format: dd\/mm\/yyyy. For example 17\/03\/2006 for the 17th of March, 2006.":"Veuillez utiliser ce format de date : jj\/mm\/aaaa. Par exemple, 21\/12\/2012 pour le 21 D\u00e9cembre 2012.","Please enter a valid $ amount. For example $100.00.":"Veuillez saisir un montant valide. Par exemple 100.00 \u20ac.","Please select one of the above options.":"Veuillez choisir une des options ci-dessus.","Please select one of the options.":"Veuillez choisir une des options.","Please select State\/Province.":"Veuillez choisir un \u00e9tat\/province.","Please enter valid password.":"Veuillez saisir un mot de passe valide.","Please enter 6 or more characters. Leading or trailing spaces will be ignored.":"Veuillez saisir au moins 6 caract\u00e8res. Les espaces en d\u00e9but ou en fin de cha\u00eene seront ignor\u00e9s.","Please use letters only (a-z or A-Z) in this field.":"Veuillez utiliser uniquement des lettres (a-z ou A-Z) dans ce champ.","Please enter a number greater than 0 in this field.":"Veuillez saisir un nombre sup\u00e9rieur \u00e0 0 dans ce champ.","Please enter a valid credit card number.":"Veuillez saisir un num\u00e9ro de carte bancaire valide.","Please wait, loading...":"Veuillez patienter, chargement en cours...","Please choose to register or to checkout as a guest":"Choisissez de vous enregistrer ou de passer votre commande en tant qu'invit\u00e9","Error: Passwords do not match":"Erreur : les mots de passe sont diff\u00e9rents","Your order cannot be completed at this time as there is no shipping methods available for it. Please make necessary changes in your shipping address.":"Vous ne pouvez pas continuer votre commande car aucun mode de livraison n'est disponible pour votre adresse.","Please specify shipping method.":"Choisissez un mode de livraison.","Your order cannot be completed at this time as there is no payment methods available for it.":"Vous ne pouvez pas continuer votre commande car aucun mode de paiement n'est disponible.","Please specify payment method.":"Choisissez un mode de paiement.","Please enter a valid credit card verification number.":"Veuillez saisir un num\u00e9ro de v\u00e9rification de carte bancaire valide.","Please use only letters (a-z or A-Z), numbers (0-9) or underscore(_) in this field, first character should be a letter.":"Utilisez uniquement des lettres (a-z ou A-Z), des chiffres (0-9) ou des underscores (_) dans ce champ. Le premier caract\u00e8re doit \u00eatre une lettre.","Maximum length exceeded.":"D\u00e9passement de la longueur maximum","Your session has been expired, you will be relogged in now.":"Votre session a expir\u00e9, veuillez vous connecter \u00e0 nouveau.","This date is a required value.":"Cette date est obligatoire."});
var apijs = null, dacrydium = null, genericForm = null;
var prog = { geographics: null, homemap: null };
var allDepartSelects = [], allVilleSelects = [];
apijs = {
	i18n: null,
	dialogue: null,
	slideshow: null,
	upload: null,
	config: {
		lang: 'fr',
		debug: true,
		debugkey: false,
		navigator: true,
		transition: true,
		autolang: true,
		dialogue: {
			blocks: [],
			hiddenPage: false,
			savingDialog: false,
			savingTime: 750,
			showLoader: true,
			showFullsize: false,
			savePhoto: false,
			saveVideo: false,
			videoAutoplay: false,
			videoWidth: 640,
			videoHeight: 480,
			imagePrev: { src: 'http://www.strip-for-you.com/skin/frontend/dacrydium/strip4you/images/icons/24/gnome-prev.png', width: 34, height: 34 },
			imageNext: { src: 'http://www.strip-for-you.com/skin/frontend/dacrydium/strip4you/images/icons/24/gnome-next.png', width: 34, height: 34 },
			imageClose: { src: 'http://www.strip-for-you.com/skin/frontend/dacrydium/strip4you/images/dialogue/close.png', width: 60, height: 22 },
			imageUpload: { src: 'http://www.strip-for-you.com/skin/frontend/dacrydium/strip4you/images/dialogue/progressbar.svg.php', width: 300, height: 17 },
			filePhoto: null,
			fileVideo: null,
			fileUpload: 'http://www.strip-for-you.com/uploader/uploadfile.php'
		},
		slideshow: {
			ids: 'diaporama',
			hiddenPage: false,
			hoverload: false
		}
	}
};
function number_format(number, decimals, dec_point, thousands_sep) {
	var s, n, prec, sep, dec, toFixedFix;
	s = '';
	n = !isFinite(+number) ? 0 : +number;
	prec = !isFinite(+decimals) ? 0 : Math.abs(decimals);
	sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep;
	dec = (typeof dec_point === 'undefined') ? '.' : dec_point;
	toFixedFix = function (n, prec) {
		var k = Math.pow(10, prec);
		return '' + Math.round(n * k) / k;
	};
	s = ((prec) ? toFixedFix(n, prec) : '' + Math.round(n)).split('.');
	if (s[0].length > 3)
		s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep);
	if ((s[1] || '').length < prec) {
		s[1] = s[1] || '';
		s[1] += new Array(prec - s[1].length + 1).join('0');
	}
	return s.join(dec);
}
function in_array(needle, haystack) {
	if ((needle === null) || (haystack === null))
		return false;
	var key = null;
	if (needle instanceof Array) {
		for (key in needle) if (needle.hasOwnProperty(key)) {
			if (in_array(needle[key], haystack))
				return true;
		}
	}
	else {
		for (key in haystack) if (haystack.hasOwnProperty(key)) {
			if (!isNaN(key) && (haystack[key] === needle))
				return true;
		}
	}
	return false;
}
if ((navigator.userAgent.indexOf('MSIE') < 0) || (navigator.userAgent.indexOf('MSIE 9') > -1)) {
	window.addEventListener('load', start, false);
}
else if (navigator.userAgent.indexOf('MSIE 8') > -1) {
	apijs.config.navigator = false;
	apijs.config.transition = false;
	document.createElement('video');
	window.innerWidth = document.documentElement.clientWidth;
	window.innerHeight = document.documentElement.clientHeight;
	window.attachEvent('onload', start);
}
function start() {
	for (var tag = document.getElementsByTagName('a'), i = 0; i < tag.length; i++) {
		if (apijs.config.navigator && tag[i].hasAttribute('class') && (tag[i].getAttribute('class').indexOf('popup') > -1))
			tag[i].addEventListener('click', openTab, false);
		else if (tag[i].hasAttribute('class') && (tag[i].getAttribute('class').indexOf('popup') > -1))
			tag[i].setAttribute('onclick', 'window.open(this.href); return false;');
	}
	if (document.getElementById('genericForm'))
		genericForm = new VarienForm('genericForm');
	if ((typeof Internationalization === 'function') && (typeof BBcode === 'function') && (typeof Dialogue === 'function') && (typeof Slideshow === 'function')) {
		if ((typeof document.getElementsByTagName('body')[0].style.transitionDuration !== 'string') &&
		 (typeof document.getElementsByTagName('body')[0].style.MozTransitionDuration !== 'string') &&
		 (typeof document.getElementsByTagName('body')[0].style.webkitTransitionDuration !== 'string')) {
			apijs.config.transition = false;
		}
		if (apijs.config.navigator || (navigator.userAgent.indexOf('MSIE 8') > -1)) {
			try {
				apijs.i18n = new Internationalization();
				apijs.i18n.init();
				apijs.dialogue = new Dialogue();
				apijs.upload = new Upload();
				if (document.getElementById('diaporama.0')) {
					apijs.slideshow = new Slideshow();
					apijs.slideshow.init();
				}
			}
			catch (e) { }
		}
	}
	dacrydium = {};
	if (typeof TheForms === 'function') {
		dacrydium.theforms = new TheForms();
		dacrydium.theforms.init();
	}
	if (typeof TheProduct === 'function') {
		dacrydium.theproduct = new TheProduct();
		dacrydium.theproduct.init();
	}
	if (document.getElementById('homeMapStripteaseuses') && document.getElementById('homeMapStripteaseurs')) {
		Event.observe(document.getElementById('homeMapStripteaseuses'), 'click', function (ev) { prog.homemap = 'stripteaseuses'; });
		Event.observe(document.getElementById('homeMapStripteaseurs'), 'click', function (ev) { prog.homemap = 'stripteaseurs'; });
	}
	if (document.getElementById('selected')) {
		window.setInterval(function () {
		 if (/selected/.test(document.getElementById('selected').getAttribute('class')))
			 $('selected').removeClassName('selected');
		 else
			 $('selected').addClassName('selected');
		}, 1000);
	}
}
function check(id, type) {
	if (typeof prog.homemap !== 'string') {
		apijs.dialogue.dialogInformation('Strip For You','[p]Merci de préciser votre recherche[/p][p][img width="160" height="88" alt="Stripteaseuses" src="http://www.strip-for-you.com/skin/frontend/dacrydium/strip4you/images/design/sticker/stripteaseuses.png" onclick="validHomeMap(this.alt, ' + id + ', ' + type + ');"] [img width="160" height="88" alt="Stripteaseurs" src="http://www.strip-for-you.com/skin/frontend/dacrydium/strip4you/images/design/sticker/stripteaseurs.png" onclick="validHomeMap(this.alt, ' + id + ', ' + type + ');"][/p]', 'home');
		document.getElementById('box').removeChild(document.getElementById('box').lastChild);
	}
	else {
		validHomeMap(prog.homemap, id, type);
	}
	return false;
}
function checkPlace(id, type) {
	if (typeof prog.homemap !== 'string') {
		apijs.dialogue.dialogInformation('Strip For You','[p]Merci de préciser votre recherche[/p][p][img width="160" height="88" alt="restos" src="http://www.strip-for-you.com/skin/frontend/dacrydium/strip4you/images/design/sticker/restaurant.png" onclick="validPlaceMap(this.alt, ' + id + ', ' + type + ');"] [img width="160" height="88" alt="clubs" src="http://www.strip-for-you.com/skin/frontend/dacrydium/strip4you/images/design/sticker/club.png" onclick="validPlaceMap(this.alt, ' + id + ', ' + type + ');"][/p]', 'home');
		document.getElementById('box').removeChild(document.getElementById('box').lastChild);
	}
	else {
		validPlaceMap(prog.homemap, id, type);
	}
	return false;
}
function validHomeMap(cat, id, type) {
	if (document.getElementById('dialogue'))
		apijs.dialogue.dialogWaiting('Un instant', 'Merci de patienter quelques secondes...');
	cat = (typeof cat === 'string') ? cat.toLowerCase() : prog.homemap;
	location.href = 'http://www.strip-for-you.com/' + cat + '.html?' + ((type == 1) ? 'departements' : 'regions') + '=' + id + '&___store=stripforyou';
}
function validPlaceMap(cat, id, type) {
	if (document.getElementById('dialogue'))
		apijs.dialogue.dialogWaiting('Un instant', 'Merci de patienter quelques secondes...');
	cat = (typeof cat === 'string') ? cat.toLowerCase() : prog.homemap;
	location.href = 'http://www.strip-for-you.com/' + cat + '.html?' + ((type == 1) ? 'departements' : 'regions') + '=' + id + '&___store=stripforyou';
}
function openTab(ev) {
	ev.preventDefault();
	window.open(this.href);
}
function TheForms() {
	this.formRegister = null;
	this.formCrop = null;
	this.geographics = {
		'&nbsp;': {
			'&nbsp;': null
		},
		'monaco': null,
		'luxembourg': null,
		'france': {
			'alsace': null,
			'aquitaine': null,
			'auvergne': null,
			'bourgogne': null,
			'bretagne': null,
			'centre': null,
			'champagne-ardenne': null,
			'corse': null,
			'franche-comté': null,
			'île-de-france': null,
			'languedoc-roussillon': null,
			'limousin': null,
			'lorraine': null,
			'midi-pyrénées': null,
			'nord-pas-de-calais': null,
			'basse-normandie': null,
			'haute-normandie': null,
			'pays de la loire': null,
			'picardie': null,
			'poitou-charentes': null,
			'provence-alpes-côte-d\'azur': null,
			'rhône-alpes': null
		},
		'dom-tom': {
			'guyane': null,
			'guadeloupe': null,
			'réunion': null,
			'martinique': null,
			'nouvelle-calédonie': null,
			'polynésie française': null,
			'wallis-et-futuna': null,
			'mayotte': null,
			'saint-pierre-et-miquelon': null,
			'saint-martin': null
		},
		'alsace': {
			'67 bas-rhin': null,
			'68 haut-rhin': null
		},
		'aquitaine': {
			'24 dordogne': null,
			'33 gironde': null,
			'40 landes': null,
			'47 lot-et-garonne': null,
			'64 pyrénées-atlantiques': null
		},
		'auvergne': {
			'03 allier': null,
			'15 cantal': null,
			'43 haute-loire': null,
			'63 puy-de-dôme': null
		},
		'bourgogne': {
			'21 côte-d\'or': null,
			'58 nièvre': null,
			'71 saône-et-loire': null,
			'89 yonne': null
		},
		'bretagne': {
			'22 côtes-d\'armor': null,
			'29 finistère': null,
			'35 ille-et-vilaine': null,
			'56 morbihan': null
		},
		'centre': {
			'18 cher': null,
			'28 eure-et-loir': null,
			'36 indre': null,
			'37 indre-et-loire': null,
			'41 loir-et-cher': null,
			'45 loiret': null
		},
		'champagne-ardenne': {
			'08 ardennes': null,
			'10 aube': null,
			'51 marne': null,
			'52 haute-marne': null
		},
		'corse': {
			'2a corse-du-sud': null,
			'2b haute-corse': null
		},
		'franche-comté': {
			'25 doubs': null,
			'39 jura': null,
			'70 haute-saône': null,
			'90 territoire de belfort': null
		},
		'île-de-france': {
			'75 paris': null,
			'77 seine-et-marne': null,
			'78 yvelines': null,
			'91 essonne': null,
			'92 hauts-de-seine': null,
			'93 seine-saint-denis': null,
			'94 val-de-marne': null,
			'95 val-d\'oise': null
		},
		'languedoc-roussillon': {
			'11 aude': null,
			'30 gard': null,
			'34 hérault': null,
			'48 lozère': null,
			'66 pyrénées-orientales': null
		},
		'limousin': {
			'19 corrèze': null,
			'23 creuse': null,
			'87 haute-vienne': null
		},
		'lorraine': {
			'54 meurthe-et-moselle': null,
			'55 meuse': null,
			'57 moselle': null,
			'88 vosges': null
		},
		'midi-pyrénées': {
			'09 ariège': null,
			'12 aveyron': null,
			'31 haute-garonne': null,
			'32 gers': null,
			'46 lot': null,
			'65 hautes-pyrénées': null,
			'81 tarn': null,
			'82 tarn-et-garonne': null
		},
		'nord-pas-de-calais': {
			'59 nord': null,
			'62 pas-de-calais': null
		},
		'basse-normandie': {
			'14 calvados': null,
			'50 manche': null,
			'61 orne': null
		},
		'haute-normandie': {
			'27 eure': null,
			'76 seine-maritime': null
		},
		'pays de la loire': {
			'44 loire-atlantique': null,
			'49 maine-et-loire': null,
			'53 mayenne': null,
			'72 sarthe': null,
			'85 vendée': null
		},
		'picardie': {
			'02 aisne': null,
			'60 oise': null,
			'80 somme': null
		},
		'poitou-charentes': {
			'16 charente': null,
			'17 charente-maritime': null,
			'79 deux-sèvres': null,
			'86 vienne': null
		},
		'provence-alpes-côte-d\'azur': {
			'04 alpes-de-haute-provence': null,
			'05 hautes-alpes': null,
			'06 alpes-maritimes': null,
			'13 bouches-du-rhône': null,
			'83 var': null,
			'84 vaucluse': null
		},
		'rhône-alpes': {
			'01 ain': null,
			'07 ardèche': null,
			'26 drôme': null,
			'38 isère': null,
			'42 loire': null,
			'69 rhône': null,
			'73 savoie': null,
			'74 haute-savoie': null
		},
		'reg6': {
			'67 bas-rhin': null,
			'68 haut-rhin': null
		},
		'reg7': {
			'24 dordogne': null,
			'33 gironde': null,
			'40 landes': null,
			'47 lot-et-garonne': null,
			'64 pyrénées-atlantiques': null
		},
		'reg8': {
			'03 allier': null,
			'15 cantal': null,
			'43 haute-loire': null,
			'63 puy-de-dôme': null
		},
		'reg9': {
			'21 côte-d\'or': null,
			'58 nièvre': null,
			'71 saône-et-loire': null,
			'89 yonne': null
		},
		'reg10': {
			'22 côtes-d\'armor': null,
			'29 finistère': null,
			'35 ille-et-vilaine': null,
			'56 morbihan': null
		},
		'reg11': {
			'18 cher': null,
			'28 eure-et-loir': null,
			'36 indre': null,
			'37 indre-et-loire': null,
			'41 loir-et-cher': null,
			'45 loiret': null
		},
		'reg12': {
			'08 ardennes': null,
			'10 aube': null,
			'51 marne': null,
			'52 haute-marne': null
		},
		'reg13': {
			'2a corse-du-sud': null,
			'2b haute-corse': null
		},
		'reg14': {
			'25 doubs': null,
			'39 jura': null,
			'70 haute-saône': null,
			'90 territoire de belfort': null
		},
		'reg15': {
			'75 paris': null,
			'77 seine-et-marne': null,
			'78 yvelines': null,
			'91 essonne': null,
			'92 hauts-de-seine': null,
			'93 seine-saint-denis': null,
			'94 val-de-marne': null,
			'95 val-d\'ois': null
		},
		'reg16': {
			'11 aude': null,
			'30 gard': null,
			'34 hérault': null,
			'48 lozère': null,
			'66 pyrénées-orientales': null
		},
		'reg17': {
			'19 corrèze': null,
			'23 creuse': null,
			'87 haute-vienne': null
		},
		'reg18': {
			'54 meurthe-et-moselle': null,
			'55 meuse': null,
			'57 moselle': null,
			'88 vosges': null
		},
		'reg19': {
			'09 ariège': null,
			'12 aveyron': null,
			'31 haute-garonne': null,
			'32 gers': null,
			'46 lot': null,
			'65 hautes-pyrénées': null,
			'81 tarn': null,
			'82 tarn-et-garonne': null
		},
		'reg20': {
			'59 nord': null,
			'62 pas-de-calais': null
		},
		'reg21': {
			'14 calvados': null,
			'50 manche': null,
			'61 orne': null
		},
		'reg22': {
			'27 eure': null,
			'76 seine-maritime': null
		},
		'reg23': {
			'44 loire-atlantique': null,
			'49 maine-et-loire': null,
			'53 mayenne': null,
			'72 sarthe': null,
			'85 vendée': null
		},
		'reg24': {
			'02 aisne': null,
			'60 oise': null,
			'80 somme': null
		},
		'reg25': {
			'16 charente': null,
			'17 charente-maritime': null,
			'79 deux-sèvres': null,
			'86 vienne': null
		},
		'reg26': {
			'04 alpes-de-haute-provence': null,
			'05 hautes-alpes': null,
			'06 alpes-maritimes': null,
			'13 bouches-du-rhône': null,
			'83 var': null,
			'84 vaucluse': null
		},
		'reg27': {
			'01 ain': null,
			'07 ardèche': null,
			'26 drôme': null,
			'38 isère': null,
			'42 loire': null,
			'69 rhône': null,
			'73 savoie': null,
			'74 haute-savoie': null
		},
		'suisse': {
			'zh zurich': null,
			'be berne': null,
			'lu lucerne': null,
			'ur uri': null,
			'sz schwytz': null,
			'ow obwald': null,
			'nw nidwald': null,
			'gl glaris': null,
			'zg zoug': null,
			'fr fribourg': null,
			'so soleure': null,
			'bs bâle-ville': null,
			'bl bâle-campagne': null,
			'sh schaffhouse': null,
			'ar appenzell rhodes-extérieures': null,
			'ai appenzell rhodes-intérieures': null,
			'sg saint-gall': null,
			'gr grisons': null,
			'ag argovie': null,
			'tg thurgovie': null,
			'ti tessin': null,
			'vd vaud': null,
			'vs valais': null,
			'ne neuchâtel': null,
			'ge genève': null,
			'ju jura': null,
			'ch suisse': null
		},
		'belgique': {
			'flandre': null,
			'wallonie': null,
			'bruxelles': null
		},
		'flandre': {
			'anvers': null,
			'flandre orientale': null,
			'flandre occidentale': null,
			'brabant flamand': null,
			'limbourg': null,
			'louvain': null
		},
		'wallonie': {
			'hainaut': null,
			'liège': null,
			'namur': null,
			'brabant wallon': null,
			'luxembourg': null
		},
		'bruxelles': {
			'bruxelles': null
		},
		'01': {
			'bourg-en-bresse': null,
			'oyonnax': null,
			'ambérieu-en-bugey': null,
			'bellegarde-sur-valserine': null},
		'02': {
			'saint-quentin': null,
			'soissons': null,
			'laon': null,
			'château-thierry': null,
			'tergnier': null,
			'chauny': null,
			'villers-cotterêts': null},
		'03': {
			'montluçon': null,
			'vichy': null,
			'moulins': null,
			'cusset': null,
			'yzeure': null},
		'04': {
			'manosque': null,
			'digne-les-bains': null},
		'05': {
			'gap': null,
			'briançon': null},
		'06': {
			'nice': null,
			'antibes': null,
			'cannes': null,
			'grasse': null,
			'cagnes-sur-mer': null,
			'le cannet': null,
			'vallauris': null,
			'saint-laurent-du-var': null,
			'menton': null,
			'mandelieu-la-napoule': null,
			'mougins': null,
			'vence': null,
			'villeneuve-loubet': null,
			'beausoleil': null,
			'roquebrune-cap-martin': null,
			'valbonne': null,
			'carros': null,
			'mouans-sartoux': null,
			'la trinité': null},
		'07': {
			'annonay': null,
			'aubenas': null,
			'tournon-sur-rhône': null,
			'guilherand-granges': null},
		'08': {
			'charleville-mézières': null,
			'sedan': null},
		'09': {
			'pamiers': null,
			'foix': null},
		'10': {
			'troyes': null,
			'romilly-sur-seine': null,
			'la chapelle-saint-luc': null,
			'saint-andré-les-vergers': null,
			'sainte-savine': null},
		'11': {
			'narbonne': null,
			'carcassonne': null,
			'castelnaudary': null,
			'limoux': null},
		'12': {
			'rodez': null,
			'millau': null,
			'villefranche-de-rouergue': null,
			'onet-le-château': null},
		'13': {
			'aix-en-provence': null,
			'arles': null,
			'martigues': null,
			'aubagne': null,
			'istres': null,
			'salon-de-provence': null,
			'vitrolles': null,
			'marseille': null,
			'marignane': null,
			'la ciotat': null,
			'miramas': null,
			'gardanne': null,
			'les pennes-mirabeau': null,
			'allauch': null,
			'port-de-bouc': null,
			'fos-sur-mer': null,
			'châteaurenard': null,
			'berre-lÉtang': null,
			'bouc-bel-air': null,
			'tarascon': null,
			'rognac': null,
			'chateauneuf-les-martigues': null,
			'auriol': null,
			'saint-martin-de-crau': null,
			'plan-de-cuques': null,
			'saint-rémy-de-provence': null,
			'trets': null,
			'septèmes-les-vallons': null},
		'14': {
			'caen': null,
			'lisieux': null,
			'hérouville-saint-clair': null,
			'bayeux': null,
			'vire': null,
			'ifs': null,
			'mondeville': null},
		'15': {
			'aurillac': null},
		'16': {
			'angoulême': null,
			'cognac': null,
			'soyaux': null},
		'17': {
			'la rochelle': null,
			'saintes': null,
			'rochefort': null,
			'royan': null},
		'18': {
			'bourges': null,
			'vierzon': null,
			'saint-amand-montrond': null},
		'19': {
			'brive-la-gaillarde': null,
			'tulle': null,
			'ussel': null},
		'21': {
			'dijon': null,
			'beaune': null,
			'chenôve': null,
			'talant': null},
		'22': {
			'saint-brieuc': null,
			'lannion': null,
			'plérin': null,
			'dinan': null,
			'lamballe': null,
			'ploufragan': null,
			'loudéac': null},
		'23': {
			'guéret': null},
		'24': {
			'périgueux': null,
			'bergerac': null,
			'sarlat-la-canéda': null},
		'25': {
			'besançon': null,
			'montbéliard': null,
			'pontarlier': null,
			'audincourt': null,
			'valentigney': null},
		'26': {
			'valence': null,
			'montélimar': null,
			'romans-sur-isère': null,
			'bourg-lès-valence': null,
			'pierrelatte': null,
			'bourg-de-péage': null},
		'27': {
			'Évreux': null,
			'vernon': null,
			'louviers': null,
			'val-de-reuil': null,
			'gisors': null,
			'bernay': null},
		'28': {
			'chartres': null,
			'dreux': null,
			'lucé': null,
			'châteaudun': null,
			'vernouillet': null,
			'nogent-le-rotrou': null,
			'mainvilliers': null},
		'29': {
			'brest': null,
			'quimper': null,
			'concarneau': null,
			'morlaix': null,
			'douarnenez': null,
			'landerneau': null,
			'guipavas': null,
			'plougastel-daoulas': null,
			'plouzané': null,
			'quimperlé': null,
			'le relecq-kerhuon': null,
			'fouesnant': null},
		'2A': {
			'ajaccio': null},
		'2B': {
			'bastia': null},
		'2a': {
				'ajaccio': null},
		'2b': {
				'bastia': null},
		'30': {
			'nîmes': null,
			'alès': null,
			'bagnols-sur-cèze': null,
			'beaucaire': null,
			'saint-gilles': null,
			'villeneuve-lès-avignon': null,
			'vauvert': null},
		'31': {
			'toulouse': null,
			'colomiers': null,
			'tournefeuille': null,
			'muret': null,
			'blagnac': null,
			'cugnaux': null,
			'plaisance-du-touch': null,
			'balma': null,
			'l union': null,
			'ramonville-saint-agne': null,
			'saint-gaudens': null,
			'saint-orens-de-gameville': null,
			'fonsorbes': null,
			'castanet-tolosan': null},
		'32': {
			'auch': null},
		'33': {
			'bordeaux': null,
			'mérignac': null,
			'pessac': null,
			'talence': null,
			'villenave-d ornon': null,
			'saint-médard-en-jalles': null,
			'la teste-de-buch': null,
			'bègles': null,
			'libourne': null,
			'le bouscat': null,
			'gradignan': null,
			'cenon': null,
			'lormont': null,
			'eysines': null,
			'gujan-mestras': null,
			'cestas': null,
			'floirac': null,
			'blanquefort': null,
			'bruges': null,
			'ambarès-et-lagrave': null,
			'arcachon': null,
			'andernos-les-bains': null},
		'34': {
			'montpellier': null,
			'béziers': null,
			'sète': null,
			'lunel': null,
			'frontignan': null,
			'agde': null,
			'lattes': null,
			'mauguio': null,
			'castelnau-le-lez': null,
			'mèze': null},
		'35': {
			'rennes': null,
			'saint-malo': null,
			'fougères': null,
			'vitré': null,
			'cesson-sévigné': null,
			'bruz': null,
			'dinard': null,
			'redon': null},
		'36': {
			'châteauroux': null,
			'issoudun': null},
		'37': {
			'tours': null,
			'joué-lès-tours': null,
			'saint-cyr-sur-loire': null,
			'saint-pierre-des-corps': null,
			'saint-avertin': null,
			'amboise': null,
			'chambray-lès-tours': null,
			'montlouis-sur-loire': null,
			'fondettes': null},
		'38': {
			'grenoble': null,
			'Échirolles': null,
			'saint-martin-d hères': null,
			'vienne': null,
			'bourgoin-jallieu': null,
			'fontaine': null,
			'voiron': null,
			'villefontaine': null,
			'meylan': null,
			'l isle-d abeau': null,
			'saint-Égrève': null,
			'seyssinet-pariset': null,
			'le pont-de-claix': null,
			'sassenage': null},
		'39': {
			'dole': null,
			'lons-le-saunier': null,
			'saint-claude': null},
		'40': {
			'mont-de-marsan': null,
			'dax': null,
			'biscarrosse': null,
			'saint-paul-lès-dax': null,
			'tarnos': null},
		'41': {
			'blois': null,
			'romorantin-lanthenay': null,
			'vendôme': null},
		'42': {
			'saint-Étienne': null,
			'roanne': null,
			'saint-chamond': null,
			'firminy': null,
			'montbrison': null,
			'saint-just-saint-rambert': null,
			'rive-de-gier': null,
			'le chambon-feugerolles': null,
			'roche-la-molière': null,
			'riorges': null},
		'43': {
			'le puy-en-velay': null},
		'44': {
			'nantes': null,
			'saint-nazaire': null,
			'saint-herblain': null,
			'rezé': null,
			'saint-sébastien-sur-loire': null,
			'orvault': null,
			'vertou': null,
			'couëron': null,
			'carquefou': null,
			'la chapelle-sur-erdre': null,
			'bouguenais': null,
			'la baule-escoublac': null,
			'guérande': null,
			'pornic': null,
			'châteaubriant': null,
			'sainte-luce-sur-loire': null,
			'saint-brevin-les-pins': null,
			'pornichet': null},
		'45': {
			'orléans': null,
			'fleury-les-aubrais': null,
			'olivet': null,
			'saint-jean-de-braye': null,
			'saint-jean-de-la-ruelle': null,
			'montargis': null,
			'gien': null,
			'saran': null,
			'châlette-sur-loing': null,
			'amilly': null},
		'46': {
			'cahors': null,
			'figeac': null},
		'47': {
			'agen': null,
			'villeneuve-sur-lot': null,
			'marmande': null},
		'48': {
			'mende': null},
		'49': {
			'angers': null,
			'cholet': null,
			'saumur': null,
			'avrillé': null,
			'trélazé': null,
			'les ponts-de-cé': null},
		'50': {
			'cherbourg-octeville': null,
			'saint-lô': null,
			'Équeurdreville-hainneville': null,
			'tourlaville': null,
			'granville': null,
			'coutances': null},
		'51': {
			'reims': null,
			'châlons-en-champagne': null,
			'Épernay': null,
			'vitry-le-françois': null,
			'tinqueux': null},
		'52': {
			'saint-dizier': null,
			'chaumont': null},
		'53': {
			'laval': null,
			'mayenne': null,
			'château-gontier': null},
		'54': {
			'nancy': null,
			'vandoeuvre-lès-nancy': null,
			'lunéville': null,
			'toul': null,
			'laxou': null,
			'villers-lès-nancy': null,
			'longwy': null,
			'pont-à-mousson': null,
			'saint-max': null},
		'55': {
			'verdun': null,
			'bar-le-duc': null},
		'56': {
			'lorient': null,
			'vannes': null,
			'lanester': null,
			'ploemeur': null,
			'hennebont': null,
			'pontivy': null,
			'auray': null,
			'guidel': null,
			'saint-avé': null},
		'57': {
			'metz': null,
			'thionville': null,
			'montigny-lès-metz': null,
			'forbach': null,
			'sarreguemines': null,
			'saint-avold': null,
			'yutz': null,
			'hayange': null,
			'creutzwald': null,
			'freyming-merlebach': null,
			'woippy': null,
			'sarrebourg': null,
			'stiring-wendel': null,
			'fameck': null,
			'florange': null,
			'amnéville': null,
			'rombas': null},
		'58': {
			'nevers': null,
			'cosne-cours-sur-loire': null},
		'59': {
			'lille': null,
			'roubaix': null,
			'tourcoing': null,
			'dunkerque': null,
			'villeneuve-d ascq': null,
			'douai': null,
			'valenciennes': null,
			'wattrelos': null,
			'marcq-en-baroeul': null,
			'cambrai': null,
			'maubeuge': null,
			'lambersart': null,
			'armentières': null,
			'coudekerque-branche': null,
			'la madeleine': null,
			'mons-en-baroeul': null,
			'saint-pol-sur-mer': null,
			'loos': null,
			'grande-synthe': null,
			'hazebrouck': null,
			'croix': null,
			'denain': null,
			'halluin': null,
			'wasquehal': null,
			'ronchin': null,
			'hem': null,
			'sin-le-noble': null,
			'saint-amand-les-eaux': null,
			'faches-thumesnil': null,
			'hautmont': null,
			'haubourdin': null,
			'anzin': null,
			'wattignies': null,
			'bailleul': null,
			'caudry': null,
			'raismes': null,
			'fourmies': null,
			'mouvaux': null,
			'roncq': null,
			'lys-lez-lannoy': null,
			'seclin': null,
			'comines': null,
			'somain': null,
			'gravelines': null,
			'marly': null,
			'bruay-sur-l escaut': null,
			'vieux-condé': null,
			'saint-andré-lez-lille': null,
			'saint-saulve': null,
			'bondues': null,
			'jeumont': null,
			'condé-sur-l escaut': null,
			'douchy-les-mines': null,
			'aniche': null,
			'marquette-lez-lille': null},
		'60': {
			'beauvais': null,
			'compiègne': null,
			'creil': null,
			'nogent-sur-oise': null,
			'senlis': null,
			'noyon': null,
			'crépy-en-valois': null,
			'méru': null,
			'montataire': null,
			'pont-sainte-maxence': null,
			'chantilly': null,
			'clermont': null},
		'61': {
			'alençon': null,
			'flers': null,
			'argentan': null},
		'62': {
			'calais': null,
			'boulogne-sur-mer': null,
			'arras': null,
			'lens': null,
			'liévin': null,
			'béthune': null,
			'hénin-beaumont': null,
			'bruay-la-buissière': null,
			'avion': null,
			'carvin': null,
			'saint-omer': null,
			'berck': null,
			'outreau': null,
			'harnes': null,
			'noeux-les-mines': null,
			'bully-les-mines': null,
			'longuenesse': null,
			'Étaples': null,
			'méricourt': null,
			'saint-martin-boulogne': null,
			'auchel': null,
			'oignies': null,
			'sallaumines': null,
			'courrières': null,
			'montigny-en-gohelle': null,
			'le portel': null,
			'lillers': null},
		'63': {
			'clermont-ferrand': null,
			'cournon-d auvergne': null,
			'riom': null,
			'chamalières': null,
			'issoire': null,
			'thiers': null,
			'beaumont': null,
			'pont-du-château': null,
			'aubière': null,
			'gerzat': null},
		'64': {
			'pau': null,
			'bayonne': null,
			'anglet': null,
			'biarritz': null,
			'hendaye': null,
			'saint-jean-de-luz': null,
			'billère': null,
			'lons': null,
			'oloron-sainte-marie': null,
			'orthez': null,
			'lescar': null},
		'65': {
			'tarbes': null,
			'lourdes': null},
		'66': {
			'perpignan': null,
			'canet-en-roussillon': null,
			'saint-estève': null,
			'saint-cyprien': null,
			'argelès-sur-mer': null},
		'67': {
			'strasbourg': null,
			'haguenau': null,
			'schiltigheim': null,
			'illkirch-graffenstaden': null,
			'sélestat': null,
			'bischheim': null,
			'lingolsheim': null,
			'bischwiller': null,
			'saverne': null,
			'obernai': null,
			'ostwald': null,
			'hoenheim': null},
		'68': {
			'mulhouse': null,
			'colmar': null,
			'saint-louis': null,
			'illzach': null,
			'wittenheim': null,
			'kingersheim': null,
			'rixheim': null,
			'riedisheim': null,
			'guebwiller': null,
			'cernay': null,
			'wittelsheim': null},
		'69': {
			'villeurbanne': null,
			'vénissieux': null,
			'caluire-et-cuire': null,
			'saint-priest': null,
			'vaulx-en-velin': null,
			'bron': null,
			'villefranche-sur-saône': null,
			'rillieux-la-pape': null,
			'meyzieu': null,
			'oullins': null,
			'décines-charpieu': null,
			'sainte-foy-lès-lyon': null,
			'saint-genis-laval': null,
			'givors': null,
			'Écully': null,
			'tassin-la-demi-lune': null,
			'saint-fons': null,
			'francheville': null,
			'lyon': null,
			'brignais': null,
			'genas': null,
			'mions': null,
			'tarare': null,
			'pierre-bénite': null},
		'70': {
			'vesoul': null,
			'héricourt': null},
		'71': {
			'chalon-sur-saône': null,
			'mâcon': null,
			'le creusot': null,
			'montceau-les-mines': null,
			'autun': null},
		'72': {
			'le mans': null,
			'la flèche': null,
			'sablé-sur-sarthe': null,
			'allonnes': null},
		'73': {
			'chambéry': null,
			'aix-les-bains': null,
			'albertville': null,
			'la motte-servolex': null},
		'74': {
			'annecy': null,
			'thonon-les-bains': null,
			'annemasse': null,
			'annecy-le-vieux': null,
			'cluses': null,
			'seynod': null,
			'cran-gevrier': null,
			'sallanches': null,
			'rumilly': null,
			'passy': null,
			'gaillard': null,
			'saint-julien-en-genevois': null,
			'bonneville': null,
			'la roche-sur-foron': null},
		'75': {
			'paris': null},
		'76': {
			'le havre': null,
			'rouen': null,
			'dieppe': null,
			'sotteville-lès-rouen': null,
			'saint-Étienne-du-rouvray': null,
			'le grand-quevilly': null,
			'le petit-quevilly': null,
			'mont-saint-aignan': null,
			'fécamp': null,
			'elbeuf': null,
			'montivilliers': null,
			'canteleu': null,
			'bois-guillaume': null,
			'barentin': null,
			'bolbec': null,
			'maromme': null,
			'oissel': null,
			'yvetot': null,
			'déville-lès-rouen': null},
		'77': {
			'meaux': null,
			'chelles': null,
			'melun': null,
			'pontault-combault': null,
			'savigny-le-temple': null,
			'champs-sur-marne': null,
			'villeparisis': null,
			'torcy': null,
			'combs-la-ville': null,
			'roissy-en-brie': null,
			'dammarie-les-lys': null,
			'le mée-sur-seine': null,
			'ozoir-la-ferrière': null,
			'lagny-sur-marne': null,
			'bussy-saint-georges': null,
			'mitry-mory': null,
			'montereau-fault-yonne': null,
			'moissy-cramayel': null,
			'fontainebleau': null,
			'noisiel': null,
			'brie-comte-robert': null,
			'lognes': null,
			'avon': null,
			'coulommiers': null,
			'nemours': null,
			'provins': null,
			'saint-fargeau-ponthierry': null,
			'vaires-sur-marne': null,
			'vaux-le-pénil': null,
			'claye-souilly': null},
		'78': {
			'versailles': null,
			'sartrouville': null,
			'saint-germain-en-laye': null,
			'mantes-la-jolie': null,
			'poissy': null,
			'montigny-le-bretonneux': null,
			'conflans-sainte-honorine': null,
			'les mureaux': null,
			'plaisir': null,
			'houilles': null,
			'le chesnay': null,
			'chatou': null,
			'trappes': null,
			'guyancourt': null,
			'Élancourt': null,
			'rambouillet': null,
			'maisons-laffitte': null,
			'la celle-saint-cloud': null,
			'vélizy-villacoublay': null,
			'achères': null,
			'maurepas': null,
			'mantes-la-ville': null,
			'les clayes-sous-bois': null,
			'le vésinet': null,
			'marly-le-roi': null,
			'saint-cyr-l École': null,
			'viroflay': null,
			'limay': null,
			'le pecq': null,
			'verneuil-sur-seine': null,
			'carrières-sur-seine': null,
			'montesson': null,
			'carrières-sous-poissy': null,
			'bois-d arcy': null,
			'fontenay-le-fleury': null,
			'voisins-le-bretonneux': null,
			'andrésy': null,
			'aubergenville': null,
			'triel-sur-seine': null,
			'croissy-sur-seine': null,
			'villepreux': null},
		'79': {
			'niort': null,
			'bressuire': null,
			'parthenay': null,
			'thouars': null},
		'80': {
			'amiens': null,
			'abbeville': null,
			'albert': null},
		'81': {
			'albi': null,
			'castres': null,
			'gaillac': null,
			'graulhet': null,
			'mazamet': null,
			'carmaux': null,
			'lavaur': null},
		'82': {
			'montauban': null,
			'castelsarrasin': null,
			'moissac': null},
		'83': {
			'toulon': null,
			'la seyne-sur-mer': null,
			'hyères': null,
			'fréjus': null,
			'draguignan': null,
			'six-fours-les-plages': null,
			'saint-raphaël': null,
			'la garde': null,
			'la valette-du-var': null,
			'sanary-sur-mer': null,
			'la crau': null,
			'brignoles': null,
			'saint-maximin-la-sainte-baume': null,
			'sainte-maxime': null,
			'ollioules': null,
			'saint-cyr-sur-mer': null,
			'roquebrune-sur-argens': null,
			'cogolin': null,
			'solliès-pont': null,
			'le pradet': null,
			'la londe-les-maures': null},
		'84': {
			'avignon': null,
			'orange': null,
			'carpentras': null,
			'cavaillon': null,
			'pertuis': null,
			'sorgues': null,
			'l isle-sur-la-sorgue': null,
			'le pontet': null,
			'bollène': null,
			'apt': null,
			'monteux': null,
			'pernes-les-fontaines': null,
			'valréas': null,
			'vedène': null},
		'85': {
			'la roche-sur-yon': null,
			'challans': null,
			'les sables-d olonne': null,
			'les herbiers': null,
			'fontenay-le-comte': null,
			'château-d olonne': null,
			'olonne-sur-mer': null,
			'saint-hilaire-de-riez': null,
			'luçon': null},
		'86': {
			'poitiers': null,
			'châtellerault': null},
		'87': {
			'limoges': null,
			'saint-junien': null,
			'panazol': null},
		'88': {
			'Épinal': null,
			'saint-dié-des-vosges': null},
		'89': {
			'auxerre': null,
			'sens': null,
			'joigny': null},
		'90': {
			'belfort': null},
		'91': {
			'Évry': null,
			'corbeil-essonnes': null,
			'massy': null,
			'savigny-sur-orge': null,
			'sainte-geneviève-des-bois': null,
			'viry-châtillon': null,
			'athis-mons': null,
			'palaiseau': null,
			'draveil': null,
			'yerres': null,
			'ris-orangis': null,
			'vigneux-sur-seine': null,
			'brunoy': null,
			'grigny': null,
			'les ulis': null,
			'montgeron': null,
			'brétigny-sur-orge': null,
			'Étampes': null,
			'gif-sur-yvette': null,
			'morsang-sur-orge': null,
			'longjumeau': null,
			'saint-michel-sur-orge': null,
			'chilly-mazarin': null,
			'orsay': null,
			'verrières-le-buisson': null,
			'courcouronnes': null,
			'juvisy-sur-orge': null,
			'mennecy': null,
			'Épinay-sous-sénart': null,
			'morangis': null,
			'igny': null,
			'Épinay-sur-orge': null},
		'92': {
			'boulogne-billancourt': null,
			'nanterre': null,
			'courbevoie': null,
			'asnières-sur-seine': null,
			'colombes': null,
			'rueil-malmaison': null,
			'levallois-perret': null,
			'neuilly-sur-seine': null,
			'issy-les-moulineaux': null,
			'antony': null,
			'clichy': null,
			'clamart': null,
			'meudon': null,
			'montrouge': null,
			'suresnes': null,
			'gennevilliers': null,
			'puteaux': null,
			'bagneux': null,
			'châtillon': null,
			'châtenay-malabry': null,
			'malakoff': null,
			'saint-cloud': null,
			'la garenne-colombes': null,
			'bois-colombes': null,
			'vanves': null,
			'villeneuve-la-garenne': null,
			'fontenay-aux-roses': null,
			'sèvres': null,
			'le plessis-robinson': null,
			'bourg-la-reine': null,
			'sceaux': null,
			'chaville': null,
			'garches': null,
			'ville-d avray': null},
		'93': {
			'montreuil': null,
			'saint-denis': null,
			'aulnay-sous-bois': null,
			'aubervilliers': null,
			'drancy': null,
			'noisy-le-grand': null,
			'pantin': null,
			'bondy': null,
			'Épinay-sur-seine': null,
			'le blanc-mesnil': null,
			'sevran': null,
			'bobigny': null,
			'saint-ouen': null,
			'livry-gargan': null,
			'rosny-sous-bois': null,
			'noisy-le-sec': null,
			'gagny': null,
			'la courneuve': null,
			'villepinte': null,
			'tremblay-en-france': null,
			'stains': null,
			'bagnolet': null,
			'neuilly-sur-marne': null,
			'clichy-sous-bois': null,
			'villemomble': null,
			'pierrefitte-sur-seine': null,
			'montfermeil': null,
			'romainville': null,
			'les lilas': null,
			'les pavillons-sous-bois': null,
			'neuilly-plaisance': null,
			'le pré-saint-gervais': null,
			'le raincy': null,
			'le bourget': null,
			'villetaneuse': null,
			'dugny': null},
		'94': {
			'créteil': null,
			'vitry-sur-seine': null,
			'saint-maur-des-fossés': null,
			'champigny-sur-marne': null,
			'ivry-sur-seine': null,
			'maisons-alfort': null,
			'fontenay-sous-bois': null,
			'villejuif': null,
			'vincennes': null,
			'alfortville': null,
			'choisy-le-roi': null,
			'le perreux-sur-marne': null,
			'nogent-sur-marne': null,
			'l haÿ-les-roses': null,
			'villeneuve-saint-georges': null,
			'thiais': null,
			'villiers-sur-marne': null,
			'charenton-le-pont': null,
			'cachan': null,
			'sucy-en-brie': null,
			'fresnes': null,
			'le kremlin-bicêtre': null,
			'saint-mandé': null,
			'orly': null,
			'arcueil': null,
			'limeil-brévannes': null,
			'chevilly-larue': null,
			'villeneuve-le-roi': null,
			'le plessis-trévise': null,
			'chennevières-sur-marne': null,
			'joinville-le-pont': null,
			'gentilly': null,
			'bonneuil-sur-marne': null,
			'boissy-saint-léger': null,
			'bry-sur-marne': null,
			'saint-maurice': null,
			'valenton': null,
			'la queue-en-brie': null},
		'95': {
			'argenteuil': null,
			'sarcelles': null,
			'cergy': null,
			'garges-lès-gonesse': null,
			'franconville': null,
			'goussainville': null,
			'pontoise': null,
			'ermont': null,
			'bezons': null,
			'villiers-le-bel': null,
			'taverny': null,
			'sannois': null,
			'gonesse': null,
			'herblay': null,
			'eaubonne': null,
			'saint-ouen-l aumône': null,
			'cormeilles-en-parisis': null,
			'montmorency': null,
			'saint-gratien': null,
			'deuil-la-barre': null,
			'montigny-lès-cormeilles': null,
			'soisy-sous-montmorency': null,
			'jouy-le-moutier': null,
			'Éragny': null,
			'osny': null,
			'vauréal': null,
			'domont': null,
			'saint-leu-la-forêt': null,
			'montmagny': null,
			'saint-brice-sous-forêt': null,
			'arnouville-lès-gonesse': null,
			'enghien-les-bains': null,
			'l isle-adam': null,
			'persan': null}
	};
	this.listesInitiales = function () {
			var i = 0, j= 0; depSelects = null; villesSelects = null; Selected = null; departements = []; villes = [];
			for (depSelects = $$('.validate-select-dep'), i = 0; i < depSelects.length; i++){
				departements = [];
				for (tag = depSelects[i].getElementsByTagName('option'), j = 0; j < tag.length; j++) {
					departements.push(tag[j].value);
				}
			allDepartSelects[depSelects[i].id] = departements;
			}
			for (villesSelects = $$('.validate-select-vil'), i = 0; i < villesSelects.length; i++){
				villes = [];
				for (tag = villesSelects[i].getElementsByTagName('option'), j = 0; j < tag.length; j++) {
					villes.push(tag[j].value);
				}
				allVilleSelects[villesSelects[i].id] = villes;
			}
		};
	this.filterGeographicDeparts = function (selectedRegion) {
			var i = 0, tag = null, departSelect = '', villeSelect, departement = null, departId = 'departement'+selectedRegion.id.substr(6), departsOfRegion = [], selectedRegionName = selectedRegion.value.toLowerCase(), Selected = 0, htmlSelect = '';
				departSelect = document.getElementById(departId);
				villeSelect = document.getElementById('villes'+selectedRegion.id.substr(6));
				for ( i = 0; i < allDepartSelects[departSelect.id].length; i++) {
					departement = allDepartSelects[departSelect.id][i].toLowerCase();
						if ((dacrydium.theforms.geographics[selectedRegionName] !== null) && (typeof dacrydium.theforms.geographics[selectedRegionName] === 'object')) {
							if (typeof dacrydium.theforms.geographics[selectedRegionName][departement] !== 'undefined')
								departsOfRegion.push(departement);
						}
				}
				
				while (document.getElementById(departId).childNodes) {
					if ((document.getElementById(departId).lastChild.nodeType === 1) && (document.getElementById(departId).lastChild.getAttribute('value') === '-1'))
						break;
					else
						document.getElementById(departId).removeChild(document.getElementById(departId).lastChild);
				} 
				
				for (i = 0; i< departsOfRegion.length; i++){
					
					tag = document.createElement('option');
					tag.setAttribute('value', departsOfRegion[i]);
					tag.appendChild(document.createTextNode(departsOfRegion[i]));
					document.getElementById(departId).appendChild(tag);
				}
				
				this.filterGeographicVilles(departSelect);
		};
	this.remplace = function (expr,a,b) {
		var i=0
		while (i!=-1) {
		 i=expr.indexOf(a,i);
		 if (i>=0) {
			 expr=expr.substring(0,i)+b+expr.substring(i+a.length);
			 i+=b.length;
		 }
		}
		return expr
	 }
	this.filterGeographicDepartsPop = function (selectedRegion) {
			var i = 0, tag = null, departSelect = '', villeSelect = null, departement = null, departId = 'departementpop'+selectedRegion.id.substr(9), departsOfRegion = [], selectedRegionName = selectedRegion.value.toLowerCase(), Selected = 0, htmlSelect = '';
				departSelect = document.getElementById(departId);
				villeSelect = document.getElementById('villespop'+selectedRegion.id.substr(9));
				for ( i = 0; i < allDepartSelects[this.remplace(departSelect.id,'pop','')].length; i++) {
					departement = allDepartSelects[this.remplace(departSelect.id,'pop','')][i].toLowerCase();
						if ((dacrydium.theforms.geographics[selectedRegionName] !== null) && (typeof dacrydium.theforms.geographics[selectedRegionName] === 'object')) {
							if (typeof dacrydium.theforms.geographics[selectedRegionName][departement] !== 'undefined')
								departsOfRegion.push(departement);
						}
				}
				
				while (document.getElementById(departId).childNodes) {
					if ((document.getElementById(departId).lastChild.nodeType === 1) && (document.getElementById(departId).lastChild.getAttribute('value') === '-1'))
						break;
					else
						document.getElementById(departId).removeChild(document.getElementById(departId).lastChild);
				} 
				for (i = 0; i< departsOfRegion.length; i++){
					
					tag = document.createElement('option');
					tag.setAttribute('value', departsOfRegion[i]);
					tag.appendChild(document.createTextNode(departsOfRegion[i]));
					document.getElementById(departId).appendChild(tag);
				}
				
				this.filterGeographicVillesPop(departSelect);
		};
	this.filterGeographicVilles = function (selectedDepart) {
			var i = 0, tag = null, villeSelect = '', ville = null, villeId = 'villes'+selectedDepart.id.substr(11), villesOfDepart = [], selectedDepartName = selectedDepart.value.toLowerCase().substr(0,2); Selected = 0; htmlSelect = '';
				villeSelect = document.getElementById(villeId);
				for ( i = 0; i < allVilleSelects[villeSelect.id].length; i++) {
					ville = allVilleSelects[villeSelect.id][i].toLowerCase();
						if ((dacrydium.theforms.geographics[selectedDepartName] !== null) && (typeof dacrydium.theforms.geographics[selectedDepartName] === 'object')) {
							if (typeof dacrydium.theforms.geographics[selectedDepartName][ville] !== 'undefined')
								villesOfDepart.push(ville);
						}
				}
				while (document.getElementById(villeId).childNodes) {
					if ((document.getElementById(villeId).lastChild.nodeType === 1) && (document.getElementById(villeId).lastChild.getAttribute('value') === '-1'))
						break;
					else
						document.getElementById(villeId).removeChild(document.getElementById(villeId).lastChild);
				} 
				for (i = 0; i< villesOfDepart.length; i++){
					
					tag = document.createElement('option');
					tag.setAttribute('value', villesOfDepart[i]);
					tag.appendChild(document.createTextNode(villesOfDepart[i]));
					document.getElementById(villeId).appendChild(tag);
				}
		};
	this.filterGeographicVillesPop = function (selectedDepart) {
		var i = 0, tag = null, villeSelect = null; ville = null; villeId = 'villespop'+selectedDepart.id.substr(14), villesOfDepart = []; selectedDepartName = selectedDepart.value.toLowerCase().substr(0,2); Selected = 0, htmlSelect = '';
			villeSelect = document.getElementById('villespop'+selectedDepart.id.substr(14));
			for ( i = 0; i < allVilleSelects[this.remplace(villeSelect.id,'pop','')].length; i++) {
				ville = allVilleSelects[this.remplace(villeSelect.id,'pop','')][i];
					if ((dacrydium.theforms.geographics[selectedDepartName] !== null) && (typeof dacrydium.theforms.geographics[selectedDepartName] === 'object')) {
						if (typeof dacrydium.theforms.geographics[selectedDepartName][ville.toLowerCase()] !== 'undefined')
							villesOfDepart.push(ville);
					}
			}
			while (document.getElementById(villeId).childNodes) {
				if ((document.getElementById(villeId).lastChild.nodeType === 1) && (document.getElementById(villeId).lastChild.getAttribute('value') === '-1'))
					break;
				else
					document.getElementById(villeId).removeChild(document.getElementById(villeId).lastChild);
			} 
			for (i = 0; i< villesOfDepart.length; i++){
				
				tag = document.createElement('option');
				tag.setAttribute('value', villesOfDepart[i]);
				tag.appendChild(document.createTextNode(villesOfDepart[i]));
				document.getElementById(villeId).appendChild(tag);
			}
	};
	this.init = function () {
		if (document.getElementById('formLogin') || document.getElementById('formSearch') || document.getElementById('formNewsletter'))
			this.initForms();
		if (document.getElementById('formRegister')) {
			this.formRegister = new VarienForm('formRegister');
			document.getElementById('regions').setAttribute('class', 'nodisplay');
			document.getElementById('departements').setAttribute('class', 'nodisplay');
			Event.observe(document.getElementById('gender'), 'change', function (ev) { dacrydium.theforms.filterFormRegister(this.value); Event.stop(ev); });
			Event.observe(document.getElementById('formRegister'), 'submit', dacrydium.theforms.checkCgu);
		}
		if (document.getElementById('formRegister')) {
			this.formRegister = new VarienForm('formRegister');
			Event.observe(document.getElementById('formRegister'), 'submit', dacrydium.theforms.checkAge);
		}
		if ($$('.validate-select-dep').length > 0)
			this.listesInitiales();
		if($$('.validate-select-reg')) {
			for (tag = $$('.validate-select-reg'), i = 0; i < tag.length; i++) {
				Event.observe(tag[i], 'change', function (ev) { dacrydium.theforms.filterGeographicDeparts(this); });
				this.filterGeographicDeparts(tag[i]);
			}
		}
		if($$('.validate-select-dep')) {
			for (tag = $$('.validate-select-dep'), i = 0; i < tag.length; i++) {
				Event.observe(tag[i], 'change', function (ev) { dacrydium.theforms.filterGeographicVilles(this); });
				this.filterGeographicVilles(tag[i]);
			}
		}
		if (document.getElementById('countries')) {
			for (tag = document.getElementById('countries').getElementsByTagName('input'), i = 0; i < tag.length; i++)
				Event.observe(tag[i], 'click', dacrydium.theforms.filterGeographicRegions);
			for (tag = document.getElementById('regions').getElementsByTagName('input'), i = 0; i < tag.length; i++)
				Event.observe(tag[i], 'click', dacrydium.theforms.filterGeographicDepartements);
			for (tag = document.getElementById('departements').getElementsByTagName('li'), i = 0; i < tag.length; i++)
				tag[i].setAttribute('class', 'nodisplay');
			this.filterGeographicRegions();
		}
		if (document.getElementById('addPhotoA')) {
			document.getElementById('noJsA').setAttribute('class', 'nodisplay');
			Event.observe(document.getElementById('addPhotoA'), 'click', function (ev) { Event.stop(ev); apijs.upload.sendFile('Ajouter ou modifier une photo', 2, ['jpg','jpeg'], dacrydium.theforms.addPhoto, 'A', 'myInputImage'); });
		}
		if (document.getElementById('addPhotoB')) {
			document.getElementById('noJsB').setAttribute('class', 'nodisplay');
			Event.observe(document.getElementById('addPhotoB'), 'click', function (ev) { Event.stop(ev); apijs.upload.sendFile('Ajouter ou modifier une photo', 2, ['jpg','jpeg'], dacrydium.theforms.savePhoto, 'B', 'myInputImage'); });
		}
		if (document.getElementById('addPhotoC')) {
			document.getElementById('noJsC').setAttribute('class', 'nodisplay');
			Event.observe(document.getElementById('addPhotoC'), 'click', function (ev) { Event.stop(ev); apijs.upload.sendFile('Ajouter ou modifier une photo', 2, ['jpg','jpeg'], dacrydium.theforms.savePhoto, 'C', 'myInputImage'); });
		}
		if (document.getElementById('delPhotoA')) {
			Event.observe(document.getElementById('delPhotoA'), 'click', function (ev) { Event.stop(ev); apijs.upload.sendFile('Ajouter ou modifier une photo', 2, ['jpg','jpeg'], dacrydium.theforms.addPhoto, 'A', 'myInputImage'); });
		}
		if (document.getElementById('delPhotoB')) {
			document.getElementById('delPhotoB').setAttribute('onclick', 'apijs.upload.deleteFile("Suppression", "Êtes-vous certain(e) de vouloir supprimer cette photo ?[br]Attention, cette opération n\'est pas annulable.", dacrydium.theforms.deletePhoto, "B", "' + document.getElementById('keyB').getAttribute('value') + '"); return false;');
		}
		if (document.getElementById('delPhotoC')) {
			document.getElementById('delPhotoC').setAttribute('onclick', 'apijs.upload.deleteFile("Suppression", "Êtes-vous certain(e) de vouloir supprimer cette photo ?[br]Attention, cette opération n\'est pas annulable.", dacrydium.theforms.deletePhoto, "C", "' + document.getElementById('keyC').getAttribute('value') + '"); return false;');
		}
		try {
			if ($$('.focus').length > 0)
				$$('.focus')[0].focus();
		}
		catch (e) { }
	};
	this.addPhoto = function (key, id) {
		var bbcode = new BBcode();
		bbcode.init('[p]Recadrez votre photo en sélectionnant la zone souhaitée et cliquez sur enregistrer.[/p][img src="' + apijs.config.dialogue.fileUpload + '?image=' + key + '" width="640" height="480" alt="" id="image' + id + '"][div class="buttons"][button type="button"]Supprimer[/button][button type="button"]Enregistrer[/button][/div]');
		bbcode.exec();
		document.getElementById('crop' + id).appendChild(bbcode.get());
		document.getElementById('crop' + id).getElementsByTagName('button')[0].setAttribute('onclick', 'apijs.upload.deleteFile("Suppression", "Êtes-vous certain(e) de vouloir supprimer cette photo ?[br]Attention, cette opération n\'est pas annulable.", dacrydium.theforms.deletePhoto, "' + id + '", "' + key +'");');
		document.getElementById('crop' + id).getElementsByTagName('button')[1].setAttribute('onclick', 'dacrydium.theforms.savePhotoCrop("' + key +'", "' + id + '");');
		document.getElementById('crop' + id).setAttribute('class', 'cropper');
		apijs.dialogue.actionClose(true);
		jQuery('#imageA').imgAreaSelect({ aspectRatio: '1:1', onSelectChange: dacrydium.theforms.onEndCrop });
	};
	this.savePhotoCrop = function (key, id) {
		apijs.dialogue.dialogWaiting('Recadrer votre photo', apijs.i18n.translate('savingInProgress'));
		jQuery('.imgareaselect-outer').remove();
		jQuery('.imgareaselect-selection').remove();
		jQuery('.imgareaselect-border1').remove();
		jQuery('.imgareaselect-border2').remove();
		document.getElementById('crop' + id).setAttribute('class', 'nodisplay');
		document.getElementById('crop' + id).removeChild(document.getElementById('crop' + id).lastChild);
		document.getElementById('key' + id).setAttribute('value', key);
		var xhr = new XMLHttpRequest();
		xhr.onreadystatechange = function () {
			if ((xhr.readyState === 4) && (xhr.status === 200)) {
				var result = xhr.responseXML, key = null, status = null;
				key = result.getElementsByTagName('key')[0].firstChild.nodeValue;
				message = result.getElementsByTagName('message')[0].firstChild.nodeValue;
				apijs.dialogue.dialogInformation('Recadrer votre photo', message);
				document.getElementById('addPhotoA').getElementsByTagName('img')[0].setAttribute('src', apijs.config.dialogue.fileUpload + '?thumb=' + key);
				document.getElementById('delPhotoA').setAttribute('onclick', 'apijs.upload.deleteFile("Suppression", "Êtes-vous certain(e) de vouloir supprimer cette photo ?[br]Attention, cette opération n\'est pas annulable.", dacrydium.theforms.deletePhoto, "A", "' + key +'"); return false;');
				document.getElementById('delPhotoA').setAttribute('class', 'delete');
			}
		};
		if (dacrydium.theforms.formCrop == null)
			dacrydium.theforms.formCrop = { x1: 0, y1: 0, x2: 640, y2: 480 };
		xhr.open('GET', apijs.config.dialogue.fileUpload + '?crop=true&image=' + key + '&x1=' + dacrydium.theforms.formCrop.x1 + '&y1=' + dacrydium.theforms.formCrop.y1 + '&x2=' + dacrydium.theforms.formCrop.x2 + '&y2=' + dacrydium.theforms.formCrop.y2, true);
		xhr.send(null);
	};
	this.savePhoto = function (key, id) {
		apijs.dialogue.dialogInformation('Ajouter une photo', 'Votre photo a bien été enregistrée.');
		document.getElementById('addPhoto' + id).getElementsByTagName('img')[0].setAttribute('src', apijs.config.dialogue.fileUpload + '?thumb=' + key);
		document.getElementById('key' + id).setAttribute('value', key);
		document.getElementById('delPhoto' + id).setAttribute('onclick', 'apijs.upload.deleteFile("Suppression", "Êtes-vous certain(e) de vouloir supprimer cette photo ?[br]Attention, cette opération n\'est pas annulable.", dacrydium.theforms.deletePhoto, "' + id + '", "' + key +'"); return false;');
		document.getElementById('delPhoto' + id).setAttribute('class', 'delete');
	};
	this.deletePhoto = function (id) {
		if (document.getElementById('crop' + id) && document.getElementById('crop' + id).hasChildNodes()) {
			document.getElementById('crop' + id).setAttribute('class', 'nodisplay');
			document.getElementById('crop' + id).removeChild(document.getElementById('crop' + id).lastChild);
		}
		document.getElementById('key' + id).setAttribute('value', '');
		document.getElementById('delPhoto' + id).setAttribute('class', 'delete nodisplay');
		document.getElementById('addPhoto' + id).getElementsByTagName('img')[0].setAttribute('src', 'http://www.strip-for-you.com/skin/frontend/dacrydium/strip4you/images/design/addphoto.png');
	};
	this.onEndCrop = function (img, coords) {
		dacrydium.theforms.formCrop = coords;
	};
	this.initForms = function () {
		apijs.i18n.data.en['formLogin'] = "Identifiant";
		apijs.i18n.data.en['formSearch'] = "Search";
		apijs.i18n.data.en['formMail'] = "Email address";
		apijs.i18n.data.en['confirmNewsletter'] = "En vous abonnant à la newsletter vous acceptez les [a href='http://www.strip-for-you.com/' class='popup nostyle']conditions générales d'utilisations[/a].";
		apijs.i18n.data.fr['formLogin'] = "Identifiant";
		apijs.i18n.data.fr['formSearch'] = "Rechercher";
		apijs.i18n.data.fr['formMail'] = "Adresse email";
		apijs.i18n.data.fr['confirmNewsletter'] = "En vous abonnant à la newsletter vous acceptez les [a href='http://www.strip-for-you.com/' class='popup nostyle']conditions générales d'utilisations[/a].";
		if (document.getElementById('formLogin')) {
			if ((document.getElementById('loginUsername').value.length < 1) || (document.getElementById('loginPassword').value.length < 1)) {
				document.getElementById('loginUsername').value = apijs.i18n.translate('formLogin');
				document.getElementById('loginPassword').value = '******';
			}
			Event.observe(document.getElementById('formLogin'), 'submit', function (ev) {
				if (document.getElementById('loginUsername').value === apijs.i18n.translate('formLogin')) {
					Event.stop(ev);
					document.getElementById('loginUsername').focus();
				}
			});
			Event.observe(document.getElementById('loginUsername'), 'focus', function () {
				if (document.getElementById('loginUsername').value === apijs.i18n.translate('formLogin'))
					document.getElementById('loginUsername').value = '';
			});
			Event.observe(document.getElementById('loginPassword'), 'focus', function () {
				if (document.getElementById('loginPassword').value === '******')
					document.getElementById('loginPassword').value = '';
			});
			Event.observe(document.getElementById('loginUsername'), 'blur', function () {
				if (document.getElementById('loginUsername').value.length < 1) {
					document.getElementById('loginUsername').value = apijs.i18n.translate('formLogin');
					document.getElementById('loginPassword').value = '******';
				}
			});
			Event.observe(document.getElementById('loginPassword'), 'blur', function () {
				if (document.getElementById('loginPassword').value.length < 1)
					document.getElementById('loginPassword').value = '******';
			});
		}
		if (document.getElementById('formSearch')) {
			if (document.getElementById('searchText').value.length < 1)
				document.getElementById('searchText').value = apijs.i18n.translate('formSearch');
			Event.observe(document.getElementById('formSearch'), 'submit', function (ev) {
				if (document.getElementById('searchText').value === apijs.i18n.translate('formSearch')) {
					Event.stop(ev);
					document.getElementById('searchText').focus();
				}
			});
			Event.observe(document.getElementById('searchText'), 'focus', function () {
				if (document.getElementById('searchText').value === apijs.i18n.translate('formSearch'))
					document.getElementById('searchText').value = '';
			});
			Event.observe(document.getElementById('searchText'), 'blur', function () {
				if (document.getElementById('searchText').value.length < 1)
					document.getElementById('searchText').value = apijs.i18n.translate('formSearch');
			});
		}
		if (document.getElementById('formNewsletter')) {
			if (document.getElementById('newsletterMail').value.length < 1)
				document.getElementById('newsletterMail').value = apijs.i18n.translate('formMail');
			Event.observe(document.getElementById('formNewsletter'), 'submit', function (ev) {
				Event.stop(ev);
				if (document.getElementById('newsletterMail').value === apijs.i18n.translate('formMail'))
					document.getElementById('newsletterMail').focus();
				else if (document.getElementById('newsletterMail').value.length > 0)
					apijs.dialogue.dialogConfirmation('Newsletter', apijs.i18n.translate('confirmNewsletter'), confirmNewsletter, null, this.getAttribute('href'));
			});
			Event.observe(document.getElementById('newsletterMail'), 'focus', function () {
				if (document.getElementById('newsletterMail').value === apijs.i18n.translate('formMail'))
					document.getElementById('newsletterMail').value = '';
			});
			Event.observe(document.getElementById('newsletterMail'), 'blur', function () {
				if (document.getElementById('newsletterMail').value.length < 1)
					document.getElementById('newsletterMail').value = apijs.i18n.translate('formMail');
			});
		}
	};
	this.confirmNewsletter = function () {
		document.getElementById('formNewsletter').submit();
	};
	this.initConfirms = function () {
		apijs.i18n.data.en['titleDelete'] = "Deleting";
		apijs.i18n.data.en['deleteProduct'] = "Are you sure you want to delete this article ?[br]Be careful, you can't cancel this operation.";
		apijs.i18n.data.en['deleteAddress'] = "Are you sure you want to delete this address ?[br]Be careful, you can't cancel this operation.";
		apijs.i18n.data.fr['titleDelete'] = "Suppression";
		apijs.i18n.data.fr['deleteProduct'] = "Êtes-vous certain(e) de vouloir supprimer cet article ?[br]Attention, cette opération n'est pas annulable.";
		apijs.i18n.data.fr['deleteAddress'] = "Êtes-vous certain(e) de vouloir supprimer cette adresse ?[br]Attention, cette opération n'est pas annulable.";
		for (tag = document.getElementsByClassName('deleteProduct'), i = 0; i < tag.length; i++) {
			Event.observe(tag[i], 'click', function (ev) {
				Event.stop(ev);
				apijs.dialogue.dialogConfirmation(apijs.i18n.translate('titleDelete'), apijs.i18n.translate('deleteProduct'), dacrydium.theforms.deleteProduct, this.getAttribute('id'));
			});
		}
		for (tag = document.getElementsByClassName('deleteAddress'), i = 0; i < tag.length; i++) {
			Event.observe(tag[i], 'click', function (ev) {
				Event.stop(ev);
				apijs.dialogue.dialogConfirmation(apijs.i18n.translate('titleDelete'), apijs.i18n.translate('deleteAddress'), dacrydium.theforms.deleteAddress, this.getAttribute('id'));
			});
		}
	};
	this.deleteProduct = function (id) {
		location.href = document.getElementById(id).getAttribute('href');
	};
	this.deleteAddress = function (id) {
		location.href = document.getElementById(id).getAttribute('href');
	};
	this.filterFormRegister = function (type) {
		if (type == '1') {
			document.getElementById('bonnet').parentNode.parentNode.setAttribute('class', 'nodisplay');
			document.getElementById('bonnet').removeAttribute('class');
			document.getElementById('chestSize').parentNode.parentNode.setAttribute('class', 'nodisplay');
			document.getElementById('chestSize').removeAttribute('class');
			document.getElementById('hipsSize').parentNode.parentNode.setAttribute('class', 'nodisplay');
			document.getElementById('hipsSize').removeAttribute('class');
			document.getElementById('sizeSize').parentNode.parentNode.setAttribute('class', 'nodisplay');
			document.getElementById('sizeSize').removeAttribute('class');
			document.getElementById('costumesF').setAttribute('class', 'nodisplay');
			document.getElementById('costumesM').setAttribute('class', 'separ');
			document.getElementById('benefitsTypesF').setAttribute('class', 'nodisplay');
			document.getElementById('benefitsTypesM').setAttribute('class', 'separ');
		}
		else if (type == '2') {
			document.getElementById('bonnet').parentNode.parentNode.removeAttribute('class');
			document.getElementById('bonnet').setAttribute('class', 'required-entry validate-greater-than-zero');
			document.getElementById('chestSize').parentNode.parentNode.removeAttribute('class');
			document.getElementById('chestSize').setAttribute('class', 'validate-greater-than-zero');
			document.getElementById('hipsSize').parentNode.parentNode.removeAttribute('class');
			document.getElementById('hipsSize').setAttribute('class', 'validate-greater-than-zero');
			document.getElementById('sizeSize').parentNode.parentNode.removeAttribute('class');
			document.getElementById('sizeSize').setAttribute('class', 'validate-greater-than-zero');
			document.getElementById('costumesM').setAttribute('class', 'nodisplay');
			document.getElementById('costumesF').setAttribute('class', 'separ');
			document.getElementById('benefitsTypesM').setAttribute('class', 'nodisplay');
			document.getElementById('benefitsTypesF').setAttribute('class', 'separ');
		}
		else {
			document.getElementById('bonnet').parentNode.parentNode.setAttribute('class', 'nodisplay');
			document.getElementById('bonnet').removeAttribute('class');
			document.getElementById('chestSize').parentNode.parentNode.setAttribute('class', 'nodisplay');
			document.getElementById('chestSize').removeAttribute('class');
			document.getElementById('hipsSize').parentNode.parentNode.setAttribute('class', 'nodisplay');
			document.getElementById('hipsSize').removeAttribute('class');
			document.getElementById('sizeSize').parentNode.parentNode.setAttribute('class', 'nodisplay');
			document.getElementById('sizeSize').removeAttribute('class');
			document.getElementById('costumesM').setAttribute('class', 'nodisplay');
			document.getElementById('costumesF').setAttribute('class', 'nodisplay');
			document.getElementById('benefitsTypesF').setAttribute('class', 'nodisplay');
			document.getElementById('benefitsTypesM').setAttribute('class', 'nodisplay');
			for (var tag = document.getElementById('benefitsTypesF').getElementsByTagName('input'), i = 0; i < tag.length; i++)
				tag[i].setAttribute('class', 'nodisplay');
			for (tag = document.getElementById('benefitsTypesM').getElementsByTagName('input'), i = 0; i < tag.length; i++)
				tag[i].setAttribute('class', 'nodisplay');
		}
	};
	this.filterGeographicRegions = function (ev) {
		var i = 0, tag = null, countries = null, region = null, selectedCountries = [], authorizedRegions = [];
		for (tag = document.getElementById('countries').getElementsByTagName('input'), i = 0; i < tag.length; i++) {
			if (tag[i].checked)
				selectedCountries.push(tag[i].parentNode.lastChild.nodeValue.substr(1));
		}
		if (selectedCountries.length > 0) {
			for (tag = document.getElementById('regions').getElementsByTagName('li'), i = 0; i < tag.length; i++) {
				for (countries in selectedCountries) if (selectedCountries.hasOwnProperty(countries)) {
					countries = selectedCountries[countries].toLowerCase();
					region = tag[i].firstChild.lastChild.nodeValue.substr(1).toLowerCase();
					if ((dacrydium.theforms.geographics[countries] !== null) && (typeof dacrydium.theforms.geographics[countries] === 'object')) {
						if (typeof dacrydium.theforms.geographics[countries][region] !== 'undefined')
							authorizedRegions.push(region);
					}
				}
			}
			for (tag = document.getElementById('regions').getElementsByTagName('li'), i = 0; i < tag.length; i++) {
				region = tag[i].firstChild.lastChild.nodeValue.substr(1).toLowerCase();
				if (in_array(region, authorizedRegions)) {
					tag[i].removeAttribute('class');
				}
				else {
					tag[i].getElementsByTagName('input')[0].checked = false;
					tag[i].setAttribute('class', 'nodisplay');
				}
			}
			if (authorizedRegions.length > 0)
				document.getElementById('regions').setAttribute('class', 'separ');
			else
				document.getElementById('regions').setAttribute('class', 'nodisplay');
		}
		else {
			document.getElementById('regions').setAttribute('class', 'nodisplay');
			for (tag = document.getElementById('regions').getElementsByTagName('input'), i = 0; i < tag.length; i++)
				tag[i].checked = false;
		}
		dacrydium.theforms.filterGeographicDepartements(null, false);
	};
	this.filterGeographicDepartements = function (ev, autocheck) {
		var i = 0, tag = null, region = null, departement = null, selectedRegions = [], authorizedDepartements = [], previousDepartements = [];
		for (tag = document.getElementById('regions').getElementsByTagName('input'), i = 0; i < tag.length; i++) {
			if (tag[i].checked)
				selectedRegions.push(tag[i].parentNode.lastChild.nodeValue.substr(1));
		}
		if (selectedRegions.length > 0) {
			for (tag = document.getElementById('departements').getElementsByTagName('li'), i = 0; i < tag.length; i++) {
				for (region in selectedRegions) if (selectedRegions.hasOwnProperty(region)) {
					region = selectedRegions[region].toLowerCase();
					departement = tag[i].firstChild.lastChild.nodeValue.substr(1).toLowerCase();
					if ((dacrydium.theforms.geographics[region] !== null) && (typeof dacrydium.theforms.geographics[region] === 'object')) {
						if (typeof dacrydium.theforms.geographics[region][departement] !== 'undefined')
							authorizedDepartements.push(departement);
						if (!tag[i].hasAttribute('class'))
							previousDepartements.push(departement);
					}
				}
			}
			for (tag = document.getElementById('departements').getElementsByTagName('li'), i = 0; i < tag.length; i++) {
				departement = tag[i].firstChild.lastChild.nodeValue.substr(1).toLowerCase();
				if (in_array(departement, authorizedDepartements)) {
					if ((typeof autocheck !== 'boolean') && !in_array(departement, previousDepartements)) {
						tag[i].getElementsByTagName('input')[0].checked = true;
						tag[i].removeAttribute('class');
					}
					else {
						tag[i].removeAttribute('class');
					}
				}
				else {
					tag[i].setAttribute('class', 'nodisplay');
					tag[i].getElementsByTagName('input')[0].checked = false;
				}
			}
			if (authorizedDepartements.length > 0)
				document.getElementById('departements').setAttribute('class', 'separ');
			else
				document.getElementById('departements').setAttribute('class', 'nodisplay');
		}
		else {
			document.getElementById('departements').setAttribute('class', 'nodisplay');
		}
	};
	this.checkCgu = function (ev) {
		apijs.i18n.data.en['titleWCgu'] = "Warning";
		apijs.i18n.data.en['warningCgu'] = "Vous devez accepter les conditions générales d'utilisations.";
		apijs.i18n.data.fr['titleCgu'] = "Attention";
		apijs.i18n.data.fr['warningCgu'] = "Vous devez accepter les conditions générales d'utilisations.";
		if (!document.getElementById('cgu').checked) {
			Event.stop(ev);
			apijs.dialogue.dialogInformation(apijs.i18n.translate('titleCgu'), apijs.i18n.translate('warningCgu'), 'warning');
		}
	};
	this.checkAge = function (ev) {
		apijs.i18n.data.en['titleAge'] = "Warning";
		apijs.i18n.data.en['warningAge'] = "Vous devez avoir plus de 18 ans pour vous inscrire.";
		apijs.i18n.data.fr['titleAge'] = "Attention";
		apijs.i18n.data.fr['warningAge'] = "Vous devez avoir plus de 18 ans pour vous inscrire.";
		var min_age = 18;
		var year = parseInt(document.forms["formRegister"]["year"].value);
		var month = parseInt(document.forms["formRegister"]["month"].value) - 1;
		var day = parseInt(document.forms["formRegister"]["day"].value);
		var theirDate = new Date((year + min_age), month, day);
		var today = new Date;
		if(isNaN(year) != true && isNaN(month) != true && isNaN(day) != true){
			if ( (today.getTime() - theirDate.getTime()) < 0) {
				apijs.dialogue.dialogInformation(apijs.i18n.translate('titleAge'), apijs.i18n.translate('warningAge'), 'warning');
				Event.stop(ev);
			}
		}
	};
}
function TheProduct() {
	this.formProduct = null;
	this.tab = null;
	this.init = function () {
		if (document.getElementById('formProduct'))
			this.formProduct = new VarienForm('formProduct');
		if (document.getElementById('quantityLess') && document.getElementById('quantityMore')) {
			document.getElementById('quantityLess').removeAttribute('class');
			document.getElementById('quantityMore').removeAttribute('class');
			document.getElementById('quantityMore').removeAttribute('disabled');
			Event.observe(document.getElementById('quantityLess'), 'click', dacrydium.theproduct.updateQuantityProduct);
			Event.observe(document.getElementById('quantityMore'), 'click', dacrydium.theproduct.updateQuantityProduct);
			if (document.getElementById('initialPrice'))
				this.updatePriceProduct();
		}
		for (var id in dacrydium.productsList) if (dacrydium.productsList.hasOwnProperty(id)) {
			id = dacrydium.productsList[id];
			if (document.getElementById(id) && (document.getElementById(id).getElementsByTagName('li').length > document.getElementById(id + 'Show').value)) {
				document.getElementById(id + 'Prev').setAttribute('class', 'prev');
				document.getElementById(id + 'Next').setAttribute('class', 'next');
				document.getElementById(id + 'Next').removeAttribute('disabled');
				Event.observe(document.getElementById(id + 'Prev'), 'click', dacrydium.theproduct.listPrev);
				Event.observe(document.getElementById(id + 'Next'), 'click', dacrydium.theproduct.listNext);
			}
		}
		if (document.getElementById('goTab')) {
			for (var tag = document.getElementById('goTab').getElementsByTagName('button'), i = 0; i < tag.length; i++)
				Event.observe(tag[i], 'click', dacrydium.theproduct.showTab);
			if (document.getElementById('goSize2'))
				Event.observe(document.getElementById('goSize2'), 'click', dacrydium.theproduct.showTab);
		}
		if (document.getElementById('category')) {
			this.prepareCategory();
		}
	};
	this.updateQuantityProduct = function (ev) {
		var i = parseInt(document.getElementById('quantity').value, 10);
		if (isNaN(i) || (i < 1))
			document.getElementById('quantity').value = '1';
		else if ((this.getAttribute('id') === 'quantityLess') && (i > 1))
			document.getElementById('quantity').value = i - 1;
		else if ((this.getAttribute('id') === 'quantityMore') && (i < 99))
			document.getElementById('quantity').value = i + 1;
		this.updatePriceProduct();
	};
	this.updatePriceProduct = function () {
		var i = 0, unitPrice = 0, totalPrice = 0, price = 0, index = 0;
		i = parseInt(document.getElementById('quantity').value, 10);
		if (document.getElementById('initialPrice').getAttribute('value').match(/^[0-9]/)) {
			price = document.getElementById('initialPrice').getAttribute('value').replace(/(\u00a0)|(\u2009)/, '|');
			unitPrice = price.slice(0, price.lastIndexOf('|'));
			totalPrice = parseFloat(unitPrice.replace(',', '.'), 10) * parseFloat(document.getElementById('quantity').value, 10);
			totalPrice = number_format(totalPrice, 2, ',', '\u2009') + '\u00a0' + price.slice((price.lastIndexOf('|') + 1));
		}
		else {
			index = document.getElementById('initialPrice').getAttribute('value').search(/[0-9]/);
			price = document.getElementById('initialPrice').getAttribute('value').slice(0, index) + '|' + document.getElementById('initialPrice').getAttribute('value').slice(index);
			unitPrice = price.slice(price.lastIndexOf('|') + 1);
			totalPrice = parseFloat(unitPrice.replace(',', '.'), 10) * parseFloat(document.getElementById('quantity').value, 10);
			totalPrice = price.slice(0, price.lastIndexOf('|')) + '\u2009' + number_format(totalPrice, 2, ',', '\u2009');
		}
		document.getElementById('finalPrice').firstChild.replaceData(0, document.getElementById('finalPrice').firstChild.data.length, totalPrice);
	};
	this.listNext = function (ev) {
		var id = null, show = 0, offset = 0;
		id = this.getAttribute('id').slice(0, -4);
		show = parseInt(document.getElementById(id + 'Show').value, 10);
		offset = parseInt(document.getElementById(id + 'Offset').value, 10);
		document.getElementById(id).getElementsByTagName('li')[offset].setAttribute('class', 'nodisplay');
		document.getElementById(id).getElementsByTagName('li')[show + offset].removeAttribute('class');
		offset++;
		if (document.getElementById(id + 'Prev').hasAttribute('disabled'))
			document.getElementById(id + 'Prev').removeAttribute('disabled');
		if ((show + offset) >= document.getElementById(id).getElementsByTagName('li').length)
			document.getElementById(id + 'Next').setAttribute('disabled', 'disabled');
		document.getElementById(id + 'Offset').value = offset;
	};
	this.listPrev = function (ev) {
		var id = null, show = 0, offset = 0;
		id = this.getAttribute('id').slice(0, -4);
		show = parseInt(document.getElementById(id + 'Show').value, 10);
		offset = parseInt(document.getElementById(id + 'Offset').value, 10) - 1;
		if (document.getElementById(id + 'Next').hasAttribute('disabled'))
			document.getElementById(id + 'Next').removeAttribute('disabled');
		document.getElementById(id).getElementsByTagName('li')[offset].removeAttribute('class');
		document.getElementById(id).getElementsByTagName('li')[show + offset].setAttribute('class', 'nodisplay');
		if (offset < 1)
			document.getElementById(id + 'Prev').setAttribute('disabled', 'disabled');
		document.getElementById(id + 'Offset').value = offset;
	};
	this.showTab = function (ev) {
		this.tab = (this.tab == null) ? 'Product' : this.tab;
		document.getElementById('go' + this.tab).removeAttribute('class');
		document.getElementById('tab' + this.tab).setAttribute('class', 'nodisplay');
		this.tab = (this.getAttribute('id') !== 'goSize2') ? this.getAttribute('id').slice(2) : 'Size';
		document.getElementById('go' + this.tab).setAttribute('class', 'actif');
		document.getElementById('tab' + this.tab).setAttribute('class', 'tab');
	};
	this.prepareCategory = function () {
		for (var tag = $$('.phone_fr'), i = 0; (tag !== null) && (i < tag.length); i++) {
			Event.observe(tag[i], 'click', function (ev) {
				Event.stop(ev);
				apijs.dialogue.dialogInformation('', this.parentNode.parentNode.parentNode.parentNode.getElementsByTagName('input')[0].getAttribute('value'), 'contact ' + this.parentNode.parentNode.parentNode.parentNode.parentNode.getAttribute('class'));
				document.getElementById('box').getElementsByTagName('h1')[0].parentNode.removeChild(document.getElementById('box').getElementsByTagName('h1')[0]);
 var sku = this.href.split('/')[3];
			});
		}
		for (tag = $$('.phone_be'), i = 0; (tag !== null) && (i < tag.length); i++) {
			Event.observe(tag[i], 'click', function (ev) {
				Event.stop(ev);
				apijs.dialogue.dialogInformation('', this.parentNode.parentNode.parentNode.parentNode.getElementsByTagName('input')[2].getAttribute('value'), 'contact ' + this.parentNode.parentNode.parentNode.parentNode.parentNode.getAttribute('class'));
				document.getElementById('box').getElementsByTagName('h1')[0].parentNode.removeChild(document.getElementById('box').getElementsByTagName('h1')[0]);
			});
		}
		for (tag = $$('.phone_ch'), i = 0; (tag !== null) && (i < tag.length); i++) {
			Event.observe(tag[i], 'click', function (ev) {
				Event.stop(ev);
				apijs.dialogue.dialogInformation('Contacter l\'artiste', this.parentNode.parentNode.parentNode.parentNode.getElementsByTagName('input')[3].getAttribute('value'), 'contact ' + this.parentNode.parentNode.parentNode.parentNode.parentNode.getAttribute('class'));
				document.getElementById('box').getElementsByTagName('h1')[0].parentNode.removeChild(document.getElementById('box').getElementsByTagName('h1')[0]);
			});
		}
		for (tag = $$('.phone_fr_resto'), i = 0; (tag !== null) && (i < tag.length); i++) {
			Event.observe(tag[i], 'click', function (ev) {
				Event.stop(ev);
				apijs.dialogue.dialogInformation('', this.parentNode.getElementsByTagName('input')[0].getAttribute('value'), 'category stripteaseurs contact resto');
				document.getElementById('box').getElementsByTagName('h1')[0].parentNode.removeChild(document.getElementById('box').getElementsByTagName('h1')[0]);
				var sku = this.href.split('/')[3];
				new Ajax.Updater('phone_' + sku, '/strip4you/index/getRandomNumberForFrance', {method: 'get', parameters: { sku: sku } });
			});
		}
		for (tag = $$('.phone_be_resto'), i = 0; (tag !== null) && (i < tag.length); i++) {
			Event.observe(tag[i], 'click', function (ev) {
				Event.stop(ev);
				apijs.dialogue.dialogInformation('', this.parentNode.getElementsByTagName('input')[1].getAttribute('value'), 'category stripteaseurs contact resto');
				document.getElementById('box').getElementsByTagName('h1')[0].parentNode.removeChild(document.getElementById('box').getElementsByTagName('h1')[0]);
			});
		}
		for (tag = $$('.phone_ch_resto'), i = 0; (tag !== null) && (i < tag.length); i++) {
			Event.observe(tag[i], 'click', function (ev) {
				Event.stop(ev);
				apijs.dialogue.dialogInformation('', this.parentNode.getElementsByTagName('input')[2].getAttribute('value'), 'category stripteaseurs contact resto');
				document.getElementById('box').getElementsByTagName('h1')[0].parentNode.removeChild(document.getElementById('box').getElementsByTagName('h1')[0]);
			});
		}
		for (tag = $$('.phone_fr_devis'), i = 0; (tag !== null) && (i < tag.length); i++) {
			Event.observe(tag[i], 'click', function (ev) {
				Event.stop(ev);
				apijs.dialogue.dialogInformation('', this.parentNode.parentNode.parentNode.parentNode.getElementsByTagName('input')[0].getAttribute('value'), 'contact ' + this.parentNode.parentNode.parentNode.parentNode.parentNode.getAttribute('class'));
				document.getElementById('box').getElementsByTagName('h1')[0].parentNode.removeChild(document.getElementById('box').getElementsByTagName('h1')[0]);
				var phone_number = this.parentNode.parentNode.parentNode.parentNode.getElementsByTagName('h2')[0].innerHTML.split('_')[1];
				var sku = this.href.split('/')[3];
				new Ajax.Updater('phone_' + phone_number,'/strip4you/index/getRandomNumberForFrance', { method: 'get', parameters: { sku: sku } });
			});
		}
		for (tag = $$('.phone_be_devis'), i = 0; (tag !== null) && (i < tag.length); i++) {
			Event.observe(tag[i], 'click', function (ev) {
				Event.stop(ev);
				apijs.dialogue.dialogInformation('', this.parentNode.parentNode.parentNode.parentNode.getElementsByTagName('input')[1].getAttribute('value'), 'contact ' + this.parentNode.parentNode.parentNode.parentNode.parentNode.getAttribute('class'));
				document.getElementById('box').getElementsByTagName('h1')[0].parentNode.removeChild(document.getElementById('box').getElementsByTagName('h1')[0]);
			});
		}
		for (tag = $$('.phone_ch_devis'), i = 0; (tag !== null) && (i < tag.length); i++) {
			Event.observe(tag[i], 'click', function (ev) {
				Event.stop(ev);
				apijs.dialogue.dialogInformation('', this.parentNode.parentNode.parentNode.parentNode.getElementsByTagName('input')[2].getAttribute('value'), 'contact ' + this.parentNode.parentNode.parentNode.parentNode.parentNode.getAttribute('class'));
				document.getElementById('box').getElementsByTagName('h1')[0].parentNode.removeChild(document.getElementById('box').getElementsByTagName('h1')[0]);
			});
		}
		for (tag = $$('.more'), i = 0; (tag !== null) && (i < tag.length); i++) {
			Event.observe(tag[i], 'click', function (ev) {
				Event.stop(ev);
				apijs.dialogue.dialogInformation('En savoir plus', this.parentNode.parentNode.parentNode.getElementsByTagName('input')[1].getAttribute('value'), 'category ' + this.parentNode.parentNode.parentNode.parentNode.getAttribute('class'));
				if($$('.validate-select-region-pop')) {
					for (tag2 = $$('.validate-select-region-pop'), i = 0; i < tag2.length; i++) {
						Event.observe(tag2[i], 'change', function (ev) { dacrydium.theforms.filterGeographicDepartsPop(this); });
						dacrydium.theforms.filterGeographicDepartsPop(tag2[i]);
					}
				}
				if($$('.validate-select-depart-pop')) {
					for (tag3 = $$('.validate-select-depart-pop'), i = 0; i < tag3.length; i++) {
						Event.observe(tag3[i], 'change', function (ev) { dacrydium.theforms.filterGeographicVillesPop(this); });
						dacrydium.theforms.filterGeographicVillesPop(tag3[i]);
					}
				}
			});
		}
	};
}
function popupCallFR(el) {
	var type = el.getAttribute('type');
	var cat = el.getAttribute('cat');
	var text = el.parentNode.getElementsByTagName('input')[0].getAttribute('value').replace(/\{/g,'[').replace(/\}/g,']').replace(/#/g,'"');
	apijs.dialogue.dialogInformation('', text, 'information contact category ' + cat);
	document.getElementById('box').getElementsByTagName('h1')[0].parentNode.removeChild(document.getElementById('box').getElementsByTagName('h1')[0]);
	var sku = el.getAttribute('sku');
}
function popupCallBE(el) {
	var type = el.getAttribute('type');
	var cat = el.getAttribute('cat');
	var text = el.parentNode.getElementsByTagName('input')[0].getAttribute('value').replace(/\{/g,'[').replace(/\}/g,']').replace(/#/g,'"');
	apijs.dialogue.dialogInformation('', text, 'information contact category ' + cat);
	document.getElementById('box').getElementsByTagName('h1')[0].parentNode.removeChild(document.getElementById('box').getElementsByTagName('h1')[0]);
}
function popupCallCH(el) {
	var type = el.getAttribute('type');
	var cat = el.getAttribute('cat');
	var text = el.parentNode.getElementsByTagName('input')[1].getAttribute('value').replace(/\{/g,'[').replace(/\}/g,']').replace(/#/g,'"');
	apijs.dialogue.dialogInformation('', text, 'information contact category ' + cat);
	document.getElementById('box').getElementsByTagName('h1')[0].parentNode.removeChild(document.getElementById('box').getElementsByTagName('h1')[0]);
}

