function amiDemandeRep(id,ok) {
	new Ajax.Request('/php/amis_demande.php',{
					 method:'post',
					 parameters:{ok:ok,id:id},
					 onSuccess:function(){}
		});
}


function homeDressing(elt,type) {
	$$('#homebox-dressing .box-top a').each(function(e){e.className='';});
	elt.className='active';
	$('dressing-content').update('<img src="/images/v1/loading-dressing.gif" style="margin-top:10px" />');
	new Ajax.Updater('dressing-content','/php/home_dressing.php',{
			method:'post',
			parameters:{type:type}
		});
}

function homeMembres(elt,type) {
	$$('#homebox-membres .box-top a').each(function(e){e.className='';});
	elt.className='active';
	$('membres-content').update('<img src="/images/v1/loading.gif" style="margin-top:40px" />');
	new Ajax.Updater('membres-content','/php/home_membres.php',{
			method:'post',
			parameters:{type:type}
		});
}

function sondageVoter(id,voter) {
	var rep=false;
	if (voter) {
		$$('#sondage-list .reponse').each(function(e){
			var radio = e.down('input');
//			alert(radio+ '   id: '+radio.id+'   checked:'+radio.checked+'   value:'+radio.value);
			if (radio.checked) 
				rep = radio.value;
		});
		if (!rep) { 
			alert('aucune reponse choisie!');
			return false;
		}
	}
	else 
		rep = 0;
	new Ajax.Updater('sondage-list','/php/sondage_voter.php',{method:'post',parameters:{id:id,rep:rep,voter:voter}});
}

 // faire défiler les infos d vips
 function moreVip()
 {
// 	for(var e in $$('#homebox-op1000m .item'))
//		alert(e.id);
	var all=$$('#homebox-op1000m .item');
	if(all[all.length-2].visible() && all[all.length-1].visible())
	{
		all[all.length-2].hide();
		all[all.length-1].hide();
		all[0].up(0).insert({top: '<div class="item">'+all[all.length-1].innerHTML+'</div>'});
		all[all.length-1].remove();
		all[0].show();
	}
	else
	for (var i=0; i < all.length; ++i)
	{
		var e=all[i];
		if( e.visible() && i<all.length-1 && e.next().visible() )
			e.hide();
		else if (!e.visible() && i>0 && e.previous().visible())
		{
			e.show();
			break;
		}
	}
/*
	
	$('vip-hidden').value=0;
 	$$('#homebox-op1000m .item').each(function(e){
		if( $('vip-hidden').value>0 ) return true;
		// visible
		if(e.visible() && e.next() && e.next().visible())
		{
			e.hide();
		}
		// celle d'avant est visible
		else if (!e.visible() && e.previous() && e.previous().visible())
		{
			e.show();
		}
		else if ( $$('#homebox-op1000m .item').last().visible() && $$('#homebox-op1000m .item').last().previous().visible() )
		{
			$$('#homebox-op1000m .item').last().previous().hide();
			$$('#homebox-op1000m .item').first().show();
		}
	});*/
	
 }
