var hauteur;
var hauteurSyndic;

var deviceAgent = navigator.userAgent.toLowerCase();
iMachin = deviceAgent.match(/(iphone|ipod|ipad)/);
isAndroid = deviceAgent.indexOf("android") > -1;
var isMobile=(iMachin || isAndroid);

function shortenMembreSlow(){
	if(!isMobile){
		$('#menu-membre').animate({
			height: '178px'
		  },'1000');
	}
}

function expandMembre(){
		$('#menu-membre').animate({
		    height: hauteur+'px'
		  },'1000');
}

function shortenMembre(){
	if(!isMobile){
		hauteur=$("#menu-membre").height();
		$('#menu-membre').animate({
			height: '178px'
		  },1);
	}
}

function shortenSyndicSlow(){
	if(!isMobile){
		$('#menu-syndic').animate({
			height: '40px'
		  },'1000');
		document.getElementById("syndic-ul").style.visibility="hidden";
	}
}

function shortenSyndic(){
	if(!isMobile){
		hauteurSyndic=$("#menu-syndic").height();
		$('#menu-syndic').animate({
			height: '40px'
		  },1);
		document.getElementById("syndic-ul").style.visibility="hidden";
	}
}

function expandSyndic(){
	document.getElementById("syndic-ul").style.visibility="visible";
		$('#menu-syndic').animate({
		    height: hauteurSyndic+'px'
		  },'1000');
}

$(document).ready(function(){
	var margin = ($(window).height()/2)-150;
	if(margin>=0)$('#connection form').css('margin-top',margin);
	
	if(isMobile){
		$('#menu-membre,#menu-syndic').css('height','auto');
	}
});

$(window).resize(function(){
	var margin = ($(window).height()/2)-150;
	if(margin>=0)$('#connection form').css('margin-top',margin);
});

function showOubli(){
	document.getElementById('connect').style.display='none';
	document.getElementById('oubli').style.display='block';
}

function showChangement(){
	document.getElementById('connect').style.display='none';
	document.getElementById('changement').style.display='block';
}

function showNewUser(){
	document.getElementById('connect').style.display='none';
	document.getElementById('nouveau-user').style.display='block';
}
