jQuery(document).ready(function($) {
	$.each($("span.md5hash"), function () {
		var elem = $(this);
		$.ajax({type		: "GET",
				dataType	: "jsonp",
				url			: "http://feeds.delicious.com/v2/json/urlinfo/"+$(this).html(),
				success		: function(data) { if (data.length > 0) { elem.next().prepend(data[0].total_posts + " "); } }
		});
	});
});

function wp_social_connect_window_open(url) {
    var newWindow = window.open(url,'Social Connect','height=400,width=600,scrollbars=no,menubar=no,resizable=no,toolbar=no');
    if (window.focus) {newWindow.focus();}
    return false;
}

function wp_social_connect_page_widget_toggle(value) {
	var services = {
		'digg'			: 'wp-social-connect-digg',
		'mixx'			: 'wp-social-connect-mixx',
		'reddit'		: 'wp-social-connect-reddit',
		'delicious'		: 'wp-social-connect-delicious',
		'facebook'		: 'wp-social-connect-facebook',
		'lfacebook'		: 'wp-social-connect-facebook-like',
		'rebuzzthis'	: 'wp-social-connect-rebuzzthis',
		'stumble'		: 'wp-social-connect-stumble',
		'twitter'		: 'wp-social-connect-twitter'
	};
	
	for (var key in services) { document.getElementById(ids[key]).disabled = ((value == false) ? false : true); }
	return;
}

function wp_social_connect_button_opacity(id,state) {
	
	var browser_opac = (state == 1) ? 0.7 : 1;
	var ie_opac = (state == 1) ? 70 : 100;
	id.style.opacity = browser_opac;
	id.filters.alpha.opacity = ie_opac;
}

function wp_social_connect_button_format_helper_display(id,checked,url) {
	if (id == 'button-post-placement') { url += (checked) ? '/align-after.png' : '/align-before.png'; }
	document.getElementById(id).src = url;
}