// ######################
// QUELQUES VAR
// ######################
var soonall="Ce module sera mis en place prochainement.<br/>Il permettra de partager des avis sur des produits.";
var soonevent="Ce module sera mis en place prochainement.<br/>Il permettra de partager des &eacute;v&eacute;nements.";
var soonprod="Ce module sera mis en place prochainement.<br/>Il permettra de partager des avis sur des produits.";


//alert( $(window).width());

// function doSomething() {
	// if ($(window).width() > 1200) $("#social_ids").css({position : "fixed", right : "10px", bottom : "0px" , padding : "10px" });
//};
//var resizeTimer = null;
//$(window).bind('resize', function() {
//    if (resizeTimer) clearTimeout(resizeTimer);
//    resizeTimer = setTimeout(doSomething, 100);
//}); 



// ######################
// EFFET ANCRES
// ######################
$(document).ready(function() {
//$('.inner_container').roundCorners(4);
/* $(".idc-footer").hide(); */
// if ($(window).width() > 1200) $("#social_ids").css({position : "fixed", right : "10px", bottom : "0px" , padding : "10px" });

// comment='<input name="comment" type="text" /> <a href="javascript:;" onclick="Comment(id)">comment</a>';).attr("id")+'
//$(".item").find(".quepasa_item").append('<input name="postcomment" type="text" class="comment" /> <a href="javascript:;" onclick="Comment()"><br/>poster ce commentaire</a>');

 $(".sm").find(".co").append(' <textarea name="postcomment" id="postcomment" class="textareaCo" cols="45" rows="5"></textarea> <a href="javascript:;" onclick="Comment()"><br/>poster ce commentaire</a>');
 

  if ($('a[href*=#]').length) {	
    $('a[href*=#]').click(function() {
      var $target = $(this.hash);
      $target = $target.length && $target || $('[name=' + this.hash.slice(1) +']');
      $('html,body').animate({ scrollTop: $target.offset().top },1000);
      return false;
    })
  }
});


// ######################
// MENU
// ######################
// active lets us keep track of which <strong class="highlight">menu</strong> if any is currently being displayed
var active;

// toggles a dropdown between being visible / invisible
function toggle(t)
{
	// if there's an active drop down we hide itcingu
	if(active != null)
	{
		for(var i=0; i<active.childNodes.length; i++)
			if(active.childNodes[i].nodeName == "UL")
				active.childNodes[i].style.display = "none";
	}

	// if the user didn't just click the active one (hiding it)
	if(active != t)
	{
		// set the active dropdown
		active = t;

		// set each UL in the dropdown to be "block"
		for(var i=0; i<active.childNodes.length; i++)
			if(active.childNodes[i].nodeName == "UL")
				active.childNodes[i].style.display = "block";

		// bring it to the top
		active.style.zIndex = "999";
	}
	else
		active = null;
}

// used to untoggle when a dropdown link is clicked
function untogglefromlink(t)
{
	// when a link is clicked in the drop down you can call this function to hide it, eg:
	// <a href="page.html" onclick="untogglefromlink(this);">whatever</a>.
	toggle(t.parentNode.parentNode.parentNode);
}

// ######################
// CO DELETE
// ######################
function AjaxCo_del(id) {
$('#saving').show();
window.setTimeout("coDEL("+id+")", 1000) ; 
}
function coDEL(id) {
 $.ajax({
   type: "GET",
   url: "/app/ajax/codel.php",
   data: "id="+id,
   success: function(msg){
	$('#co'+id).hide('slow');
	$('#saving').hide()
	//alert(msg)
   }
 });
}


// ######################
// POST DELETE
// ######################
function confirmDelete() {
    return confirm("Are you sure you want to delete this permanently?"); 
}

function AjaxPost_del(id) {
if (confirmDelete()) {
$('#saving').show();
window.setTimeout("postDEL("+id+")", 1000) ; 
}
 }
function postDEL(id) {
 $.ajax({
   type: "GET",
   url: "/app/ajax/postdel.php",
   data: "id="+id,
   success: function(msg){
	$('#li'+id).hide('slow');
	$('#saving').hide()
	//alert(msg)
   }
 });
}


// ######################
// HOME quepasa.fr ADD or DEL
// ######################
function editoHome(id) {
$('#saving').show();
 $.ajax({
   type: "GET",
   url: "/app/ajax/editoHome.php",
   data: "id="+id,
   success: function(msg){
   // $(this).replaceWith( $(this).html() );
   if ( msg = "1" ){
	$("#img"+id).attr({ src: "/my/ico/rate/starrouge.gif"});
		alert('home');
	} else {
	$("#img"+id).attr({ src: "/my/ico/rate/starnoir.gif"});
		alert('no home');
	}
//	$('#sum'+id).html(msg);
	$('#saving').hide();
   }
 });
}




// ######################
// GENERALE TIMELINE
// ######################
	function timeline(nav){
	offset=offset+nav;
	if(offset==1) $('#timeline-navup').html('<img src="/my/ico/up-disabled.gif" />');
	if(offset>=11) $('#timeline-navup').html('<a href="javascript:;" onclick="timeline(-10);"><img src="/my/ico/up.gif" /></a>');
	if((offsetTotal/offset)<=1.1) $('#timeline-navdown').html('<img src="/my/ico/down-disabled.gif" />');
	if((offsetTotal/offset)>1.1) $('#timeline-navdown').html('<a href="javascript:;" onclick="timeline(10);"><img src="/my/ico/down.gif" /></a>');
	$.ajax({
			 type: "GET",
			 url: "/app/ajax/timeline.php",
			 data: "offset="+offset,
			 success: function(msg){
				$('#timeline_show').html(msg);
				$('#timeline_show').show();
			 }
		});
	}
	

