/***************************************************************************
* 
*     copyright            : (C) 2009 AQB Soft
*     website              : http://www.aqbsoft.com
*      
* IMPORTANT: This is a commercial product made by AQB Soft. It cannot be modified for other than personal usage.
* The "personal usage" means the product can be installed and set up for ONE domain name ONLY. 
* To be able to use this product for another domain names you have to order another copy of this product (license).
* 
* This product cannot be redistributed for free or a fee without written permission from AQB Soft.
* 
* This notice may not be removed from the source code.
* 
***************************************************************************/

AqbItem = new AqbItems();

function AqbItems(){
	this._price = 0;
	this._points_num = 0;
}

AqbItems.prototype.showPopup = function(sUrl) {
   var oPopupOptions = {
        fog: {color: '#fff', opacity: .7}       
    };

    $.get(sUrl, function(data) {   
		 $('#aqb_popup').remove();
		  $(data).appendTo('body').dolPopup(oPopupOptions); 
	 });

}

AqbItems.prototype.deleteGifts = function(sMessage, sUrl, sUrlBase) {
   var sItems = '';
   
   $("div.aqb-del-button").parent().find('input:checkbox:checked').each(function(){
		sItems += $(this).val() + ',';
   });
   
   if (sItems.length == 0 || !confirm(sMessage)) return false;
   
   
   var oDate = new Date();
   $.post(sUrl,{_t:oDate.getTime(), items: sItems},
   function(oData){
		if (oData.code == 0) document.location.href = sUrlBase;
   },
	'json'
   );
   return false;
}

AqbItems.prototype.onExchangePoints = function(sUrl, sConfirm){
	if (!confirm(sConfirm))  return;
	var oDate = new Date();
	
	$.post(sUrl,		
				{
					_t:oDate.getTime()
				},
	        function(oData){
	           try{ 
					alert(oData.message);
					if (oData.code == 0) window.location.reload();
				}catch(e){}
	        },
	        'json'
	     );
}


AqbMain = new AqbF();

function AqbF(){};

AqbF.prototype.showPopup = function(sUrl) {
    var oPopupOptions = {
        fog: {color: '#fff', opacity: .7}  
    };

	var oDate = new Date();
	$.get(sUrl, { _t:oDate.getTime() }, function(data) {   
  	 	 $('#aqb_popup').remove();
		 $(data).appendTo('body').dolPopup(oPopupOptions); 
	});
}
