var sl_idArr = new Array();
function bskClr() {
	var url = window.location.pathname;
	if (((url.indexOf('index.php') != -1) || (url == '/')) && $(':checkbox').length > 0)
	{
		$(':checkbox').each (function () {
			$(this).parent('dd').removeClass().addClass('m_chk');
		});
	}
	$.ajax({type:'post', url:'/recipe.php', data:'c=x', success:function (t) {bskUpdCb(t);}});
}

function bskTog(id, add, l) {
	var serves = 0;

	if (add) {
		if ($('#serves').length)
			serves = $('#serves').val();
		else
			serves = $('#servings').val();		
	}
	
	p = "c=b&id=" + id + "&add=" + add + "&s=" + serves + "&l=" + encodeURIComponent(l);
	$.ajax({type:'post', url:'/recipe.php', data:p, success:function (t) {bskUpdCb(t);}});
}

function bskUpd(t) {
	if (t != '')
		$('#basketContents').html(t);
}

function bskUpdSrv(path, l, id) {
	var serves = $('#'+path).get(0).options[$('#'+path).get(0).selectedIndex].value;
	p = "c=s&l=" + encodeURIComponent(l) + "&id=" + id + "&s=" + serves; 
	$.ajax({type:'post', url:'/recipe.php', data:p, success:function (t) {bskUpdCb(t);}});
}

function bskRem(id, lb) {
	bskTog(id, 0, lb);
	if ($("#recipe_" + id).length > 0) 
		$("#recipe_" + id).parent('dd').removeClass('m_chkd').addClass('m_chk').children(':checkbox').removeAttr('checked');
}

function chg_tab(nm, on) {
	if (on == 1) {
		$('#'+nm+'_off').hide();
		$('#'+nm+'_on').show();
		$('.basket').hide();
		$('#'+nm).show();
		$('#NP').removeClass().addClass('NP cright');
	} else {
		$('#'+nm+'_on').hide();
		$('#'+nm+'_off').show();
		$('.basket').show();
		$('#'+nm).hide();
		$('#NP').removeClass().addClass('NP NP_back cright');
	}
}