		function timeLine(){

        	this.emptyYears =				1;//показывать пустые года
			this.tenYears =					0;//показывать таймлайн в режиме десятков
			this.timelineWidth =			'100%';//ширина таймлайна(поля с точками)
			this.timelineBorder =			'0';//бордюр для таймлайна
			this.timelineSpacing =			'2px';//расстояние между полоской годов, блоком названий категорий и блоком ячеек
			this.groupWidth = 				'160px';//ширина блока названий категорий
			this.groupHeight =				'86px';//высота "ячеек" таймлайна
			this.yearWidth = 				'40px';//ширина колонки года
			this.yearBackgroundColor = 		'silver';//фоновый цвет полоски годов
			this.yearForegroundColor = 		'gray';//цвет шрифта годов
			this.yearFont = 				'bold 10px Arial';//шрифт годов
			this.yearArrowsColor = 			'gray';//цвет стрелок в полоске годов
			this.yearArrowsOpacity = 		'70';//степень прозрачности у стрелок годов
			this.yearArrowsHoverColor = 	'white';//цвет стрелок в полоске годов при наведении
			this.yearArrowsHoverOpacity = 	'100';//степень прозрачности у стрелок годов при наведении
			this.pointWidth =             	'6px';//ширина точек
			this.pointHeight =				'6px';//высота точек
			this.pointBackground = 			'transparent url(/images/points.gif) no-repeat center 0px';//фоновый рисунок у точек
			this.pointHoverBackground = 	'transparent url(/images/points.gif) no-repeat center -6px';//фоновый рисунок у точек при наведении курсора
			this.pointPadding =             '0px';//отступ точек от границ года
			this.pointMargin = 				'1px';//отступ у точек
			this.crosshairColor = 			'white';//цвет целеуказателя
			this.crosshairHoverColor = 		'white';//цвет целеуказателя при наведении на точку
			this.crosshairOpacity = 		'50';//степень прозрачности целеуказателя
			this.crosshairSize = 			'1px';//ширина линий целеуказателя
			this.crosshairHoverSize = 		'3px';//ширина линий целеуказателя при наведении на точку
			this.helpDelay = 				25;//время появления подсказки
			this.helpBorderColor = 			'#3c3c3c';//цвет бордюра у подсказок
			this.helpBackgroundColor = 		'white';//фоновый цвет подсказок
			this.helpShadowOffsetX = 		'3px';//смещение тени подсказки по x-координате
			this.helpShadowOffsetY = 		'3px';//смещение тени подсказки по y-координате
			this.helpShadowColor = 			'#3c3c3c';//цвет тени
			this.helpShadowOpacity = 		'40';//прозрачность тени
			/*1.цвет для основы построениия градиентного фона для категории
			2.цвет шрифта у названий категорий
			3.цвет нечетных ячеек
			4.цвет четных ячеек*/
			this.group=[
				'',
				'black white #E0E0E0 #F2F2F2',
				'red white #FFA4A4 #FFD9D9',
				'#0066CC white #7AAACD #B8D1E4',
				'#009933 white #98D8AB #C2E7C9',
				'#FF9900 white #FFCE84 #FAE0C7',
				'#663399 white #C5A8E1 #DDCCEE',
				'#FF33CC white #FFB3EC #FFD5F4'
			];
			


			this.id='tl';
			for(var i=0;i<16;i++){this.id+=parseInt(Math.random()*16).toString(16)}
            var id=this.id;
            
			
			this.transGradient=function(color){
				color=color||'black';var g;
				if(!window.stop){
					g=document.createElement('div');
					g.style.background=color;
					g.style.filter='alpha(style=1,opacity=0,finishOpacity=100)';
				}
				else{
					g=document.createElement('canvas');
					if(g&&g.getContext){
						g.style.background='transparent';
						var gc=g.getContext('2d');
						var gr=window.opera?gc.createLinearGradient(300,0,-70,0):window.console&&!window.dump?gc.createLinearGradient(300,0,0,0):gc.createLinearGradient(270,0,-30,0);
						gr.addColorStop(0,color);
						gr.addColorStop(1,'rgba(255,255,255,0)');
						gc.fillStyle=gr;
						gc.fillRect(0,0,300,300);
					}
				}
				g.className='canvas';
				return g
			};
			
			//создаем ноду таймлайна
			this.node=document.createElement('div');
			if(window.opera&&window.setDocument){
				if(!document.getElementById('invisibleFix4OP9')){
					var tmp=document.createElement('div');
					tmp.style.display='none';
					var head=document.getElementsByTagName('head')[0];
					head.insertBefore(tmp,head.firstChild);
					tmp.id='invisibleFix4OP9'
				}
				document.getElementById('invisibleFix4OP9').appendChild(this.node)
			}
            this.node.className=id;
			this.node.innerHTML='<ul style="display:none"><li class="last"></li></ul><div class="wrapp"><div class="body"><div class="wrapp2"><table class="points"><tbody></tbody></table><div class="target left"></div><div class="target top"></div><div class="target right"></div><div class="target bottom"></div></div><table class="years"><tbody><tr></tr></tbody></table></div><a href="#" class="arrow a_left"><span></span></a><a href="#" class="arrow a_right"><span></span></a></div>';

            var cH=50,cW=50,helptime=(!window.stop&&window.Element?12:24),offX,cS=0;
			this.create=function(){
				offX=parseInt(this.helpShadowOffsetX);
				cH=parseInt(this.groupHeight);
				cW=parseInt(this.yearWidth);
				cS=Math.floor(parseInt(this.crosshairSize)/2);
				helptime=parseInt(this.helpDelay);
				if(!window.stop&&window.Element){helptime/=helptime}
				this.style='';
				for(var i=1,tmp,gl=this.group.length;i<gl;i++){
					tmp=this.group[i].split(' ');
					this.style+='.tl .c'+i+' td{background:'+tmp[2]+'}.tl .c'+i+' .ev{background:'+tmp[3]+'}'
				}
				this.style=(
				this.style+
				'.tl,.tl *,.tl_help_block *,.tl_help_shadow *{font-size:100%;margin:0;padding:0;outline:none;-moz-outline:none;-khtml-margin-start:0;-khtml-padding-start:0;-webkit-padding-start:0;-webkit-margin-start:0;-moz-box-sizing:border-box;box-sizing:border-box;border-box:border-box;-ms-box-sizing:border-box;-khtml-box-sizing:border-box;-webkit-box-sizing:border-box;background:none;background:transparent;border:0}'+
				'.tl .canvas{display:block;width:100%;height:100%}'+
				'.tl{border:'+this.timelineBorder+';font:0.8em Arial,Helvetica,sans-serif;margin-top:10px}'+
				'.tl table{border-collapse:collapse;border-spacing:0;empty-cells:show}'+
				'.tl{width:'+this.timelineWidth+';overflow:hidden;float:none;clear:both}'+
            	'.tl ul,.tl li{display:block;list-style-type:none}'+
            	'.tl ul{width:'+this.groupWidth+';float:left}'+
            	'.tl li{float:none;clear:both;height:'+this.groupHeight+';width:100%;line-height:'+this.groupHeight+';font-weight:bold}'+
				'.tl li span{display:block;height:'+this.groupHeight+';width:'+this.groupWidth+';text-align:right;padding-right:15px;position:absolute;overflow:hidden}'+
				'.tl .last{height:17px;_height:18px;margin-top:'+this.timelineSpacing+';overflow:hidden}'+
				'.tl .wrapp,.tl .body{float:left;width:100%;overflow:hidden}'+

				'.tl .wrapp2{position:relative}'+
				'.tl .body{position:relative}'+
				'.tl table{position:relative;table-layout:fixed;width:1px;}'+
				'.tl td{position:relative;vertical-align:top;width:'+this.yearWidth+';height:'+this.groupHeight+'}'+
				'.tl td div{margin:'+this.pointPadding+';position:relative}'+
				'.tl .points{cursor:crosshair}'+
				'.tl .point{cursor:hand;cursor:pointer;text-decoration:none;display:block;height:'+this.pointHeight+';width:'+this.pointWidth+';overflow:hidden;background:'+this.pointBackground+';margin:'+this.pointMargin+';position:absolute;}'+
				'.tl .point:hover{cursor:hand;cursor:pointer;color:#4e4e4e;background:'+this.pointHoverBackground+'}'+
				'.tl .years{cursor:move;margin-top:'+this.timelineSpacing+';-moz-user-select:none}'+
				'.tl .years td{background:'+this.yearBackgroundColor+';vertical-align:middle;height:18px;text-align:'+(this.tenYears?'left':'center')+';font:'+this.yearFont+';color:'+this.yearForegroundColor+';}'+
				'.tl .arrow{color:transparent;/*IE6fix*/text-decoration:none;cursor:hand;cursor:pointer;float:left;display:block;box-sizing:content-box;border-box:border-box;width:0;height:0;position:relative;margin-top:-18px;border:8px solid '+this.yearArrowsColor+';filter:progid:DXImageTransform.Microsoft.Alpha(opacity='+this.yearArrowsOpacity+');_filter:progid:DXImageTransform.Microsoft.Chroma(color=black) alpha(opacity='+this.yearArrowsOpacity+');border-top-color:transparent;border-bottom-color:transparent;opacity:'+this.yearArrowsOpacity/100+';-moz-opacity:'+this.yearArrowsOpacity/100+';-khtml-opacity:'+this.yearArrowsOpacity/100+';-webkit-opacity:'+this.yearArrowsOpacity/100+'}'+
				'.tl .arrow:hover{color:transparent;/*IE6fix*/text-decoration:none;border:8px solid '+this.yearArrowsHoverColor+';filter:progid:DXImageTransform.Microsoft.Alpha(opacity='+this.yearArrowsHoverOpacity+');_filter:progid:DXImageTransform.Microsoft.Chroma(color=black) alpha(opacity='+this.yearArrowsHoverOpacity+');border-top-color:transparent;border-bottom-color:transparent;opacity:'+this.yearArrowsHoverOpacity/100+';-moz-opacity:'+this.yearArrowsHoverOpacity/100+';-khtml-opacity:'+this.yearArrowsHoverOpacity/100+';-webkit-opacity:'+this.yearArrowsHoverOpacity/100+'}'+
				':root .tl .last{height:18px}'+
				':root .tl .arrow{margin-top:-17px}'+
            	'@media all and (min-width:0px){.tl .last{height:18px}.tl .arrow{margin-top:-17px}}'+
				'.tl .a_left,.tl .a_left:hover{border-left:0}'+
            	'.tl .a_right,.tl .a_right:hover{border-right:0;float:right}'+
				'.tl .target,.tl .target_hover{filter:alpha(opacity='+this.crosshairOpacity+');-moz-opacity:'+this.crosshairOpacity/100+';-webkit-opacity:'+this.crosshairOpacity/100+';opacity:'+this.crosshairOpacity/100+';visibility:hidden;position:absolute;height:'+this.crosshairSize+';width:'+this.crosshairSize+';top:0;left:0;_font:0/0;background:'+this.crosshairColor+';overflow:hidden}'+
				'.tl .target_hover{width:'+this.crosshairHoverSize+';height:'+this.crosshairHoverSize+';background:'+this.crosshairHoverColor+'}'+
				'.tl_help .r_box{margin:5px 0 5px 0;color:#3c3c3c;background:'+this.helpBackgroundColor+';border-right:1px solid '+this.helpBorderColor+';border-left:1px solid '+this.helpBorderColor+';padding:0 8px 0 8px}'+
				'.tl_help .r_sup,.tl_help .r_sup *,.tl_help .r_sub,.tl_help .r_sub *{display:block;_font:0/0;background:'+this.helpBackgroundColor+';position:relative;border-right:1px solid '+this.helpBorderColor+';border-left:1px solid '+this.helpBorderColor+'}'+
				'.tl_help .r_sup,.tl_help .r_sub{left:-8px;margin-right:-16px}'+
				'.tl_help .r_sup{height:2px;max-height:2px;top:-2px}'+
				'.tl_help .r_sup *{height:1px;max-height:1px;top:-1px}'+
				'.tl_help .r_sup * *{border-width:2px}'+
				'.tl_help .r_sup * * *{overflow:hidden;border:0;max-height:0px;border-top:1px solid '+this.helpBorderColor+'}'+
				'.tl_help .r_sub{height:2px;max-height:2px;top:2px}'+
				'.tl_help .r_sub *{height:1px;max-height:1px;top:2px}'+
				'.tl_help .r_sub * *{top:1px;border-width:2px}'+
				'.tl_help .r_sub * * *{overflow:hidden;height:1px;max-height:0px;border:0;border-bottom:1px solid '+this.helpBorderColor+'}'+
				'.tl_help{position:absolute;visibility:visible;z-index:20000;top:-5000px;left:-5000px}'+
				'.tl_help_block,.tl_help_shadow{position:relative;width:250px;height:1%}'+
				'.tl_help_block,.tl_help_shadow{z-index:20000;border:1px solid transparent;_border:0;_margin:2px}'+
		    	'.tl_help_shadow{position:absolute;top:'+(parseInt(this.helpShadowOffsetY)+(window.stop||window.Element?1:-1))+'px;left:'+this.helpShadowOffsetX+';z-index:100}'+
		    	'.tl_help_arrow,.tl_help_arrow_in{width:12px;height:12px;color:transparent !important;background:none !important;overflow:hidden;position:relative;_filter:progid:DXImageTransform.Microsoft.Chroma(color=black)}'+
		    	'.tl_help_bottom .tl_help_arrow{border:6px solid transparent;border-top:12px solid '+this.helpBorderColor+';border-bottom:0;left:50px;}'+
            	'.tl_help_bottom .tl_help_arrow_in{border:6px solid transparent;border-top:12px solid '+this.helpBackgroundColor+';border-bottom:0;top:-2px;margin-top:-12px;left:50px;}'+
				'.tl_help_bottom,.tl_help_top{padding-top:12px;_padding-top:17px;}'+
				'.tl_help_top .tl_help_arrow{border:6px solid transparent;border-bottom:12px solid '+this.helpBorderColor+';border-top:0;position:absolute;top:0;left:50px;}'+
            	'.tl_help_top .tl_help_arrow_in{border:6px solid transparent;border-bottom:12px solid '+this.helpBackgroundColor+';border-top:0;position:absolute;top:2px;left:50px;}'+
            	'.tl_help .tl_help_shadow *{color:'+this.helpShadowColor+';background:'+this.helpShadowColor+'}'+
            	'.tl_help .tl_help_shadow .tl_help_arrow{border-top-color:'+this.helpShadowColor+';border-bottom-color:'+this.helpShadowColor+'}'+
            	'.tl_help .tl_help_shadow .r_box,.tl_help .tl_help_shadow .r_box *{border-color:'+this.helpShadowColor+'}'+
            	'.tl_help .tl_help_shadow .tl_help_arrow_in{visibility:hidden}'+
            	'.tl_help_shadow{_filter:alpha(opacity='+this.helpShadowOpacity+');opacity:'+this.helpShadowOpacity/100+';-moz-opacity:'+this.helpShadowOpacity/100+';-khtml-opacity:'+this.helpShadowOpacity/100+';-webkit-opacity:'+this.helpShadowOpacity/100+'}'+
				'.tl_help_shadow .tl_help_arrow,.tl_help_shadow .r_box,.tl_help_shadow .r_box *{-ms-filter:"alpha(opacity='+this.helpShadowOpacity+')"}'
				).replace(/\.tl/ig,'.'+id);
				var stl=document.createElement('style');
				document.getElementsByTagName('head')[0].appendChild(stl);
				stl.type='text/css';stl.rel='stylesheet';
				if(stl.styleSheet){stl.styleSheet.cssText=this.style}
				else{try{stl.innerHTML=this.style}catch(e){stl.innerText=this.style}}			
			
				var g=this.transGradient(this.yearBackgroundColor);
				g.style.height='30px';//fix в Геко и Вебките, если высота канвас меньше 30, появляются глюки с позиционированием(появляется сверху какой-то отступ)
				this.node.getElementsByTagName('ul')[0].lastChild.appendChild(g);
			
			};
			//прибиваем возможность выделения таблицы годов, чтоб можно было скролить таймлайн, "хватаясь" за них
			var ys=this.node.getElementsByTagName('table')[1];
			ys.oncontextmenu=ys.onselectstart=function(e){return!1};
			
			ys.onmousedown=function(e){
				e=e||event;
				timeLine.SCROLL=this;
				this.lastX=e.pageX||e.clientX+document.body.scrollLeft;
				return!1
			};
			ys.onmousemove=function(e){
				if(this==timeLine.SCROLL){
					e=e||event;
					var eX=e.pageX||e.clientX+document.body.scrollLeft;
					this.parentNode.scrollLeft+=(eX-this.lastX);
				}
			};
			
			var a_l=ys.parentNode.nextSibling,a_r=a_l.nextSibling;
			//обновляем показ стрелок в лини годов(запускать после вставки в документ или предполагаемого измененя размеров) /*т.к. основная нода еще не вставлена в документ, то ширина всех ее детей -0...*/
			this.scroll=function(x){
				var scrObj=ys.parentNode;
				a_l.style.display=a_r.style.display=scrObj.offsetWidth<ys.offsetWidth?'block':'none';
				/*IE8fix*/
				scrObj.onresize=function(){
					a_l.style.display=a_r.style.display=scrObj.offsetWidth<ys.offsetWidth?'block':'none'
				};
				if(!x||x=='start'){scrObj.scrollLeft=0}
				else{
					if(x=='end'){scrObj.scrollLeft=scrObj.scrollWidth}
					else{
						var tmp=this.years[x+''];
						//ищем ближайший, если нет указанного
						if(!tmp){
							for(var i=0,x=parseInt(x);i<1000;i++){
								tmp=this.years[(x+i)+'']||this.years[(x-i)+''];
								if(tmp){break}
								tmp=!1
							}
						
						}
						if(tmp){scrObj.scrollLeft=tmp.node.offsetLeft}
					}
				}	
			};
			
			a_l.onmousedown=a_r.onmousedown=function(e){
				   	var way=this.className.indexOf('a_left')>-1?-1:1;
					function scroll_go(){
						if(timeLine.SCROLL){
							ys.parentNode.scrollLeft+=20*way;
							timeLine.scrolltimer=setTimeout(scroll_go,100);
						}
						else{timeLine.SCROLL_CLOSE();clearTimeout(timeLine.scrolltimer);timeLine.scrolltimer=null}
					}
					timeLine.SCROLL=1;scroll_go();
					return!1
			};
			a_l.onclick=a_r.onclick=function(){return!1};//IEfix
			
			var ps=this.node.getElementsByTagName('table')[0],
			t_l=ps.nextSibling,t_t=t_l.nextSibling,t_r=t_t.nextSibling,t_b=t_r.nextSibling,
			WK=window.console&&!window.dump&&window.stop&&!window.opera,ng=!WK;
			
			ps.tW=ps.offsetWidth;ps.tH=ps.offsetHeight;//fix4IE8
			
			ps.onmouseover=function(e){
				this.tW=this.offsetWidth;this.tH=this.offsetHeight
			};//fix4IE8
			var max=Math.max;//fix4IE8
			ps.onmousemove=function(e){
				e=e||event;
                var eT=e.target||e.srcElement,eTN=(eT.tagName||'').toLowerCase();
				var eX=(e.layerX||e.offsetX||0),eY=(e.layerY||e.offsetY||0);
                
				if(eTN!='td'){
					eX=eX+eT.offsetLeft+(ng?0:eT.offsetParent.offsetLeft);eY=eY+eT.offsetTop+(ng?0:eT.offsetParent.offsetTop);
					eT=eT.parentNode.parentNode;
				}
				else if(WK){eX+=(WK?this.parentNode.scrollLeft:0)}
				
				var eX2=max(eX+(ng?eT.cellIndex*cW:0),0),eY2=max(eY+(ng&&eT.parentNode?eT.parentNode.rowIndex*cH:0),0);
				
				t_l.className=t_r.className=t_b.className=t_t.className=eTN!='td'?'target_hover':'target'
				
				t_l.style.width=max(eX2-12,0)+'px';
				t_r.style.top=t_l.style.top=(eY2-cS)+'px';
				t_r.style.left=(eX2+12)+'px';
				t_r.style.width=max(this.tW-(eX2+12),0)+'px';

				t_b.style.left=t_t.style.left=(eX2-cS)+'px';
                t_t.style.height=max(eY2-12,0)+'px';
				t_b.style.top=(eY2+12)+'px';
                t_b.style.height=max(this.tH-(eY2+12),0)+'px';
				
				t_t.style.visibility=t_l.style.visibility=t_r.style.visibility=t_b.style.visibility='visible';
			};
			ps.onmouseout=function(e){
				e=e||event;e.trg=e.toElement;
				//fix4IE8
				this.tW=this.offsetWidth;this.tH=this.offsetHeight;
				//fix4IE8
				if(!window.stop&&window.Element&&e.trg&&e.trg.className=='point'){return}
				t_l.style.visibility=t_t.style.visibility=t_r.style.visibility=t_b.style.visibility='hidden';
			};
			
			
			this.categories={};//категории и их порядковый номер {'Mix':1,'New':2}
			this.categoriesCount=0;//кол-во категорий в таймлайне
            this.years={};//года {1980:{},'-1':{}};
            this.startYear=null;
	
			//добавление новой категоии, x - название категории
			this.addCategory=function(x,y){
				
				//если категория уже существует выходим из ф-ции
				if(this.categories[x]){return}
				//добавляем новую строку в таблицу пойнтов
				var tb=this.node.getElementsByTagName('table')[0].tBodies[0];
            	var newRow=tb.insertRow(tb.rows.length);
            	//если уже есть категории заполянем пустыми ячейками новую строку, чтоб в ней их было столько же сколько в других строках
				if(tb.rows.length>1){
					for(var i=0,cl=tb.rows[0].cells;cl[i];i++){
						var tmp=newRow.insertCell(i);
						if(cl[i].className=='ev'){tmp.className='ev'}
						tmp.innerHTML='<div></div>'
					}
				}
				//добавляем новую категорию в список
				var newCat=this.node.getElementsByTagName('ul')[0];
            	newCat=newCat.insertBefore(document.createElement('li'),newCat.lastChild)
				newCat.innerHTML='<span style="color:white">'+x+'</span>';
				//назначаем нужные классы
				newRow.className=newCat.className='c'+(++this.categoriesCount);
				//создаем полупрозрачный градиент
				var groupColors=this.group[this.categoriesCount]||this.group[1];
				var g=this.transGradient(groupColors.split(' ')[0]);
				newCat.appendChild(g);
				this.categories[x]=this.categoriesCount;
				//если категории заданы, то показываем блок категорий
				if(this.categoriesCount>1||!this.categories['other']){
					this.node.getElementsByTagName('ul')[0].style.display='block';
					var ls=this.node.lastChild.style;
					ls.paddingLeft=(parseInt(this.groupWidth)+parseInt(this.timelineSpacing))+'px';
				    ls.marginLeft=parseInt(this.groupWidth)*-1+'px'
				}
			};
			//добавление нового года, х - год из 4-цифр, можно номером или строкой	
			this.addYear=function(x){
                x=parseInt(x);//переводим строку в числовой тип
				if(this.years[x+'']){return this.years[x+'']}//если такой год уже есть, выходим
				//делаем рекурсивные запуски, чтоб создать промежуточные годы
				if(this.emptyYears&&this.startYear!==null){this.addYear(x<this.startYear?x+1:x-1)}
				//устанавливаем в начало или в конец нужно ставить гол
				var st;if(this.startYear===null||x<this.startYear){st=1;this.startYear=x}
				//получаем табличные ноды
				var nC,nCY,points=this.node.getElementsByTagName('table');
				var years=points[1].tBodies[0].rows[0];points=points[0].tBodies[0].rows;
 				//вычисляем четность года
				var ty=this.years[x+'']={even:points[0].cells.length%2==0,number:x};
				//добавляем ячейки в таблицу поинтов
				for(var i=0;i<this.categoriesCount;i++){
					nC=points[i].insertCell(st?0:points[i].cells.length);
					nC.innerHTML='<div></div>';
					if(ty.even){nC.className='ev'}
				}
				//добавляем ячейку в таблицу годов
				this.years[x+''].node=nCY=years.insertCell(st?0:years.cells.length);
				nCY.innerHTML='<span>'+x+'</span>';
				if(ty.even){nCY.className='ev'}
				return this.years[x+'']
			};
			
			this.catyear={};
			//добавление нового события, x - дата в формате 'гггг.мм.дд', y - описание события(html-строка), z - категория	
			this.addPoint=function(x,y,z,f){
				z=z||'other';x=x||'';f=(f||x||'');
				
				//если задана несуществующая категория, создаем ее
            	if(!this.categories[z]){this.addCategory(z)}
            	
            	//преобразовываем дату, если она пришла из ф-ции парсинга
                if(f){
                	var dR=Math.floor(Math.random()*30)||1;
                	var mR=Math.floor(Math.random()*12)||1;
					x=f.replace(/\s+/g,'').replace(/[^\d\.]/,'-');

					//11–12.2000->1.11.2000
					x=x.replace(/^(\d{1,2})\-\d{1,2}\.(\d{4})$/,dR+'.$1.$2');
					//2000-2002 -> 1.1.2000
					x=x.replace(/^(\d{4})(\-\d{4}|.{0})$/,dR+'.'+mR+'.$1');
					//12.2000 | 12.2000-12.2002 | 12.2000-2002 -> 1.12.2000
					x=x.replace(/^(\d{1,2}\.\d{4})((\-(\d{1,2}\.|.{0})\d{4})|.{0})$/,dR+'.$1');
					//30–31.12.2000->30.12.2000
					x=x.replace(/^(\d{1,2})\-\d{1,2}\.(\d{1,2}\.\d{4})$/,'$1.$2');
					//30.12–31.12.2000->30.12.2000
					x=x.replace(/^(\d{1,2}\.\d{1,2})\-\d{1,2}\.\d{1,2}\.(\d{4})$/,'$1.$2');
					//30.12.2000-30.12.2002->30.12.2000
					x=x.replace(/^(\d{1,2}\.\d{1,2}\.\d{4})((\-\d{1,2}\.\d{1,2}\.\d{4})|.{0})$/,'$1');
					//30.12.2000->2000.12.30
					//alert(f+'\n'+x)
				}
				if(f){x=x.replace(/^(.*)\.(\d{1,2})\.(\d{4})$/,'$3.$2.$1')}
				var date=x.split('.');
				if(!date||!date.join||date.length!==3){alert('Date Format Error!')}
                
				
				//создаем пойнт
                nP=document.createElement('a');
                if(!WK){nP.href='#'}
                nP.className='point';
                //преобразуем диапазон чисел в четкое число
                if(date[2].indexOf('-')>0){
					date[2]=date[2].split('-');
					date[2]=parseInt(date[2][0])+Math.round(Math.abs(date[2][1]-date[2][0])/2)	
				}
                if(!this.catyear[z+'-'+date[0]]){this.catyear[z+'-'+date[0]]={top:[],left:[]}}
                
				var dt=date[2];
				while(this.catyear[z+'-'+date[0]].top[dt]){date[2]>15?dt--:dt++}
				this.catyear[z+'-'+date[0]].top[dt]=1;
				
				var dl=date[1];
				while(this.catyear[z+'-'+date[0]].left[dl]){date[1]>6?dl--:dl++}
				this.catyear[z+'-'+date[0]].left[dl]=1;
				
				nP.style.top=(dt==1?dt:dt*2.5)+'px';
				nP.style.left=(dl==1?dl:dl*2.5)+'px';
                //создаем к пойнту подсказку
				var hlp=document.createElement('div');
				hlp.className=id+'_help';
				hlp.style.visibility='hidden';
				hlp.innerHTML='<div class="'+id+'_help_shadow"><div class="r_box"><i class="r_sup"><i><i><i></i></i></i></i>'+y+'<i class="r_sub"><i><i><i></i></i></i></i></div><div class="'+id+'_help_arrow"></div><div class="'+id+'_help_arrow_in"></div></div><div class="'+id+'_help_block"><div class="r_box"><i class="r_sup"><i><i><i></i></i></i></i>'+y+'<i class="r_sub"><i><i><i></i></i></i></i></div><div class="'+id+'_help_arrow"></div><div class="'+id+'_help_arrow_in"></div></div>';
				document.body.appendChild(hlp);
				nP.help=hlp;
				hlp.lastChild.firstChild.onmouseover=function(e){
					if(timeLine.timer){clearTimeout(timeLine.timer);timeLine.timer=null}
				};
				this.cellIndex=function(t){
					var i=0;
					while(t&&(t=t.previousSibling)){i++}
					return i
				};
                //открытие подсказки
				nP.onmouseover=function(e){
					e=e||event;
					var hlp=this.help;
					//если кликнули по этому же пойнту, выходим
					//if(hlp==timeLine.HELP){return};
					timeLine.HELP_CLOSE();//закрываем старую, если открыта
					hlp.lastChild.firstChild.onmouseover();
					timeLine.HELP=hlp;
                    
					
                    
					var sY=document.body.scrollTop||document.documentElement.scrollTop,sX=document.body.scrollLeft||document.documentElement.scrollLeft;
					//получаем координаты клика относительно страницы
					e.X=e.pageX||e.clientX+sX;e.Y=e.pageY||e.clientY+sY;
                    
					var H=hlp.offsetHeight;
					
					var shadow=hlp.firstChild,block=hlp.lastChild,shadow_arrow=shadow.lastChild.previousSibling,block_arrow=block.lastChild;
                    
                    var where=((e.Y-sY)-H)<0?'top':'bottom';
					
					shadow.className=id+'_help_shadow '+id+'_help_'+where;
					block.className=id+'_help_block '+id+'_help_'+where;
					
					shadow_arrow.style.left=block_arrow.style.left=block_arrow.previousSibling.style.left=(((e.X-sX)-hlp.offsetWidth/2)<0?10:hlp.offsetWidth/2-8)+'px';

					//открываем подсказку внизу если вверху она будет обрезана окном браузера, иначе открываем вверху подсказку
					hlp.style.top=(where=='top'?e.Y+10:(e.Y-H)-10)+'px';
					//открываем подсказку слева по центру если, справа она будет обрезана окном браузера, иначе открываем справа подсказку
					hlp.style.left=(((e.X-sX)-hlp.offsetWidth/2)<0?e.X-16:e.X-hlp.offsetWidth/2)+'px';
			
				    
					hlp.style.visibility='visible';
					hlp.style.overflow='hidden';
					hlp.style.height='20px';
					hlp.style.width=hlp.offsetWidth+offX+'px';
                    function help_open(){
						if(hlp.offsetHeight<H){
							hlp.style.height=hlp.offsetHeight+Math.min(H-hlp.offsetHeight,20)+'px';
							hlp.timer=setTimeout(help_open,helptime);
						}
						else{hlp.style.overflow='visible';clearTimeout(hlp.timer);hlp.timer=null}
					}
					help_open();
					
                    
					
					//отключаем всплытие, чтоб при клике на тело подсказки, в кот. могут быть ссылки, сама подсказка не закрылась
					hlp.onmousedown=function(e){(e||event).cancelBubble=!0};
					//отключаем всплытие, чтобы подсказка тут же не закрывлась из-за навешивания закрытия последней подсказки на document
					e.cancelBubble=!0;
					return!1
				};
				hlp.lastChild.firstChild.onmouseout=nP.onmouseout=function(e){timeLine.timer=setTimeout(timeLine.HELP_CLOSE,450)};
				//IE fixes
				nP.onclick=function(e){return!1};
				nP.onfocus=function(e){window.focus()};
				//возвращаем ноду пойнта
				var yearNode=this.addYear(date[0]).node,yearNodeIndex=typeof yearNode.cellIndex=='number'?yearNode.cellIndex:this.cellIndex(yearNode)||0;
				return this.node.getElementsByTagName('table')[0].tBodies[0].rows[ this.categories[z]-1 ].cells[ yearNodeIndex ].firstChild.appendChild(nP)
			};
			this.parse=function(str){
				var arr=str.replace(/<h([1-6])>/ig,'<h$1 group="other">');
				arr=arr.replace(/\s+/ig,' ').match(/<div[^>]*>(.*?)<\/div>/ig);
				if(arr[0]){
					for(var i=arr.length;i--;){
						arr[i]=arr[i].replace(/(<div(\s+startDate\=\"([^\"]+)\"|.{0})[^>]*>\s*<h[1-6]\s+group\=\"([^\"]+)\">(\s*[\d\.]*(\s*\W\s*|.{0})[\d\.]+\s+|.{0})(.*)<\/h[1-6]>(.*)<\/div>)/i,'this.addPoint(\'$3\',\'$1\',\'$4\',\'$5\');')
					}
					eval(arr.join(''))
				}
				if(this.tenYears){this.tens()}
			};
			this.background=function(x,y){
				for(var rl=ps.rows.length,i=0;i<rl;i++){
					ps.rows[i].cells[x].className=y
				}
			};
			this.tens=function(){
				for(var ar=ys.rows[0].cells,i=ar.length,ev='';i--;){
					var sl=ar[i],slf=sl.firstChild;
					if(parseInt(slf.innerHTML)%10!=0){
						if(i>0){
							var pre=ar[i-1],pref=pre.firstChild,ten1=slf.innerHTML*1,ten2=pref.innerHTML*1;
							ten1=ten1-ten1%10;ten2=ten2-ten2%10;
							if(ten1!==ten2){
								 slf.innerHTML=ten1
							}
							else{slf.innerHTML=''}
						}
						else{
							slf.innerHTML=''
						}
					}
					
					this.background(ar[i].cellIndex||this.cellIndex(ar[i]),ev)
					if(parseInt(slf.innerHTML)%10==0){
						if(!window.stop&&!window.Element){
							slf.style.position='absolute';
							slf.style.marginTop='2px';
						}
						slf.style.marginLeft='-12px';
						ev=ev=='ev'?'':'ev';
					}
					
				}
			
			};
		    return this
		};
		timeLine.HELP=timeLine.SCROLL='';
		timeLine.addEvent=function(tt,ev,fu){
			if(tt.addEventListener){tt.addEventListener(ev,fu,!1)}
			else if(tt.attachEvent){tt.attachEvent('on'+ev,fu)}
		};
		
		//при клике на документ последняя открытая подсказка должна закрыться
		timeLine.HELP_CLOSE=function(e){if(timeLine.HELP){var hlp=timeLine.HELP;hlp.style.visibility='hidden';hlp.style.top=hlp.style.left='-5000px';timeLine.HELP=null}};
		timeLine.SCROLL_CLOSE=function(e){if(timeLine.SCROLL){timeLine.SCROLL=null}};
		timeLine.addEvent(document,'mouseup',timeLine.SCROLL_CLOSE);
