
function viewOnglet(contenu){
	
	if(contenu == "contenu1"){
		document.getElementById('lien1').className = "itemActive";
		document.getElementById('lien2').className = "itemLien"; 
		$("#contenu2").hide(1);
		$("#contenu1").show(1);
	}
	
	if(contenu == "contenu2"){
		document.getElementById('lien2').className = "itemActive";
		document.getElementById('lien1').className = "itemLien"; 
		$("#contenu1").hide(1);
		$("#contenu2").show(1);
	}
}

function ajx(file, objectId, postVar,loader){
	if (loader!='1')
		$("#"+objectId).html('<div align="center"><img src="images/loading2.gif" /></div>');
		$.ajax({
			type: "POST",
			url: "php/"+file,
			data: postVar,
			success: function(html){
				$("#"+objectId).html(html);
				ajxcharge='ok';
			}
		});
}

function fenetreCent(url,nom,largeur,hauteur,options) {
	
	var haut=(screen.height-hauteur)/2;
	var Gauche=(screen.width-largeur)/2;
	window.open(url,nom,"top="+haut+",left="+Gauche+",width="+largeur+",height="+hauteur+","+options);
}

/*
function message_commercant(id_com){
		
	
	var nom = document.getElementById('nom').value;
	var email = document.getElementById('email').value;
	var tel = document.getElementById('tel').value;
	var corps = document.getElementById('corps').value;	

 
    if ($('requestMultiplier')) {
        // Suppression de la balise si elle existait déjà
        // (pour faire un brin de ménage dans le DOM)
        $('requestMultiplier').remove();
    }
 
    // Création de la nouvelle balise :
    var script = document.createElement('script');
    script.src = 'http://v2.voisineo-pro.com/message.php?id='+id_com+'&from=1';
    script.src += 'func=resultFunction';
    script.src += '&nom=' + nom;
    script.src += '&email=' + email;
	script.src += '&tel=' + tel;
	script.src += '&corps=' + corps;
 
    script.id = 'requestMultiplier';
    script.type = 'text/javascript';
 
    // Et injection dans le DOM :
    document.body.appendChild(script);
}
*/

// Online
function ajxOnline(file, objectId){
	$("#"+objectId).load(file);
}

function ajx2(file, postVar, id){
	
	$.ajax(
	{
		type: "GET",
		url: "php/"+file,
		data: postVar,
		success: function(){
		  $("#message"+id).fadeOut(900);

		}
	}
	);
}


function openm(quoi,nbrmess, id) {
	
		for(var i=1;i<=nbrmess;i++){
			
			if(document.getElementById('messageText'+i)){
				if(document.getElementById('messageText'+i).style.display = 'block') {
					document.getElementById('messageText'+i).style.display = 'none';
				}
			}
		}
	
		document.getElementById('messageText'+quoi).style.display = 'block';
		document.getElementById('message'+id).style.backgroundImage = '';
		document.getElementById('message'+id).style.background = "url('../images/compte/bg2.gif')";

}

//permet de lancer la thickbox via un onclick
function dotb(title, url)
{
	mOut();
	if (title=="") title="<b>Voisineo</b>";
$(document).ready(function(){ tb_show(title, url, null); });
}

//raccourci pour les liens en non logués qui ouvrent une tickbox
function nolog() {
	dotb('<b>D&eacute;couvrez Voisineo</b>', 'php/page_inscription.php?TB_iframe=true&width=700&height=300');return false;
}

function nolog2(lien){

	var strChUserAgent = navigator.userAgent;
    var intSplitStart = strChUserAgent.indexOf("(",0);
    var intSplitEnd = strChUserAgent.indexOf(")",0);
    var strChStart = strChUserAgent.substring(0,intSplitStart);
    var strChMid = strChUserAgent.substring(intSplitStart, intSplitEnd);

    if(strChMid.indexOf("MSIE 6") != -1)
    alert('Pour accèder à cette rubrique, merci de vous inscrire.');
	
	else
	dotb('<b>D&eacute;couvrez Voisineo</b>', 'php/page_inscription.php?affi_type=localiser&lien='+lien+'&TB_iframe=true&width=700&height=300');return false;
}

function nolog3(lien, lien2){
	dotb('<b>D&eacute;couvrez Voisineo</b>', 'php/page_inscription.php?affi_type=localiser&lien3='+lien+'&lien2='+lien2+'&TB_iframe=true&width=700&height=300');return false;
}


//detection de IE
function isIE() { return /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent);  }

// Overlays Message
function mess(id, sdom, logue, nom, objet, de) { 
	if (logue=='1')
		dotb('<span style="font-size:13px;"><b>Envoyer un message</b></span>', 'http://'+sdom+'/php/overlays/page_envoi_message.php?sdom='+sdom+'&id='+id+'&objet='+objet+'&de='+de+'&TB_iframe=true&width=470&height=320'); 
	else
		dotb('<b>D&eacute;couvrez Voisineo</b>', 'php/page_inscription.php?affi_type=message&nom='+nom+'&lien3=http://'+sdom+'/membre/'+nom+'&TB_iframe=true&width=700&height=300');return false;
}

// Overlays amis
function ami(id,sdom, sdom2, logue,nom) { 
	if (logue=='1')
		dotb('<span style="font-size:13px;"><b>Mes amis Voisineo</b></span>', 'http://'+sdom+'/php/overlays/page_demande_ami.php?sdom='+sdom+'&sdom2='+sdom2+'&id='+id+'&nom='+nom+'&TB_iframe=true&width=340&height=160&amp;modal=true');
	else
		dotb('<b>D&eacute;couvrez Voisineo</b>', 'php/page_inscription.php?affi_type=ami&nom='+nom+'&lien3='+sdom2+'&TB_iframe=true&width=700&height=300');return false;
}

// Overlays toquer
function toquer(id,sdom, sdom2, logue,nom, id_toque) { 
	if (logue=='1')
		dotb('<span style="font-size:13px;"><b>Toquer &agrave; la porte de '+nom+'</b></span>', 'http://'+sdom+'/php/overlays/page_toquer_ami.php?sdom='+sdom+'&sdom2='+sdom2+'&id='+id+'&nom='+nom+'&id_toque='+id_toque+'&TB_iframe=true&width=340&height=110');
	else
		dotb('<b>D&eacute;couvrez Voisineo</b>', 'php/page_inscription.php?affi_type=toquer&nom='+nom+'&lien3='+sdom2+'&TB_iframe=true&width=700&height=300');return false;
}


// Overlays coup de coeur
function coeur(id,sdom, sdom2, logue,nom, ft) { 
	if (logue=='1')
		dotb('<span style="font-size:13px;"><b>Ajouter comme favoris</b></span>', 'http://'+sdom+'/php/overlays/page_coup_coeur.php?ft='+ft+'&sdom='+sdom+'&sdom2='+sdom2+'&id='+id+'&nom='+nom+'&TB_iframe=true&width=340&height=100');
	else
		dotb('<b>D&eacute;couvrez Voisineo</b>', 'php/page_inscription.php?affi_type=ami&nom='+nom+'&lien3='+sdom2+'&TB_iframe=true&width=700&height=300');return false;
}

// Overlays favoris
function favoris(id,sdom, sdom2, logue,nom, ft) { 
	if (logue=='1')
		dotb('<span style="font-size:13px;"><b>'+nom+'</b></span>', 'http://'+sdom+'/php/overlays/page_ajouter_favoris.php?ft='+ft+'&sdom='+sdom+'&sdom2='+sdom2+'&id='+id+'&nom='+nom+'&TB_iframe=true&width=340&height=100');
	else
		dotb('<b>D&eacute;couvrez Voisineo</b>', 'php/page_inscription.php?affi_type=ami&nom='+nom+'&TB_iframe=true&width=700&height=300');return false;
}

// Overlays recommander
function recommander(id,sdom, sdom2, logue,nom) { 
	if (logue=='1')
		dotb('<span style="font-size:13px;"><b>Recommander '+nom+'</b></span>', 'http://'+sdom+'/php/overlays/page_recommander.php?sdom='+sdom+'&sdom2='+sdom2+'&id='+id+'&nom='+nom+'&TB_iframe=true&width=340&height=440&modal=true');
	else
		dotb('<b>D&eacute;couvrez Voisineo</b>', 'php/page_inscription.php?affi_type=ami&nom='+nom+'&lien3='+sdom2+'&TB_iframe=true&width=700&height=300');return false;
}

// Overlays recommander annonce
function recommander_annonce(id,sdom, sdom2, logue,nom) { 
	if (logue=='1')
		dotb('<span style="font-size:13px;"><b>Recommander</b></span>', 'http://'+sdom+'/php/overlays/page_recommander2.php?sdom='+sdom+'&sdom2='+sdom2+'&id='+id+'&nom='+nom+'&TB_iframe=true&width=340&height=420&modal=true');
	else
		dotb('<b>D&eacute;couvrez Voisineo</b>', 'php/page_inscription.php?affi_type=ami&nom='+nom+'&TB_iframe=true&width=700&height=300');return false;
}

// Overlays avis
function avis(id,sdom, sdom2, logue,nom) { 
	if (logue=='1')
		dotb('<span style="font-size:13px;"><b>Ajouter un avis</b></span>', 'http://'+sdom+'/php/overlays/page_avis.php?sdom='+sdom+'&sdom2='+sdom2+'&id='+id+'&nom='+nom+'&TB_iframe=true&width=340&height=270');
	else
		dotb('<b>D&eacute;couvrez Voisineo</b>', 'php/page_inscription.php?affi_type=ami&nom='+nom+'&lien3='+sdom2+'&TB_iframe=true&width=700&height=300');return false;
}

// Forum
function forum(id, type, sdom, sdom2, logue, nom) { 
	if (logue=='1')
		dotb('<span style="font-size:13px;"><b>Ajouter une discussion</b></span>', 'http://'+sdom+'/php/overlays/page_discussion.php?sdom='+sdom+'&sdom2='+sdom2+'&id='+id+'&type='+type+'&TB_iframe=true&width=340&height=270');
	else
		dotb('<b>D&eacute;couvrez Voisineo</b>', 'php/page_inscription.php?affi_type=ami&nom='+nom+'&TB_iframe=true&width=700&height=300');return false;
}


// Popup
function ouvrir(l,h,url) {
hauteur=Math.round((screen.availHeight-h)/2);
largeur=Math.round((screen.availWidth-l)/2);
window.open(url, "site", "toolbar=0,location=0,directories=0,status=0, scrollbars=yes,resizable=0,menubar=0,top="+hauteur+",left="+largeur+",width="+l+",height="+h);
}


// Ouverture auto des liens http:// dans une nouvelle fenêtre
//$(document).ready(function(){$('a[href^="http://"]').attr("target", "_blank");});

// Photos fiche membre
$(document).ready(function(){

	$(".bouton-slide").click(function(){
		$("#album2").slideToggle("slow");
		$(this).toggleClass("active"); return false;
	});
	
});

// Groupes fiche membre
$(document).ready(function(){

	$(".group").click(function(){
		$("#group2").slideToggle("slow");
		$(this).toggleClass("active"); return false;
	});
	
});

// RDV fiche membre
$(document).ready(function(){

	$(".rdv").click(function(){
		$("#rdv2").slideToggle("slow");
		$(this).toggleClass("active"); return false;
	});
	
});

// Annonces fiche membre
$(document).ready(function(){

	$(".annonce").click(function(){
		$("#annonce2").slideToggle("slow");
		$(this).toggleClass("active"); return false;
	});
	
});

// Commerçant fiche membre
$(document).ready(function(){

	$(".com").click(function(){
		$("#com2").slideToggle("slow");
		$(this).toggleClass("active"); return false;
	});
	
});

// Avis commerçants
$(document).ready(function(){

	$(".avis").click(function(){
		$("#mur2").slideToggle("slow");
		$(this).toggleClass("active"); return false;
	});
	
});

// Flux
$(document).ready(function(){

	$(".listeFluxAll1").click(function(){
		$("#listeFlux1").slideToggle("slow");
		$(this).toggleClass("active"); return false;
	});
	
});

$(document).ready(function(){

	$(".listeFluxAll2").click(function(){
		$("#listeFlux2").slideToggle("slow");
		$(this).toggleClass("active"); return false;
	});
	
});

// Membre flux
$(document).ready(function(){

	$(".membreFlux").click(function(){
		$("#listeFlux0").slideToggle("slow");
		$(this).toggleClass("active"); return false;
	});
	
});

// Participant échanges
$(document).ready(function(){

	$(".echange").click(function(){
		$("#list2").slideToggle("slow");
		$(this).toggleClass("active"); return false;
	});
	
});


// Promotion comerçant
$(document).ready(function(){

	$(".promo").click(function(){
		$("#list2").slideToggle("slow");
		$(this).toggleClass("active"); return false;
	});
	
});

// Module com
function moduleCom(id){

	var avis = document.getElementById('avis').value;
	var note = document.getElementByName('rating').value;
	
	if(avis != '' && note != ''){
		ajx("ajax/module-commercants.php", "id", "id="+id+"&avis="+avis+"&note="+note+"");
		document.getElementById('blocom').innerHTML = '<p style="color: #0064C1; font-weight: bold; margin-bottom: 2px;">Votre avis a bien été enregistré !</p>';
	}
	else
		document.getElementById('result').innerHTML = '<p style="color: #E76656; font-weight: bold; margin-bottom: 2px;">Merci d\'écrire un avis et de donner une note.</p>';
}

// Liste invitation membre
function toggleAll(cb) {
    var val = cb.checked;
	var frm = document.f1;
	var len = frm.elements.length;
	var i=0;
	for( i=0 ; i<len ; i++) {
		if (frm.elements[i].name=='emails[]') {
			frm.elements[i].checked=val;
		}
	}
}

//moteur recherche
function rechi() {
	//on envoi la recherche
	 document.rech.submit();
}

// Loading
function loading(id, button){
		document.getElementById(id).style.display = 'block';
		
		if(button != '')
		document.getElementById(button).style.display = 'none';
}