function AddtoLB (id) {
	var strSubmit="";
	strSubmit+="id="+id+"&action=ADD";
	
	new Ajax.Request('lightbox.php', {
		method: 'post',
		parameters: strSubmit, 
		onSuccess: function(transport) {					
			//transport.responseText
			//update lightbox num
			$("lbNum").innerHTML="lightbox ("+transport.responseText+")";
		},
		onFailure: function () {
				alert ("add to lightbox error");
		}
	});
}

function RemoveLB (id) {
	var strSubmit="";
	strSubmit+="id="+id+"&action=DEL";
	
	new Ajax.Request('lightbox.php', {
		method: 'post',
		parameters: strSubmit, 
		onSuccess: function(transport) {					
			//update lightbox num
			if (transport.responseText=="") {
				$("lbNum").innerHTML="lightbox";
				$$("#rigth .LB_title")[0].innerHTML="no image in your lightbox.";
			}
			else
			{
				var num=parseInt(transport.responseText);
				$("lbNum").innerHTML="lightbox ("+num+")";
				$$("#rigth .LB_title")[0].innerHTML="your lightbox contains "+num+" image"+(num>1?"s":"");
			}
			$("ico_"+id).remove();
		},
		onFailure: function () {
				alert ("remove from lightbox error");
		}
	});
}

/*function ShowLB () {
	var arrayPageSize = getPageSize();
	
	//BACK
	$("cnt").insert({after: "<div id=\"wOver_overlay\" style=\"display: none;\"></div>"});	

	$("wOver_overlay").style.width=arrayPageSize[0]+"px";
	$("wOver_overlay").style.height=arrayPageSize[1]+"px";	
	new Effect.Appear('wOver_overlay', { duration: 0.2, from: 0.0, to: 0.6 });
	
	//CNT
	$("cnt").insert({top: "<div id=\"wOver\" style=\"display:none;\"><div id=\"wOverContainer\"><img src=\"/images/loader.gif\" /></div></div>"});
	SetCntPos(16,16,true);
	$("wOver").show();
	
	//GET INFO
	var strSubmit="";
	strSubmit+="action=SHOW";
	
	new Ajax.Request('lightbox.php', {
		method: 'post',
		parameters: strSubmit, 
		onSuccess: function(transport) {
			PrintLB(transport.responseText);
		},
		onFailure: function () {					
			alert(transport.responseText);
		}
	});		
}

function PrintLB (txt) {
		$("wOver").hide();
		$$("#wOverContainer img")[0].remove();
		
		var data="";
		var cnt="";
		
		cnt ="<div class=\"zoomCnt\">"+txt+"</div>";
		
		SetCntPos(700,null);
		$("wOverContainer").insert({top: cnt});		
		
		new Effect.Appear("wOver", { duration: 0.2, 
																 from: 0.0, 
																 to: 1, 
																 afterFinish: function () { //set bg new height
																 		var newPageSize = getPageSize();
																		$("wOver_overlay").style.height=newPageSize[1]+"px";	
																}});		
		
}*/
