 (function($){  
			     $.fn.extend({   
			         //plugin name - tabify  
			         tabify: function(options) {  
			   
			             var defaults = { 

									tabPosition:"left",
									dynamic:false,
									tabUrls:['hello','hello1']
					              };  
			               
			             var options = $.extend(defaults, options);  
			           
			             return this.each(function() {  
			                   var o =options;  
			                   var t = $(this); 
			                   var ul1 =  $('ul',t);
			                   var countLi = $('li',ul1).size();
			                   var count=0;
			                   //alert("t");  
			                   //alert();
								$(ul1).children('li').each(function(){	
									//IE fix
									if(o.tabPosition == "center" && count==0)
									{
										var val = (t.width() - (($(this).width() + parseInt($(this).css('margin-right'))) * countLi ))/2;
										$(this).css({'marginLeft':val});
									}
									if(o.tabPosition == "right" && count==0)
									{
										var val1 = (t.width() - (($(this).width() + parseInt($(this).css('margin-right')) +1) * countLi ));
										$(this).css({'marginLeft':val1});
									}
									var currentId = $(this).attr('id');
									var contentId = "#"+ currentId + "content";
									if($(this).hasClass("selected"))
									{
										$(contentId).css({'display':'block'});
										
										if(o.dynamic == true)
										{
											$(contentId).html("<div style='margin-left:120px'><img src='images/loader.gif'/></div>");
											$.ajax({
												type: "GET",
												url: "feed.jsp",
												cache: false,
												data: "cid=" + o.tabUrls[count],
												success: function(data)
											    {
												  //find every Tutorial and print the author
												$(contentId).text("");
												$(contentId).append(data);
											    }
											});
										}
										
									}else
									{
										
										$(contentId).css({'display':'none'});
									}
									count++;
									});

								$("li",ul1).click(function(){ // onclick hide others and show the clicked tab

									var currentId = $(this).attr('id');
									var contentId = "#"+ currentId + "content";
									count=0;
									$(ul1).children('li').each(function(){
										var tabId = $(this).attr('id');
										var tabContentId = "#"+ tabId + "content";
										if(tabId == currentId)
										{
											$(this).addClass("selected");
											var rowpos = $(tabContentId).position();
											$(tabContentId).css({'display':'block'});
											if(o.dynamic == true)
											{
												$(tabContentId).html("<div style='margin-left:120px'><img src='images/loader.gif'/></div>");
												$.ajax({
													type: "GET",
													url: "feed.jsp",
													cache: false,
													data: "cid=" + o.tabUrls[count],
													success: function(data)
												    {
													  $(tabContentId).text("");
													  $(tabContentId).append(data);
												    }
												});
											}
											//alert(rowpos.top);
										}
										else
										{
											$(this).removeClass("selected");
											$(tabContentId).css({'display':'none'});
										}
										count++;
									});
								});
								                 
 
			             });  
			         }  
			     });  
			 })(jQuery);
