// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults
function deleteImage(i, url) {
	if(confirm('Are you sure?'))
		new Ajax.Updater('image_preview', url + '?i='+i, {asynchronous:true, evalScripts:true});
	
	return false;
}

function disable_after_validate(form)
{
	var valid = new Validation($(form), {onSubmit:false});
	var result = valid.validate();
	if (result)
	{
		setTimeout(function() {Form.disable(form);}, 100);
	}
}

function limit_input(form, limit)
{
	alert(this.value);
	if (this.value.length > limit)
	{
		alert("You Are Limited To "+limit+" number of characters.");
	}
	this.select();
}

//preload images to prevent IE6 flickering
try {
  document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}
