/**
 * @author Joignie Vincent
 */

 /**
  * Method de confiramtion de suppression
  * @param string complement
  * @return bool
  */
function confSuppr(complement, url)
{
	if(confirm("Etes-vous sûr de vouloir supprimer "+complement))
	{
		document.location.href = url;
		return true;
	}
	else
	{
		return false;
	}
}

/**
 * Method de qui change le texte et affiche ou cache les options avancées de recherche
 * @param string complement
 * @return bool
 */
function advancedSearch(idChk, idDiv)
{
	chk = document.getElementById(idChk);
	div = document.getElementById(idDiv);

	if(chk.checked == true)
	{
		div.style.display = "block";
		
		document.location = "#"+idChk;
	}
	else
	{
		div.style.display = "none";
	}
}

/**
 * Method de publication via Facebook
 */
function streamPublish(description, urlImg, url){
    FB.ui(
    {
      method: 'stream.publish',
	  message: 'J\'ai trouvé cette annonce sur Tresors.com !',
	  attachment: {
	    name: 'Annonce publiée sur Tresors.com',
	    caption: 'The Facebook Connect JavaScript SDK',
	    description: description,
	    href: url,
	    media: [
	      {
	        type: 'image',
	        href: url,
	        src: urlImg
	      }
	    ]
	  },
	  action_links: [
	    { text: 'Tresors.com', href: url }
	  ],
	  user_prompt_message: 'Share your thoughts about Tresors.com'
    },
    function(response) {

    });
}
