jQuery.fn.picframe = function(){
  i = randomid;
  return this.each(function(){
	randomid++;						
     i = i + 1;
	var id = 'wrapper' + i;
	var width = $(this).width();
	var height = $(this).height();
	var float = $(this).css('float');
	$(this).wrap('<div id="'+id+'" class="frameWrap"></div>');
	id = '#'+id;

	$(id).css("width", width+"px");
	$(id).css("height", height+"px");
	$(id).css("float", float);
	
	$(id).prepend('<div class="frameT"></div><div class="frameTL"></div><div class="frameTR"></div>');
	$(id).prepend('<div class="frameB"></div><div class="frameBL"></div><div class="frameBR"></div>');
	$(id).prepend('<div class="frameL"></div><div class="frameR"></div>');
	var nwd = width - 10;
	var nhd = height - 10;
	$(id+' div.frameT').css("width", nwd+"px");
	$(id+' div.frameB').css("width", nwd+"px");
	$(id+' div.frameL').css("height", nhd+"px");
	$(id+' div.frameR').css("height", nhd+"px");
  });
};


