
onresize = function() {
	var height=0;
	if (document.documentElement.scrollHeight) {
		height=document.documentElement.scrollHeight;
	} else if (document.documentElement.offsetHeight) {
		height=document.documentElement.scrollHeight;
	} else if (document.body.scrollHeight) {
		height=document.body.scrollHeight;
	} else {
		return false;
	}
	$('contener').setStyle('height', height);
	if (height > 649) {
		$('menu_bottom').setStyle('top', height - 114);
		$('menu2_bottom').setStyle('top', height - 79);
	}
};

window.addEvents({ 'domready': onresize, 'onresize': onresize });

function gotoSpectacle(id) {
	var pos = $(id).getPosition($('scr_scrollcontent'));
	var myFx = new Fx.Scroll('scr_scrollarea');
	myFx.start(pos.x, pos.y);
}

function toggleRadio(id,value,off_src,on_src) {
	var current_value=$(id).value;
	if($(id+'_'+current_value)) $(id+'_'+current_value).src=off_src;
	$(id+'_'+value).src=on_src;
	$(id).value=value;
}

function toggleCheck(id,value,off_src,on_src) {
	var current_value=$(id).value;
	if ($(id).value)
		var tab = $(id).value.split(',');
	else
		var tab = new Array();
	var tab2 = new Array();
	var done = false;
	for(var i=0; i < tab.length; i++) {
		$(id+'_'+tab[i]).src=off_src;
		if (tab[i] != value) {
			tab2.push(tab[i]);
		} else {
			done = true;
		}
	}
	if (!done)
		tab2.push(value);
	for(var i=0; i < tab2.length; i++) {
		$(id+'_'+tab2[i]).src=on_src;
	}
	$(id).value=tab2.join(',');
}

function toggleInscription(type) {
	var type2=(type=='in'?'pro':'in');
	$('div_ins_tab_'+type).className="bookmark_ins_on";
	$('div_ins_tab_'+type2).className="bookmark_ins_off";
	$('center_ins_'+type).show();
	$('center_ins_'+type2).hide();
}

var flashinstalled = 0;
var flashversion = 0;
if (navigator.plugins && navigator.plugins.length) {
	x = navigator.plugins["Shockwave Flash"];
	if (x) {
		flashinstalled = 2;
		if (x.description) {
			y = x.description;
			flashversion = y.charAt(y.indexOf('.')-1);
		}
	}
	else flashinstalled = 1;
	if (navigator.plugins["Shockwave Flash 2.0"]) {
		flashinstalled = 2;
		flashversion = 2;
	}
}
else if (navigator.mimeTypes && navigator.mimeTypes.length) {
	x = navigator.mimeTypes['application/x-shockwave-flash'];
	if (x && x.enabledPlugin) flashinstalled = 2;
	else flashinstalled = 1;
}

var checkStar=1;
var checkStar2=0;

function selectStar(star){
  checkStar=1;
  checkStar2=0;
  $('star').value=0;
  var number=star.readAttribute('id');
  if(number=='star1'){
  $('star1').src='images/star_b.gif';
  $('star2').src='images/star_w_b.gif';
  $('star3').src='images/star_w_b.gif';
  $('star4').src='images/star_w_b.gif';
  }
  if(number=='star2'){
  $('star1').src='images/star_b.gif';
  $('star2').src='images/star_b.gif';
  $('star3').src='images/star_w_b.gif';
  $('star4').src='images/star_w_b.gif';
  }
  if(number=='star3'){
  $('star1').src='images/star_b.gif';
  $('star2').src='images/star_b.gif';
  $('star3').src='images/star_b.gif';
  $('star4').src='images/star_w_b.gif';
  }
  if(number=='star4'){
  $('star1').src='images/star_b.gif';
  $('star2').src='images/star_b.gif';
  $('star3').src='images/star_b.gif';
  $('star4').src='images/star_b.gif';
  }
  }

function unselectStar(){
  checkStar=0;
  setTimeout(function() { unselectAll(); },400);
  
  }

function unselectAll(){
  if(checkStar==0 && checkStar2==0){
  $('star1').src='images/star_w_b.gif';
  $('star2').src='images/star_w_b.gif';
  $('star3').src='images/star_w_b.gif';
  $('star4').src='images/star_w_b.gif';
  }
  }

function pressStar(star){
  checkStar2=1;
  var number=star.readAttribute('id');
  if(number=='star1'){
  $('star1').src='images/star_b.gif';
  $('star2').src='images/star_w_b.gif';
  $('star3').src='images/star_w_b.gif';
  $('star4').src='images/star_w_b.gif';
  $('star').value=1;
  }
  if(number=='star2'){
  $('star1').src='images/star_b.gif';
  $('star2').src='images/star_b.gif';
  $('star3').src='images/star_w_b.gif';
  $('star4').src='images/star_w_b.gif';
  $('star').value=2;
  }
  if(number=='star3'){
  $('star1').src='images/star_b.gif';
  $('star2').src='images/star_b.gif';
  $('star3').src='images/star_b.gif';
  $('star4').src='images/star_w_b.gif';
  $('star').value=3;
  }
  if(number=='star4'){
  $('star1').src='images/star_b.gif';
  $('star2').src='images/star_b.gif';
  $('star3').src='images/star_b.gif';
  $('star4').src='images/star_b.gif';
  $('star').value=4;
  }
  }

function showContact(id,photo){
  $('name_'+id).style.fontSize='16px';
  $('poss_'+id).style.fontSize='12px';
  $('email_'+id).style.fontSize='12px';
  }

function hideContact(id){
  $('name_'+id).style.fontSize='12px';
  $('poss_'+id).style.fontSize='12px';
  $('email_'+id).style.fontSize='12px';
  }
  
function showPhoto(id){
$('div_'+id).style.display='none';
}

function hidePhoto(id){
$('div_'+id).style.display='';
}

function calendarPreviousMonth() {
	calendar_event=0;
	var year,month,day;
	year=$('calendar_month').getAttribute('current_year')*1;
	month=$('calendar_month').getAttribute('current_month')*1;
	day=$('calendar_month').getAttribute('current_day')*1;
	month-=1;
	if(month<=0) {
		year--;
		month=12;
	}
	new Request.HTML({
		url:'ajax/get_calendar.ajax.php',
		onSuccess: function (html) {
			$('calendar').set('text', '');
			$('calendar').adopt(html);
		}
	}).get({
			year:year,
			month:month,
			day:day
	});
}
function calendarNextMonth() {
	calendar_event=0;
	var year,month,day;
	year=$('calendar_month').getAttribute('current_year')*1;
	month=$('calendar_month').getAttribute('current_month')*1;
	day=$('calendar_month').getAttribute('current_day')*1;
	month+=1;
	if(month>12) {
		year++;
		month=1;
	}
	new Request.HTML({
		url:'ajax/get_calendar.ajax.php',
		onSuccess: function (html) {
			$('calendar').set('text', '');
			$('calendar').adopt(html);
		}
	}).get({
			year:year,
			month:month,
			day:day
	});
}

var calendar_event=0;
function calendarPreviousEvent() {
	var events=$('calendar_info_content').getAttribute('content_count');
	if(events<=0) return;
	if(calendar_event>0) {
		$('calendar_event_'+calendar_event).hide();
		calendar_event--;
		$('calendar_event_'+calendar_event).show();
		$('calendar_info_number').innerHTML=(calendar_event+1)+'/'+events;
	}
}

function calendarNextEvent() {
	var events=$('calendar_info_content').getAttribute('content_count');
	if(events<=0) return;
	if(calendar_event<events-1) {
		$('calendar_event_'+calendar_event).hide();
		calendar_event++;
		$('calendar_event_'+calendar_event).show();
		$('calendar_info_number').innerHTML=(calendar_event+1)+'/'+events;
	}
}

function calendarClickDate(id,year,month,day) {
	calendar_event=0;
	new Request.HTML({
		url:'ajax/get_calendar.ajax.php',
		onSuccess: function (html) {
			$('calendar').set('text', '');
			$('calendar').adopt(html);
		}
	}).get({
			year:year,
			month:month,
			day:day
	});
}

function substituteFlash(idflash,idsubst) {
  var flashversion=GetSwfVer();
  if(flashversion=='-1'){
  	$(idflash).style.display='none';
	$(idsubst).style.display='';
  }
}

function choose_production(id){
  $('choice').value=id;
  document.choose_prod.submit();
  }

function choose_spectacle(id){
  $('spectacle').value=id;
  document.choose_spec.submit();
  }
  
function getSeance(id){
	new Request.HTML({
		url:'ajax/action.php',
		onSuccess: function (html) {
			$('seance').set('text', '');
			$('seance').adopt(html);
		}
	}).post({
			action:'getSeance',
			id: id
	});
}

function showLoginBox(typ){
if(typ==1)
var prof='';
else
var prof='_prof';
$('over_all'+prof).style.display='';
$('login_box'+prof).style.display='';
$('login_box2'+prof).style.display='';
}


function nextSeance(month,year,id,dir){

	new Request.HTML({
		url:'ajax/action.php',
		onSuccess: function (html) {
			$('mini_calendar4').set('text', '');
			$('mini_calendar4').adopt(html);
		}
	}).post({
			action:'nextSeance',
			month: month,
			dir: dir,
			year: year,
			id: id
	});
}



