//FICHIER JS POUR LA SKIN TECHNIC AVIATION
window.addEvent('domready', function() {
	//GESTION DES SOUS BLOCS (ROLL OVER)
	if($$('div.sousBloc')){
    	$each($$('div.sousBloc'),function(sousBloc){    
    		$(sousBloc).addEvent('mouseenter',function(){
    			hideIllustrationBloc(sousBloc);
    			showIllustrationBloc(sousBloc);
    		});
    	});
    }
	
	var menuIdActual;
	//GESTION DES MENUS
	$each($$('#menuContent li a'),function(menuId){    
		$(menuId).addEvent('mouseenter',function(){
			$each($$('#menuContent li a'),function(menuId){
				if ($(menuId).hasClass("actif")){
					menuIdActual=menuId
					$(menuId).removeClass("actif");
				}
			});
		});
		$(menuId).addEvent('mouseleave',function(){
			if($(menuIdActual)){
				$(menuIdActual).addClass("actif");
			}
		});
    });
	
	SqueezeBox.initialize();

	SqueezeBox.assign($$('a.squeezeBox'), {
		parse: 'rel',
		ajaxOptions: {
			method: 'get'
		}

	});

	
	if($('afficheLogin')){
		SqueezeBox.open("index.php?affiche_login=1&template=login",{
			size: {x: 250, y: 85}
		});
	}
	
});

function showIllustrationBloc(blc){
  hideIllustrationBloc(blc);
  var showBlc="illustr_"+$(blc).id;
  if ($(showBlc)){
  	if ($(showBlc).hasClass('nod')){
  	  $(showBlc).removeClass('nod');
  	  $(showBlc).setStyle('opacity','1');
  	}  	
  }
  if ($(blc)) $(blc).addClass('sousBlocActif');
  
}

function hideIllustrationBloc(blc){
  $each($$('div.illustr'),function(bloc){
  	if($(bloc)) $(bloc).addClass('nod');
  });
  $each($$('div.sousBloc'),function(bloc){
  	if($(bloc)) $(bloc).removeClass('sousBlocActif');
  });
}

function action(type,file,titre){
    file=file.replace("..",".");
    switch (type){
      case 'view':   
      case 'print':
         SqueezeBox.open(file, {handler: 'iframe', size:{x:840,y:550}});
        break;
      case 'save':
        window.open("iframe.php?forceDownload="+file);
        break;            
    }
  }
