
/**
 * @author BE Strategy
 * @copyright www.bestrategy.com 2010
**/

loader = '<div class="loader"></div>';

$(document).ready(function()
{
	zebra();

//	$("#idsearch").quicksearch(".zebra tbody tr", {
//		noResults: '#noresults',
//		stripeRows: ['odd', 'even'],
//		loader: '#rechercheloader'
//	});
});

$(document).ready(function()
{
	$(".titlecnt").live("click",function()
	{
		id = this.id.substr(3);
		$("#ct_"+id).slideUp("slow");
		$("#ct_"+id).removeAttr("class");
		$("#ct_"+id).addClass("conttitle_");
		$("#"+this.id).removeAttr("class");
		$("#"+this.id).addClass("titlecnt_");
	});
	
	$(".titlecnt_").live("click",function()
	{
		id = this.id.substr(3);
		$("#ct_"+id).slideDown("slow");
		$("#"+this.id).removeAttr("class");
		$("#"+this.id).addClass("titlecnt");
		$(".titlecnt").not("#"+this.id).each(function()
		{
			$("#"+this.id).removeAttr("class");
			$("#"+this.id).addClass("titlecnt_");
		});
		$(".conttitle").not("#ct_"+id).each(function()
		{
			$("#"+this.id).slideUp("slow");
		});
		$(".conttitle_").not("#ct_"+id).each(function()
		{
			$("#"+this.id).slideUp("slow");
		});
	});
	$("#backtoliste").live("click",function()
	{
		$("#backgroundPopup").fadeOut("slow");
		$("#popup").fadeOut("slow");
	});

	
	$(".zebra td").live("click",function()
	{
		if($("#lsoption1").css("display")!="none")
		{
			id = this.id.substr(5);
			if($("#sl_"+id).attr("checked")==true)
			{
				$("#sl_"+id).removeAttr("checked","checked");
			}
			else
			{
				$("#sl_"+id).attr("checked","checked");
			}
			
			var lscheckbox = 0;
			$(".cnt_data input[type='checkbox']").each(function()
			{
				if($("#"+this.id).attr("checked")==true)
				{
					lscheckbox++;
				}
			});
			if(lscheckbox > 0)
			{
				$("#pourlaselection").fadeIn("slow");
			}
			else
			{
				$("#pourlaselection").fadeOut("fast");
			}
		}
	});
	
	$(".cnt_data input[type='checkbox']").live("click",function()
	{
		var lscheckbox = 0;
		$("#.cnt_data input[type='checkbox']").each(function()
		{
			if($("#"+this.id).attr("checked")==true)
			{
				lscheckbox++;
			}
		});
		if(lscheckbox > 0)
		{
			$("#pourlaselection").fadeIn("slow");
		}
		else
		{
			$("#pourlaselection").fadeOut("fast");
		}
	});
});

function zebra()
{
	$(".zebra tr").live("mouseover", function()
	{
		$(this).addClass("over");
	})
	.live("mouseout", function()
	{
		$(this).removeClass("over");
	});
	$(".zebra tr:even").addClass("alt");
}


