// JavaScript Document
	var d=document, time, step=16, h_visible=0;
	function onLoad(){		
		selection=d.getElementById('selection_block');
		m=d.getElementById('menu');
		h=selection.clientHeight;
		tour=d.getElementById('pop_tour');
		animatedTour(tour);
		
		tour2=d.getElementById('pop_tour2');
		animatedTour(tour2);
		//
		allTable=d.getElementsByTagName('table');
		for(i=0;i<allTable.length;i++){
			if(allTable[i].className=="table_announc"){
				allTr=allTable[i].getElementsByTagName('tr');
				for(j=0;j<allTr.length;j++){
					allTr[j].onmouseover=function(){this.className="active_td";};
					allTr[j].onmouseout=function(){this.className="";};
				}
			}
		}
		// menu
		roll=d.getElementById('m_rol');
		rollMenu(roll);
		
	}
	function showSelect(){				
		clearTimeout(time);
		if(h_visible==0){
			show();
		}
		else{
			hid();
			selection.style.position="absolute";
		}
		function show(){
			if(h_visible<h)
			{
				if(h_visible>h-30)
					{
						h_visible+=2;
						m.style.paddingTop=h_visible+"px";
						selection.style.clip="rect(0px, auto, "+h_visible+"px, auto)";
						time=setTimeout(show, 10);
					}
				else
					{
						h_visible+=step;
						m.style.paddingTop=h_visible+"px";
						selection.style.clip="rect(0px, auto, "+h_visible+"px, auto)";
						time=setTimeout(show, 10);
					}
			}
			else{
				selection.style.position="relative";
				m.style.paddingTop=0;
				n_obj=d.createTextNode('убрать');
				var obj = document.getElementById("tourSelectField");
				obj.replaceChild(n_obj, obj.lastChild);
				obj.className="hid_selection";
			}
		}
		
		function hid(){
			if(h_visible>0)
			{
				if(h_visible<30)
					{
						h_visible-=2;
						m.style.paddingTop=h_visible+"px";
						selection.style.clip="rect(0px, auto, "+h_visible+"px, auto)";
						time=setTimeout(hid, 10);
					}
				else
					{
						h_visible-=step;
						m.style.paddingTop=h_visible+"px";
						selection.style.clip="rect(0px, auto, "+h_visible+"px, auto)";
						time=setTimeout(hid, 10);
					}
			}
			else{
				n_obj=d.createTextNode('подбор тура');
				var obj = document.getElementById("tourSelectField");				
				obj.replaceChild(n_obj, obj.lastChild);
				obj.className="selection";
			}
		}
	}
	
	function animatedTour(tour){
		if (!tour)return;
		tr=tour.getElementsByTagName('tr');
		if(d.getElementById('flag')){
			fl=d.getElementById('flag').getElementsByTagName('img')[0];
			fl.style.marginTop=-(fl.clientHeight/2)+"px";
			fl.style.marginLeft=-(fl.clientWidth/2)+"px";
		}
		for(i=0;i<tr.length;i++){
			if(tr[i].className!="head"){
				if(tr[i].className==""){
					tr[i].onmouseover=function(){this.className="active_tour";};
					tr[i].onmouseout=function(){this.className="";};
				}
				else{
					tr[i].onmouseover=function(){this.className+=" active_tour";};
					tr[i].onmouseout=function(){this.className=this.className.replace(/ active_tour/, "");};
				}
			}
			tr[i].onclick=function(){window.location=this.title;};
		}
	}
	
	function rollMenu(roll){
		bag=d.getElementById('bager');
		//
		var time,l=true,r=false;
		roll.scrollLeft=1000;
		margL=roll.scrollLeft/2;
		margR=roll.scrollLeft;
		roll.scrollLeft=0;
		mUl=roll.getElementsByTagName('ul')[0];
		mUl.style.marginLeft=-margL+"px";
		//
		//
		l_point=d.getElementById('left_arrow');
		r_point=d.getElementById('right_arrow');
		//
		
		mUl.scrollM=function(side, step, speed, to){
			clearTimeout(time);
			if((!side&&margL+step<=margR+145)||(side&&margL-step>=-145)){
				if(margL+to!=margL){
					side==l?margL-=step:margL+=step;
					this.style.marginLeft=-margL+"px";
					time=setTimeout("mUl.scrollM("+side+", "+step+", "+speed+", "+(to-1)+")", speed);
				}
			}
		}
		
		
		l_point.onmouseover=function(){time=setTimeout("mUl.scrollM("+l+", 5, 25, 1000)", 150)};
		l_point.onmouseout=function(){mUl.scrollM(l, 1, 15, 15);};
		r_point.onmouseover=function(){time=setTimeout("mUl.scrollM("+r+", 5, 25, 1000)", 150)};
		r_point.onmouseout=function(){mUl.scrollM(r, 1, 15, 15)};
		
	}

