var Snsart = {	cur_open_block:     "",	dropdown_open: "",	dropdown_closetime: 300,	dropdown_timer: false,	texts: [],	open_popup_num: false,	open_popup_map: false,	custom_login: '',	custom_phone: '',	custom_card:  '',	tbl: [],	popup_slider: [],	initialize: function() {		var t              = Snsart,			i              = 0,			wd             = 200,			j              = 1,			arr            = [],			ben_content_el = {},			change         = 1;		t.resize();		t.init_dropdowns();		j = 1;
		// hiding all blocks		$('main_content').childElements().each(function(block) {			if(j != 1) {				block.hide();			} else {				j = 2;			}			block.setOpacity(0);		});				$('get_bonus_block').hide();		$('get_bonus_block').setOpacity(0);						new Effect.Appear($('main_block_wrap'), { duration: 0.3 });		t.cur_open_block = "main";		$('comments_block').hide();		$('comments_block').setOpacity(0);		$('loader_wrap').hide();		$('loader_wrap').setOpacity(0);
		

		
        // init scrolls		ben_content_el = $('ben_content');
		/* creating arr of values for slider */
        while(i <= 500) {				arr[j] = i;				j++;				i += 10;		}		if(ben_content_el.getDimensions().height > 240) {			change = (ben_content_el.getDimensions().height - 220) / 200;			new Control.Slider('ben_vert_scroll_handle', 'ben_vert_scroll_track', {				axis:        'vertical',				sliderValue: 1,				values:      arr,				range:       $R(0, wd),				restricted:  true,				step:        1,				onSlide: function(v) {					ben_content_el.style.marginTop = (-v * change) + "px";				},				onChange: function(v) {					ben_content_el.style.marginTop = (-v * change) + "px";				}			});		} else {			$('ben_vert_scroll_track').style.display = "none";		}
		t.menu_fix();		$('overlay').hide();	},	resize: function() {		var t                 = Snsart,			scr_size          = t._get_screen_size(),			min_footer_height = 50,			footer_border     = 6,			all_footer_height = 0,			max_site_height   = 850,			min_site_height   = 730;		all_footer_height = min_footer_height + footer_border;		if(scr_size.height > max_site_height + all_footer_height) {			$('wrap_fix').style.height = max_site_height + "px";			$('footer').style.height = (scr_size.height - max_site_height - footer_border) + "px";		} else {			if(scr_size.height < min_site_height + all_footer_height) {				$('wrap_fix').style.height = min_site_height + "px";				$('footer').style.height = min_footer_height + "px";			} else {				$('wrap_fix').style.height = (scr_size.height - all_footer_height) + "px";				$('footer').style.height = min_footer_height + "px";			}		}	},		menu_fix: function() {		var t     = Snsart,			count = 0,			i     = 0;		count = $('nav').childElements().size();		if(count == 3) {			i = 0;			$('nav').childElements().each(function(li) {				switch(i) {					case 0:						li.style.width = "30%";						break;					case 1:						li.style.width = "38%";						break;					case 2:						li.style.width = "30%";						break;				}				++i;			});		} else if(count == 4) {			i = 0;			$('nav').childElements().each(function(li) {				switch(i) {					case 0:						li.style.width = "21%";						break;					case 1:						li.style.width = "29%";						break;					case 2:						li.style.width = "24%";						break;					case 3:						li.style.width = "18%";						break;				}				++i;			});		} else if(count == 5) {			var j = 0;			$$('.dropdown').each(function(dr) {				if(j == 0) {					dr.style.left = "6px";					j++;				} else {					dr.style.left = "0";				}			});		}	},	open_map: function() {		var t = Snsart;		if(t.open_popup_map) {			return;		}		if(typeof console != 'undefined') {			console.log('open-map');		}		$('popup_3').show();		t.open_popup_map = true;	},	close_map: function() {		var t = Snsart;		if(typeof console != 'undefined') {			console.log('close-map');		}		$('popup_3').hide();		t.open_popup_map = false;	},	show_block: function(name) {		var t     = Snsart,			el    = {},			card  = {},			first = $('nav').down(),			mid   = first.next(),			last  = mid.next()			card = $('card__');		if(t.cur_open_block == name) return;		if(name == "to_main_or_not_to_main") {			if(t.cur_open_block == "main") {				name = "get_bonus";			} else {				name = "main";			}		}		var bc = t._browser_check();		if(name != 'main') {			$('house_icon').show();			document.title = $('link_' + name).innerHTML + ' - «Русское такси» г. Томск, всегда приезжаем.';			t.inc_visits_for($('link_' + name).getAttribute('rel'));		} else {			$('house_icon').hide();			document.title = '«Русское такси» г. Томск - 100 руб. по городу, заказ по интернету, всегда приезжаем.';			t.inc_visits_for(11);		}		if(t.cur_open_block == "get_bonus") {			if(name == "main") {				new Effect.Fade($('get_bonus_block'), { duration: 0.3 });				window.setTimeout(function() {					$('get_bonus_block').hide();					$('main_block').setOpacity(0);					$('main_block').show();				}, 305);								new Effect.Tween(null, 400, 30,					{						delay: 0.35,						duration: 0.25,						transition: Effect.Transitions.sinoidal					},					function(p) {						card.style.right = p + "px";					}				);								new Effect.Appear($('main_block'), { delay: 0.6, duration: 0.3 });				window.setTimeout(function() {					t.cur_open_block = "main";				}, 310);				return;			} else {				t.cur_open_block = "main";			}		}				switch(name) {			case "main":				if(parseInt(card.style.right) == 400) {					card.style.right = '30px';					$('get_bonus_block').setOpacity(0);					$('main_block').setOpacity(100);				}				new Effect.Fade($(t.cur_open_block + '_block'), { duration: 0.3 });				window.setTimeout(function() {					$(t.cur_open_block + '_block').hide();					$(name + '_block_wrap').setOpacity(0);					$(name + '_block_wrap').show();				}, 305);				new Effect.Appear($(name + '_block_wrap'), { delay: 0.32, duration: 0.3 });				window.setTimeout(function() {					t.cur_open_block = name;				}, 310);				break;			case "get_bonus":				if(t.cur_open_block == "main") {					new Effect.Fade($('main_block'), { duration: 0.3 });					window.setTimeout(function() {						$('main_block').hide();						$('get_bonus_block').setOpacity(0);						$('get_bonus_block').show();					}, 305);															new Effect.Tween(null, 30, 400,						{							delay: 0.32,							duration: 0.25,							transition: Effect.Transitions.sinoidal						},						function(p) {							card.style.right = p + "px";						}					);										new Effect.Appear($('get_bonus_block'), { delay: 0.6, duration: 0.3 });					window.setTimeout(function() {						t.cur_open_block = name;					}, 310);				} else {					$('get_bonus_block').show();					new Effect.Fade($(t.cur_open_block + '_block'), { duration: 0.3 });					window.setTimeout(function() {						$(t.cur_open_block + '_block').hide();						$('main_block').hide();						$('main_block_wrap').setOpacity(0);						$('main_block_wrap').show();					}, 305);										$('get_bonus_block').setOpacity(100);					new Effect.Appear($('main_block_wrap'), { delay: 0.32, duration: 0.3 });										window.setTimeout(function() {						card.style.right = "400px";						t.cur_open_block = name;					}, 310);				}								//1 - fade block				//2 - show bonus block				break;			case "benefits":				if($(t.cur_open_block + '_block_wrap')) {					el = $(t.cur_open_block + '_block_wrap');				} else {					el = $(t.cur_open_block + '_block');				}				new Effect.Fade(el, { duration: 0.3 });				window.setTimeout(function() {					el.hide();					$(name + '_block').setOpacity(0);					$(name + '_block').show();				}, 305);				new Effect.Appear($(name + '_block'), { delay: 0.32, duration: 0.3 });				window.setTimeout(function() {					t.cur_open_block = name;					new Effect.Appear($('main_block'), { duration: 0.1 });				}, 310);				break;			case "comments":				if($(t.cur_open_block + '_block_wrap')) {					el = $(t.cur_open_block + '_block_wrap');				} else {					el = $(t.cur_open_block + '_block');				}				new Effect.Fade(el, { duration: 0.3 });				window.setTimeout(function() {					el.hide();					$(name + '_block').setOpacity(0);					$(name + '_block').show();				}, 305);				new Effect.Appear($(name + '_block'), { delay: 0.32, duration: 0.3 });				window.setTimeout(function() {					t.cur_open_block = name;					new Effect.Appear($('main_block'), { duration: 0.1 });				}, 310);				break;			case "programm":				if($(t.cur_open_block + '_block_wrap')) {					el = $(t.cur_open_block + '_block_wrap');				} else {					el = $(t.cur_open_block + '_block');				}				new Effect.Fade(el, { duration: 0.3 });				window.setTimeout(function() {					el.hide();					$(name + '_block').setOpacity(0);					$(name + '_block').show();				}, 305);				new Effect.Appear($(name + '_block'), { delay: 0.32, duration: 0.3 });				window.setTimeout(function() {					t.cur_open_block = name;					new Effect.Appear($('main_block'), { duration: 0.1 });				}, 310);				break;			default:				if($(t.cur_open_block + '_block_wrap')) {					el = $(t.cur_open_block + '_block_wrap');				} else {					el = $(t.cur_open_block + '_block');				}				new Effect.Fade(el, { duration: 0.3 });				window.setTimeout(function() {					el.hide();					$(name + '_block').setOpacity(0);					$(name + '_block').show();				}, 305);				new Effect.Appear($(name + '_block'), { delay: 0.32, duration: 0.3 });				window.setTimeout(function() {					t.cur_open_block = name;					new Effect.Appear($('main_block'), { duration: 0.1 });				}, 310);				break;		}	},	toggle_card_field: function() {		var card_el = $('card_id');		if(!card_el.style.display) {			card_el.hide();			card_el.value = "";			$('card_label').hide();			$('card_cl_btn').hide();			$('card_link').show();		} else {			card_el.show();			$('card_label').show();			$('card_cl_btn').show();			$('card_link').hide();		}	},	add_comment: function() {		var t       = Snsart,			url     = 'comments.php',			name    = $F('c_name_id'),			email   = $F('c_email_id'),			comment = $F('c_review_id'),			pars    = "";		pars = 'name=' + name + '&email=' + email + '&comment=' + comment;				var myAjax = new Ajax.Request(url, {			method: 'get',			parameters: pars,			onComplete: function(request) {				$('comments_wrap').innerHTML = '<p>Спасибо за Ваш отзыв!</p>';			}		});	},	make_custom: function() {		var t           = Snsart,			url         = 'test.php',			login       = $F('name_id'),			phone       = $F('phone_id'),			card_number = ( $F('card_id') ? $F('card_id') : '' ),			pars        = "";				if(!phone || phone == "+7") {			alert('Введите телефон');			return;		}		phone = phone.replace(' ', '');		if(phone.charAt(0) == "+") {			phone = phone.substr(2);		}				t.custom_login = login;		t.custom_phone = phone;		t.custom_card  = card_number;				pars = 'login=' + login + '&'			+  'phone=' + phone + '&'			+  'card_number=' + card_number;				t.custom_load_start();		var myAjax = new Ajax.Request(url, {			method: 'get',			parameters: pars,			onComplete: function(request) {				t.custom_load_stop(request.responseText);			}		});			},	remake_custom: function() {		var t           = Snsart,			url         = 'test.php',			pars        = "";		pars = 'login=' + t.custom_login + '&'			+  'phone=' + t.custom_phone + '&'			+  'card_number=' + t.custom_card;		t.custom_load_start();		var myAjax = new Ajax.Request(url, {			method: 'get',			parameters: pars,			onComplete: function(request) {				if(typeof console != 'undefined') {					console.log('answer: ' + request.responseText);				}				t.custom_load_stop(request.responseText);			}		});	},	custom_load_start: function() {		var t              = Snsart,			loader_wrap_el = $('loader_wrap'),			bar            = {};				new Effect.Fade($('custom_text_wrap'), { duration: 0.3 });		new Effect.Appear(loader_wrap_el, { delay: 0.32, duration: 0.3 });				bar = loader_wrap_el.down().next("#loader").down(".bar");				new Effect.Tween('loader', 0, 235, {				delay: 0.7,				duration: 4.30			},			function(p) {				bar.style.width = p + "px";			}		);	},	custom_load_stop: function(text) {		var t = Snsart;				if(typeof console != 'undefined') {			console.log('custom-load-stop');		}		$('custom_text_wrap').innerHTML = text;		new Effect.Fade($('loader_wrap'), { duration: 0.3 });		new Effect.Appear($('custom_text_wrap'), { delay: 0.32, duration: 0.3 });	},	init_dropdowns: function() {		$$('.dropdown').each(function(dropdown) {			dropdown.hide();		});	},	show_dropdown: function(name) {		var t = Snsart;		if(t.dropdown_timer != false) {			window.clearTimeout(t.dropdown_timer);			t.dropdown_timer = false;		}		if(t.dropdown_open != false) {			if(name != t.dropdown_open) {				t.close_dropdown(t.dropdown_open);			}		}		$('dropdown_' + name).show();		$('link_' + name).addClassName('without_und');		t.dropdown_open = name;	},	start_close_dropdown: function(name) {		var t = Snsart;		t.dropdown_timer = setTimeout(function() {			t.close_dropdown(name);		}, t.dropdown_closetime);	},	close_dropdown: function(name) {		var t = Snsart;		$('link_' + name).removeClassName('without_und');		$('dropdown_' + name).hide();		t.dropdown_open = false;	},	initialize_popup: function() {		var t       = Snsart,			i       = 0,			j       = 0,			wd      = 500,			arr     = [],			hgt     = 0,			mst_hgt = 490,			change  = [];		while(i <= wd) {			arr[j] = i;			j++;			i += 10;		}				i = 1;		$$('.popup').each(function(div) {			div.style.left = "50%";			if(div.down().next('.tbl_wrap')) {				t.tbl[i] = div.down().next('.tbl_wrap').down();			} else {				div.hide();				++i;				return;			}						hgt = t.tbl[i].getDimensions().height;			if(hgt > mst_hgt) {			   				change[i] = (hgt - mst_hgt) / mst_hgt;				/*				t.popup_slider[i] = new Control.Slider('popup_scroll_handle_' + i, 'popup_scroll_' + i, {					axis:        'vertical',					sliderValue: 0,					values:      arr,					range:       $R(0, wd),					restricted:  true,					onSlide: function(v) {						t.tbl[t.open_popup_num].style.marginTop = -(v * change[t.open_popup_num]) + "px";					},					onChange: function(v) {						t.tbl[t.open_popup_num].style.marginTop = -(v * change[t.open_popup_num]) + "px";					}				});				*/				if (($('popup_content_' + i) != null) && ($('popup_scroll_' + i) != null)) {					t.popup_slider[i] = new Control.ScrollBar('popup_content_' + i, 'popup_scroll_' + i);					t.popup_slider[i].recalculateLayout();				}											} else {				$('popup_scroll_' + i).hide();			}			div.hide();			++i;		});	},	open_popup: function(num) {		var t = Snsart;		if(t.open_popup_num == num) {			return;		}		$('popup_' + num).show();		t.open_popup_num = num;				t.resize();			},	close_popup: function() {		var t = Snsart;		if(typeof console != 'undefined') {			console.log('popup-close');		}		$('popup_' + t.open_popup_num).hide();		t.open_popup_num = false;	},	inc_visits_for: function(page_id) {		var t       = Snsart,			url     = 'statistic.php',			pars    = "id=" + page_id		var myAjax = new Ajax.Request(url, {			method: 'get',			parameters: pars,			onComplete: function(request) { }		});	},	/**	 * @access private	 */	_get_screen_size: function() {		var iebody = (document.compatMode && document.compatMode != "BackCompat" ? document.documentElement : document.body);		var width  = (Prototype.Browser.IE ? iebody.clientWidth : (document.documentElement.clientWidth || self.innerWidth));		var	height = (Prototype.Browser.IE ? iebody.clientHeight : self.innerHeight);				return { width: width, height: height };	},	/**	 * @access private	 */	_browser_check : function() {		this.ver   = navigator.appVersion;		this.agent = navigator.userAgent;		this.dom   = document.getElementById ? 1 : 0;		this.ie6   = (this.ver.indexOf("MSIE 6") > -1 && this.dom) ? 1 : 0;		this.ie7   = (this.ver.indexOf("MSIE 7") > -1 && this.dom) ? 1 : 0;		this.ie8   = (this.ver.indexOf("MSIE 8") > -1 && this.dom) ? 1 : 0;		this.opera = (this.agent.indexOf("Opera") > -1 && this.dom) ? 1 : 0;		this.moz   = (!this.ie7 && !this.ie6 && !this.opera) ? 1 : 0;		this.bw    = (this.ie6 || this.ie7 || this.notie || this.opera);		return this;	}};
function setupScroll()
{
    var scrollbar = new Control.ScrollBar('page_content_0', 'page_scroll_0');
    $('page_scroll_1').style.display = 'none';
    
}
Event.observe(window, 'load', setupScroll , false);Event.observe(window, 'load', Snsart.initialize_popup, false);Event.observe(window, 'load', Snsart.initialize, false);Event.observe(window, 'resize', Snsart.resize, false);


