$(document).ready(function(){

	$('#delete-form').hide();
	$('.acc-trigger').next('.acc-container').hide();
	$('.active').next('.acc-container').show();

	$('.acc-trigger').click(function() {
		$(this).toggleClass('active');
		$(this).next('.acc-container').slideToggle(400);
	    	return false;
	  });

	$('a#delete-link').click(function() {
		$('#delete-form').slideToggle(300);
	    	return false;
	  });

	$('a#hide-att-link').click(function() {
		$('#attachments-wrap').slideToggle(300);
	    	return false;
	  });
	  
	$("input[name='usePass']").change(function(){
		if ($("input[@name='usePass']:checked").val() == '1'){
			$('#password-input').slideToggle(300);
		    	return false;
		}
	});



	$(".lorem img").each(function() { 
		$(this).addClass("inline-img"); 
		$(this).wrap('<div class="inline-img-wrap" />'); 
		if ($(this).prop("title")!='') {
			$("<p>").text($(this).prop("title")).insertAfter($(this)); 
		}
	});

	$(".inline-img").each(function() { 
		var mTop = $(this).css('marginTop');
		var mBottom = $(this).css('marginBottom');
		var mLeft = $(this).css('marginLeft');
		var mRight = $(this).css('marginRight');
		var thisfloat = $(this).css('float');
		var thiswidth = $(this).css('width');
		$(this).css('marginTop', '');
		$(this).css('marginBottom', '');
		$(this).css('marginLeft', '');
		$(this).css('marginRight', '');
		$(this).parent().css('float', thisfloat );
		$(this).css('float', '');
		$(this).parent().css('width', thiswidth );
		$(this).css('width', '');
	});
	     
});



$.fn.abpos = function() {
    var $el;
    return this.each(function() {
        $el = $(this);
        var newDiv = $("<div />", {
                "class": "td-abpos-wrap",
                "css"  : {
                        "position": "relative"
                }
        });
        $el.wrapInner(newDiv);
    });
};

