function modalShow (dialog) {
		height = $('#link-location').height();
		$('#modalContainer').height(height+30);
}


function affichecalendrier(id_magasin){
	document.getElementById("CalFrameDebut").style.display='';
	document.getElementById("CalFrameDebut").src= 'http://www.intersport-rent.fr/calendrier.aspx?magasin='+id_magasin;
}

function sumbitResa(){
	if($('#frm-resa-magasin').attr('value') == 0){
		magasin = $('form').find('select option:selected').get(0).value
	} else {
		magasin = $('#frm-resa-magasin').attr('value');
	}
	window.open($('#form_resa').attr("action")+'?magasin='+magasin+'#partenaire=6');
	document.location.href='/';
}

$(document).ready(function(){ 	
	var htmlStr = $("#dynamo ul").html();
	$("#dynamo").html('');
    $("#dynamo_ul").html(htmlStr);
	$('.link-multimag').click(function(){
		$('#link-location').modal({onShow: modalShow});
		return false;
	});
	$('ul.sousmenu').hide(); 
	$('.open').next().show();
	$("#contenu_left a[@href^='http:\/\/']").attr("target","_blank");
	$('a[@rel*=lightbox]').lightBox({
		imageBlank : '/css/images/blank.gif',
		imageLoading: '/css/images/loading.gif',
		imageBtnClose: '/css/images/close.gif',
		imageBtnPrev: '/css/images/prev.gif',
		imageBtnNext: '/css/images/next.gif',
		containerResizeSpeed: 350,
		txtImage: 'Image',
		txtOf: '/'
		
	});
	$('a.avecsousmenu').mouseover(function () {
		if ($(this).next().is(":hidden")) {				 
			$('.open').next().slideUp('1000');
			$(this).addClass('open');
			$(this).next().slideDown();
		}
	});
	$('a.avecsousmenu-clic').click(function () {
		if ($(this).next().is(":hidden")) {
			$(this).next().slideDown();
		}
		return false;
	});
	$('#accueil-fade').innerfade({
		animationtype: 'fade',
		speed: 'slow', 
		timeout: 4000,
		type: 'sequence',
		containerheight: 'auto'
	});
	$('.block-link').css('cursor','pointer').mouseover(function(){
		$(this).css('background-color','#f5f5f5');
	}).mouseout(function(){
		$(this).css('background-color','#fff');
	}).click(function(){
		document.location.href  = $(this).find('a:last')[0].href;
	});
	
	$('#calendar-frm-resa-debut').click(function () {
		if($('#frm-resa-magasin').attr('value') == 0){
			magasin = $('form').find('select option:selected').get(0).value
		} else {
			magasin = $('#frm-resa-magasin').attr('value');
		}
		affichecalendrier(magasin);
	});
	$('#frm-resa-debut').click(function () {
		if($('#frm-resa-magasin').attr('value') == 0){
			magasin = $('form').find('select option:selected').get(0).value
		} else {
			magasin = $('#frm-resa-magasin').attr('value');
		}
		affichecalendrier(magasin);
	});
});