jQuery.noConflict();
(function (jQuery) {
jQuery.fn.userDailyCounters = function() {
	var self = this;
	this.gca = function(params) {
		
		to = parseInt(params['to']);
		idc = parseInt(params['idcountry']);
		upd = params['update'] ? true : false;

		jQuery.ajax({
			url: PUBLIC_URL + 'ajax/test-daily-counter',
			type: 'POST',
		    dataType: 'json',
		    data: {counter: 'chat', update: upd, toUserId: to}, 
			success: function(transport) {
				if(transport.error == false && transport.testOk) {
					if(typeof window.enable_chat == 'function') {
						setTimeout("enable_chat('"+to+"');",0);
						return true;
					}
				}
								
				if(typeof window.close_chat == 'function') {
					setTimeout("close_chat();",0);
					return false;
				}	
			},
			error: function(obj, status, e) {
				if(typeof window.close_chat == 'function') {
					setTimeout("close_chat();",0);
					return false;
				}
			}	
		});	
	}
	
	return this;
}
})(jQuery);

(function (jQuery) {
jQuery.fn.Vip = function() {
	var self = this;
	this.payment = function() {
		if(jQuery('#popupBoxWalletPay').css("display") == 'none') {
			jQuery('#popupBoxWalletPay').css("display","block");
			return true;
		}
		self.run = true;
		jQuery.ajax({
			url: PUBLIC_URL + 'ajax/vip-package-payment',
			type: 'POST',
		    dataType: 'json',
		    data: {}, 
			success: function(transport) {
				if(transport.error == false) {
					jQuery('#buyVipBox').html(transport.html);
					jQuery.walletAtachControl();
					jQuery('#popupBoxWalletPay').css("display","block");
				} else {
					systemMessenger.set(data.message, 0);
					systemMessenger.display();
					return;
				}	
			}
		});	
		return true;		
	}
	
	return this;
}	
})(jQuery);

jQuery(document).ready(function() {
	vip = jQuery('body').Vip();
	if(jQuery('#get-vip-package').length) {
		jQuery('#get-vip-package').bind("click", function() {
   			vip.payment();
   		});	
   }
});

 