function $(id) {
	return document.getElementById(id);
}
function classFilter(r,m,not){
	m = " " + m + " ";
	var tmp = [];
	for ( var i = 0; r[i]; i++ ) {
		var pass = (" " + r[i].className + " ").indexOf( m ) >= 0;
		if ( not ^ pass )
			tmp.push( r[i] );
	}
	return tmp;
}

function search_hide()
{
	$('search_block').style.display = 'none';
	$('search_block_hidden').style.display = 'block';
	if ($('search_list3')!=undefined)
	{
		if ($('search_list3').className == 'div_list div_list3')
			$('search_list3').className = 'div_list div_list3b';
		else
			$('search_list3').className = 'div_list div_list3cb';
	}
}

function search_show()
{
	$('search_block').style.display = 'block';
	$('search_block_hidden').style.display = 'none';
	if ($('search_list3')!=undefined)
	{
		if ($('search_list3').className == 'div_list div_list3b')
			$('search_list3').className = 'div_list div_list3';
		else
			$('search_list3').className = 'div_list div_list3c';
	}
}

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("Press Ctrl+D");
 return false;
}

function showfoto(id)
{
	y=screen.height/2-280;
	x=screen.width/2-375;                
	win=window.open("/foto/id/"+id,"erwvyeirbywveiburi35r34ui5vt3o4ivb53","toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=750,height=560,top="+y+",left="+x+"");
}

function change_slider(id, show, count)
{
	for (i = 1; i <= count; i++)
		$('slider-'+id+i).style.display = 'none';
		
	$('slider-'+id+show).style.display = 'block';
	
	if (id == '1a')
	{
		if (show == 2) $('cena_type_value').innerHTML = 'у.е.';
		else $('cena_type_value').innerHTML = 'тыс. у.е.';
	}
}
function get_abs_top(id)
{
	var img = $(id);
	if (img != undefined)
	{
		var left = img.offsetLeft;
		var top = img.offsetTop;
		var parent = img.offsetParent;
		while(parent && parent.tagName != "BODY")
		{
		   left += parent.offsetLeft;
		   top += parent.offsetTop;
		   parent = parent.offsetParent;
		}
		return top;
	}
	return 0;
}

function change_gline_new(napr)
{
	if (napr == 'left' && gline_new_first > 1) gline_new_first--;
	if (napr == 'right' && gline_new_first <= (gline_new_count-5)) gline_new_first++;
	
	for (i = 1; i <= 20; i++)
	{
		if ($('gline_new_'+i) != undefined)
			$('gline_new_'+i).style.display = 'none';
	}
	for (i = gline_new_first; i <= (gline_new_first+4); i++)
	{
		if ($('gline_new_'+i) != undefined)
			$('gline_new_'+i).style.display = 'block';
	}
}
function change_gline_spec(napr)
{
	if (napr == 'left' && gline_spec_first > 1) gline_spec_first--;
	if (napr == 'right' && gline_spec_first <= (gline_spec_count-5)) gline_spec_first++;
	
	for (i = 1; i <= 20; i++)
	{
		if ($('gline_spec_'+i) != undefined)
			$('gline_spec_'+i).style.display = 'none';
	}
	for (i = gline_spec_first; i <= (gline_spec_first+4); i++)
	{
		if ($('gline_spec_'+i) != undefined)
			$('gline_spec_'+i).style.display = 'block';
	}
}
function change_gline_alike(napr)
{
	if (napr == 'left' && gline_alike_first > 1) gline_alike_first--;
	if (napr == 'right' && gline_alike_first <= (gline_alike_count-5)) gline_alike_first++;
	
	for (i = 1; i <= 20; i++)
	{
		if ($('gline_alike_'+i) != undefined)
			$('gline_alike_'+i).style.display = 'none';
	}
	for (i = gline_alike_first; i <= (gline_alike_first+4); i++)
	{
		if ($('gline_alike_'+i) != undefined)
			$('gline_alike_'+i).style.display = 'block';
	}
}

function showcounters()
{
	$('div_counter').style.display = 'block';
}
