jQuery.ajaxSetup({ 
  'beforeSend': function(xhr) {xhr.setRequestHeader("Accept", "text/javascript")}
})

jQuery.fn.submitWithAjax = function() {
  this.submit(function() {
    $.post(this.action, $(this).serialize(), null, "script");
    return false;
  })
  return this;
};

function selectImage(key, name, id)
{
	var preview=document.getElementById("selected-image");
	var asset=document.getElementById("image-asset");
	if (preview != null && asset != null)
	{
		preview.innerHTML = "<img src=\"/library/" + key + "\" />" + name ;
		asset.value = id;
	}
	return false;
}

function selectVideo(key, name, id)
{
	var preview=document.getElementById("selected-image");
	var asset=document.getElementById("image-asset");
	preview.innerHTML = "<b>" + name + "</b>" ;
	asset.value = id;
	return false;
}

