﻿/*                                                                                       */
/*                                   Craft Light v1.1a                                   */
/*                          copyright 2010->2011 Agence Origami                          */
/*                           for more information please visit                           */
/*                             www.agence-origami.com/craft/                             */
/*                                     or mail us at                                     */
/*                             craftlight@agence-origami.com                             */
/*                                                                                       */
/* ▄▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▄ */
/* █ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓█ */
/* █ ░░░▄██████▄░███████▄░▄██████▄░▄███████░████████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓█ */
/* █ ░░░██░░░░▀▀░██░░░░██░██░░░░██░██░░░░░░░░░░██░░░░░░█░░░░▀▀█▀▀░▄▀▀▀▄░█░░░█░▀▀█▀▀░░░▓█ */
/* █ ░░░██░░░░░░░███████▀░████████░█████▀░░░░░░██░░░░░░█░░░░░░█░░░█░░░░░█░░░█░░░█░░░░░▓█ */
/* █ ░░░██░░░░▄▄░██░▀██▄░░██░░░░██░██░░░░░░░░░░██░░░░░░█░░░░░░█░░░█░░▀█░█▀▀▀█░░░█░░░░░▓█ */
/* █ ░░░▀██████▀░██░░░▀██░██░░░░██░██░░░░░░░░░░██░░░░░░█▄▄▄░▄▄█▄▄░▀▄▄▄▀░█░░░█░░░█░░░░░▓█ */
/* █ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▓█ */
/* █░▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█ */
/*  ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀  */
/*                                                                                       */
$.ajax({
	url: 'craft/logtest.php',
	success: function(data)
	{
		if (data.search(/log_ok/i)>=0)
		{
		
			function addonload(func)
			{
				var oldonload = window.onload;
				if (typeof window.onload != 'function')
					window.onload = func;
				else
					window.onload = function()
					{
						if (oldonload)
							oldonload();
						func();
					}
			}
			addonload(function()
			{
				/** SETTINGS **/
				var mainColor = '#fff';
				var opositColor = '#000';
				var borderSize = 5;
				var shadowColor = '#000';
				var menuHeight = 40;
				/** STOCKING VARS FOR CHILD IFRAME **/
				$('body').append('<input type="hidden" name="craftlight_mainColor" value="'+mainColor+'" />');
				$('body').append('<input type="hidden" name="craftlight_opositColor" value="'+opositColor+'" />');
				/** DETERMINE AVAILABLE SIZE ON THE SCREEN **/
				$('body').prepend('<div id="availableHeightDeterminer" style="position:absolute;left:100%;top:100%;width:10px;height:10px;margin:0;padding:0;border:0;"></div>');
				var availableWidth = $('#availableHeightDeterminer').offset().left;
				var availableHeight = $('#availableHeightDeterminer').offset().top;
				$('#availableHeightDeterminer').remove();
				var workZoneHeight = availableHeight-100;
				/** MAIN MENU GENERATION **/
				var mainmenu  = '<div id="craftlight_mainmenu">';
					mainmenu += '	<div id="craftlight_innermainmenu">';
					mainmenu += '		<div style="position: absolute; left: 0; top: 0; width: 100%; height: 40px; text-align: center;">';
					mainmenu += '			<div id="craftlight_mainmenu_list" style="display: inline; margin: 0 100px 0 90px;"><img src="craft/images/header_modules.jpg" /></div>';
					mainmenu += '			<img src="craft/images/header_separation.jpg" />';
					mainmenu += '			<img id="craftlight_mainmenu_onoff" src="craft/images/header_off.jpg" alt="Masquer les cadres sur la page" title="Masquer les cadres sur la page" />';
					mainmenu += '			<img src="craft/images/header_separation.jpg" />';
					mainmenu += '			<a target="_blank" href="https://www.google.com/analytics/web/"><img id="craftlight_mainmenu_stats" src="craft/images/header_stats.jpg" alt="Afficher les statistiques du site" title="Afficher les statistiques du site" /></a>';
					mainmenu += '			<img src="craft/images/header_separation.jpg" />';
					mainmenu += '			<div id="craftlight_mainmenu_notifs" style="display: inline; position: relative; width: 40px; height: 40px;">';
					mainmenu += '				<img src="craft/images/header_notifs.jpg" alt="Vous n\'avez aucune nouvelle notification" title="Vous n\'avez aucune nouvelle notification" />';
					mainmenu += '				<div id="craftlight_mainmenu_nbnotifs" style="display: none; position: absolute; left: 22px; top: -22px; background-color: #ef3c24; font-size: 10px; height: 11px; line-height: 11px; padding: 0 3px 1px 3px; border-radius: 3px; box-shadow: 2px 2px 3px #000; font-weight: bold; color: #fff;">0</div>';
					mainmenu += '			</div>';
					mainmenu += '			<img src="craft/images/header_separation.jpg" />';
					mainmenu += '			<img id="craftlight_mainmenu_utils" src="craft/images/header_utils.jpg" alt="Gérer les utilisateurs" title="Gérer les utilisateurs" />';
					mainmenu += '			<img src="craft/images/header_separation.jpg" />';
					mainmenu += '			<img id="craftlight_mainmenu_gest" src="craft/images/header_gest.jpg" alt="Gérer mes images" title="Gérer mes images" />';
					mainmenu += '			<img src="craft/images/header_separation.jpg" />';
					mainmenu += '		</div>';
					mainmenu += '		<div style="position: absolute; left: 0; top: 0; height: 40px;">';
					mainmenu += '			<img src="craft/images/header_logo.jpg" style="float: left;" />';
					mainmenu += '			<div style="float: left; height: 40px; width: 150px; margin: 0 0 0 10px; text-align: center; line-height: 20px;">';
					mainmenu += '				Bonjour<br /><b id="herecomesthelogin"></b>';
					mainmenu += '			</div>';
					mainmenu += '		</div>';
					mainmenu += '		<div style="position: absolute; right: 0; top: 0; height: 40px; text-align: right;">';
					mainmenu += '			<img id="craftlight_mainmenu_croix" src="craft/images/header_croix.jpg" style="float: right;" />';
					mainmenu += '			<img src="craft/images/header_separation.jpg" style="float: right;" />';
					mainmenu += '			<a target="_blank" href="http://www.agence-origami.com"><img src="craft/images/header_origami.jpg" id="craftlight_mainmenu_origami" /></a>';
					mainmenu += '		</div>';
					mainmenu += '	</div>';
					mainmenu += '	<div id="craftlight_mainmenuarrow">';
					mainmenu += '	▲';
					mainmenu += '	</div>';
					mainmenu += '</div>';
				$('body').append(mainmenu);
				$('#herecomesthelogin').fadeTo(0,0).load('craft/get_name.php',function(){$(this).fadeTo(1000,1);});
				function showNotifs(nb)
				{
					$('#craftlight_mainmenu_nbnotifs').html(nb).css({'display':'block'});
				}
				function hideNotifs()
				{
					$('#craftlight_mainmenu_nbnotifs').css({'display':'none'});
				}
				$('#craftlight_mainmenu')
				.css({
					'position':'fixed',
					'left':0,
					'top':0,
					'width':'100%',
					'height':menuHeight+'px',
					'background-color':'#2b2c2d',
					'background-image':'url(craft/images/header_bg.jpg)',
					'background-repeat':'repeat-x',
					'color':'#fff',
					'margin':0,
					'padding':0,
					'box-shadow':'0 3px 5px #000',
					'border-bottom':'1px solid #333',
					'z-index':10000000000
				})
				.attr('oncontextmenu','javascript: return false;');
				$('#craftlight_mainmenu_origami').css({
					'float':'right',
					'margin-left':'5px'
				})
				.hover(function()
				{
					$(this).attr('src','craft/images/header_origami_hover.jpg');
				},
				function()
				{
					$(this).attr('src','craft/images/header_origami.jpg');
				});
				$('#craftlight_mainmenuarrow')
				.css({
					'cursor':'pointer',
					'position':'absolute',
					'left':'50%',
					'top':menuHeight+'px',
					'width':'100px',
					'height':'15px',
					'background-color':'#2b2c2d',
					'color':'#fff',
					'overflow':'hidden',
					'margin':0,
					'margin-left':'-50px',
					'padding':0,
					'text-align':'center',
					'line-height':'15px',
					'font-size':'14px',
					'border-right':'1px solid #333',
					'border-bottom':'1px solid #333',
					'border-left':'1px solid #333',
					'border-radius':'0 0 5px 5px',
					'box-shadow':'0 3px 5px #000',
					'z-index':1000000
				})
				$('#craftlight_innermainmenu')
				.css({
					'width':'100%',
					'height':'100%',
					'overflow':'hidden',
					'margin':0,
					'padding':0,
					'line-height':menuHeight+'px',
				});
				$('#craftlight_innermainmenu a')
				.css({
					'cursor':'pointer'
				});
				$('#craftlight_mainmenu')
				.css({
					'margin-top':-menuHeight+'px'
				});
				$('#craftlight_mainmenu_croix').css({'cursor':'pointer'})
				.hover(function()
				{
					$(this).attr('src','craft/images/header_croix_hover.jpg');
				},
				function()
				{
					$(this).attr('src','craft/images/header_croix.jpg');
				})
				.click(function()
				{
					if (confirm("Êtes vous sûr de vouloir vous déconnecter ?"))
					{
						$.ajax({
							url: "craft/logout.php",
							success: function()
							{
								deleteBlocks();
								$('#craftlight_mainmenu').remove();
								alert("Votre session a bien été déconnectée !");
							},
							error: function()
							{
								alert("Erreur !");
							}
						});
					}
					else
					{
						return false;
					}
				});
				function showMenu()
				{
					$('#craftlight_mainmenu').stop(true).animate({
						'margin-top':'0px'
					},1000,'easeInOutQuad');
				}
				showMenu();
				function hideMenu()
				{
					$('#craftlight_mainmenu').stop(true).animate({
						'margin-top':-menuHeight+'px'
					},1000,'easeInOutQuad');
				}
				$('#craftlight_mainmenuarrow')
				.toggle(function(){
					hideMenu();
					$(this).html("▼");
				}, function(){
					showMenu();
					$(this).html("▲");
				});
				onoff = 'off';
				$('#craftlight_mainmenu_onoff').css({'cursor':'pointer'})
				.toggle(function(){
					onoff = 'on';
					regenBlocks();
				}, function(){
					onoff = 'off';
					deleteBlocks();
				});
				$('#craftlight_mainmenu_utils').css({'cursor':'pointer'})
				.click(function()
				{
					openPage('craft/users.php');
				});
				$('#craftlight_mainmenu_gest').css({'cursor':'pointer'})
				.click(function()
				{
					openPage('craft/gest.php');
				});
				$('#craftlight_mainmenu_list').hover(function()
				{
					var listingLeft = $('#craftlight_mainmenu_list').offset().left+5;
					$('#craftlight_mainmenu_list_40').css({'left':listingLeft+'px'}).stop(true).fadeTo(0,1).animate({'height':$('#craftlight_mainmenu_list_40_0').outerHeight()},250);
				},
				function()
				{
					$('#craftlight_mainmenu_list_40').stop(true).animate({'height':0},250).fadeTo(0,0).fadeOut(0);
				});
				/** 1+4 CACHES GENERATION **/
				$('body').append('<div id="craftlight_cache0"></div>');
				$('body').append('<div id="craftlight_cache1"></div>');
				$('body').append('<div id="craftlight_cache2"></div>');
				$('body').append('<div id="craftlight_cache3"></div>');
				$('body').append('<div id="craftlight_cache4"></div>');
				$('#craftlight_cache0,#craftlight_cache1,#craftlight_cache2,#craftlight_cache3,#craftlight_cache4').css({
					'position':'absolute',
					'left':0,
					'top':0,
					'margin':0,
					'padding':0,
					'border':0,
					'background-color':'#000',
					'z-index':100000000,
				}).fadeTo(0,0).fadeOut(0);
				$('#craftlight_cache0').css({'z-index':10000000000});
				/** MENU LISTING GENERATION **/
				var listingLeft = $('#craftlight_mainmenu_list').offset().left+5;
				var listingTop = 35;
				$('#craftlight_mainmenu_list').append('<div id="craftlight_mainmenu_list_40" style="position: absolute; overflow: auto; overflow-x: hidden; overflow-y: auto; left: '+listingLeft+'px; top: '+listingTop+'px; min-width: 300px; max-width: 500px; padding: 0; background-color: #000; border: 1px solid #444; border-radius: 0 5px 5px 5px; box-shadow: 3px 3px 5px #000; z-index: 10000000;"><div id="craftlight_mainmenu_list_40_0" style="margin:0;padding:5px;"></div></div>');
				/** BLOCKS GENERATION **/
				function haveNoHiddenParent(obj)
				{
					var have = 0;
					obj.parents().each(function()
					{
						if($(this).css('display')=='none' || $(this).css('visibility')=='hidden')
							have = 1;
					});
					if (have==0)
						return true;
					else
						return false;
				}
				var seeableWidth = $(document).width();
				var seeableHeight = $(document).height();
				function isSeeable(obj)
				{
					var objLeft = obj.offset().left;
					var objTop = obj.offset().top;
					var objWidth = obj.outerWidth();
					var objHeight = obj.outerHeight();
					if (objLeft>=0 && objTop>=0 && (objLeft+objWidth)<=seeableWidth && (objTop+objHeight<=seeableHeight))
						return true;
					else
						return false;
				}
				pagesAlreadyScaned = new Array();
				moduleListIdAlreadyUsed = new Array();
				createBlocks = function()
				{
					if ($.browser.msie && $.browser.version.slice(0,1)*1<9)
					{
						$('craft').each(function()
						{
							$(this).parent().html(
								$(this).parent().html()
								.replace(/<craft/gim,'<craft:craft')
								.replace(/craft>/gim,'craft:craft>')
							);
						});
					}
					var numberOfModules = 0;
					moduleListType = new Array();
					moduleListName = new Array();
					moduleListId = new Array();
					$('craft[type!=externe]').each(function()
					{
						numberOfModules++;
						var blockId = $(this).attr('id');
						var blockLeft = Math.round($(this).offset().left-$(this).offsetParent().offset().left);
						var blockTop = Math.round($(this).offset().top-$(this).offsetParent().offset().top);
						var blockWidth = Math.round($(this).parent().outerWidth());
						var blockHeight = Math.round($(this).parent().outerHeight());
						var blockType = $(this).attr('type');
						if ($(this).attr('name'))
							var blockName = $(this).attr('name');
						else
							var blockName = '[sans titre]';
						if (haveNoHiddenParent($(this)))
						{
							$(this).parent().append('<div class="craftlight_block" id="craftlight_block_'+blockId+'"></div>');
							$('#craftlight_block_'+blockId).append('<div class="lightcraft_click">Cliquez pour éditer</div>');
							$('#craftlight_block_'+blockId).find('.lightcraft_click')
							.css({
								'background-color':mainColor,
								'color':opositColor,
								'font-size':'14px',
								'overflow':'hidden',
								'position':'absolute',
								'left':0,
								'top':0,
								'border-radius':'0 0 '+(borderSize/2)+'px 0',
								'padding':'0 '+borderSize+'px '+borderSize+'px 0',
								'cursor':'pointer',
								'font-family':'arial'
							})
							.attr('oncontextmenu','javascript: return false;')
							.fadeOut(0)
							.click(function()
							{
								openModule(blockId);
							});
							$('#craftlight_block_'+blockId)
							.css({
								'position':'absolute',
								'left':blockLeft,
								'top':blockTop,
								'width':blockWidth,
								'height':blockHeight,
								'z-index':1000000000,
								'border':borderSize+'px solid '+mainColor,
								'margin-left':'-'+borderSize+'px',
								'margin-top':'-'+borderSize+'px',
								'box-shadow':'0 0 '+borderSize+'px '+shadowColor,
								'border-radius':(borderSize/2)+'px '+(borderSize/2)+'px '+(borderSize/2)+'px '+(borderSize/2)+'px',
								'background-image':'url(craft/images/blank.gif)',
								'cursor':'pointer',
								'font-family':'arial',
								'font-size':'16px'
							})
							.attr('oncontextmenu','javascript: return false;')
							.fadeOut(0)
							.fadeTo(1000,0.5)
							.hover(function()
							{
								$('.craftlight_block[id!='+$(this).attr('id')+']').stop(true).fadeTo(250,0.25);
								$(this).stop(true).fadeTo(0,1);
								$(this).find('.lightcraft_click').stop(true).fadeTo(0,1);
								$block = $(this);
								$('#craftlight_cache1').css({
									'left':0,
									'top':0,
									'width':availableWidth,
									'height':$block.offset().top
								});
								$('#craftlight_cache2').css({
									'left':0,
									'top':$block.offset().top,
									'width':$block.offset().left,
									'height':$block.outerHeight()
								});
								$('#craftlight_cache3').css({
									'left':$block.offset().left+$block.outerWidth(),
									'top':$block.offset().top,
									'width':availableWidth-($block.offset().left+$block.outerWidth()),
									'height':$block.outerHeight()
								});
								$('#craftlight_cache4').css({
									'left':0,
									'top':$block.offset().top+$block.outerHeight(),
									'width':availableWidth,
									'height':$(document).height()-($block.offset().top-$('#craftlight_mainmenu').height()+$block.outerHeight())
								});
								$('#craftlight_cache1,#craftlight_cache2,#craftlight_cache3,#craftlight_cache4').stop(true).fadeTo(250,0.66);
							},
							function()
							{
								$('.craftlight_block[id!='+$(this).attr('id')+']').stop(true).fadeTo(250,0.5);
								$(this).stop(true).fadeTo(500,0.5);
								$(this).find('.lightcraft_click').stop(true).fadeTo(500,0);
								$('#craftlight_cache1,#craftlight_cache2,#craftlight_cache3,#craftlight_cache4').stop(true).fadeTo(250,0).fadeOut(0);
							})
							.click(function()
							{
								openModule(blockId);
							});
						}
						else
						{
							//alert('id "'+blockId+'" is NOT displayed !');
						}
						if (moduleListIdAlreadyUsed[blockId] != 1)
						{
							$('#craftlight_mainmenu_list_40_0').append('<div id="craftlight_mainmenu_list_40_inner"><div class="craftlight_mainmenu_list_40_div" style="height: 20px; line-height: 20px; background-color: #111; margin: 3px; padding: 2px 5px 2px 5px; border-radius: 3px; cursor: pointer;" onclick="javascript:openModule(\''+blockId+'\');">'+'<div style="float: left; width: 20px; height: 20px; line-height: 20px; text-align: center;"><img src="craft/modules/'+blockType+'/icon.png" style="vertical-align: middle;" /></div><div style="float: left; height: 20px; padding-left: 5px; text-align: left;"><div style="height: 8px; line-height: 8px; font-size: 8px; color: #555; text-align: left;">'+blockType.toUpperCase()+'</div><div style="height: 12px; line-height: 12px; font-size: 11px; color: #fff; text-align: left;">'+blockName.toUpperCase()+'</div></div>'+'</div></div>');
							$('.craftlight_mainmenu_list_40_div').removeAttr('onmouseover')
							.hover(function()
							{
								$(this).css({'background-color':'#333'});
							},
							function()
							{
								$(this).stop(true).animate({'background-color':'#111'},250);
							});
							moduleListIdAlreadyUsed[blockId] = 1;
						}
					});
					var craftExterneNb = 0;
					$('craft[type=externe]').each(function()
					{
						craftExterneNb++;
						var url = $(this).attr('src');
						if (pagesAlreadyScaned[url] != 1)
						{
							pagesAlreadyScaned[url] = 1;
							$('body').append('<div id="craftexterne'+craftExterneNb+'" style="display:none;position:absolute;left:0;top:0;z-index:-1;width:0;height:0;border:0;margin:0;padding:0;overflow:hidden;visibility:hidden;"></div>');
							$('#craftexterne'+craftExterneNb).load(url+' craft',function(data)
							{
								if ($(this).html())
								{
									$(this).find('craft').each(function()
									{
										var blockId = $(this).attr('id');
										if (moduleListIdAlreadyUsed[blockId] != 1)
										{
											var blockType = $(this).attr('type');
											if ($(this).attr('name'))
												var blockName = $(this).attr('name');
											else
												var blockName = '[sans titre]';
											$('#craftlight_mainmenu_list_40_0').append('<div id="craftlight_mainmenu_list_40_inner"><div class="craftlight_mainmenu_list_40_div" style="height: 20px; line-height: 20px; background-color: #111; margin: 3px; padding: 2px 5px 2px 5px; border-radius: 3px; cursor: pointer;" onclick="javascript:openModule(\''+blockId+'\');">'+'<div style="float: left; width: 20px; height: 20px; line-height: 20px; text-align: center;"><img src="craft/modules/'+blockType+'/icon.png" style="vertical-align: middle;" /></div><div style="float: left; height: 20px; padding-left: 5px; text-align: left;"><div style="height: 8px; line-height: 8px; font-size: 8px; color: #555; text-align: left;">'+blockType.toUpperCase()+'</div><div style="height: 12px; line-height: 12px; font-size: 11px; color: #fff; text-align: left;">'+blockName.toUpperCase()+'</div></div>'+'</div></div>');
											$('.craftlight_mainmenu_list_40_div').removeAttr('onmouseover')
											.hover(function()
											{
												$(this).css({'background-color':'#333'});
											},
											function()
											{
												$(this).stop(true).animate({'background-color':'#111'},250);
											});
											moduleListIdAlreadyUsed[blockId] = 1;
										}
									});
								}
							});
						}
					});
					$('#craftlight_mainmenu_onoff').attr('src','craft/images/header_on.jpg');
					$('#craftlight_mainmenu_onoff').attr('alt','Masquer les cadres sur la page');
					$('#craftlight_mainmenu_onoff').attr('title','Masquer les cadres sur la page');
				};
				createBlocks();
				deleteBlocks = function()
				{
					$('.craftlight_block').remove();
					$('#craftlight_mainmenu_onoff').attr('src','craft/images/header_off.jpg');
					$('#craftlight_mainmenu_onoff').attr('alt','Afficher les cadres sur la page');
					$('#craftlight_mainmenu_onoff').attr('title','Afficher les cadres sur la page');
				};
				deleteBlocks();
				regenBlocks = function()
				{
					if (onoff != 'off')
					{
						deleteBlocks();
						createBlocks();
					}
				};
				$('#craftlight_mainmenu_list_40').css({'height':0}).fadeOut(0);
				/** WORKING ZONE GENERATION **/
				$('body').append(
					'<div id="craftlight_workingzone">'+
					'	<div id="craftlight_innerworkingzone">'+
					'		working zone !'+
					'	</div>'+
					'	<div id="craftlight_workingzonearrow" style="display:block;width:100%;height:40px;line-height:40px;">'+
					'		<a style="display: block; width: 190px; height: 25px; margin: 0 5px 0 5px; background-image: url(craft/images/btn_orange.png); background-repeat: no-repeat; text-align: left; cursor: pointer;" onclick="javascript:hideWorkingZone();">'+
					'			<span style="line-height: 25px; padding: 0 0 0 25px; font-size: 16px; vertical-align: top;">'+
					'				Fermer l\'onglet'+
					'			</span>'+
					'		</a>'+
					'	</div>'+
					'</div>');
				$('#craftlight_workingzone')
				.css({
					'position':'fixed',
					'left':0,
					'top':0,
					'width':'100%',
					'height':workZoneHeight+'px',
					'background-color':'#2b2c2d',
					'color':'#fff',
					'margin':0,
					'padding':0,
					'box-shadow':'0 5px 5px #000',
					'border-bottom':'1px solid #333',
					'z-index':100000000000
				})
				.stop(true).fadeOut(0)
				.attr('oncontextmenu','javascript: return false;');
				$('#craftlight_workingzonearrow')
				.css({
					'position':'absolute',
					'left':'50%',
					'top':workZoneHeight+'px',
					'width':'200px',
					'height':'30px',
					'background-color':'#2b2c2d',
					'color':'#fff',
					'overflow':'hidden',
					'margin':0,
					'margin-left':'-150px',
					'padding':0,
					'text-align':'center',
					'line-height':'30px',
					'font-size':'16px',
					'border-right':'1px solid #333',
					'border-bottom':'1px solid #333',
					'border-left':'1px solid #333',
					'border-radius':'0 0 10px 10px',
					'box-shadow':'0 5px 5px #000',
					'z-index':1000000
				})
				$('#craftlight_innerworkingzone')
				.css({
					'width':'100%',
					'height':'100%',
					'overflow':'hidden',
					'margin':0,
					'padding':0
				});
				$('#craftlight_workingzone')
				.css({
					'margin-top':-workZoneHeight+'px'
				});
				showWorkingZone = function()
				{
					$('#craftlight_workingzone').stop(true).fadeTo(250,1).animate({
						'margin-top':'0px'
					},500,'easeInOutQuad');
					$('#craftlight_cache0').css({
						'left':0,
						'top':0,
						'width':$(document).width(),
						'height':$(document).height()
					});
					$('#craftlight_cache0').stop(true).fadeTo(250,0.75);
				}
				hideWorkingZone = function()
				{
					$('#craftlight_cache0').stop(true).fadeTo(250,0).fadeOut(0);
					$('#craftlight_workingzone').stop(true).animate({
						'margin-top':-workZoneHeight+'px'
					},500,'easeInOutQuad').fadeTo(250,0).fadeOut(0);
					$('#craftlight_innerworkingzone').html('');
					$('#craftlight_workingzone').css({'background-color':'#2b2c2d'});
					$('#craftlight_workingzonearrow').css({'background-color':'#2b2c2d'})
					.html(
						'<a style="display: block; width: 190px; height: 25px; margin: 0 5px 0 5px; background-image: url(craft/images/btn_orange.png); background-repeat: no-repeat; text-align: left; cursor: pointer;" onclick="javascript:hideWorkingZone();">'+
						'	<span style="line-height: 25px; padding: 0 0 0 25px; font-size: 16px; vertical-align: top;">'+
						'		Fermer l\'onglet'+
						'	</span>'+
						'</a>'
					);
				};
				changeWorkingZoneBackgroundColor = function(color)
				{
					$('#craftlight_workingzone').css({'background-color':color});
					$('#craftlight_workingzonearrow').css({'background-color':color});
				};
				openModule = function(blockId)
				{
					var moduleType = $('#'+blockId).attr('type');
					$('#craftlight_innerworkingzone').html('<iframe name="craftlight_workingzone_iframe" id="craftlight_workingzone_iframe" src="craft/modules/'+moduleType+'/?blockId='+blockId+'" align="center" frameborder="0" width="100%" height="100%"></iframe>');
					showWorkingZone();
				}
				openPage = function(url)
				{
					$('#craftlight_innerworkingzone').html('<iframe name="craftlight_workingzone_iframe" id="craftlight_workingzone_iframe" src="'+url+'" align="center" frameborder="0" width="100%" height="100%"></iframe>');
					showWorkingZone();
				}
				$('#craftlight_mainmenu *, #craftlight_workingzone *, .craftlight_block *').css({'font-family':'arial'});
			});
			gestimage = function(f)
			{
				alert('http://'+document.domain+'/'+f);
				return false;
			}
		
		}
	},
	error: function()
	{
		// rien ! :D
	}
});
