// JavaScript Document
function session() {
	obj = new Image();
	obj.src = 'session.php?open=1'; 
}

function Popup(page,nom,option) {
       window.open(page,nom,option);
}

function lookup(inputString) {
    if(inputString.length == 0) {
        // Hide the suggestion box.
        $('#suggestions').hide();
    } else {
        $.post("/include/ajax/rpc.php", {queryString: ""+inputString+""}, function(data){
            if(data.length >0) {
                $('#suggestions').show();
                $('#autoSuggestionsList').html(data);
            }
        });
    }
} // lookup


$(function() {
$(".delete").click(function() {
var commentContainer = $(this).parent();
var id = $(this).attr("id");
var string = 'id='+ id ;
	
$.ajax({
   type: "POST",
   url: "include/jquery-delete/delete.php",
   data: string,
   cache: false,
   success: function(){
	commentContainer.slideUp('slow', function() {$(this).remove();});
  }
   
 });

return false;
	});
});



$(document).ready(function() {
	
	//toggle the componenet with class msg_body
	$(".expandable").click(function()
	{
		$(this).next("div").slideToggle(500);
		$(this).toggleClass("enroule"); return true;
	});
	
	$(".collapse").click(function()
	{
		$(".expandable").next("div").slideToggle(500).toggleClass("enroule");
		return false;
	});
	
	$(".moviesearch input").click(function()
	{
		if ($(this).attr('value')=='Code postal')
			$(this).attr("value","");
	});
	
	$("a.anchorLink").anchorAnimate();
	
	$('a[rel*=facebox]').facebox();

	
	$('a[rel="radio_"]').click( function() {
        window.open( '/player',"player","menubar=0,resizable=0,width=750,scrollbars=0,height=280");
        return false;
    });
});

jQuery.fn.anchorAnimate = function(settings) {

 	settings = jQuery.extend({
		speed : 1100
	}, settings);	
	
	return this.each(function(){
		var caller = this
		$(caller).click(function (event) {	
			event.preventDefault()
			var locationHref = window.location.href
			var elementClick = $(caller).attr("href")
			
			var destination = $(elementClick).offset().top;
			$("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, settings.speed, function() {
				window.location.hash = elementClick
			});
		  	return false;
		})
	})
}