(function($)
{
			$.fn.t4minfobox = function(options)
			{
				options = $.extend({
					classcontent: '',
					linktextopen: '',
					linktextclose: '',
					linkwraptag: '',
					linkwrapclass: '',
					linkwrapactiveclass: '',
					insertlink: '',
					classAddHTML: new Array(),
					single: true,				
					timetopixle: 1000 			
				}, options);		
				
				var single	=	null;	
				
				
				options.timetopixle		=	options.timetopixle*0.5;
				options.opentime		=	options.timetopixle/100*50;
				options.closetime		=	options.timetopixle/100*50;

				$(this).each(function()
				{									
					var object				=	new Object();
					object._this			=	this;
					object.content			=	$(this).find('.'+options.classcontent);	
					object.paddingtop		=	object.content.css('padding-top').slice(0,-2);;
					object.paddingbottom	=	object.content.css('padding-bottom').slice(0,-2);;
					object.height			=	object.content.height();
					object.margintop 		=	object.content.css('margin-top').slice(0,-2);
					object.marginbottom 	=	object.content.css('margin-bottom').slice(0,-2);
					object.bordertopwidth	=	Number(object.content.css('border-top-width').slice(0,-2));
					if(isNaN(object.bordertopwidth ))object.bordertopwidth=0;
					object.borderbottom		=	object.content.css('border-bottom-width').slice(0,-2);
					object.content.css('overflow','hidden');
					object.content.css('height','0px');
					object.content.css('padding-top','0px');
					object.content.css('padding-bottom','0px');
					object.content.css('border-top-width','0px');
					object.content.css('border-bottom-width','0px');
					

					if(options.linkwraptag !== '')
					{
						var link	=	'<'+options.linkwraptag+' class="'+options.linkwrapclass+'">'+options.linktextclose+'</'+options.linkwraptag+'>';

						$(this).prepend(link);

					}
					
					object.link	=	$(this).find(options.click);
					object.link.css('cursor','pointer');
					object.open	=	false;
					object.link.click
					(
						function()
						{
							if(object.open)
							{
								Close(object,options);
								single = null
							}
							else
							{
								if(single !== null)
								{	
									Close(single,options );		
								}
								Open(object,options);
								single	=	object;		
							}
						}
					)
					
				});

				function Close(object,options)
				{
					object.open = false;

					object.content.stop();
					
					object.content.animate
					(
							{ 
								height: '0px',
								paddingTop: '0px',
								paddingBottom: '0px'
							}, 
							options.timetopixle,
							function()
							{
								object.content.css('height','0px');
								object.content.css('padding-top','0px');
								object.content.css('padding-bottom','0px');
								object.content.css('border-top-width','0px');
								object.content.css('border-bottom-width','0px');
								object.content.css('margin-top-width','0px');
								object.content.css('margin-bottom-width','0px');
							}
					);
					var set = setInterval(function() {
						object.content.css('border-top-width','0px');
						object.content.css('border-bottom-width','0px');
						clearInterval(set);
					}, options.closetime);
					for(var i = 0; i < options.classAddHTML.length; i++)
					{
						$(object._this).find(options.classAddHTML[i]['tag']).attr('class',options.classAddHTML[i]['class']);
					}
				}

				function Open(object,options)
				{
					object.open = true;
					object.content.stop();
					object.content.animate
					(
							{ 
								height: (object.height)+'px',
								paddingTop: object.paddingtop+'px',
								paddingBottom: object.paddingbottom+'px',
								marginTop: object.margintop+'px',
								marginBottom: object.marginbottom+'px',
								borderTopWidth: object.bordertopwidth+'px'/*,
								//borderBottomWidth: object.borderbottom+'px'*/
							}, 
							options.timetopixle,
							function()
							{
								object.content.css('height',object.height+'px');
								object.content.css('padding-top',object.paddingtop+'px');
								object.content.css('padding-bottom',object.paddingbottom+'px');
								object.content.css('border-top-width',object.bordertop+'px');
								object.content.css('border-bottom-width',object.borderbottom+'px');
								object.content.css('margin-top',object.margintop+'px');
								object.content.css('margin-bottom',object.marginbottom+'px');
							}
					);
					var set = setInterval(function() {
						object.content.css('border-top-width',object.bordertop+'px');
						object.content.css('border-bottom-width',object.borderbottom+'px');
						clearInterval(set);
						
					}, options.opentime);
					for(var i = 0; i < options.classAddHTML.length; i++)
					{
						$(object._this).find(options.classAddHTML[i]['tag']).attr('class',options.classAddHTML[i]['activeclass']);
					}
					
				}
			}
		}
)(jQuery);
