function showComments(table, parent_id, offset) {
	byId('page_comments').style.display = 'block';
	AjaxRequest.send(null, '/tools/comment/site/load_comments.php', '', true, {'parent_id': parent_id, 'offset': offset, 'table': table});
}
function showLogin(show) {
	var display = (show) ? 'block' : 'none';
	byId('passport_bg').style.display=display;
	byId('passport').style.display=display;
}
function search_preload(type) {
	AjaxRequest.send('toursearch_form', '/actions_site.php', 'Идёт загрузка данных...', true, {'type':type});
	if (byId('resort_title')) {
		byId('resort_title').style.display='block';
		byId('night_title').style.display='block';
	}
}
function show_age(age) {
	for(i=0;i<5;i++) {
		byId('show_age_'+i).style.display='none';
	}
	if (age == 0) {
		return;
	}
	for (i=0;i<=age;i++) {
		byId('show_age_'+i).style.display='inline';
	}
}
function cleanList(name, status) {
	var elem = document.getElementsByTagName('INPUT');
	var sel = new Array();
	for(var i=0;i<elem.length;i++) {
		if (elem[i].id.substr(0, name.length) == name) {
			elem[i].checked = status;
		}
	}
}
function getBrowserInfo() {
	var t,v = undefined;
	if (window.opera) t = 'Opera';
	else if (document.all) {
		t = 'IE';
		var nv = navigator.appVersion;
		var s = nv.indexOf('MSIE')+5;
		v = nv.substring(s,s+1);
	}
	else if (navigator.appName) t = 'Netscape';
	return {type:t,version:v};
}

function bookmark(a){
	var url = window.document.location;
	var title = window.document.title;
	var b = getBrowserInfo();
	if (b.type == 'IE' && 7 > b.version && b.version >= 4) window.external.AddFavorite(url,title);
	else if (b.type == 'Opera') {
		a.href = url;
		a.rel = "sidebar";
		a.title = url+','+title;
		return true;
	}
	else if (b.type == "Netscape") window.sidebar.addPanel(title,url,"");
	else alert("Нажмите CTRL-D, чтобы добавить страницу в закладки.");
	return false;
}


// Поиск туров

function toursearch_result(page_start) {
	AjaxRequest.send('toursearch_form', '/actions_site.php', 'Идёт загрузка данных...', true, {'_event':'galopom/toursearch_result', 'page_start':page_start});
}
function get_toursearch_info(price_id, price) {
	if(byId('layer_info_'+price_id).innerHTML == '') {
		AjaxRequest.send('', '/actions_site.php', 'Идёт загрузка данных...', true, {'_event':'galopom/toursearch_info', 'price_id':price_id, 'price':price});
	} else {
		byId('layer_info_'+price_id).innerHTML = '';
	}
}
function resize_description(price_id) {
	if (!byId('hotel_description_'+price_id)) {
		return;
	}
}
function show_description(price_id, hotel_id, type) {
	byId('description_'+price_id+'_'+hotel_id).style.display='none';
	byId('photo_'+price_id+'_'+hotel_id).style.display='none';
	
	byId('folder_description_'+price_id+'_'+hotel_id).className='';
	byId('folder_photo_'+price_id+'_'+hotel_id).className='';
	
	byId('folder_'+type+'_'+price_id+'_'+hotel_id).className='selected';
	byId(type+'_'+price_id+'_'+hotel_id).style.display='block';
	byId('hotel_description_'+price_id).scrollTop=0;
}
function getBodyScrollTop() {
	return self.pageYOffset || (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop);
}
function show_tendency(x, y, param_1, param_2) {
	var obj = document.getElementById('price_history');
	obj.style.top = y + getBodyScrollTop() + 'px';
	obj.style.left = x - 550 + 'px';
	obj.innerHTML = 'Идёт загрузка данных, подождите...';
	AjaxRequest.send('', '/actions_site.php', 'Идёт загрузка данных', true, {'param_1':param_1,'param_2':param_2,'_event':'galopom/toursearch_price_history'});
}
function show_history() {
	document.getElementById('price_history').style.display='block';
	document.getElementById('price_history').innerHTML = document.getElementById('layer_buffer').innerHTML;
}
function hide_history() {
	document.getElementById('price_history').style.display='none';
}
function add_date(obj) {
	var d = obj.value.split('.');
	var d2 = new Date(d[2], d[1], Math.ceil(d[0]) + 2);
	var dday = d2.getDate();
	var dmonth = d2.getMonth();
	var dyear = d2.getFullYear();
	if (dday < 10) dday = '0'+dday;
	if (dmonth == 0) {
		dmonth = 12;
		dyear--;
	}
	if (dmonth < 10) dmonth = '0'+dmonth;
	byId('search_date_to').value = dday+'.'+dmonth+'.'+dyear;
}
