var indexx = 1;
jQuery.fn.extend({
	corner : function(pos,color) {
		//alert($('.box').css('backgroundColor'));
		switch(pos) {
			case 'lt' : mrot = 90;	break;
			case 'rt' : mrot = 180;	break;
			case 'rb' : mrot = 270;	break;
			case 'lb' : mrot = 0;	break;
		}
		return this.each(function() {
			// set flash
			var id = 'flash_corner_id'+indexx;
			$("body").append('<div id="'+id+'" style="display:none">asdasdasd</div>');
			var flashH = 35;
			var flashW = 35;
			var so = new SWFObject("../css/fe/project/3/corner.swf", "flash"+id, "35", "35", "6");
  			so.addParam("wmode", "transparent");
  			so.addParam("flashVars","color="+color+"&amp;mrot="+mrot);
  			so.write(id);

			// set position
			var thisPos = new Object;
			thisPos.left 	= $(this).offset().left;
			thisPos.top 	= $(this).offset().top;
			thisPos.width	= $(this).width();
			thisPos.height	= $(this).height();
			var left = 0;
			var top = 0;
			switch(pos) {
				case 'lt' : 
					left = thisPos.left;
					top = thisPos.top;	
				break;
				case 'rt' : 
					left = thisPos.left+thisPos.width-flashW;
					top = thisPos.top;
				break;
				case 'rb' : 
					left = thisPos.left+thisPos.width-flashW+1;
					top = thisPos.top+thisPos.height-flashH;	
				break;
				case 'lb' :
					left = thisPos.left;
					top = thisPos.top+thisPos.height-flashH;	
				break;
			}
			
			var corn = $('#'+id);
		    var cssObj = {
		    	'position' 	: 'absolute',
				'left'		: left,
				'top' 		: top,
				'display'	: 'block'
		    };
		    corn.css(cssObj);
			indexx++;
		}); 
	}
});


