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(){ 	

	$('.link-multimag').click(function(){
		$('#link-location').modal({onShow: modalShow});
		return false;
	});
	
	
	$('.encart-mag').hide(); 

	$('#content-site-right h4').css('cursor','pointer').click(function () {
		if ($(this).next().is(":hidden")) {				 
			$('.open').next().slideUp('fast');
			$(this).addClass('open');
			$(this).next().slideDown();
		}
		return false;
	});
	$('#content-site-right').find('h4:first').addClass('open').next().slideDown();
	
	$('#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);
	});
});