var pf;

//actions sur les boutons
//demande de devis
function affDivDemDevisSolo(id,togo)
{ 
	tb_show(document.getElementById("content").innerHTML, 'php/a_agence/formDemDevis.php?togo='+togo+'&check_me[]='+id+'&KeepThis=true&TB_iframe=true&height=400&width=415');
}

//ajoute à une liste
function affAddListeSolo(id,togo)
{ 
	tb_show(document.getElementById("content").innerHTML, 'php/a_agence/formAddListe.php?togo='+togo+'&check_me[]='+id+'&KeepThis=true&TB_iframe=true&height=400&width=415');
}

//ajoute à un annuaire
function affAddAnnuSolo(id,togo)
{ 
	tb_show(document.getElementById("content").innerHTML, 'php/a_agence/formAddAnnu.php?togo='+togo+'&check_me[]='+id+'&KeepThis=true&TB_iframe=true&height=400&width=415');
}

//envoie de demande de contact
function affContactSolo(id,togo)
{ 
	tb_show(document.getElementById("content").innerHTML, 'php/a_agence/formContact.php?togo='+togo+'&free=yes&check_me[]='+id+'&KeepThis=true&TB_iframe=true&height=440&width=415');
}
//soumettre un appel d'offre
function affAOSolo(id,togo)
{ 
	tb_show(document.getElementById("content").innerHTML, 'php/a_agence/formAO.php?togo='+togo+'&check_me[]='+id+'&KeepThis=true&TB_iframe=true&height=400&width=415');
}
//transfert à un ami
function affTrans(id,togo)
{ 
	tb_show(document.getElementById("content").innerHTML, 'php/a_agence/formTransfert.php?togo='+togo+'&id_cpt='+id+'&KeepThis=true&TB_iframe=true&height=400&width=510');
}

//signaler un abus
function affAbus(id,togo)
{ 
	tb_show(document.getElementById("content").innerHTML, 'php/a_agence/formAbus.php?togo='+togo+'&id_cpt='+id+'&KeepThis=true&TB_iframe=true&height=400&width=580');
}


function affNoAbo(togo,cat)
{ 
	tb_show(document.getElementById("content").innerHTML, 'php/projets-missions/form_pictos/no_abo.php?cat='+cat+'&togo='+togo+'&KeepThis=true&TB_iframe=true&height=400&width=600');
}

function affNoLog(togo)
{ 
	tb_show(document.getElementById("content").innerHTML, 'php/a_agence/formLog.php?togo='+togo+'&KeepThis=true&TB_iframe=true&height=400&width=600');
}
/////////////////////////

//Pour l'onglet notation prestataire
function depli_div(id)
{
	$('#offre_'+id).toggle();
	$('#offre_'+id+'_2').toggle();	
	var img=$('#cross_'+id).attr('src');
	if(img=='../../img/deco/noncross_000000_FFFFFF.png')
	{
		$('#cross_'+id).attr('src','../../img/deco/cross_000000_FFFFFF.png');
	}else{
		$('#cross_'+id).attr('src','../../img/deco/noncross_000000_FFFFFF.png');
	}
}

function openAll()
{
	var img=$('#cross_all').attr('src');
	if(img=='../../img/deco/noncross_000000_FFFFFF.png')
	{
		$('#cross_all').attr('src','../../img/deco/cross_000000_FFFFFF.png');
		for(i=0;i<51;i++)
		{
			$('#offre_'+i).hide();
			$('#offre_'+i+'_2').hide();			
			$('#cross_'+i).attr('src','../../img/deco/cross_000000_FFFFFF.png');
		}
	}else{
		$('#cross_all').attr('src','../../img/deco/noncross_000000_FFFFFF.png');
		for(i=0;i<51;i++)
		{
			$('#offre_'+i).show();
			$('#offre_'+i+'_2').show();			
			$('#cross_'+i).attr('src','../../img/deco/noncross_000000_FFFFFF.png');
		}		
	}
}
/////////////////////////

function viewMatos(id_inde)
{
	$.ajax({
	   type: "POST",
	   url: "../../ajax/indeMatos.php",
	   data: "action=viewfiche&id_inde="+id_inde,
	   success: function(retour){
		   		//alert(retour);
				$("#body_matos").html(retour);
		}
	 });
}

function viewConn(id_inde)
{
	$.ajax({
	   type: "POST",
	   url: "../../ajax/indeCon.php",
	   data: "action=viewfiche&id_inde="+id_inde,
	   success: function(retour){
		   		//alert(retour);
				$("#body_con").html(retour);
		}
	 });
}

function viewAccre(id_inde)
{
	$.ajax({
	   type: "POST",
	   url: "../../ajax/indeAccre.php",
	   data: "action=viewfiche&id_inde="+id_inde,
	   success: function(retour){
		   		//alert(retour);
				$("#body_accre").html(retour);
		}
	 });
}

function viewForma(id_inde)
{
	$.ajax({
	   type: "POST",
	   url: "../../ajax/indeForma.php",
	   data: "action=viewfiche&id_inde="+id_inde,
	   success: function(retour){
		   		//alert(retour);
				$("#body_forma").html(retour);
		}
	 });
}

function viewRef(id_agence)
{
	$.ajax({
	   type: "POST",
	   url: "../../ajax/agencesRef.php",
	   data: "action=viewfiche&id_agence="+id_agence,
	   success: function(retour){
		   		//alert(retour);
				$("#body_ref").html(retour);
		}
	 });
}

function viewRefInde(id_inde)
{
	$.ajax({
	   type: "POST",
	   url: "../../ajax/indeRef.php",
	   data: "action=viewfiche&id_inde="+id_inde,
	   success: function(retour){
		   		//alert(retour);
				$("#body_ref").html(retour);
		}
	 });
}

function viewXp(id_inde)
{
	$.ajax({
	   type: "POST",
	   url: "../../ajax/indeXp.php",
	   data: "action=viewfiche&id_inde="+id_inde,
	   success: function(retour){
		   		//alert(retour);
				$("#body_xp").html(retour);
		}
	 });
}

function viewLanga(id_inde)
{
	$.ajax({
	   type: "POST",
	   url: "../../ajax/indeLanga.php",
	   data: "action=viewfiche&id_inde="+id_inde,
	   success: function(retour){
		   		//alert(retour);
				$("#body_comp").prepend(retour);
		}
	 });
}

function viewLogi(id_inde)
{
	$.ajax({
	   type: "POST",
	   url: "../../ajax/indeLogi.php",
	   data: "action=viewfiche&id_inde="+id_inde,
	   success: function(retour){
		   		//alert(retour);
				$("#body_comp").prepend(retour);
		}
	 });
}

function viewComp(id_inde)
{
	$.ajax({
	   type: "POST",
	   url: "../../ajax/indeSpe.php",
	   data: "action=viewfiche&id_inde="+id_inde,
	   success: function(retour){
		   		//alert(retour);
				$("#body_comp").prepend(retour);
		}
	 });
}

function openItem(id,file,x,y)
{
	x+=200;
	y+=25;
	if(pf)
	{
		pf.close();
	}
	pf=window.open("../../portfolio/pf.php?id="+id+"&file="+file,"portfolio","width="+x+",height="+y+",resizable=yes,scrollbars=no,location=no,menubar=no,toolbar=no,status=no")
}

function getItems(id_inde,type)
{
	$("#div_loading").show();
	$("#div_pf").hide();
	$.ajax({
	   type: "POST",
	   url: "../../ajax/indePf.php",
	   data: "action=view&id_inde="+id_inde+"&type="+type,
	   success: function(retour){
		   		//alert(retour);
				$("#div_loading").hide();
				$("#div_pf").fadeIn("slow");
				$("#div_pf").html(retour);
		}
	 });
}

function viewLang(id)
{
	$.ajax({
	   type: "POST",
	   url: "../../ajax/lang.php",
	   data: "action=fiche&id="+id,
	   success: function(retour){
		   		//alert(retour);
				$("#body_combi3").html(retour);
		}
	 });
}

function viewLangTrad(id_agence)
{
	if(id_agence!=0)
	{
	$.ajax({
	   type: "POST",
	   url: "../../ajax/agencesLangTrad.php",
	   data: "action=viewfiche&id_agence="+id_agence,
	   success: function(retour){
		   		//alert(retour);
				$("#body_combi").html(retour);
		}
	 });
	}
}

function viewLangInte(id_agence)
{
	if(id_agence!=0)
	{
	$.ajax({
	   type: "POST",
	   url: "../../ajax/agencesLangInte.php",
	   data: "action=viewfiche&id_agence="+id_agence,
	   success: function(retour){
		   		//alert(retour);
				$("#body_combi2").html(retour);
		}
	 });
	}
}

