jQuery(document).ready(function() {
	$("ul.dropdown li button").click(function() {
	        $(this).parent().find("ul").slideDown('fast').show();
			// $(this).parent().find("a.buttonShare").addClass("buttonShare_hover");

			$(this).parent().hover(function() {  
		    }, function(){  
				// $(this).parent().find("a.buttonShare").removeClass("buttonShare_hover");
		        $(this).parent().find("ul").slideUp('fast');
		    });

			$(this).parent().find("ul").click(function() {
				// $(this).parent().find("a.buttonShare").removeClass("buttonShare_hover");
				$(this).parent().find("ul").slideUp('fast'); 
			});
	});
});

function openPayment(handle, udata, type) {
	
	payment_url = 'https://ppp.pornme.com/' + handle + '/m/payment';
	
	if(typeof(type) != "undefined" && type == "wishlist") {
		payment_url = payment_url + '/wishlist';
	} 
	
	if(typeof(udata) != "undefined") {
		payment_url = payment_url + '?udata=' + udata;
	} 
	
	var paymentWindowSettings = "width=740,height=650,scrollbars=1,resizable=0,toolbar=0,location=0,menubar=0,status=0,directories=0";
	paymentWindow = window.open(payment_url, "paymentWindow", paymentWindowSettings);
	paymentWindow.focus();
}

function closePayment() {
	window.close();
	window.opener.focus();
}

function updateUserCredits(site_id) {
	// $('#usermenuCreditDisplay').text("0");
	$('#usermenuCreditDisplay').load('/'+site_id+'/ajax/countUserCredits');
}

function updateUserUnreadMails(site_id) {
	// $('#usermenuUnreadMailsDisplay').text("0");
	$('#usermenuUnreadMailsDisplay').load('/'+site_id+'/ajax/countUnreadPmail');
}

function openPopup(popup_id, width, height) {
	var popupWindowSettings = "width="+width+",height="+height+",scrollbars=0,resizable=0,toolbar=0,location=0,menubar=0,status=0,directories=0";
	var popupWindowName = 'popup_' + popup_id;
	popupWindow = window.open('http://ppp.pornme.com/popup?id=' + popup_id, popupWindowName, popupWindowSettings);
	popupWindow.focus();
}
