			var cur = 0,
				idnum = 0,
				select_line=-1;
			
			window.onresize = function(){
				document.getElementById('holder').innerHTML = '';
				load();
				
			}

			function getClientWidth(){
			return (window.innerWidth ? window.innerWidth : (document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.offsetWidth));
			}

			function getClientHeight(){
			return (window.innerHeight ? window.innerHeight : (document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.offsetHeight));
			}
						
			
			function closeGal(){
				document.getElementById("vgallery").style.visibility = "hidden";
			}
			
			function bignews(){
			var html = document.documentElement,
					W = getClientWidth(),
					H = getClientHeight();
					
					if (H < 850) {H = 850; W = html.clientWidth;};

				document.getElementById("pane").style.height = (H/100)*60+'px';
				
			}
				
				
				function currentline(){
					var linev = document.getElementById('line'),
						H = getClientHeight(),
						curline;
						

					curline = $("#current a").position().left;
					linev.style.display = 'block';
					linev.style.height = H + 'px';
					linev.style.left = curline - 5 + 'px';

				}

				
				
			function load()
			{	
			
				document.getElementById("total").style.visibility = "visible";
				document.getElementById("load").style.visibility = "hidden";
				  
 
				
			    pager();
			
				document.getElementById("load").style.visibility = "hidden";

				var html = document.documentElement,
					W = getClientWidth(),
					H = getClientHeight()-15;
					
					if (H < 850) {H = 850; W = html.clientWidth; document.body.style.overflow = "auto";}
					
					if (W < 1280) W = 1280;
					
				var	r = Raphael("holder", W, H),
                    values = [],
					len = 9;

				for (var i = len; i--;) {
                    values.push(50);
                }
				
				

                function translate(x, y) {
                    return [
                        -5+(W+10) / (values.length - 1) * x,
                        H - 50 - (H - 20) / 60 * y,
						
				    ];
				}
				

				function line(cur, selectX)
				{
					var	linev = document.getElementById('line'),
						x11 = 0;

					if (x11 != selectX[cur]){
						
						linev.style.display = 'block';
						linev.style.height = H + 15 + 'px';
						linev.style.left = selectX[cur]+'px';
						x11 = selectX[cur];
						
						}
					else
						if (linev.style.display != 'none'){
							linev.style.display = 'none';
						}
						else {
							linev.style.display = 'block';
							linev.style.height = H + 15 + 'px';
							linev.style.left = selectX[cur]+'px';
							x11 = selectX[cur];
							}
				}

                function drawPath() {
				
                    var p = [];
                    for (var j = 1, jj = X.length; j < jj; j++) {
                        p.push(X[j], Y[j]);
                    }
                    p = ["M", X[0], Y[0], "R"].concat(p);
                    var subaddon = "L" + (W - 10) + "," + (H - 10) + ",50," + (H - 10) + "z";
                    path.attr({path: p});
                }
				                
				function drawPath2() {
					var p1 = [];
					//document.write(X);
                    for (var j1 = 1, jj1 = X1.length; j1 < jj1; j1++) {
                        p1.push(X1[j1], Y1[j1]);
                    }
                    p1 = ["M", X1[0], Y1[0], "R"].concat(p1);
                    var subaddon = "L" + (W - 10) + "," + (H - 10) + ",50," + (H - 10) + "z";
                    path2.attr({path: p1});
                }
				
				function drawPath3() {
					var p2 = [];
					//document.write(X);
                    for (var j1 = 1, jj1 = X2.length; j1 < jj1; j1++) {
                        p2.push(X2[j1], Y2[j1]);
                    }
                    p2 = ["M", X2[0], Y2[0], "R"].concat(p2);
                    var subaddon = "L" + (W - 10) + "," + (H - 10) + ",50," + (H - 10) + "z";
                    path3.attr({path: p2});
                }
								
				function drawPath4() {
					var p3 = [];
					//document.write(X);
                    for (var j1 = 1, jj1 = X3.length; j1 < jj1; j1++) {
                        p3.push(X3[j1], Y3[j1]);
                    }
                    p3 = ["M", X3[0], Y3[0], "R"].concat(p3);
                    var subaddon = "L" + (W - 10) + "," + (H - 10) + ",50," + (H - 10) + "z";
                    path4.attr({path: p3});
                }
				
				function drawPath5() {
					var p4 = [];
					//document.write(X);
                    for (var j1 = 1, jj1 = X4.length; j1 < jj1; j1++) {
                        p4.push(X4[j1], Y4[j1]);
                    }
                    p4 = ["M", X4[0], Y4[0], "R"].concat(p4);
                    var subaddon = "L" + (W - 10) + "," + (H - 10) + ",50," + (H - 10) + "z";
                    path5.attr({path: p4});
                }
				
				
				
                var p = [["M"].concat(translate(0, values[0]))],
				
                    color = "#656565",
					color2 = "#fff",
					
					w = W / 100,
                    
					X=[0,w*4,w*20,w*50,w*68,w*72,w*70];//тесты, профессии
					Y=[150,130,80,70,60,270,H+15];
					
					X1=[0, w*2, w*17, w*40, w*83, W];//карта, новости
					Y1=[60, 70, 140, 160, 50, 40];
					
					X2=[w*72,w*70,w*74,W];//не рисуются точки
					Y2=[H+15,370,100,90];
					
					
					X3=[w*20,w*85,W];//рейтинги
					Y3=[80,140,160];
					
					
					X4=[0,w*30,w*90,W];//мероприятия
					Y4=[90,120,110,110];

                    blankets1 = r.set(),
                    buttons1 = r.set(),
					
					blankets2 = r.set(),
                    buttons2 = r.set(),
					
					blankets3 = r.set(),
                    buttons3 = r.set(),
					
					blankets4 = r.set(),
                    buttons4 = r.set(),
					
					blankets5 = r.set(),
                    buttons5 = r.set(),
					
                    w = (W - 60) / values.length,
                    isDrag = -1,

                    start = null,
                    //sub = r.path().attr({stroke: "none", fill: [90, color2, color2].join("-"), opacity: 0}),
                    
					path = r.path().attr({stroke: color, "stroke-width": 3}),
					path2 = r.path().attr({stroke: color, "stroke-width": 2}),
					path3 = r.path().attr({stroke: color, "stroke-width": 1}),
					path4 = r.path().attr({stroke: color, "stroke-width": 2}),
					path5 = r.path().attr({stroke: color, "stroke-width": 0.5}),

                    unhighlight = function () {};
                var ii;

				function PointBrush(pointX,pointY,buttons,blankets,index_line){

					for (i = 1, ii = pointX.length; i < ii-1; i++) {
                    var xy = translate(i, values[i]),
                        xy1 = translate(i + 1, values[i + 1]),
                        f;
                    
                    (f = function (i, xy) {
						
						buttons.push(r.circle(pointX[i], pointY[i], 3).attr({fill: color2, stroke: color, "stroke-width": 6}));
						// document.write(X);
                        blankets.push(r.circle(pointX[i], pointY[i], 5).attr({stroke: "none", fill: "#fff", opacity: 0}).mouseover(function () {
                            if (isDrag + 1) {
                                unhighlight = function () {};
                            } else {
                                buttons.items[i-1].animate({r: 10}, 200);
                            }
                        }).click(function () {
							cur = i;
							select_line = index_line;
							line(cur, pointX);
							switch (index_line) {
								case 1: idnum = i - 1; break;  
								case 2: idnum = X.length + i - 3; break;
								//case 3: line(cur, X2); break;
								case 4: idnum = X.length + X1.length + i -5; break;
								case 5: idnum = X.length + X1.length + X3.length + i -7; break;
							};

							window.location.href = document.getElementById('id'+idnum).href;
						}).mouseout(function () {
							
							if (isDrag + 1) {
										unhighlight = function () {
											buttons.items[i-1].animate({r: 3}, 200);
										};
									} else {
										buttons.items[i-1].animate({r: 3}, 200);
									}

                        }).drag(function (dx, dy) {
                            var start = this.start;
                            start && update(start.i, start.p + dy);
                        }, function (x, y) {
                            //this.start = {i: i, m: y, p: Y[i]};
                        }));
                        blankets.items[blankets.items.length - 1].node.style.cursor = "pointer";
						
                    })(i, xy);
                    if (i == ii - 1) {
                        f(i + 1, xy1);
                    }
				
                }
					
				}	
				
				PointBrush(X,Y,buttons1,blankets1,1);
				
				PointBrush(X1,Y1,buttons2,blankets2,2);
				
				//PointBrush(X2,Y2,buttons3,blankets3,3);
				PointBrush(X3,Y3,buttons4,blankets4,4);
				
				PointBrush(X4,Y4,buttons5,blankets5,5);
				
				drawPath();
                drawPath2();
				drawPath3();
				drawPath4();
				drawPath5();
				
				var w = W/100;
				
				var	linev = document.getElementById('line');
				
				var wiki = document.getElementById("id5");
				wiki.style.left = w*2+'px'; 
				wiki.style.top = 70-25+'px'; 
				
				var news = document.getElementById("id7");
				news.style.left = w*40+'px'; 
				news.style.top = 160+5+'px'; 
				
				var map = document.getElementById("id6");
				map.style.left = w*17+'px'; 
				map.style.top = 140+5+'px'; 
				
				var work = document.getElementById("id8");
				work.style.left = w*83+'px'; 
				work.style.top = 50+5+'px'; 
				
				
				
				var tender = document.getElementById("id0");
				tender.style.left = w*4+'px'; 
				tender.style.top = 130+5+'px'; 
				
				var prof = document.getElementById("id1");
				prof.style.left = w*20+'px'; 
				prof.style.top = 80-30+'px'; 
				
				var rating = document.getElementById("id9");
				rating.style.left = w*85+'px'; 
				rating.style.top = 140+5+'px'; 
				
				
				
				var tests = document.getElementById("id2");
				tests.style.left = w*50+'px'; 
				tests.style.top = 70-30+'px'; 
				
				var parent = document.getElementById("id3");
				parent.style.left = w*68+'px'; 
				parent.style.top = 60-25+'px'; 
				
				
				var events = document.getElementById("id10");
				events.style.left = w*30+'px'; 
				events.style.top = 120+5+'px'; 
				
				var feedback = document.getElementById("id11");
				feedback.style.left = w*90+'px'; 
				feedback.style.top = 110-25+'px'; 
								
				var gal = document.getElementById("id13");
				gal.style.left = W/50+"px";
				gal.style.top = H/3+"px";	
				
				var calendar = document.getElementById("id12");
				calendar.style.left = W/25+"px";
				calendar.style.top = 200+"px";
								
				var cont = document.getElementById("id14");
				cont.style.left = W/25+"px";
				cont.style.top = H/2+"px";
				
				
				var logo = document.getElementById("logo");
				logo.style.left = w*72-54+'px'; 
				logo.style.top = 220+'px'; 
				
				var cfon = document.getElementById("content-fon");
				cfon.style.top = H-407+8+"px";
				cfon.style.width = W+"px";
				
				
				var content = document.getElementById("content");
				content.style.width = W+"px";
				content.style.height = H+15+"px";
					


				var container = document.getElementById("container");
				container.style.left = W/10+'px'; 
				container.style.top = 200+'px'; 
				container.style.width = w*55+"px";
				container.style.height = "auto";
				
				function getElementsByNameIE(tag, name) {
     
					 var elem = document.getElementsByTagName(tag);
					 var arr = new Array();
					 for(i = 0,iarr = 0; i < elem.length; i++) {
						  att = elem[i].getAttribute("name");
						  if(att == name) {
							   arr[iarr] = elem[i];
							   iarr++;
						  }
					 }
					 return arr;
				}
				
				var item1 = getElementsByNameIE("div", "item");
				
				for (i = 0; i < item1.length; i++){
					
					item1[i].style.width = w*55+"px";
					item1[i].style.height = "auto";
				}					
				
				var blocksize = getElementsByNameIE("div", "blocksize");
				
				for (i = 0; i < blocksize.length; i++){
					
					blocksize[i].style.width = w*55+"px";
					blocksize[i].style.height = (H/100)*60+'px';

				}	
				
					var linev = document.getElementById('line');

					
					var curline = getElementsByNameIE("a", "current");

					linev.style.display = 'block';
					
					linev.style.height = H + 15 + 'px';

					linev.style.left = curline[0].style.left;

				/*
				var bignews = document.getElementById("bignews");
				bignews.style.width = W/2+"px";
				bignews.style.height = H/2+"px";
				*/

				var html = document.documentElement;
					var vgallery = document.getElementById("vgallery");
					vgallery.style.left = W/10+'px'; 
					vgallery.style.height = H+15+'px'; 
				
				/*
				var point = document.getElementById("point");
				point.style.width = W+"px";
				point.style.height = H+"px";
				*/
				var color = '#656565';
				
				var cir = r.set(),
					cir2 = r.set(),
					cir3 = r.set(),
					isDrag = -1;

				
				var l1 = document.getElementById("line_l1");
				l1.style.height = H+15+"px";
				l1.style.left = W/50+"px";
				cir.push(r.circle(W/50, H/3, 3).attr({fill: "#fff", stroke: color, "stroke-width": 6}));
				cir.push(r.circle(W/50, H/3, 10).attr({stroke: "none", fill: "#fff", opacity: 0}).mouseover(function () {
                            if (isDrag + 1) {
                                unhighlight = function () {};
                            } else {
                                cir.items[0].animate({r: 10}, 200);
                            }
                        }).mouseout(function () {
                            if (isDrag + 1) {
                                unhighlight = function () {
                                    cir.items[0].animate({r: 3}, 200);
                                };
                            } else {
                                cir.items[0].animate({r: 3}, 200);
								
                            }
						}).click(function () {
							if (vgallery.style.visibility == "hidden") {
								vgallery.style.visibility = "visible";
							}
							else vgallery.style.visibility = "hidden";
							
							}
							));
				cir.items[cir.items.length - 1].node.style.cursor = "pointer";
				isDrag = -1;
				
				var l2 = document.getElementById("line_l2");
				l2.style.height = H+15+"px";
				l2.style.left = W/25+"px";
				cir2.push(r.circle(W/25, H/2, 2).attr({fill: "#fff", stroke: color, 'stroke-width': 6}));
				
				cir2.push(r.circle(W/25, H/2, 8).attr({stroke: "none", fill: "#fff", opacity: 0}).mouseover(function () {
                            if (isDrag + 1) {
                                unhighlight = function () {};
                            } else {
                                cir2.items[0].animate({r: 8}, 200);
                            }
                        }).mouseout(function () {
                            if (isDrag + 1) {
                                unhighlight = function () {
                                    cir2.items[0].animate({r: 2}, 200);
                                };
                            } else {
                                cir2.items[0].animate({r: 2}, 200);
								
                            }
						}).click(function () {
							
							window.location.href = document.getElementById('id14').href;
							}
							));
				cir2.items[cir2.items.length - 1].node.style.cursor = "pointer";
				isDrag = -1;
				
				
				var l3 = document.getElementById("line_l3");
				l3.style.height = 200+"px";
				l3.style.left = W/25+"px";
				cir3.push(r.circle(W/25, 200, 3).attr({fill: "#fff", stroke: color, "stroke-width": 6}));
				cir3.push(r.circle(W/25, 200, 10).attr({stroke: "none", fill: "#fff", opacity: 0}).mouseover(function () {
                            if (isDrag + 1) {
                                unhighlight = function () {};
                            } else {
                                cir3.items[0].animate({r: 10}, 200);
                            }
                        }).mouseout(function () {
                            if (isDrag + 1) {
                                unhighlight = function () {
                                    cir3.items[0].animate({r: 3}, 200);
                                };
                            } else {
                                cir3.items[0].animate({r: 3}, 200);
								
                            }
						}).click(function () {
							window.location.href = document.getElementById('id12').href;
							}
							));
				cir3.items[cir3.items.length - 1].node.style.cursor = "pointer";
							
				var r1 = document.getElementById("line_r1");
				r1.style.height = H+15+"px";
				
				var swipe = document.getElementById("swipe_container");
				swipe.style.width = item1.length*(w*55)+"px";
				

				//alert(selectX);
				
				switch (select_line) {
					case 1: line(cur, X); break;  
					case 2: line(cur, X1); break;
					//case 3: line(cur, X2); break;
					case 4: line(cur, X3); break;
					case 5: line(cur, X4); break;
				};
				
				
				
				
}
	
	
	
	
	
	
	
	
	
		//pager
	var item_index = 1;	
	
	function pager(){

		var html = document.documentElement,
		W = getClientWidth();
		H = getClientHeight();
		if (H < 850) {H = 850; W = html.clientWidth;};
		if (W < 1280) W = 1280;
	    var item_width = (W/100)*55;
	    var items = $("#swipe_container > div.item").length;
	    var cont_post_temp;

	    
	    $("#swipe_container").draggable({ axis: "x", revert: true });
		$("#swipe_container").unbind('mouseup');
		$("#swipe_container").animate({left: -1*item_width*(item_index-1)},0);		
		var cont_pos = $("#swipe_container").position();


		function bindMouseUp() {  		
	        $("#swipe_container").unbind('mouseup');
	        cont_post_temp = $("#swipe_container").position().left;

	        if ((cont_pos.left > cont_post_temp) && (item_index != items)) {
	            // Перелистывание вправо
	            $("#swipe_container").draggable("option", "revert", false);
				
	            var moveLeft = cont_pos.left - cont_post_temp;

	            moveLeft = Math.abs(item_width - moveLeft);

	            $("#swipe_container").animate({
	                left: '-=' + moveLeft
	            }, 500, function() {
	                $("#swipe_container").draggable("option", "revert", true);
	                cont_pos = $("#swipe_container").position();
	                $("#swipe_container").bind('mouseup', function() {
	                    bindMouseUp();
	                });
	            });
	            item_index++;
	        } else if (cont_pos.left < cont_post_temp && item_index != 1) {
	            // Перелистывание влево
	            $("#swipe_container").draggable("option", "revert", false);
	            var moveLeft = cont_post_temp - cont_pos.left;
	            moveLeft = Math.abs(item_width - moveLeft);
	            $("#swipe_container").animate({
	                left: '+=' + moveLeft
	            }, 500, function() {
	                $("#swipe_container").draggable("option", "revert", true);
	                cont_pos = $("#swipe_container").position();
	                $("#swipe_container").bind('mouseup', function() {
	                    bindMouseUp();
	                });
	            });
	            item_index = item_index - 1;
	        } else {
	            // В начале или в конце перелистывания страницы
	            $("#swipe_container").draggable( "option", "revert", true );
	            $("#swipe_container").bind('mouseup', function() {
	                bindMouseUp();
	            });
	        }
			
	    }

	    $("#swipe_container").mouseup(function() {
	        bindMouseUp();
	    });


};		





		function bindMouseUpRight() {	

			var html = document.documentElement,
			W = getClientWidth();
			H = getClientHeight();
			if (H < 850) {H = 850; W = html.clientWidth;};
			if (W < 1280) W = 1280;
			var item_width = (W/100)*55;
			var items = $("#swipe_container > div.item").length;
			var cont_post_temp;	

			var cont_pos = $("#swipe_container").position();

			cont_post_temp = $("#swipe_container").position().left;
			
			if (item_index != items) {
	            // Перелистывание вправо
				
	            $("#swipe_container").draggable("option", "revert", false);
	            var moveLeft = item_width;
			    $("#swipe_container").animate({
	                left: '-=' + moveLeft
	            }, 500, function() {
						
					pager();
	                $("#swipe_container").draggable("option", "revert", true);
	                cont_pos = $("#swipe_container").position();

	            });
				
	            item_index++;
			} 

		
		}
		
		function bindMouseUpLeft() {	

		var html = document.documentElement,
		W = getClientWidth();
		H = getClientHeight();
		if (H < 850) {H = 850; W = html.clientWidth;};
		if (W < 1280) W = 1280;
	    var item_width = (W/100)*55;
	    var items = $("#swipe_container > div.item").length;
	    var cont_post_temp;

		var cont_pos = $("#swipe_container").position();

	        cont_post_temp = $("#swipe_container").position().left;
			if (item_index != 1) {
	            // Перелистывание влево
	           $("#swipe_container").draggable("option", "revert", false);
	            moveLeft = item_width;
	
	            $("#swipe_container").animate({
	                left: '+=' + moveLeft
	            }, 500, function() {
							
					pager();
	                $("#swipe_container").draggable("option", "revert", true);
	                cont_pos = $("#swipe_container").position();

	            });
				
	            item_index = item_index - 1;

			}

	    }	

