// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

function toggle_img(img){
	if (img.attr("src").indexOf("plus") > 0) {
  	img.attr({
			"src": "/images/minus.gif"
		});
  }
  else 
  	img.attr({"src": "/images/plus.gif"});
}

function photo_finish(url, id){
	$('#photo_div_'+id).load(url, 1, function(){
		$('#photo_form_'+id).reset();
		$('#upload_container').toggle();
	});
		
//	new Ajax.Updater('photo_div_'+id, url, {method:'get', onComplete:function(){
//			$('photo_form_'+id).reset();
//			$('upload_container').toggle();
//		}});
}

make_form = function(divId){
	data = $(divId).html();
	$(divId+" + a").hide();
    ed = $("<textarea/>").css({
        "width": "100%"
    });
	ed.attr({
  	"value": data,
  });
	form = $("<form/>").append(ed);
	form.attr({
		"method":"post",
		"action":"/admin/link_name_save"
	});
	$("<input type='submit'/>").appendTo(form);
	$(divId).html(form);
}
