function display_dialog(id,height,width,title)
{
	jQuery("<div id=\"dialog-div-"+id+"\"></div>").dialog({
		modal:true,
		height:height,
		width:width, 
		title:title,
		close:function(){jQuery(this).remove();},
		open:function(){jQuery(this).load("/dialog/"+id+".html");}
	});
}

function submit_ajax_form(id,callback)
{
	var json = jQuery.parseJSON(jQuery.ajax
	({
	 	type:		"POST",
		url:		"/ajax/"+id+"-form-submit.html",
		data:		jQuery("#"+id+"-form").serialize(),
		async:		false,
		cache:		false
	}).responseText);
	eval(callback+"(json)");
	return false;
}

$(document).ready(function()					  
{
	$("#retailer-search-input").autocomplete(
	{
		source:"/json/retailer-search.html",
		minLength:3,
		select: function(event,ui)
		{
			document.location.href = "/"+ui.item.id+"-"+ui.item.urlname+"-voucher-codes";
		}
	});
	
	$(".button").button();
});
