jQuery(document).ready(function($) {

	$('a[rel*=external]').attr('target','_blank');

	$.postJSON = function(url, data, callback) {
	  $.post(url, data, callback, "json");
	};
	$('a[rel*=dialog]').click(function() {
		var anchor = $(this);
		var url = anchor.attr('href');//this.href;
		
		var dialog = $('<div style="display:hidden" title="' + anchor.attr('title') + '"></div>').appendTo('body');
		// load remote content
		dialog.load(url, {},
			function(responseText, textStatus, XMLHttpRequest) {
				dialog.dialog({
					autoOpen: true,
					modal: false,
					height: 'auto',
					width: 700,
					maxWidth: 700
				});
		});
		//prevent the browser to follow the link
		return false;
	});
	jQuery("#id_query").click(function() {
		if (jQuery(this).val() == "Search realbuzz.com") jQuery(this).val("");
	});
	var display = function(string) {
		if(typeof(console) !== 'undefined' && console != null) {
			// console.log('DISPLAY: ' + string);
		} else {
			$('body').append('<p>Error ' + string + '</p>');
		}
	}
});
