/**
 * Update WishList Cart by adding, deleting, updating objects
 *
 * @return void
 */
function WishlistCartpro(id, action, id_product, id_product_attribute, quantity, token, blockwishlist_name)
{
$.ajax({
		type: 'GET',
		url:	baseDir + 'modules/' + blockwishlist_name + '/cart.php',
		async: true,
		cache: false,
		data: 'action=' + action + '&id_product=' + id_product + '&quantity=' + quantity + '&token=' + static_token + '&id_product_attribute=' + id_product_attribute,
		success: function(data)
		{
			if($('#' + id).length != 0)
			{
				$('#' + id).slideUp('normal');
				document.getElementById(id).innerHTML = data;
				$('#' + id).slideDown('normal');
			}
		}
	});	
}

/**
 * Change customer default wishlist
 *
 * @return void
 */
function WishlistChangeDefaultpro(id, id_wishlist, blockwishlist_name)
{
	$.ajax({
		type: 'GET',
		url:	baseDir + 'modules/' + blockwishlist_name + '/cart.php',
		async: true,
		data: 'id_wishlist=' + id_wishlist + '&token=' + static_token,
		cache: false,
		success: function(data)
		{
			$('#' + id).slideUp('normal');
			document.getElementById(id).innerHTML = data;
			$('#' + id).slideDown('normal');
		}
	});
}

/**
 * Buy Product
 *
 * @return void
 */
function WishlistBuyProductpro(token, id_product, id_product_attribute, id_quantity, button, ajax, offer_qty)
{
var offer_qty = Number(offer_qty);
	if(ajax)
		ajaxCart.add(id_product, id_product_attribute, false, button, offer_qty, [token, offer_qty]); //the last offer_qty is useful. keep the first one because of ajaxCart parameters
//		ajaxCart.add(id_product, id_product_attribute, false, button, 1, [token, id_quantity]);
	else
	{
		WishlistAddProductCart(token, id_product, id_product_attribute, offer_qty)
//		WishlistAddProductCart(token, id_product, id_product_attribute, id_quantity, offer_qty)
		document.forms['addtocart' + '_' + id_product  + '_' + id_product_attribute].method='POST';
		document.forms['addtocart' + '_' + id_product  + '_' + id_product_attribute].action=baseDir + 'cart.php';
		document.forms['addtocart' + '_' + id_product  + '_' + id_product_attribute].elements['token'].value = static_token;
		document.forms['addtocart' + '_' + id_product  + '_' + id_product_attribute].submit();
	}
// reactive the button when adding has finished / new since PS 1.4.2.5
$('#' + 'a_' + id_product+'_'+id_product_attribute).removeAttr('disabled').addClass('exclusive').removeClass('exclusive_disabled');

	return (true);
}

function WishlistAddProductCart(token, id_product, id_product_attribute, id_quantity)
{
//alert("ajaw-wishlistpro, WishlistAddProductCart, id_quantity="+id_quantity);	
/*dd*/		if ($('#' + id_quantity).val() < 0) /*if <= then limit wpc.quantity to max wanted quantity -dd*/
		return (false);
	$.ajax({
		type: 'GET',
		url: baseDir + 'modules/blockwishlistpro/buywishlistproduct.php',
		data: 'token=' + token + '&static_token=' + static_token + '&id_product=' + id_product  + '&id_product_attribute=' + id_product_attribute + '&quantity=' + id_quantity,
		async: true,
		cache: false, 
		success: function(data)
		{
			if (data)
				alert(data);
			else
			{	/*dd new test*/
//alert("on retire les qtés mises en panier : id_quantity=" + Number(id_quantity) + "|"+$('#' + 'enter_'+ id_product+'_'+id_product_attribute).val());

				if ( $('#' + 'nnn_' + id_product+'_'+id_product_attribute).val() - $('#' + 'enter_'+ id_product+'_'+id_product_attribute).val()<= 0) {$('#' + 'nnn_' + id_product+'_'+id_product_attribute).val(0);}
//				if ($('#' + id_quantity).val() <= 0) {$('#' + id_quantity).val($('#' + id_quantity).val());}
				else {$('#' + 'nnn_' + id_product+'_'+id_product_attribute).val($('#' + 'nnn_' + id_product+'_'+id_product_attribute).val() - $('#' + 'enter_'+ id_product+'_'+id_product_attribute).val());} 
//				else {$('#' + id_quantity).val($('#' + id_quantity).val() - $('#' + 'enter_'+ id_product+'_'+id_product_attribute).val());} 
																		//withdraw qty to quantity displayed on view.php = wp.quantity
			}
		}
	});
	return (true);
}

/**
 * Show wishlist managment page
 *
 * @return void
 */
function WishlistManagePro(id, id_wishlist)
{
  
$("body").css("cursor", "progress");
	$.ajax({
		type: 'GET',
		async: true,
		url: baseDir + 'modules/blockwishlistpro/managewishlist.php',
		data: 'id_wishlist=' + id_wishlist + '&refresh=' + false,
		cache: false,
		success: function(data)
		{
$("body").css("cursor", "auto");
			$('#' + id).hide();
			document.getElementById(id).innerHTML = data;
			$('#' + id).fadeIn('slow');
		}
	});
}

/**DD
 * Edit PDF - wishlist management page
 *
 * @return 
 */
/*dd */
function WishlistManagePDF(id, id_wishlist)
{
alert(id_wishlist);	
	$.ajax({
		type: 'GET',
		async: true,
		url: baseDir + 'modules/blockwishlistpro/summary_table_post_creator.php',
		data: 'id_wishlist=' + id_wishlist + '&refresh=' + false,
		cache: false,
		success: function(data)
		{
alert("success ajax");	
			$('#' + id).hide();
//			document.getElementById(id).innerHTML = data;
			$('#' + id).fadeOut('slow');
			$('#' + id).fadeIn('slow');
		}
	});
}

/**
 * Show wishlist product managment page
 *
 * @return void
 */
/*dd new parameter : quantity_left */
function WishlistProductManage(id, action, id_wishlist, id_product, id_product_attribute, quantity, zone_qty_left, zone_qty, priority, alert_wanted_qty, removing_impossible)
{
$("body").css("cursor", "progress");
$.ajax({
		type: 'GET',
		async: true,
		url: baseDir + 'modules/blockwishlistpro/managewishlist.php',
		data: 'action=' + action + '&id_wishlist=' + id_wishlist + '&id_product=' + id_product + '&id_product_attribute=' + id_product_attribute + '&quantity=' + quantity + '&priority=' + priority + '&refresh=' + true,
		cache: false,
		success: function(data)
		{
$("body").css("cursor", "auto");
			if (action == 'delete' && data == "successful removing") {
				$('#wlp_' + id_product + '_' + id_product_attribute).fadeOut('fast');
			}
			else if (action == 'delete' && data != "impossible") {
				alert(removing_impossible);
			}
			else if (action == 'update')
			{
				$('#wlp_' + id_product + '_' + id_product_attribute).fadeOut('fast');
				$('#wlp_' + id_product + '_' + id_product_attribute).fadeIn('fast');
//alert(data);
				//dd if data contains 'alert|' then alert : wanted qty can not be inferior to bought qty
/*				if (data.indexOf('|',5) != -1) {
						alert("La quantite souhaitee ne peut pas etre inferieure a la quantite achetee !\n-------------\n Please note that wanted quantity should not be inferior to bought quantity !");*/
				if (data.indexOf('|',5) != -1) {
						alert(alert_wanted_qty);
				/*dd*/	var $tab=new Array();
				/*dd*/	$tab=data.split("|");
				/*dd*/	document.getElementById(zone_qty).value = $tab[1];
				/*dd*/	document.getElementById(zone_qty_left).value = $tab[2];
				
				}
				else {
					$trt=Number(data);
					/*dd*/	document.getElementById(zone_qty_left).value = $trt;
				}

			}
		}
	});
}

/**
 * Delete wishlist
 *
 * @return boolean succeed
 */
function WishlistDelete(id, id_wishlist, msg)
{
	var res = confirm(msg);
	if (res == false)
		return (false);
$("body").css("cursor", "progress");
	$.ajax({
		type: 'GET',
		async: true,
		url: baseDir + 'modules/blockwishlistpro/mywishlist.php',
		cache: false,
		data: 'deleted&id_wishlist=' + id_wishlist,
		success: function(data)
		{
			$('#' + id).fadeOut('slow');
			$("body").css("cursor", "auto");

		}
	});
}

/**
 * Create new wishlist
 *
 * @return boolean succeed
 */

function WishlistNew(name_list, msg_empty, msg_success, moduledir, blockwishlist_name, msg_exists) 
{
	if (name_list == '') { 	var res = alert(msg_empty); 			
							document.getElementById("name").style.cssText="background-color:#d9ddf4;";
							document.getElementById("name").focus();
							return ;
						};
	$("body").css("cursor", "progress");
	// desactive the button when saving new list
	$('input#submitWishlist').hide();

$.post(moduledir + '/' + blockwishlist_name +'/newlist.php',
	{ 	token: static_token,
		name: name_list
	  },
	function(data) 
	{
		if (data=="name_exists") 
		{	alert(msg_exists);
			document.getElementById("name").style.cssText="background-color:#d9ddf4;";
			document.getElementById("name").focus();
			document.getElementById("name").select();
			// reactive the button when adding has finished / new since PS 1.4.2.5
			$('input#submitWishlist').fadeIn('fast');
			return;}
		else
		{	//alert(msg_success);
		$("body").css("cursor", "auto");
			/*fix bug ie9 force no-cache with new url : ActiveXObject*/
			/* instead of  : location.assign(location.href); , code below ...*/
			 if(window.XMLHttpRequest) {
				try {
				  req = new XMLHttpRequest();
				} catch(e) {
				  req = false;
				}
			  } else if(window.ActiveXObject) {
				try {
				  req = new ActiveXObject("Msxml2.XMLHTTP");
				} catch(e) {
				  try {
					req = new ActiveXObject("Microsoft.XMLHTTP");
				  } catch(e) {
					req = false;
				  }
				}
			  }
			req.open('GET', moduledir + '/' + blockwishlist_name +'/mywishlist.php');
			req.setRequestHeader('Expires', '-1');//req.setRequestHeader('Cache-Control','no-store, no-cache, must-revalidate'); //HTTP 1.1
			req.setRequestHeader("Cache-Control","no-store, no-cache, must-revalidate"); //HTTP 1.1
			req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
			req.setRequestHeader('If-Modified-Since', 'Sat, 29 Oct 1994 19:43:31 GMT');
			req.setRequestHeader("Pragma","no-cache"); //HTTP 1.0
			req.send(null);
			req.onreadystatechange = function() { 
					  if(req.readyState == 4 && req.status == 200) { location.assign(location.href);	}
						 
				   }
		}
		$("body").css("cursor", "auto");
		// reactive the button when adding has finished / new since PS 1.4.2.5
		$('input#submitWishlist').fadeIn('fast');
	});
	
//$('input#submitWishlist').fadeIn('fast');
}


/**
 * Hide/Show bought product
 *
 * @return void
 */
function WishlistVisibilitypro(bought_class, id_button)
{
	if ($('#hide' + id_button).css('display') == 'none')
	{
		$('.' + bought_class).slideDown('fast');
		$('#show' + id_button).hide();
		$('#hide' + id_button).fadeIn('fast');

		if ((id_button == 'BoughtProductsInfos') )	/*dd to hide products and emails form when displaying infos */
		{
			$('.' + 'wlp_bought').slideUp('fast');
/*!*/			$('#hide' + 'BoughtProducts').hide();
/*!*/			$('#show' + 'BoughtProducts').fadeIn('fast');

			$('.' + 'wl_send').slideUp('fast');
			$('#hide' + 'SendWishlist').hide();
			$('#show' + 'SendWishlist').fadeIn('fast'); /*end*/
			
		}
		if ((id_button == 'SendWishlist') )			/*dd to hide products and infos when displaying emails form */
		{
			$('.' + 'wlp_bought').slideUp('fast');
			$('#hide' + 'BoughtProducts').hide();
			$('#show' + 'BoughtProducts').fadeIn('fast');
			$('.' + 'wlp_bought_infos').slideUp('fast');
			$('#hide' + 'BoughtProductsInfos').hide();
			$('#show' + 'BoughtProductsInfos').fadeIn('fast');
		}
		if ((id_button == 'BoughtProducts') )		/*dd to hide emails form and infos when displaying emails form */
		{
			$('.' + 'wl_send').slideUp('fast');
			$('#hide' + 'SendWishlist').hide();
			$('#show' + 'SendWishlist').fadeIn('fast'); 
			$('.' + 'wlp_bought_infos').slideUp('fast');
			$('#hide' + 'BoughtProductsInfos').hide();
			$('#show' + 'BoughtProductsInfos').fadeIn('fast');
		}
	}
	else
	{
		$('.' + bought_class).slideUp('fast');
		$('#hide' + id_button).hide();
		$('#show' + id_button).fadeIn('fast');
		/*if ((id_button) == 'BoughtProductsInfos')
		{$('.' + 'wlp_bought').slideUp('fast');}*/
	}
}
/**
 * Hide/Show new list creation block (manage my wishlists)
 *
 * @return void
 */
function newWlVisibilitypro(bought_class, id_button)
{
	if ($("#hide" + id_button).css("display") == "none")
	{
		$('.' + bought_class).slideDown('fast');
		$('#show' + id_button).hide();
		$('#hide' + id_button).fadeIn('fast');
		document.getElementById('empty_dd').innerHTML = " " ;

	}
	else
	{
		$('.' + bought_class).slideUp('fast');
		$('#hide' + id_button).hide();
		$('#show' + id_button).fadeIn('fast');
		/*if ((id_button) == 'BoughtProductsInfos')
		{$('.' + 'wlp_bought').slideUp('fast');}*/
		document.getElementById('empty_dd').innerHTML = " ";
	}
}

/**
 * Hide/Show calendar fields (then datepicker)
 *
 * @return void
 */
function PeriodVisibility(id_button)
{
//alert(id_button);
	if (id_button == 'period_select' || id_button == 'calendar') 			//dd to hide products and infos when displaying emails form 
		{
		$('#date12').slideDown('normal');
		};
		
	if (id_button != 'period_select' && id_button != 'calendar')
		{
		$('#date12').slideUp('normal');
		};
	if (id_button == 'calendar')
		{
/*dd*/	document.getElementById('period_select').checked="checked";
		}
}

/**
 * Zoom table report (orders_wishlists.php))
 */
function Zoom(action,id)
{
	if (action == 'plus') 			//dd to enlarge table 
		{
 		width1 = Math.floor($('#' + id).width()*1.05);
//		if (width1 >= 1) {width1 = 1;};
//		alert(width1);
		$('#' + id).css("width", width1);
		};
	if (action == 'minus') 			//dd to minmize table 
		{
 		width1 = $('#' + id).width();
		width1 = Math.floor(width1*0.95);
//		alert(width1);
		$('#' + id).css("width", width1);
//document.getElementById(id).style.cssText="color:red";
//document.getElementById(id).style.cssText="width:50%";
		};
		
}

/**
 * Send wishlist by email
 *
 * @return void
 */
function WishlistSendpro(id, id_wishlist, id_email, submit_button, message_personal, blockwishlist_name)
{
mail_requ=document.getElementById('mail_requ').value;
mail_sent=document.getElementById('mail_sent').value;
mail_not_sent=document.getElementById('mail_not_sent').value;
mail_invalid=document.getElementById('mail_invalid').value;
//cursor - loading ...
document.getElementById(submit_button).disabled=true;
document.getElementById(submit_button).style.cssText="display:none";
$("body").css("cursor", "progress");

var email = new Array();
var emailval = new Array();

/*cancel spaces in emails */
	for (i=1;i<=10;i++) {
email[i] = id_email + i;
emailval[i] = $('#' + id_email + i).val();
emailval[i] = emailval[i].replace(/ /g,"");
	}
/*check wether first email is filled in or empty*/
if ( emailval[1] == '') 
		{
			$("body").css("cursor", "auto");
document.getElementById(submit_button).disabled=false;
document.getElementById(submit_button).style.cssText="display:block";
			alert(mail_requ);
			document.getElementById(email[1]).style.cssText="background-color:#d9ddf4;";
			document.getElementById(email[1]).select();
			return (false); 
		}
/*split in case of several emails*/
//	emails_tab = emails.split(";") ;
	var test_mail=/^[a-zA-Z0-9_][a-zA-Z0-9_.-]*@[a-zA-Z0-9_][.a-zA-Z0-9_-]*\.[a-zA-Z]{2,6}$/gi;
	var test_conf = 1;
	var invalidmails = '';
	var checkvalid = new Array();
	var k=0;
	for (i in email) {
	/*---*/
		if ( emailval[i] != '' && emailval[i].search(test_mail) == -1 ) {
			$("body").css("cursor", "auto");
			document.getElementById(submit_button).disabled=false;
			document.getElementById(submit_button).style.cssText="display:block";
			invalidmails = invalidmails + emailval[i] + "\n";
			checkvalid[i] = 0;
			test_conf = test_conf * (0);
//			test_conf = test_conf * (-1);
		} 
		else { checkvalid[i] = 1;}
		;
	};

/*---invalid mails---*/
	if (test_conf == 0) {
		alert(mail_invalid +":\n"+ invalidmails);
		$("body").css("cursor", "auto");
		document.getElementById(submit_button).disabled=false;
		document.getElementById(submit_button).style.cssText="display:block";

		for (i in email) {
			if (checkvalid[i] == 0 && emailval[i] != "") {
//				alert("avant test i="+i+", k="+k);
				if (k == 0) k=i;
//				alert("après test i="+i+", k="+k);
				document.getElementById(email[i]).style.cssText="background-color:#d9ddf4;";
			};
		};
//				alert("hors boucle  k="+k);
		document.getElementById(email[k]).select();


		return (false);
		
	};
	$.post(baseDir + 'modules/'+ blockwishlist_name +'/sendwishlist.php',
	{ token: static_token,
	  id_wishlist: id_wishlist,
	  message_personal : message_personal,
	  email1: $('#' + id_email + '1').val(),
	  email2: $('#' + id_email + '2').val(),
	  email3: $('#' + id_email + '3').val(),
	  email4: $('#' + id_email + '4').val(),
	  email5: $('#' + id_email + '5').val(),
	  email6: $('#' + id_email + '6').val(),
	  email7: $('#' + id_email + '7').val(),
	  email8: $('#' + id_email + '8').val(),
	  email9: $('#' + id_email + '9').val(),
	  email10: $('#' + id_email + '10').val() },
	function(data)
	{
//alert('data=' + data + 'fin data');
if (data) {
//			alert('retour ajax' + data);
			alert(mail_not_sent);
			alert(mail_nok + data);
			$("body").css("cursor", "auto");
document.getElementById(submit_button).disabled=false;
document.getElementById(submit_button).style.cssText="display:block";
		}
		else
		{
			$("body").css("cursor", "auto");
document.getElementById(submit_button).disabled=false;
document.getElementById(submit_button).style.cssText="display:block";
			alert(mail_sent);
			WishlistVisibilitypro(id, 'hideSendWishlist');
/*dd*/			$('#hide' + 'SendWishlist').hide();
			$('#show' + 'SendWishlist').fadeIn('fast'); 
		}
/*dd*/
	});
}

/**
 * Find out before Sending the email of wishlist
 *
 * @return void
 */
function findOutEmail(id_wishlist, id_email, submit_button, file, file_temp, message_personal, blockwishlist_name)
{
//var blockwishlist_name = 'blockwishlist';
//alert(submit_button);
$("body").css("cursor", "progress");

$.post(baseDir + 'modules/'+ blockwishlist_name +'/find_out_email1.php',
	{ token: static_token,
	  id_wishlist: id_wishlist,
	  message_personal : message_personal,
	  file : file,
	  file_temp : file_temp
	  },
	function(data)
	{
//alert(data);
		$("body").css("cursor", "auto");
		document.getElementById('create_templ').style.cssText="color:gray; display:block";
		document.getElementById('view_templ_0').style.cssText="display:none;";
		document.getElementById('view_templ').style.cssText="display:block; background-color:yellow;";
		document.getElementById('view_templ').focus();

			return (true);
	});
$("body").css("cursor", "auto");
}


function verif_form(id)
{
//format email
var test_mail=/^[a-zA-Z0-9_][a-zA-Z0-9_.-]*@[a-zA-Z0-9_][.a-zA-Z0-9_-]*\.[a-zA-Z]{2,6}$/gi;
 
if ( document.getElementById(id).value.search(test_mail) == -1 ) {
		alert("Invalid mail address ! \nAdresse email invalide !");
		document.getElementById(id).select();
		document.getElementById(id).style.cssText="background-color:#ECECEC";
		return (false) ;} ;
}


function ajaxOrdersWishlists(id,id2,id3, period_type,date1,date2,moduledir,blockwishlist_name,id_lang)
{
//alert(id_lang);
$("body").css("cursor", "progress");

$.ajax({
		type: 'GET',
		url:	moduledir + blockwishlist_name +'/orders_wishlists.php',
		async: true,
		data: 'period_type=' + period_type + '&date1=' + date1 + '&date2=' + date2 + '&id_lang=' + id_lang,
		cache: false,
		success: function(data)
	{

	if ($('#' + id2).css('display') != 'none') 	{
		$('#' + id2).fadeOut('slow');
	}
	if ($('#' + id3).css('display') != 'none') 	{
		$('#' + id3).fadeOut('slow');
	}
		$('#' + id).fadeIn('normal');
		document.getElementById(id).innerHTML = data;

//table2
		if (data) {
				$("#table2")
				.tablesorter({	debug: false,
							 	sortList:[[1,1]],
								//dateFormat: "dd-mm-yy",
								dateFormat: 'uk',
								headers: { 0: { sorter: 'shortDate'} }, 		//0 : { sorter : false } to disable sorting 
								widgets: ['zebra']
							})
				.tablesorterPager({ container: $("#pagerOne"), positionFixed: false, size: $(".pagesize option:selected").val() })
				;
		//-------- filter plugin  + count the number of rows in the filter table ------------
					var grid2 = $('#table2');
				// Initialise Filter Plugin
					var options2 = {                
						filteringRows: function(filterStates) {										
							grid2.addClass('filtering');
						},
						filteredRows: function(filterStates) {      															
							grid2.removeClass('filtering');					
							setRowCountOnGrid2();
						},
						clearFiltersControls: [$('#cleanfilters')],   
						selectOptionLabel: ['...'],
						filterCaseSensitive: false
					};			
					function setRowCountOnGrid2() {
						var rowcount = grid2.find('tbody tr:not(:hidden)').length;
						$('#rowcount').text(' (' + rowcount );										
					}
					
					grid2.tableFilter(options2); // No additional filters			
					setRowCountOnGrid2();
		//---------------------------------------------------------------------
		
		}
		$('#' + id).slideDown('normal');

//			return (true);
	}

	});
	$("body").css("cursor", "auto");
	
}

function resultsVisibility(id,id2,id3) {
	if ($('#' + id2).css('display') != 'none') 	{
		$('#' + id2).css("display","none");
//		$('#' + id2).fadeOut('slow');
	}
	if ($('#' + id3).css('display') != 'none') 	{
		$('#' + id3).css("display","none");
//		$('#' + id2).fadeOut('slow');
	}
	if (id == 'results_pdfmail') {
		$('#' + id2).slideUp('slow');
		$('#' + id3).slideUp('slow');
		$('#' + id).fadeIn('slow');
		return (true);	
	}
	if ($('#' + id).css('display') == 'none') 	{
	$('#' + id).css("display","block");
	$('#' + id2).css("display","none");
	$('#' + id3).css("display","none");
	}
//	$('#' + id).slideDown('normal');
//	document.getElementById('pdf_mail').select();
//	document.getElementById('pdf_mail').focus();
return (true);	
}


function dataRecovery(typesubmit,moduledir,blockwishlist_name,id, id_lang) {
$.ajax({
		type: 'GET',
		url:	moduledir + blockwishlist_name +'/datarecovery0.php',
		async: true,
		data: 'typesubmit=' + typesubmit + '&id_lang=' + id_lang ,
		cache: false,
		success: function(data)
	{
		if ($('#' + id).css('display') == 'block') 	{
			$('#' + id).fadeOut('slow');
			$('#' + id).slideUp('slow');
		}
//alert(data);
//location.reload() ;
var tempo = setTimeout("location.assign(location.href)",7000);
//location.assign(location.href);
document.getElementById(id).innerHTML = '';
		$('#' + id).slideDown('slow');
		document.getElementById(id).innerHTML = data;
	}
});
}


function WishlistPublish(checkedstate,moduledir,blockwishlist_name,id, id_wishlist, msg_publish, msg_unpublish,click_to_publish,click_to_unpublish) {
if (checkedstate == 0) { var res = confirm(msg_publish); }
else { var res = confirm(msg_unpublish); } ;

if (res == false)
	return (false);
$.ajax({
		type: 'GET',
		url:	moduledir + blockwishlist_name +'/publish.php',
		async: true,
		cache: false,
		data: 'id_wishlist=' + id_wishlist,
		success: function(data)
	{
		$('#' + id).fadeOut('slow');
			$('#' + id).fadeIn('slow');
		if (data == '1' || data == 1) 	{
			document.getElementById(id).style.cssText="display:inline";
			document.getElementById(id).checked = true;
			document.getElementById(id).value = 1;
			document.getElementById(id).title = click_to_unpublish;
		}
		else 	{
			document.getElementById(id).style.cssText="display:inline";
			document.getElementById(id).checked = false;
			document.getElementById(id).value = 0;
			document.getElementById(id).title = click_to_publish;
		}
	}
});
}



