if(!CORP) { var CORP = {}; }

//gestion de l'affichage de la liste de hotels avec ou sans la flash map
CORP.listHotel = {
	init: function(){
		$$('#continent-noh h2').each(function(e){
			if(e.next().hasClassName('close')){
				e.remove();	
			}
			e.observe('click', function(){
				CORP.listHotel.changeStat(this.id);
			});
		});
	},
	changeStat:function(id){
		if($(id)){
			if($(id).hasClassName('close')){
				CORP.listHotel.resetAll();
				$(id).removeClassName('close').addClassName('open');
				CORP.listHotel.openDiv(id);
			} else {
				$(id).removeClassName('open').addClassName('close');
				CORP.listHotel.resetAll();
			}
			window.location = '#'+id;
		} else {
			window.location = '#continent-noh';
			CORP.listHotel.resetAll();
		}
	},
	openDiv:function(id){
		if($(id)){
			$(id).next('div').removeClassName('off').addClassName('on');
		}
	},
	resetAll:function(){
		$$('#continent-noh h2').each(function(e){
			e.removeClassName('open').addClassName('close');
		});
		$$('#continent-noh div').each(function(e){
			e.removeClassName('on').addClassName('off');						  
		});
	}
}

CORP.initOffresList = {
	init: function(){
		CORP.initOffresList.setSimpleTabs();
		CORP.initOffresList.setHeightContent();
		CORP.initOffresList.setHeightOnglet();
	},
	setSimpleTabs:function(){
		var url = parent.window.location.href;
		if(url.indexOf('#')>-1){
			var id = url.substring(url.indexOf('#')+1,url.length);
			PRO.simpleTabs.hide('#'+id);
			$(id).addClassName('on');
			PRO.simpleTabs.liOff('search-toc');
			$('search-toc').select('[href="#'+id+'"]')[0].up(0).addClassName('on');
		}
	},
	setHeightContent:function(){
		var h = $('search-toc').getHeight();
		if(Prototype.Browser.IE && navigator.appVersion.indexOf('MSIE 6') > -1 ){
			$('content').setStyle({height:h+'px'});
		} else {
			$('content').setStyle({minHeight:h+'px'});
		}
		$$('#search-toc li').each(function(e){
			e.observe('click',function(h){
				var f = parent.document.getElementById(window.name);
				f.style.height = ($('content').getHeight()) + 'px';
			});
		});	
	},
	setHeightOnglet:function(){
		$$('#search-toc li').each(function(e){
			e.down('div.mask').setStyle({height:e.getHeight()+'px'});
		});
	}
}

document.observe("dom:loaded",function() {
	if($('continent-noh')){
		CORP.listHotel.init();
	}
	if($('blocOfferList-noh')){
		CORP.initOffresList.init();
		auto_height_iframe.defer();
	}
	if($('OfferPartner-noh')){
		//redimensionnement de l'iframe de la page promotions.shtml
		auto_height_iframe();
	}
});
