/**
 * @author florent.martin
 */
Event.observe(window, 'load', chargementPage);

var activeImage = 0;

function chargementPage(){
	//preload(PLImages, 'load');
	load();
	clickedElem = actMenu;
	dispMenu(actMenu);
}
function load() {
    var ids = 'divDetail divAgenceCad divRealisations divProjets divPrestations divCadShop';   
    $w(ids).each(function(node){ if ($(node)) $(node).style.visibility = 'hidden' }); // Je cache tous les themes
	$('divCadShop').style.visibility = 'visible';
	$('divInnerCadShop').style.display = 'none';
	$('divInnerCadShop').style.visibility = 'visible';
	Event.observe($('divContact2'), 'click', gestionContact);
	Event.observe($('imagesCadShop'), 'mouseover', hoverImagesCategorie);
	Event.observe($('imagesCadShop'), 'mouseout', outImagesCategorie);
	Effect.Appear('divInnerCadShop', {from: 0, to: 0.8, duration: 2});
	//Effect.Appear('titreCadShop', {from: 0, to: 1, duration: 2});
	$w(listAppear).each(function(node){ 
			Effect.Appear($(node).id, {from:0, to:1, duration: 2});
		});
}

function hoverImagesCategorie(evt) {
	if (evt.element().tagName != "IMG") return;
	var elem = evt.element();
	var elemId = elem.id;
	var elemName = elemId.match(/^img_([^_]+)/i)[1];
	$('img_' + elemName + '_hover').show();
	$('img_' + elemName + '_hover').setOpacity(1);
}
function outImagesCategorie(evt) {
	if (evt.element().tagName != "IMG") return;
	var elem = evt.element();
	var elemId = elem.id;
	var elemName = elemId.match(/^img_([^_]+)/i)[1];
	if (elemId.match(/^img_([^_]+)$/i)) return; // si mouseOut sur l'image du fond
    $w(listCategory).each(function(node){ 
			if (($(node).getOpacity() == 1) && ($(node).style.display != 'none')) {
				Effect.Appear($(node).id, {from:1, to:0, duration: 0.2, afterFinish: (function(){$(node).hide()})});
			}
		});
}
	
	
	
	
