// JavaScript Document
function ajouter_favori(texte,url)
{
   if (window.sidebar)
	   window.sidebar.addPanel(texte, url,"");
   else if( document.all )
	   window.external.AddFavorite(url, texte);
   else
	   return true;
} 


function centrarVentana(theURL,winName,features, myWidth, myHeight, isCenter) { //v3.0
	if(window.screen)if(isCenter)if(isCenter=="true"){
		var myLeft = (screen.width-myWidth)/2;
		var myTop = (screen.height-myHeight)/2;
		features+=(features!='')?',':'';
		features+=',left='+myLeft+',top='+myTop;
	}
	window.open(theURL,winName,features+((features!='')?',':'')+'width='+myWidth+',height='+myHeight);
}



function displayCommentaires(idArticle){
	jQuery('#com_photos')
	.hide();
	
	jQuery('#com_videos')
	.hide();

	jQuery('#com_buzz')
	.hide();
	
	jQuery('#com_commentaires')
	.load("/_preprod/forum.php?page=forum&id_article="+idArticle);
	jQuery('#com_commentaires')
	.show();
}

function displayPhotos(){
	jQuery('#com_photos')
	.show();
	
	jQuery('#com_videos')
	.hide();

	jQuery('#com_buzz')
	.hide();
	
	jQuery('#com_commentaires')
	.hide();
}

function displayVideos(){
	jQuery('#com_photos')
	.hide();
	
	jQuery('#com_videos')
	.show();

	jQuery('#com_buzz')
	.hide();
	
	jQuery('#com_commentaires')
	.hide();
}

function displayBuzz(){
	jQuery('#com_photos')
	.hide();
	
	jQuery('#com_videos')
	.hide();

	jQuery('#com_buzz')
	.show();
	
	jQuery('#com_commentaires')
	.hide();
}

function deployerCriteres(){
	if (etatCriteres == 0){
		jQuery('#filtrage_criteres').show();
		jQuery('#zone_recherche').toggleClass('zone_recherche_deployee');
		etatCriteres = 1;
	}
	else{
		jQuery('#filtrage_criteres').hide();
		jQuery('#zone_recherche').toggleClass('zone_recherche_deployee');
		etatCriteres = 0;
	}
}

function zipzou(inId, inIdFleche){	
	jQuery(inId).toggle();
	if(jQuery(inId).css('display')=='none')
		jQuery(inIdFleche).html('&#x25BC;');
	else
		jQuery(inIdFleche).html('&#x25B2;');
}

function setOnglet(contenu){
	if ($('#musicplayer')) player_stop();

	if (contenu.length == 0 )
		monContenu = 'images';
	else
		monContenu = contenu;
	$('#monOnglet').attr('value', monContenu);
	$('#txtOngletGalerieImages').attr('className', 'OngletInactif');
	$('#txtOngletGalerieVideos').attr('className', 'OngletInactif');
	$('#txtOngletGalerieAudio').attr('className', 'OngletInactif');;
	$('#txtOngletGalerie'+monContenu).attr('className', 'OngletActif');
	getMedias();
}

function getMedias(){
	$('#pleaseWait').show();
	$('#thumbcointainer').html('');
	var maSaison;
	maSaison 	= $('#SaisonId').attr('value');
	var monKW;
	monKW		= $('#KwId').attr('value');
	var monContenu;
	monContenu 	= $('#monOnglet').attr('value');
	$('#thumbcointainer').load('/spip.php?rnd='+Math.random()+'&page=inc_recherche_galerie&monOnglet='+monContenu+'&KwId='+monKW+'&SaisonId='+maSaison);
}


function setKW(inID){
	$('#KwId').attr('value', inID);
	// échange de l'attribut value de tous les champs du formulaire
	$("#mediaRubrique [@name^='KWDom_']").each(function() {
		$("#mediaRubrique [@name='"+ this.name+"']").attr('className','KwUnChecked');
	});
	$('#KWDom_'+inID).attr('className','KwChecked');
	getMedias();
}
	
	
function setRubSaison(inID){
	$('#SaisonId').attr('value', inID);
	// échange de l'attribut value de tous les champs du formulaire
	$("#mediaSaison [@name^='RubSaison_']").each(function() {
		$("#mediaSaison [@name='"+ this.name+"']").attr('className','KwUnChecked');
	});
	
	$('#RubSaison_'+inID).attr('className','KwChecked');
	getMedias();
}
	
function rechercheSetPagination(inUrl){
	//$('#zone_affichage_resultats').html('');
	//$('#zone_infos_resultats').html('<img src="/IMG/gif/loadingAnimation.gif" style="margin-left:275px; margin-top:10px;"/>');
	//$('#zone_infos_resultats').show();
	$('#zone_affichage_resultats').load(inUrl);
	//$('#zone_infos_resultats').hide();
}	
	
function agendaNavTo(strListe, strDtDebut, strDtFin, strIndex){
	var targetUrl = "/spip.php?page=inc_recherche_agenda-n&resultsR="+strListe+"&date_debut="+strDtDebut+"&date_fin="+strDtFin+"&cIndex="+strIndex;
	//alert(targetUrl);
	$('#zone_affichage_resultats').load(targetUrl);
}
	
	
	