///////////////////////////////////////////////
/////////////////  MD5 ////////////////////////
var hexcase = 0; var b64pad  = ""; var chrsz   = 8; function hex_md5(s){ return binl2hex(core_md5(str2binl(s), s.length * chrsz));} function b64_md5(s){ return binl2b64(core_md5(str2binl(s), s.length * chrsz));} function str_md5(s){ return binl2str(core_md5(str2binl(s), s.length * chrsz));}
function hex_hmac_md5(key, data) { return binl2hex(core_hmac_md5(key, data)); }
function b64_hmac_md5(key, data) { return binl2b64(core_hmac_md5(key, data)); }
function str_hmac_md5(key, data) { return binl2str(core_hmac_md5(key, data)); }
function md5_vm_test()
{
  return hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72";
}
function core_md5(x, len)
{
  x[len >> 5] |= 0x80 << ((len) % 32);
  x[(((len + 64) >>> 9) << 4) + 14] = len;

  var a =  1732584193;
  var b = -271733879;
  var c = -1732584194;
  var d =  271733878;

  for(var i = 0; i < x.length; i += 16)
  {
    var olda = a;
    var oldb = b;
    var oldc = c;
    var oldd = d;

    a = md5_ff(a, b, c, d, x[i+ 0], 7 , -680876936);
    d = md5_ff(d, a, b, c, x[i+ 1], 12, -389564586);
    c = md5_ff(c, d, a, b, x[i+ 2], 17,  606105819);
    b = md5_ff(b, c, d, a, x[i+ 3], 22, -1044525330);
    a = md5_ff(a, b, c, d, x[i+ 4], 7 , -176418897);
    d = md5_ff(d, a, b, c, x[i+ 5], 12,  1200080426);
    c = md5_ff(c, d, a, b, x[i+ 6], 17, -1473231341);
    b = md5_ff(b, c, d, a, x[i+ 7], 22, -45705983);
    a = md5_ff(a, b, c, d, x[i+ 8], 7 ,  1770035416);
    d = md5_ff(d, a, b, c, x[i+ 9], 12, -1958414417);
    c = md5_ff(c, d, a, b, x[i+10], 17, -42063);
    b = md5_ff(b, c, d, a, x[i+11], 22, -1990404162);
    a = md5_ff(a, b, c, d, x[i+12], 7 ,  1804603682);
    d = md5_ff(d, a, b, c, x[i+13], 12, -40341101);
    c = md5_ff(c, d, a, b, x[i+14], 17, -1502002290);
    b = md5_ff(b, c, d, a, x[i+15], 22,  1236535329);

    a = md5_gg(a, b, c, d, x[i+ 1], 5 , -165796510);
    d = md5_gg(d, a, b, c, x[i+ 6], 9 , -1069501632);
    c = md5_gg(c, d, a, b, x[i+11], 14,  643717713);
    b = md5_gg(b, c, d, a, x[i+ 0], 20, -373897302);
    a = md5_gg(a, b, c, d, x[i+ 5], 5 , -701558691);
    d = md5_gg(d, a, b, c, x[i+10], 9 ,  38016083);
    c = md5_gg(c, d, a, b, x[i+15], 14, -660478335);
    b = md5_gg(b, c, d, a, x[i+ 4], 20, -405537848);
    a = md5_gg(a, b, c, d, x[i+ 9], 5 ,  568446438);
    d = md5_gg(d, a, b, c, x[i+14], 9 , -1019803690);
    c = md5_gg(c, d, a, b, x[i+ 3], 14, -187363961);
    b = md5_gg(b, c, d, a, x[i+ 8], 20,  1163531501);
    a = md5_gg(a, b, c, d, x[i+13], 5 , -1444681467);
    d = md5_gg(d, a, b, c, x[i+ 2], 9 , -51403784);
    c = md5_gg(c, d, a, b, x[i+ 7], 14,  1735328473);
    b = md5_gg(b, c, d, a, x[i+12], 20, -1926607734);

    a = md5_hh(a, b, c, d, x[i+ 5], 4 , -378558);
    d = md5_hh(d, a, b, c, x[i+ 8], 11, -2022574463);
    c = md5_hh(c, d, a, b, x[i+11], 16,  1839030562);
    b = md5_hh(b, c, d, a, x[i+14], 23, -35309556);
    a = md5_hh(a, b, c, d, x[i+ 1], 4 , -1530992060);
    d = md5_hh(d, a, b, c, x[i+ 4], 11,  1272893353);
    c = md5_hh(c, d, a, b, x[i+ 7], 16, -155497632);
    b = md5_hh(b, c, d, a, x[i+10], 23, -1094730640);
    a = md5_hh(a, b, c, d, x[i+13], 4 ,  681279174);
    d = md5_hh(d, a, b, c, x[i+ 0], 11, -358537222);
    c = md5_hh(c, d, a, b, x[i+ 3], 16, -722521979);
    b = md5_hh(b, c, d, a, x[i+ 6], 23,  76029189);
    a = md5_hh(a, b, c, d, x[i+ 9], 4 , -640364487);
    d = md5_hh(d, a, b, c, x[i+12], 11, -421815835);
    c = md5_hh(c, d, a, b, x[i+15], 16,  530742520);
    b = md5_hh(b, c, d, a, x[i+ 2], 23, -995338651);

    a = md5_ii(a, b, c, d, x[i+ 0], 6 , -198630844);
    d = md5_ii(d, a, b, c, x[i+ 7], 10,  1126891415);
    c = md5_ii(c, d, a, b, x[i+14], 15, -1416354905);
    b = md5_ii(b, c, d, a, x[i+ 5], 21, -57434055);
    a = md5_ii(a, b, c, d, x[i+12], 6 ,  1700485571);
    d = md5_ii(d, a, b, c, x[i+ 3], 10, -1894986606);
    c = md5_ii(c, d, a, b, x[i+10], 15, -1051523);
    b = md5_ii(b, c, d, a, x[i+ 1], 21, -2054922799);
    a = md5_ii(a, b, c, d, x[i+ 8], 6 ,  1873313359);
    d = md5_ii(d, a, b, c, x[i+15], 10, -30611744);
    c = md5_ii(c, d, a, b, x[i+ 6], 15, -1560198380);
    b = md5_ii(b, c, d, a, x[i+13], 21,  1309151649);
    a = md5_ii(a, b, c, d, x[i+ 4], 6 , -145523070);
    d = md5_ii(d, a, b, c, x[i+11], 10, -1120210379);
    c = md5_ii(c, d, a, b, x[i+ 2], 15,  718787259);
    b = md5_ii(b, c, d, a, x[i+ 9], 21, -343485551);

    a = safe_add(a, olda);
    b = safe_add(b, oldb);
    c = safe_add(c, oldc);
    d = safe_add(d, oldd);
  }
  return Array(a, b, c, d);

}
function md5_cmn(q, a, b, x, s, t)
{
  return safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s),b);
}
function md5_ff(a, b, c, d, x, s, t)
{
  return md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
}
function md5_gg(a, b, c, d, x, s, t)
{
  return md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
}
function md5_hh(a, b, c, d, x, s, t)
{
  return md5_cmn(b ^ c ^ d, a, b, x, s, t);
}
function md5_ii(a, b, c, d, x, s, t)
{
  return md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
}
function core_hmac_md5(key, data)
{
  var bkey = str2binl(key);
  if(bkey.length > 16) bkey = core_md5(bkey, key.length * chrsz);

  var ipad = Array(16), opad = Array(16);
  for(var i = 0; i < 16; i++)
  {
    ipad[i] = bkey[i] ^ 0x36363636;
    opad[i] = bkey[i] ^ 0x5C5C5C5C;
  }

  var hash = core_md5(ipad.concat(str2binl(data)), 512 + data.length * chrsz);
  return core_md5(opad.concat(hash), 512 + 128);
}
function safe_add(x, y)
{
  var lsw = (x & 0xFFFF) + (y & 0xFFFF);
  var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
  return (msw << 16) | (lsw & 0xFFFF);
}
function bit_rol(num, cnt)
{
  return (num << cnt) | (num >>> (32 - cnt));
}
function str2binl(str)
{
  var bin = Array();
  var mask = (1 << chrsz) - 1;
  for(var i = 0; i < str.length * chrsz; i += chrsz)
    bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (i%32);
  return bin;
}
function binl2str(bin)
{
  var str = "";
  var mask = (1 << chrsz) - 1;
  for(var i = 0; i < bin.length * 32; i += chrsz)
    str += String.fromCharCode((bin[i>>5] >>> (i % 32)) & mask);
  return str;
}
function binl2hex(binarray)
{
  var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
  var str = "";
  for(var i = 0; i < binarray.length * 4; i++)
  {
    str += hex_tab.charAt((binarray[i>>2] >> ((i%4)*8+4)) & 0xF) +
           hex_tab.charAt((binarray[i>>2] >> ((i%4)*8  )) & 0xF);
  }
  return str;
}
function binl2b64(binarray)
{
  var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
  var str = "";
  for(var i = 0; i < binarray.length * 4; i += 3)
  {
    var triplet = (((binarray[i   >> 2] >> 8 * ( i   %4)) & 0xFF) << 16)
                | (((binarray[i+1 >> 2] >> 8 * ((i+1)%4)) & 0xFF) << 8 )
                |  ((binarray[i+2 >> 2] >> 8 * ((i+2)%4)) & 0xFF);
    for(var j = 0; j < 4; j++)
    {
      if(i * 8 + j * 6 > binarray.length * 32) str += b64pad;
      else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);
    }
  }
  return str;
}
/////////////////  MD5 ////////////////////////
function getCookie( name ) {
	var start = document.cookie.indexOf( name + "=" );
	var len = start + name.length + 1;
	if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ) {
		return null;
	}
	if ( start == -1 ) return null;
	var end = document.cookie.indexOf( ';', len );
	if ( end == -1 ) end = document.cookie.length;
	return unescape( document.cookie.substring( len, end ) );
}
function setCookie( name, value, expires, path, domain, secure ) {
	var today = new Date();
	today.setTime( today.getTime() );
	if ( expires ) {
		expires = expires * 1000 * 60 * 60 * 24;
	}
	var expires_date = new Date( today.getTime() + (expires) );
	document.cookie = name+'='+escape( value ) +
		( ( expires ) ? ';expires='+expires_date.toGMTString() : '' ) + //expires.toGMTString()
		( ( path ) ? ';path=' + path : '' ) +
		( ( domain ) ? ';domain=' + domain : '' ) +
		( ( secure ) ? ';secure' : '' );
}
function deleteCookie( name, path, domain ) {
	if ( getCookie( name ) ) document.cookie = name + '=' +
			( ( path ) ? ';path=' + path : '') +
			( ( domain ) ? ';domain=' + domain : '' ) +
			';expires=Thu, 01-Jan-1970 00:00:01 GMT';
}

function toggleit(element) {
	$('#'+element).slideToggle("slow");
}

function hide(element) {
	$('#'+element).style.display = 'none';
	return element;
}

function show(element) {
	$('#'+element).style.display = '';
	return element;
}

function change_view(){
	var needed = arguments[0];
	var elements = new Array();
	for (var i = 1; i < arguments.length; i++) {
		tmp = arguments[i];
		zz = $('#'+tmp);
		if (tmp != needed) zz.hide();
		else zz.show();
	}
	setCookie('view', needed);
}

function togglesubcat(zz){
	obj = $('#'+zz+'_div');
	if (obj.css('display') != 'none'){
		obj.slideUp();
		$('img.ajax-load-'+zz).remove();
	} else {
		obj.after("<img style='display: none' class='ajax-load-" + zz + "' src='images/ajax-loader.gif' alt='' />");
		img = $("img.ajax-load-" + zz);
		img.fadeIn("fast");
		obj.hide().load(
			"index_files/ajax.php?cat="+zz,
			function(){
				$("img.ajax-load-" + zz).fadeOut("fast");
				obj.slideDown();
			}
		);
	}
}

function federal_withess_security_program(kill){
	if (kill)
		$("#svidetel").fadeOut("slow");
	else {
		var win = setTimeout('federal_withess_security_program(true)', 1000);
		$("#svidetel").hide().fadeIn("slow");
	}

}

function toggle_services(){
	sdiv = $('div#services');
	sli = $('li.services-popup');
	var isVisible = sdiv.is(':visible');
	if (isVisible){
		sdiv.fadeOut("fast");
		sli.toggleClass('serv-active');
		$('div#div_premium_banner').show();
	} else {
		sli.toggleClass('serv-active');
		sdiv.fadeIn("fast");
		$('div#div_premium_banner').hide();
		$('#link_triger_toggle_services').get(0).focus();
	}
}

//==============================================================================
current_pack='gold';
current_pack_sort='date';
function init_list_packs()
{
	if(jQuery.browser['msie'])
	{
		if($('.packets ul li.'+current_pack).get(0))
		  $('.packets ul li.'+current_pack).get(0).style.backgroundPositionY='-62px';
	}
}
function packets_show(pack,pack_sort)
{
	if(pack!='')
	  current_pack=pack;
	if(pack_sort!='')
	{
	  current_pack_sort=pack_sort;
	  $('div#menu_sort_packets').hide();
	}
	td = $('div#packets-list');
	imload = $('table.pack-table img.ajaxloading');
	buy = $('div.buy');
	spc = $('div#spacer');
	link_sort=$('a#link_menu_sort_packets');
	
	spc.css({'height': td.parent().height()}).show();
	buy.hide();
	$('.packets ul li').removeClass('active');
	$('#menu_sort_packets div').removeClass('active_sort');
	
	if (current_pack == 'standart')
	{
		buy.children().text('Купить пакет стандарт');
		$('.packets ul li.standart').addClass('active');
	}
	else if (current_pack == 'premium')
	{
		buy.children().text('Купить пакет премиум');
		$('.packets ul li.premium').addClass('active');
	}
	else if (current_pack == 'gold')
	{
		buy.children().text('Купить пакет голд');
		$('.packets ul li.gold').addClass('active');
	}
	
	if(current_pack_sort=='date')
	{
       link_sort.text('по дате');
	   $('#sort_date').addClass('active_sort');
	}
	else if(current_pack_sort=='rating')
	{
	   link_sort.text('по рейтингу');
	   $('#sort_rating').addClass('active_sort');
	}
	else if(current_pack_sort=='filling')
	{
	   link_sort.text('по наполнению');
	   $('#sort_filling').addClass('active_sort');
	}
	
	imload.fadeIn("fast");
	td.hide().load(
					"index_files/ajax.php?action=getents&num=5&pack="+current_pack+"&sort="+current_pack_sort,
					function ()
					{
						spc.hide();
						imload.fadeOut("fast");
						td.fadeIn("slow");
						buy.fadeIn("slow");
						
						init_stats('stats_packets');
					}
	);
	if(jQuery.browser['msie'])
	{
		$('.packets ul li').get(0).style.backgroundPositionY='0px';
		$('.packets ul li').get(1).style.backgroundPositionY='0px';
		$('.packets ul li').get(2).style.backgroundPositionY='0px';
		$('.packets ul li.'+current_pack).get(0).style.backgroundPositionY='-62px';
	}
}
//==============================================================================
current_city='';
city_name='';
function show_weather(city)
{
  $('div#menu_cities').hide();
  current_city=city;
  setCookie( 'curren_city', current_city, 100); //save city in cookies
  city_name=$('#weather_city_'+city+' a').text();
  ajaxloader=$('#top-weather div.ajaxloader');
  $('#top-weather div.temperature').hide();
  $('#top-weather div.name_city_weather').hide();
  $('#top-weather #weather_img').hide();
  
  ajaxloader.show();
  
  $.get(
	'index_files/ajax.php',	
	{
		 action: 'get_weather', 
		 city: current_city
	},
	function (data)
	{
		m_data=data.split('##');
		$('#weather_temperature').text(m_data[0]);
		$('#weather_opadu').text(m_data[1]);
		$('div.name_city_weather a').text(city_name);
		document.getElementById('weather_img').src='index_files/images/weather/'+m_data[2]+'.png';
		document.getElementById('weather_img').alt=m_data[3];
		
		ajaxloader.hide();
		
		$('#top-weather div.temperature').show();
        $('#top-weather div.name_city_weather').show();
        $('#top-weather #weather_img').show();
		setTimeout("$('#top-weather #weather_img').ifixpng()",100);
	}
  );
}

//==============================================================================
current_book_mark_cats_center='';
function init_cats_center()
{
	if(getCookie('save_book-mark_cats_center'))
	{
	  current_book_mark_cats_center=getCookie('save_book-mark_cats_center');
	}
	else
	  current_book_mark_cats_center='cat';
}

function save_book_mark_cats_center()
{
   if(getCookie('save_book-mark_cats_center')!=current_book_mark_cats_center)
   {
	   setCookie( 'save_book-mark_cats_center', current_book_mark_cats_center, 100);
	   temp_obj=$('div.catalog_box ul.header li.save_boockmark div');
	   temp_obj.addClass('active');
	   temp_obj.attr('title','Зафиксированная вкладка');
   }
   else
   {
	   setCookie( 'save_book-mark_cats_center', '', 100);
	   temp_obj=$('div.catalog_box ul.header li.save_boockmark div');
	   temp_obj.removeClass('active');
	   temp_obj.attr('title','Зафиксировать вкладку');
   }
}

function load_cats_center(type) {
	if(current_book_mark_cats_center==type)
	{
		if(type=='cat')
		  window.open('http://ukrbiznes.com/catalog.php');
		else if(type=='rat')
		  window.open('http://ukrbiznes.com/allstatistic.php');
		else if(type=='new')
		  window.open('http://ukrbiznes.com/catalog.php');
		return false;
	}
	
	current_book_mark_cats_center=type;
	div = $('div#cats-ajax-box');
	div.hide();
	imload = $('.cats-content div.ajaxloading');
	if (type == 'new'){
		new_page=1;
		imload.fadeIn("fast");
		$('div.catalog_box ul li').removeClass('menu_active');
		$('div.catalog_box ul li.new').addClass('menu_active');
		div.load(
						"index_files/ajax.php?action=getents_new",
						function (){
							imload.fadeOut("fast");
							div.fadeIn("slow");
							
							init_stats('stats_catalognew');
						}
		);
	} else if (type == 'rat'){
		rat_page=1;
		imload.fadeIn("fast");
		$('div.catalog_box ul li').removeClass('menu_active');
		$('div.catalog_box ul li.rat').addClass('menu_active');
		div.hide().load(
						"index_files/ajax.php?action=getents_rat",
						function (){
							imload.fadeOut("fast");
							div.fadeIn("slow");
							
							init_stats('stats_catalograting');
						}
		);
	} else if (type == 'pop'){
		pop_page=1;
		imload.fadeIn("fast");
		$('div.catalog_box ul li').removeClass('menu_active');
		$('div.catalog_box ul li.pop').addClass('menu_active');
		div.load(
						"index_files/ajax.php?action=getents_pop",
						function (){
							imload.fadeOut("fast");
							div.fadeIn("slow");
							
							init_stats('stats_catalogpopular');
						}
		);
	} else {
		cats_page=1;
		imload.fadeIn("fast");
		$('div.catalog_box ul li').removeClass('menu_active');
		$('div.catalog_box ul li.cat').addClass('menu_active');
		div.load(
						"index_files/ajax.php?action=getcat",
						function (){
							imload.fadeOut("fast");
							div.fadeIn("slow");
							
							init_stats('stats_catalog');
						}
		);
	}
	
	
	if(getCookie('save_book-mark_cats_center')==type)
	{
		temp_obj=$('div.catalog_box ul.header li.save_boockmark div');
		temp_obj.addClass('active');
		temp_obj.attr('title','Зафиксированная вкладка');
	}
	else
	{
		temp_obj=$('div.catalog_box ul.header li.save_boockmark div');
		temp_obj.removeClass('active');
		temp_obj.attr('title','Зафиксировать вкладку');
	}
	setTimeout("$('td.divider').ifixpng()",1500);
}

function cats_move_page(to, what){
	imload = $('.cats-content div.ajaxloading');
	spc = $('.cats-content .spacer2');
	if (what == 'rat'){
		if (to > 8)
			return 8;
		if (to < 1)
			return 1;
		div = $('.rat-table');
		imload.show();
		img = $('#ajax-control-cats img');
		img.attr('src', 'index_files/images/ajax-'+to+'of8-theme'+current_theme+'.gif');
		$('#ajax-control-cats .ajax-arrows').removeClass('noleft').removeClass('noright')
		if (to == 8)
			$('#ajax-control-cats .ajax-arrows').addClass('noright');
		if (to == 1)
			$('#ajax-control-cats .ajax-arrows').addClass('noleft');
		div.fadeOut('fast').hide().load(
																		"index_files/ajax.php?action=getents_rat&page="+to,
																		function(){
																			imload.hide();
																			div.fadeIn('fast');
																			
																			init_stats('stats_catalograting');
																		}
																		);
	} else if (what == 'pop'){
		if (to > 8)
			return 8;
		if (to < 1)
			return 1;
		div = $('.pop-table');
		imload.show();
		img = $('#ajax-control-cats img');
		img.attr('src', 'index_files/images/ajax-'+to+'of8-theme'+current_theme+'.gif');
		$('#ajax-control-cats .ajax-arrows').removeClass('noleft').removeClass('noright')
		if (to == 8)
			$('#ajax-control-cats .ajax-arrows').addClass('noright');
		if (to == 1)
			$('#ajax-control-cats .ajax-arrows').addClass('noleft');
		div.fadeOut('slow').hide().load(
																		"index_files/ajax.php?action=getents_pop&page="+to,
																		function(){
																			imload.hide();
																			div.fadeIn('slow');
																			
																			init_stats('stats_catalogpopular');
																		}
																		);
	} else if (what == 'new'){
		if (to > 8)
			return 8;
		if (to < 1)
			return 1;
		div = $('.new-table');
		imload.show();
		img = $('#ajax-control-cats img');
		img.attr('src', 'index_files/images/ajax-'+to+'of8-theme'+current_theme+'.gif');
		$('#ajax-control-cats .ajax-arrows').removeClass('noleft').removeClass('noright')
		if (to == 8)
			$('#ajax-control-cats .ajax-arrows').addClass('noright');
		if (to == 1)
			$('#ajax-control-cats .ajax-arrows').addClass('noleft');
		div.fadeOut('slow').hide().load(
																		"index_files/ajax.php?action=getents_new&page="+to,
																		function(){
																			imload.hide();
																			div.fadeIn('slow');
																			
																			init_stats('stats_catalognew');
																		}
																		);
	} else {
		if (to > 4)
			return 4;
		if (to < 1)
			return 1;
	    div = $('#parent-cats');
		img = $('#ajax-control-cats img');
		imload.show();
		img.attr('src', 'index_files/images/ajax-'+to+'of4-theme'+current_theme+'.gif');
		$('#ajax-control-cats .ajax-arrows').removeClass('noleft').removeClass('noright')
		if (to == 4)
			$('#ajax-control-cats .ajax-arrows').addClass('noright');
		if (to == 1)
			$('#ajax-control-cats .ajax-arrows').addClass('noleft');
		div.fadeOut('slow').hide().load(
																		"index_files/ajax.php?action=getcat&page="+to,
																		function(){
																			imload.hide();
																			div.fadeIn('slow');
																			
																			init_stats('stats_catalog');
																		}
																		);		
	}
	setTimeout("$('td.divider').ifixpng()",1500);
	return to;
}
//===============================================================================
curent_topnews_type=getCookie('type_topnews');
if(curent_topnews_type=='')
  curent_topnews_type='top';
current_newsline_page=1;
current_firmnews_page=1;
function change_news(type)
{
	if(curent_topnews_type==type)
	{
	  if(type=='top')
	    window.open("http://ukrbiznes.com/news/");
	  else if(type=='line')
	    window.open("http://ukrbiznes.com/news/");
	  else if(type=='firm_news')
	    window.open("http://ukrbiznes.com/news/company/");
	  return;
	}
	curent_topnews_type=type;
	$('td.news-hdr ul.news-menu li').removeClass('active').removeClass('color-black');
	if(curent_topnews_type=='top')
	{
		$('td.news-hdr ul.news-menu li.top').addClass('active');
	}
	if(curent_topnews_type=='line')
	{
		$('td.news-hdr ul.news-menu li.line').addClass('active');
		$('td.news-hdr ul.news-menu li.line').addClass('color-black');
	}
	if(curent_topnews_type=='firm_news')
	{
		$('td.news-hdr ul.news-menu li.firm_news').addClass('active');
		$('td.news-hdr ul.news-menu li.firm_news').addClass('color-black');
	}
	ajaxloader=$('#news-and-weather div.ajaxloading');
	ajaxloader.fadeIn('fast');
	div=$('div#content-news-ajax-box');
	div.hide();
	div.load(
								"index_files/ajax.php?action=get_topnews&type="+curent_topnews_type,
								function()
								{
									div.fadeIn('slow');
									ajaxloader.hide();
									if(curent_topnews_type=='top')
									  init_stats('stats_topnews');
									if(curent_topnews_type=='line')
									{
									  init_stats('stats_linenews');
									  $("#news-and-weather div.date div.reklama").hide();
									}
									if(curent_topnews_type=='firm_news')
									{
									  init_stats('stats_firmnews');  
									  $("#news-and-weather div.date div.reklama").hide();
									}
								}
						);
	setCookie( 'type_topnews', curent_topnews_type, 100);
}
function newsline_move_page(page)
{
	 if(page<1 || page>4)
	   return;
	 current_newsline_page=page;
	 ajaxloader=$('#news-and-weather div.ajaxloading');
	 obj_content=$('#content_linenews div');
	 img = $('#ajax-control-news img');
 	 img.attr('src', 'index_files/images/ajax-'+page+'of4-theme'+current_theme+'.gif');
	 $('#ajax-control-news .ajax-arrows').removeClass('noleft').removeClass('noright')
	 if (page == 4)
		$('#ajax-control-news .ajax-arrows').addClass('noright');
	 if (page == 1)
		$('#ajax-control-news .ajax-arrows').addClass('noleft');
			
	 ajaxloader.fadeIn('fast');
	 obj_content.hide().load(
								"index_files/ajax.php?action=get_topnews&type=line&page="+current_newsline_page,
								function()
								{
									obj_content.fadeIn('slow');
									ajaxloader.hide();
									
									init_stats('stats_linenews');
								}
						);
}
function firmnews_move_page(page)
{
	 if(page<1 || page>4)
	   return;
	 current_firmnews_page=page;
	 ajaxloader=$('#news-and-weather div.ajaxloading');
	 obj_content=$('#content_firm_news div');
	 img = $('#ajax-control-news img');
 	 img.attr('src', 'index_files/images/ajax-'+page+'of4-theme'+current_theme+'.gif');
	 $('#ajax-control-news .ajax-arrows').removeClass('noleft').removeClass('noright')
	 if (page == 4)
		$('#ajax-control-news .ajax-arrows').addClass('noright');
	 if (page == 1)
		$('#ajax-control-news .ajax-arrows').addClass('noleft');
			
	 ajaxloader.fadeIn('fast');
	 obj_content.hide().load(
								"index_files/ajax.php?action=get_topnews&type=firm_news&page="+current_firmnews_page,
								function()
								{
									obj_content.fadeIn('slow');
									ajaxloader.hide();
									
									init_stats('stats_firmnews');
								}
						);
}
function change_fon(param,obj,ev,param2)
{
	 if(jQuery.browser['msie'])
	 {
		 if(param2=='packs')
		 {
			 if(ev=='over')
			 {
				if(param!=current_pack)
				{
				   obj.style.backgroundPositionY='-31px';
				}
			 }
			 else
			 {
			   if(param!=current_pack)
				 obj.style.backgroundPositionY='0px';
			 }
		 }
	 }
}
function show_hide_menu_sort_packs()
{
	  if($('div#menu_sort_packets').css('display')=='none')
	  {
	    $('div#menu_sort_packets').show(); 
		$('a.sort').get(0).focus();
	  }
}
function makeOver()
{
  $('a.sort').get(0).onblur=function onblur(event){return false;};
}
function makeOut()
{
  $('a.sort').get(0).onblur=function onblur(event){$('div#menu_sort_packets').hide();};
}

function forget()
{
  open("forget.php","","width=300,height=250,left=0,top=0,resizeable=yes,locationbar=no,menubar=no,scrollbars=yes,status=no,toolbar=no");
}
//===============================================================================
function show_hide_menu_cities()
{
	  if($('div#menu_cities').css('display')=='none')
	    $('div#menu_cities').show();
	  else
	    $('div#menu_cities').hide();
}
//==================================express adver=============================================
function reload_express_adver(rub)
{
		spc=$('#express_adver_content_'+rub);
		obj_content=$('#express_adver_content_'+rub+' div.vmist');
		spc.css({'height': spc.height()});
		obj_content.hide();
	    $.get(
		'index_files/ajax.php',	
		{
			 action: 'get_express_adver', 
			 rub: rub
		},
		function (data)
		{
			obj_content.get(0).innerHTML=data;
			$('#express_'+rub).show();
			spc.css('height','auto');
			obj_content.fadeIn('fast');
			init_stats('stats_expressadver');
		}
	  );
}
function show_expressadver(rub)
{
	show_hide_expressadver(rub,'show');
	//setTimeout("show_hide_expressadver("+rub+",'show')",'2000');
}
function hide_expressadver(rub)
{
	show_hide_expressadver(rub,'hide');
	//setTimeout("show_hide_expressadver("+rub+",'hide')",'2000');
}
function show_hide_expressadver(rub,param)
{
	if(param=='hide')
	{
		$('#express_'+rub).hide();
	}
	if(param=='show')
	{
	    $('#express_'+rub).show();
	}
}

//===============================================================================
function init_gallery()
{
	var mxy=new Array(30);
	mxy['gallery_foto_1x']=0;
	mxy['gallery_foto_1y']=0;
	mxy['gallery_foto_2x']=38;
	mxy['gallery_foto_2y']=0;
	mxy['gallery_foto_3x']=38*2;
	mxy['gallery_foto_3y']=0;
	mxy['gallery_foto_4x']=38*3;
	mxy['gallery_foto_4y']=0;
	mxy['gallery_foto_5x']=38*4;
	mxy['gallery_foto_5y']=0;
	mxy['gallery_foto_6x']=0;
	mxy['gallery_foto_6y']=38;
	mxy['gallery_foto_7x']=38;
	mxy['gallery_foto_7y']=38;
	mxy['gallery_foto_8x']=38*2;
	mxy['gallery_foto_8y']=38;
	mxy['gallery_foto_9x']=38*3;
	mxy['gallery_foto_9y']=38;
	mxy['gallery_foto_10x']=38*4;
	mxy['gallery_foto_10y']=38;
	mxy['gallery_foto_11x']=0;
	mxy['gallery_foto_11y']=38*2;
	mxy['gallery_foto_12x']=38;
	mxy['gallery_foto_12y']=38*2;
	mxy['gallery_foto_13x']=38*2;
	mxy['gallery_foto_13y']=38*2;
	mxy['gallery_foto_14x']=38*3;
	mxy['gallery_foto_14y']=38*2;
	mxy['gallery_foto_15x']=38*4;
	mxy['gallery_foto_15y']=38*2;
	jQuery('div.img-cloud img').css('opacity','0.7');
	$("div.img-cloud img").each(
	  function()
	  {
		id=jQuery(this).attr('id');
		jQuery(this).css('position', 'absolute');
		jQuery(this).css('left', (mxy[id+'x'])+'px');
		jQuery(this).css('top', (mxy[id+'y'])+'px');
	  }
    );
	jQuery('div.img-cloud img').hover(function() {
		   id=jQuery(this).attr('id');
		   jQuery(this).css('left', (mxy[id+'x']-15)+'px');
		   jQuery(this).css('top', (mxy[id+'y']-15)+'px');
           jQuery(this).css('width', '60px');
		   jQuery(this).css('opacity','1');
		   jQuery(this).css('z-index','99');
    }, function() {
		   id=jQuery(this).attr('id');
		   jQuery(this).css('left', (mxy[id+'x'])+'px');
		   jQuery(this).css('top', (mxy[id+'y'])+'px');
           jQuery(this).css('width', '30px');
		   jQuery(this).css('opacity','0.7');
		   jQuery(this).css('z-index','1');
    });
}
function change_big_photo(obj,f_src,f_alt,f_id,f_rate)
{
	if($('div#gallery div.big a.big').attr('href')==('img.php?f='+f_id))
	{
		open('img.php?f='+f_id);
		return;
	}
	temp_src=$('div.big img').attr('src');
	$('div.big img').attr('src','image_turbo.php?&action=3&f='+f_src+'&w=180&h=135');
	$('div.big img').attr('alt',f_alt);
	$('div#gallery div.big a.big').attr('href','img.php?f='+f_id);
	$('div#gallery td.padding-left-10px a').text(f_alt);
	$('div#gallery td.padding-left-10px a').attr('href','img.php?f='+f_id);
	$('div#gallery div.img-cloud img').css('borderColor','#ccc');
	obj.style.borderColor='#6297c3';
}
//--------------------------goods------------------
/*
  типи товарів
  1 - Хіти
  2 - Акційні
  3 - Неліквіди
  4 - Нові
*/

function init_box_goods()
{
	current_type_goods=getCookie('save_boockmark_goods');
	if(!current_type_goods)
	  current_type_goods=1;
    current_page_goods=1;
}
function change_type_goods(type)
{
	if(current_type_goods==type)
	{
	  window.open('http://ukrbiznes.com/goods.php');
	  return;
	}
	$('div.goods_box li.menu').removeClass('menu_active');
	$('div.goods_box li.boockmark'+type).addClass('menu_active');
	current_type_goods=type;
	div=$('div.goods_box li.save_boockmark div');
	if(current_type_goods==getCookie('save_boockmark_goods'))
	{
		div.addClass('active');
		div.get(0).title='Зафиксированная вкладка';
	}
	else
	{
		div.removeClass('active');
		div.get(0).title='Зафиксировать вкладку';
	}
	get_goods_box_content();
}
function save_boockmark_goods()
{
	div=$('div.goods_box li.save_boockmark div');
	if(div.get(0).className=='active')
	{
		  div.removeClass('active');
		  div.get(0).title='Зафиксировать вкладку';
		  deleteCookie( 'save_boockmark_goods' ,'/','ukrbiznes.com');
	}
	else
	{
		div.addClass('active');
		div.get(0).title='Зафиксированная вкладка';
		setCookie( 'save_boockmark_goods', current_type_goods, 100, '/','ukrbiznes.com');
	}
}
function get_goods_box_content()
{
	ajaxloader=$('div.goods_box div.goods_box_content div.ajaxloader');
	div=$('div.goods_box_content div.sub_goods_box_content');
	div.hide();
	ajaxloader.show();
	div.load(
						"index_files/ajax.php?action=get_goods_box_content&type_goods="+current_type_goods,
						function()
						{
							current_page_goods=1;
							ajaxloader.hide();
							div.show();
	
							init_stats('stats_goods'+current_type_goods);
						}
				);
}
function goods_move_page(param)
{
	if(param=='+' && current_page_goods==8)
	  return;
	if(param=='-' && current_page_goods==1)
	  return;
	if(param=='+')
	  current_page_goods++;
	else
	  if(param=='-')
	    current_page_goods--;
	  else
	    current_page_goods=param;
		
	img = $('div.goods_box_content div.pages img');
	img.attr('src', 'index_files/images/ajax-'+current_page_goods+'of8-theme'+current_theme+'.gif');
	div=$('div.goods_box_content div.buttons_page');
	if(current_page_goods==1)
	  div.css('backgroundPosition','left -34px');
	else
	  if(current_page_goods==8)
	    div.css('backgroundPosition','left -17px');
	  else
	  {
	    div.css('backgroundPosition','left 0px');
	  }
	ajaxloader=$('div.goods_box div.goods_box_content div.ajaxloader');
	div=$('div.goods_box_content div.content_page div.sub_content_page');
	div.hide();
	ajaxloader.show();
	div.load(
						"index_files/ajax.php?action=get_goods_box_content_page&type_goods="+current_type_goods+"&page="+current_page_goods,
						function()
						{
							ajaxloader.hide();
							div.show();
							
							init_stats('stats_goods'+current_type_goods);
						}
				); 
}
//--------------------------box statti------------------
function init_statti_box()
{
	current_page_statti=1;
	current_type_statti=getCookie('save_boockmark_statti');
	if(!current_type_statti)
	  current_type_statti=1;
}
function statti_move_page(param)
{
	if(current_type_statti==1)
	  max_page=8;
	if(current_type_statti==2)
	{
	  type_box=$('div.statti_box_content').width();
	  if(type_box==740)
	    max_page=4;
	  if(type_box==490)
	    max_page=6;
	}
	if(param=='+' && current_page_statti==max_page)
	  return;
	if(param=='-' && current_page_statti==1)
	  return;
	if(param=='+')
	  current_page_statti++;
	else
	  if(param=='-')
	    current_page_statti--;
	  else
	    current_page_statti=param;
		
	img = $('div.statti_box_content div.pages img');
	img.attr('src', 'index_files/images/ajax-'+current_page_statti+'of'+max_page+'-theme'+current_theme+'.gif');
	div=$('div.statti_box_content div.buttons_page');
	if(current_page_statti==1)
	  div.css('backgroundPosition','left -34px');
	else
	  if(current_page_statti==max_page)
	    div.css('backgroundPosition','left -17px');
	  else
	  {
	    div.css('backgroundPosition','left 0px');
	  }
	ajaxloader=$('div.statti_box div.statti_box_content div.ajaxloader');
	div=$('div.statti_box_content div.content_page div.sub_content_page');
	div.hide();
	ajaxloader.show();
	div.load(
						"index_files/ajax.php?action=get_statti_box_content_page&type_statti="+current_type_statti+"&page="+current_page_statti,
						function()
						{
							ajaxloader.hide();
							div.show();
							
							init_stats('stats_statti'+current_type_statti);
						}
				); 
}
function change_type_statti(type)
{
	if(current_type_statti==type)
	{
	  window.open('http://ukrbiznes.com/analitic.php');
	  return;
	}
	$('div.statti_box li.menu').removeClass('menu_active');
	$('div.statti_box li.boockmark'+type).addClass('menu_active');
	current_type_statti=type;
	div=$('div.statti_box li.save_boockmark div');
	if(current_type_statti==getCookie('save_boockmark_statti'))
	{
		div.addClass('active');
		div.get(0).title='Зафиксированная вкладка';
	}
	else
	{
		div.removeClass('active');
		div.get(0).title='Зафиксировать вкладку';
	}
	get_statti_box_content();
}
function get_statti_box_content()
{
	ajaxloader=$('div.statti_box div.statti_box_content div.ajaxloader');
	div=$('div.sub_statti_box_content');
	div.hide();
	ajaxloader.show();
	div.load(
						"index_files/ajax.php?action=get_statti_box_content&type_statti="+current_type_statti,
						function()
						{
							current_page_statti=1;
							ajaxloader.hide();
							div.show();
							
							init_stats('stats_statti'+current_type_statti);
						}
				);
}
function save_boockmark_statti()
{
	div=$('div.statti_box li.save_boockmark div');
	if(div.get(0).className=='active')
	{
		  div.removeClass('active');
		  div.get(0).title='Зафиксировать вкладку';
		  deleteCookie( 'save_boockmark_statti' ,'/','ukrbiznes.com');
	}
	else
	{
		div.addClass('active');
		div.get(0).title='Зафиксированная вкладка';
		setCookie( 'save_boockmark_statti', current_type_statti, 100, '/','ukrbiznes.com');
	}
}
/*-------------------------- work box ----------------------------------*/
function init_work_box()
{
	current_page_work=1;
	current_type_work=getCookie('save_boockmark_work');
	if(!current_type_work)
	  current_type_work=1;
}
function change_type_work(type)
{
	if(current_type_work==type)
	{
	  if(type==1 || type==2)
	    window.open('http://ukrbiznes.com/work.php');
	  else if(type==3)
	    window.open('http://ukrbiznes.com/work.php?r=ok');
	  return;
	}
	$('div.work_box li.menu').removeClass('menu_active');
	$('div.work_box li.boockmark'+type).addClass('menu_active');
	current_type_work=type;
	div=$('div.work_box li.save_boockmark div');
	if(current_type_work==getCookie('save_boockmark_work'))
	{
		div.addClass('active');
		div.get(0).title='Зафиксированная вкладка';
	}
	else
	{
		div.removeClass('active');
		div.get(0).title='Зафиксировать вкладку';
	}
	get_work_box_content();
}
function get_work_box_content()
{
	ajaxloader=$('div.work_box div.work_box_content div.ajaxloader');
	div=$('div.sub_work_box_content');
	div.hide();
	ajaxloader.show();
	div.load(
						"index_files/ajax.php?action=get_work_box_content&type_work="+current_type_work,
						function()
						{
							current_page_work=1;
							ajaxloader.hide();
							div.show();
							
							init_stats('stats_work'+current_type_work);
						}
				);
}
function save_boockmark_work()
{
	div=$('div.work_box li.save_boockmark div');
	if(div.get(0).className=='active')
	{
		  div.removeClass('active');
		  div.get(0).title='Зафиксировать вкладку';
		  deleteCookie( 'save_boockmark_work' ,'/','ukrbiznes.com');
	}
	else
	{
		div.addClass('active');
		div.get(0).title='Зафиксированная вкладка';
		setCookie( 'save_boockmark_work', current_type_work, 100, '/','ukrbiznes.com');
	}
}
function work_move_page(param)
{
	max_page=8;
	if(param=='+' && current_page_work==max_page)
	  return;
	if(param=='-' && current_page_work==1)
	  return;
	if(param=='+')
	  current_page_work++;
	else
	  if(param=='-')
	    current_page_work--;
	  else
	    current_page_work=param;
		
	img = $('div.work_box_content div.pages img');
	img.attr('src', 'index_files/images/ajax-'+current_page_work+'of'+max_page+'-theme'+current_theme+'.gif');
	div=$('div.work_box_content div.buttons_page');
	if(current_page_work==1)
	  div.css('backgroundPosition','left -34px');
	else
	  if(current_page_work==max_page)
	    div.css('backgroundPosition','left -17px');
	  else
	  {
	    div.css('backgroundPosition','left 0px');
	  }
    ajaxloader=$('div.work_box div.work_box_content div.ajaxloader');
	div=$('div.work_box_content div.sub_content_page');
	div.hide();
	ajaxloader.show();
	div.load(
						"index_files/ajax.php?action=get_work_box_content_page&type_work="+current_type_work+"&page="+current_page_work,
						function()
						{
							ajaxloader.hide();
							div.show();
							
							init_stats('stats_work'+current_type_work);
						}
				); 
}
/*-------------------------- site box ----------------------------------*/
function init_site_box()
{
	current_page_site=1;
	current_type_site=getCookie('save_boockmark_site');
	if(!current_type_site)
	  current_type_site=1;
}
function change_type_site(type)
{
	if(current_type_site==type)
	{
	  window.open('http://ukrbiznes.com/websitecat.php');
	  return;
	}
	$('div.site_box li.menu').removeClass('menu_active');
	$('div.site_box li.boockmark'+type).addClass('menu_active');
	current_type_site=type;
	div=$('div.site_box li.save_boockmark div');
	if(current_type_site==getCookie('save_boockmark_site'))
	{
		div.addClass('active');
		div.get(0).title='Зафиксированная вкладка';
	}
	else
	{
		div.removeClass('active');
		div.get(0).title='Зафиксировать вкладку';
	}
	get_site_box_content();
}
function get_site_box_content()
{
	ajaxloader=$('div.site_box_content div.ajaxloader');
	div=$('div.sub_site_box_content');
	div.hide();
	ajaxloader.show();
	div.load(
						"index_files/ajax.php?action=get_site_box_content&type_site="+current_type_site,
						function()
						{
							current_page_site=1;
							ajaxloader.hide();
							div.show();
							
							init_stats('stats_site'+current_type_site);
						}
				);
}
function site_move_page(param)
{
	max_page=8;
	if(param=='+' && current_page_site==max_page)
	  return;
	if(param=='-' && current_page_site==1)
	  return;
	if(param=='+')
	  current_page_site++;
	else
	  if(param=='-')
	    current_page_site--;
	  else
	    current_page_site=param;
		
	img = $('div.site_box_content div.pages img');
	img.attr('src', 'index_files/images/ajax-'+current_page_site+'of'+max_page+'-theme'+current_theme+'.gif');
	div=$('div.site_box_content div.buttons_page');
	if(current_page_site==1)
	  div.css('backgroundPosition','left -34px');
	else
	  if(current_page_site==max_page)
	    div.css('backgroundPosition','left -17px');
	  else
	  {
	    div.css('backgroundPosition','left 0px');
	  }
	ajaxloader=$('div.site_box_content div.ajaxloader');  
	div=$('div.site_box_content div.sub_content_page');
	div.hide();
	ajaxloader.show();
	div.load(
						"index_files/ajax.php?action=get_site_box_content_page&type_site="+current_type_site+"&page="+current_page_site,
						function()
						{
							ajaxloader.hide();
							div.show();
							
							init_stats('stats_site'+current_type_site);
						}
				); 
}
function save_boockmark_site()
{
	div=$('div.site_box li.save_boockmark div');
	if(div.get(0).className=='active')
	{
		  div.removeClass('active');
		  div.get(0).title='Зафиксировать вкладку';
		  deleteCookie( 'save_boockmark_site' ,'/','ukrbiznes.com');
	}
	else
	{
		div.addClass('active');
		div.get(0).title='Зафиксированная вкладка';
		setCookie( 'save_boockmark_site', current_type_site, 100, '/','ukrbiznes.com');
	}
}
/*-------------------------- label ----------------------------------*/
function init_label_box()
{
	current_type_label=getCookie('save_boockmark_label');
	if(!current_type_label)
	  current_type_label=1;
}
function change_type_label(type)
{
	if(current_type_label==type)
	  return;
	$('div.label_box li.menu').removeClass('menu_active');
	$('div.label_box li.boockmark'+type).addClass('menu_active');
	current_type_label=type;
	load_label();
}
function load_label()
{
	ajaxloader=$('div.label_box div.label_box_content div.ajaxloader');
	div=$('div.sub_label_box_content');
	div.hide();
	ajaxloader.show();
	div.load(
						"index_files/ajax.php?action=get_label&type="+current_type_label,
						function()
						{
							ajaxloader.hide();
							div.show();
							
							init_stats('stats_label'+current_type_label);
						}
				);
}
/*-------------------------- settings ----------------------------------*/
function init_settings(number,reload_time)
{
	current_theme=number;
	change_theme='';
	
	current_reload_time_index_page=reload_time;
	change_reload_time_index_page='';
}
function show_hide_form_settings()
{
	if($('div.settings div.container_form_settings').is(':visible'))
	{
		$('div.settings div.container_form_settings').hide();
		
		change_theme='';
	    $('div.settings div.change_theme').removeClass('change_theme_active');
	    $('#button_change_theme_'+current_theme).addClass('change_theme_active');
		
		change_reload_time_index_page='';
		if(current_reload_time_index_page==0)
		  tempvar=0;
		if(current_reload_time_index_page==5)
		  tempvar=1;
		if(current_reload_time_index_page==10)
		  tempvar=2;
		if(current_reload_time_index_page==15)
		  tempvar=3;
		if(current_reload_time_index_page==30)
		  tempvar=4;
		$('#select_reload_time').get(0).selectedIndex=tempvar;
	}
	else
	{
		$('div.settings div.container_form_settings').show();
	}
}
function change_theme_index(number)
{
	change_theme=number;
	$('div.settings div.change_theme').removeClass('change_theme_active');
	$('#button_change_theme_'+number).addClass('change_theme_active');
}
function change_reload_time_index(reload_time)
{
	change_reload_time_index_page=reload_time;
}
function save_change_settings()
{
	params='';
	
	if(change_theme!='')
	{
		params='theme='+change_theme;
	}
	if(change_reload_time_index_page!='')
	{
		if(params=='')
		  params='reload_time_index_page='+change_reload_time_index_page;
		else
		  params+='&reload_time_index_page='+change_reload_time_index_page;
	}
	if(params!='')
	{
		document.location='?'+params;
	}
	else
	{
		show_hide_form_settings();
	}
}
/*--------------------------ogol box ----------------------------------*/
function init_ogol_box()
{
	current_page_ogol=1;
	current_type_ogol=getCookie('save_boockmark_ogol');
	if(!current_type_ogol)
	  current_type_ogol=1;
}
function ogol_move_page(param)
{
	max_page=8;
	if(param=='+' && current_page_ogol==max_page)
	  return;
	if(param=='-' && current_page_ogol==1)
	  return;
	if(param=='+')
	  current_page_ogol++;
	else
	  if(param=='-')
	    current_page_ogol--;
	  else
	    current_page_ogol=param;
		
	img = $('div.ogol_box_content div.pages img');
	img.attr('src', 'index_files/images/ajax-'+current_page_ogol+'of'+max_page+'-theme'+current_theme+'.gif');
	div=$('div.ogol_box_content div.buttons_page');
	if(current_page_ogol==1)
	  div.css('backgroundPosition','left -34px');
	else
	  if(current_page_ogol==max_page)
	    div.css('backgroundPosition','left -17px');
	  else
	  {
	    div.css('backgroundPosition','left 0px');
	  }
    ajaxloader=$('div.ogol_box div.ogol_box_content div.ajaxloader');
	div=$('div.ogol_box_content div.sub_content_page');
	div.hide();
	ajaxloader.show();
	div.load(
						"index_files/ajax.php?action=get_ogol_box_content_page&type_ogol="+current_type_ogol+"&page="+current_page_ogol,
						function()
						{
							current_item_ogol='';
							ajaxloader.hide();
							div.show();
							
							init_stats('stats_ogol'+current_type_ogol);
						}
				); 
}

function change_type_ogol(type)
{
	if(current_type_ogol==type)
	{
	  window.open('http://www.ukrbiznes.com/boardind.php');
	  return;
	}
	$('div.ogol_box li.menu').removeClass('menu_active');
	$('div.ogol_box li.boockmark'+type).addClass('menu_active');
	current_type_ogol=type;
	div=$('div.ogol_box li.save_boockmark div');
	if(current_type_ogol==getCookie('save_boockmark_ogol'))
	{
		div.addClass('active');
		div.get(0).title='Зафиксированная вкладка';
	}
	else
	{
		div.removeClass('active');
		div.get(0).title='Зафиксировать вкладку';
	}
	get_ogol_box_content();
}
function get_ogol_box_content()
{
	ajaxloader=$('div.ogol_box div.ogol_box_content div.ajaxloader');
	div=$('div.sub_ogol_box_content');
	div.hide();
	ajaxloader.show();
	div.load(
						"index_files/ajax.php?action=get_ogol_box_content&type_ogol="+current_type_ogol,
						function()
						{
							current_page_ogol=1;
							ajaxloader.hide();
							div.show();
							
							init_stats('stats_ogol'+current_type_ogol);
						}
				);
}
function save_boockmark_ogol()
{
	div=$('div.ogol_box li.save_boockmark div');
	if(div.get(0).className=='active')
	{
		  div.removeClass('active');
		  div.get(0).title='Зафиксировать вкладку';
		  deleteCookie( 'save_boockmark_ogol' ,'/','ukrbiznes.com');
	}
	else
	{
		div.addClass('active');
		div.get(0).title='Зафиксированная вкладка';
		setCookie( 'save_boockmark_ogol', current_type_ogol, 100, '/');
	}
}
//========================mail===========
function enter_mail()
{
	if($('div.mail_box_label div.mail_box_brief').is(':visible'))
	{
	  $('div.mail_box_label div.mail_box_brief').hide();
	  $('div.mail_box_label div.mail_box_full').show();
	  $('div.mail_box_label div.labels').height(175);
	  $('#kind_mail_box_label').attr('checked',false);
	}
	else
	{
	  $('div.mail_box_label div.mail_box_full').hide();
	  $('div.mail_box_label div.mail_box_brief').show();
	  $('div.mail_box_label div.labels').height(250);
	  $('#kind_mail_box_label').attr('checked',true);
	}
}
/*-------------------------- portraits ----------------------------------*/
function get_content_box_portraits(page)
{
	$('div.portraits div.portraits_content').hide();
	$('div.portraits div.ajaxloader').show();
	$.get(
			'index_files/ajax.php',	
			{
				 action: 'get_content_box_portraits', 
				 page: page
			},
			function (data)
			{
			    $('div.portraits div.portraits_content').html(data);
				$('div.portraits div.ajaxloader').hide();
				$('div.portraits div.portraits_content').show();
			}
		  );
}
/*-------------------------- mail_weather_money_super_box ----------------------------------*/
var count_item_list_superbox=7;
var m_list_super_box=new Array(count_item_list_superbox);
var m_current_list_super_box=new Array(6);
var current_number_button_superbox;
var current_number_list_services_superbox;
var m_list_country_superbox=new Array(29);
var m_current_list_country_superbox=new Array(6);
var list_exchange_superbox=new Array(9);

function init_mail_weather_money_super_box()
{
	if(!$('div.mail_weather_money_super_box').get(0))
	  return false;
	  
	m_list_super_box[1]=new Array(2);
	m_list_super_box[1]['class']='ubmail';
	m_list_super_box[1]['title']='ub.Mail';
	m_list_super_box[2]=new Array(2);
	m_list_super_box[2]['class']='weather';
	m_list_super_box[2]['title']='ub.Погода';
	m_list_super_box[3]=new Array(2);
	m_list_super_box[3]['class']='exchange';
	m_list_super_box[3]['title']='Курсы валют';
	m_list_super_box[4]=new Array(2);
	m_list_super_box[4]['class']='gmail';
	m_list_super_box[4]['title']='Gmail';
	m_list_super_box[5]=new Array(2);
	m_list_super_box[5]['class']='mailru';
	m_list_super_box[5]['title']='Mail.ru';
	m_list_super_box[6]=new Array(2);
	m_list_super_box[6]['class']='bigmir';
	m_list_super_box[6]['title']='Bigmir';
	m_list_super_box[7]=new Array(2);
	m_list_super_box[7]['class']='yahoo';
	m_list_super_box[7]['title']='Yahoo! Mail';
	//m_list_super_box[5]=new Array(2);
	//m_list_super_box[5]['class']='yandex';
	//m_list_super_box[5]['title']='Яндекс почта';
	//m_list_super_box[4]=new Array(2);
	//m_list_super_box[4]['class']='calendar';
	//m_list_super_box[4]['title']='ub.Календарь';
	//m_list_super_box[9]=new Array(2);
	//m_list_super_box[9]['class']='ukrnet';
	//m_list_super_box[9]['title']='Freemail';
	
	m_current_list_super_box[1] = getCookie('service_superbox1') ? getCookie('service_superbox1') : 1;
	m_current_list_super_box[2] = getCookie('service_superbox2') ? getCookie('service_superbox2') : 2;
	m_current_list_super_box[3] = getCookie('service_superbox3') ? getCookie('service_superbox3') : 3;
	m_current_list_super_box[4] = getCookie('service_superbox4') ? getCookie('service_superbox4') : 4;
	m_current_list_super_box[5] = getCookie('service_superbox5') ? getCookie('service_superbox5') : 5;
	m_current_list_super_box[6] = getCookie('service_superbox6') ? getCookie('service_superbox6') : 6;
	current_number_button_superbox = getCookie('current_number_button_superbox') ? getCookie('current_number_button_superbox') : 3;
	
    position_list_services_superbox(1,'top');
	if(current_number_button_superbox>2)
	  position_list_services_superbox(2,'top');
	else
	  position_list_services_superbox(2,'bottom');
	if(current_number_button_superbox>4)
	  position_list_services_superbox(3,'top');
	else
	  position_list_services_superbox(3,'bottom');
	
	
	m_list_country_superbox[1]=new Array(6);
	m_list_country_superbox[1]['title']='австралийский доллар';
	m_list_country_superbox[1]['img']='australia.gif';
	m_list_country_superbox[1]['valuta']='AUD';
	m_list_country_superbox[1]['size']=0;
	m_list_country_superbox[1]['rate']=0;
	m_list_country_superbox[1]['changes']=0;
	m_list_country_superbox[2]=new Array(6);
	m_list_country_superbox[2]['title']='азербайджанский манат';
	m_list_country_superbox[2]['img']='azerbaijan.gif';
	m_list_country_superbox[2]['valuta']='AZM';
	m_list_country_superbox[2]['size']=0;
	m_list_country_superbox[2]['rate']=0;
	m_list_country_superbox[2]['changes']=0;
	m_list_country_superbox[3]=new Array(6);
	m_list_country_superbox[3]['title']='английский фунт стерлингов';
	m_list_country_superbox[3]['img']='united_kingdom.gif';
	m_list_country_superbox[3]['valuta']='GBP';
	m_list_country_superbox[3]['size']=0;
	m_list_country_superbox[3]['rate']=0;
	m_list_country_superbox[3]['changes']=0;
	m_list_country_superbox[4]=new Array(6);
	m_list_country_superbox[4]['title']='белорусский рубль';
	m_list_country_superbox[4]['img']='belarus.gif';
	m_list_country_superbox[4]['valuta']='BYR';
	m_list_country_superbox[4]['size']=0;
	m_list_country_superbox[4]['rate']=0;
	m_list_country_superbox[4]['changes']=0;
	m_list_country_superbox[5]=new Array(6);
	m_list_country_superbox[5]['title']='датская крона';
	m_list_country_superbox[5]['img']='denmark.gif';
	m_list_country_superbox[5]['valuta']='DKK';
	m_list_country_superbox[5]['size']=0;
	m_list_country_superbox[5]['rate']=0;
	m_list_country_superbox[5]['changes']=0;
	m_list_country_superbox[6]=new Array(6);
	m_list_country_superbox[6]['title']='доллар США';
	m_list_country_superbox[6]['img']='usa.gif';
	m_list_country_superbox[6]['valuta']='USD';
	m_list_country_superbox[6]['size']=0;
	m_list_country_superbox[6]['rate']=0;
	m_list_country_superbox[6]['changes']=0;
	m_list_country_superbox[7]=new Array(6);
	m_list_country_superbox[7]['title']='эстонская крона';
	m_list_country_superbox[7]['img']='estonia.gif';
	m_list_country_superbox[7]['valuta']='EEK';
	m_list_country_superbox[7]['size']=0;
	m_list_country_superbox[7]['rate']=0;
	m_list_country_superbox[7]['changes']=0;
	m_list_country_superbox[8]=new Array(6);
	m_list_country_superbox[8]['title']='евро';
	m_list_country_superbox[8]['img']='european_union.gif';
	m_list_country_superbox[8]['valuta']='EUR';
	m_list_country_superbox[8]['size']=0;
	m_list_country_superbox[8]['rate']=0;
	m_list_country_superbox[8]['changes']=0;
	m_list_country_superbox[9]=new Array(6);
	m_list_country_superbox[9]['title']='исландская крона';
	m_list_country_superbox[9]['img']='iceland.gif';
	m_list_country_superbox[9]['valuta']='ISK';
	m_list_country_superbox[9]['size']=0;
	m_list_country_superbox[9]['rate']=0;
	m_list_country_superbox[9]['changes']=0;
	m_list_country_superbox[10]=new Array(6);
	m_list_country_superbox[10]['title']='казахский тенге';
	m_list_country_superbox[10]['img']='kazakhstan.gif';
	m_list_country_superbox[10]['valuta']='KZT';
	m_list_country_superbox[10]['size']=0;
	m_list_country_superbox[10]['rate']=0;
	m_list_country_superbox[10]['changes']=0;
	m_list_country_superbox[11]=new Array(6);
	m_list_country_superbox[11]['title']='канадский доллар';
	m_list_country_superbox[11]['img']='canada.gif';
	m_list_country_superbox[11]['valuta']='CAD';
	m_list_country_superbox[11]['size']=0;
	m_list_country_superbox[11]['rate']=0;
	m_list_country_superbox[11]['changes']=0;
	m_list_country_superbox[12]=new Array(6);
	m_list_country_superbox[12]['title']='латвийский лат';
	m_list_country_superbox[12]['img']='latvia.gif';
	m_list_country_superbox[12]['valuta']='LVL';
	m_list_country_superbox[12]['size']=0;
	m_list_country_superbox[12]['rate']=0;
	m_list_country_superbox[12]['changes']=0;
	m_list_country_superbox[13]=new Array(6);
	m_list_country_superbox[13]['title']='литовский лит';
	m_list_country_superbox[13]['img']='lithuania.gif';
	m_list_country_superbox[13]['valuta']='LTL';
	m_list_country_superbox[13]['size']=0;
	m_list_country_superbox[13]['rate']=0;
	m_list_country_superbox[13]['changes']=0;
	m_list_country_superbox[14]=new Array(6);
	m_list_country_superbox[14]['title']='молдавский лей';
	m_list_country_superbox[14]['img']='moldova.gif';
	m_list_country_superbox[14]['valuta']='MDL';
	m_list_country_superbox[14]['size']=0;
	m_list_country_superbox[14]['rate']=0;
	m_list_country_superbox[14]['changes']=0;
	m_list_country_superbox[15]=new Array(6);
	m_list_country_superbox[15]['title']='норвежская крона';
	m_list_country_superbox[15]['img']='norway.gif';
	m_list_country_superbox[15]['valuta']='NOK';
	m_list_country_superbox[15]['size']=0;
	m_list_country_superbox[15]['rate']=0;
	m_list_country_superbox[15]['changes']=0;
	m_list_country_superbox[16]=new Array(6);
	m_list_country_superbox[16]['title']='польский злотый';
	m_list_country_superbox[16]['img']='poland.gif';
	m_list_country_superbox[16]['valuta']='PLN';
	m_list_country_superbox[16]['size']=0;
	m_list_country_superbox[16]['rate']=0;
	m_list_country_superbox[16]['changes']=0;
	m_list_country_superbox[17]=new Array(6);
	m_list_country_superbox[17]['title']='русский рубль';
	m_list_country_superbox[17]['img']='russia.gif';
	m_list_country_superbox[17]['valuta']='RUB';
	m_list_country_superbox[17]['size']=0;
	m_list_country_superbox[17]['rate']=0;
	m_list_country_superbox[17]['changes']=0;
	m_list_country_superbox[18]=new Array(6);
	m_list_country_superbox[18]['title']='сингапурский доллар';
	m_list_country_superbox[18]['img']='singapore.gif';
	m_list_country_superbox[18]['valuta']='SGD';
	m_list_country_superbox[18]['size']=0;
	m_list_country_superbox[18]['rate']=0;
	m_list_country_superbox[18]['changes']=0;
	m_list_country_superbox[19]=new Array(6);
	m_list_country_superbox[19]['title']='словацкая крона';
	m_list_country_superbox[19]['img']='slovakia.gif';
	m_list_country_superbox[19]['valuta']='SKK';
	m_list_country_superbox[19]['size']=0;
	m_list_country_superbox[19]['rate']=0;
	m_list_country_superbox[19]['changes']=0;
	m_list_country_superbox[20]=new Array(6);
	m_list_country_superbox[20]['title']='турецкая лира';
	m_list_country_superbox[20]['img']='turkey.gif';
	m_list_country_superbox[20]['valuta']='TRL';
	m_list_country_superbox[20]['size']=0;
	m_list_country_superbox[20]['rate']=0;
	m_list_country_superbox[20]['changes']=0;
	m_list_country_superbox[21]=new Array(6);
	m_list_country_superbox[21]['title']='туркменский манат';
	m_list_country_superbox[21]['img']='turkmenistan.gif';
	m_list_country_superbox[21]['valuta']='TMM';
	m_list_country_superbox[21]['size']=0;
	m_list_country_superbox[21]['rate']=0;
	m_list_country_superbox[21]['changes']=0;
	m_list_country_superbox[22]=new Array(6);
	m_list_country_superbox[22]['title']='венгерский форент';
	m_list_country_superbox[22]['img']='hungary.gif';
	m_list_country_superbox[22]['valuta']='HUF';
	m_list_country_superbox[22]['size']=0;
	m_list_country_superbox[22]['rate']=0;
	m_list_country_superbox[22]['changes']=0;
	m_list_country_superbox[23]=new Array(6);
	m_list_country_superbox[23]['title']='узбекский сум';
	m_list_country_superbox[23]['img']='uzbekistan.gif';
	m_list_country_superbox[23]['valuta']='UZS';
	m_list_country_superbox[23]['size']=0;
	m_list_country_superbox[23]['rate']=0;
	m_list_country_superbox[23]['changes']=0;
	m_list_country_superbox[24]=new Array(6);
	m_list_country_superbox[24]['title']='чешская крона';
	m_list_country_superbox[24]['img']='czech_republic.gif';
	m_list_country_superbox[24]['valuta']='CZK';
	m_list_country_superbox[24]['size']=0;
	m_list_country_superbox[24]['rate']=0;
	m_list_country_superbox[24]['changes']=0;
	m_list_country_superbox[25]=new Array(6);
	m_list_country_superbox[25]['title']='шведская крона';
	m_list_country_superbox[25]['img']='sweden.gif';
	m_list_country_superbox[25]['valuta']='SEK';
	m_list_country_superbox[25]['size']=0;
	m_list_country_superbox[25]['rate']=0;
	m_list_country_superbox[25]['changes']=0;
	m_list_country_superbox[26]=new Array(6);
	m_list_country_superbox[26]['title']='швейцарский франк';
	m_list_country_superbox[26]['img']='switzerland.gif';
	m_list_country_superbox[26]['valuta']='CHF';
	m_list_country_superbox[26]['size']=0;
	m_list_country_superbox[26]['rate']=0;
	m_list_country_superbox[26]['changes']=0;
	m_list_country_superbox[27]=new Array(6);
	m_list_country_superbox[27]['title']='китайский юань';
	m_list_country_superbox[27]['img']='china.gif';
	m_list_country_superbox[27]['valuta']='CNY';
	m_list_country_superbox[27]['size']=0;
	m_list_country_superbox[27]['rate']=0;
	m_list_country_superbox[27]['changes']=0;
	m_list_country_superbox[28]=new Array(6);
	m_list_country_superbox[28]['title']='японская иена';
	m_list_country_superbox[28]['img']='japan.gif';
	m_list_country_superbox[28]['valuta']='JPY';
	m_list_country_superbox[28]['size']=0;
	m_list_country_superbox[28]['rate']=0;
	m_list_country_superbox[28]['changes']=0;
	
	get_data_currency();
	
	list_exchange_superbox_txt = getCookie('list_exchange_superbox') ? getCookie('list_exchange_superbox') : '8,6,3,17,16,11,convertor';
	list_exchange_superbox=list_exchange_superbox_txt.split(',');
	for(i=0;i<9;i++)
	  if(!list_exchange_superbox[i])
	    list_exchange_superbox[i]='';
}
function click_button_superbox(number)
{
	if(number==current_number_button_superbox)
	  return false;
	current_number_button_superbox=number;
	//setCookie( 'current_number_button_superbox', number, 100);
	setCookie( 'current_number_button_superbox', number, 100, '/', '.ukrbiznes.com');
	$('div.mail_weather_money_super_box div.button').removeClass('button_active');
	$('div.mail_weather_money_super_box div.content').hide();
	if(number==1)
	{
		if(m_current_list_super_box[number]==1 || m_current_list_super_box[number]==5 || m_current_list_super_box[number]==6 || m_current_list_super_box[number]==7 || m_current_list_super_box[number]==8 || m_current_list_super_box[number]==9 || m_current_list_super_box[number]==10)
		  $('#content_superbox1').css('backgroundPosition','left 0px');
		else
		  $('#content_superbox1').css('backgroundPosition','left -502px');
		$('#content_superbox1').show();
		$('#button_superbox1').addClass('button_active');
		position_list_services_superbox(2,'bottom');
		position_list_services_superbox(3,'bottom');
	}
	else if(number==2)
	{
		if(m_current_list_super_box[number]==1 || m_current_list_super_box[number]==5 || m_current_list_super_box[number]==6 || m_current_list_super_box[number]==7 || m_current_list_super_box[number]==8 || m_current_list_super_box[number]==9 || m_current_list_super_box[number]==10)
		  $('#content_superbox1').css('backgroundPosition','left -251px');
		else
		  $('#content_superbox1').css('backgroundPosition','left -753px');
		$('#content_superbox1').show();
		$('#button_superbox2').addClass('button_active');
		position_list_services_superbox(2,'bottom');
		position_list_services_superbox(3,'bottom');
	}
	else if(number==3)
	{
		if(m_current_list_super_box[number]==1 || m_current_list_super_box[number]==5 || m_current_list_super_box[number]==6 || m_current_list_super_box[number]==7 || m_current_list_super_box[number]==8 || m_current_list_super_box[number]==9 || m_current_list_super_box[number]==10)
		  $('#content_superbox2').css('backgroundPosition','left 0px');
		else
		  $('#content_superbox2').css('backgroundPosition','left -502px');
		$('#content_superbox2').show();
		$('#button_superbox3').addClass('button_active');
		position_list_services_superbox(2,'top');
		position_list_services_superbox(3,'bottom');
	}
	else if(number==4)
	{
		if(m_current_list_super_box[number]==1 || m_current_list_super_box[number]==5 || m_current_list_super_box[number]==6 || m_current_list_super_box[number]==7 || m_current_list_super_box[number]==8 || m_current_list_super_box[number]==9 || m_current_list_super_box[number]==10)
		  $('#content_superbox2').css('backgroundPosition','left -251px');
		else
		  $('#content_superbox2').css('backgroundPosition','left -753px');
		$('#content_superbox2').show();
		$('#button_superbox4').addClass('button_active');
		position_list_services_superbox(2,'top');
		position_list_services_superbox(3,'bottom');
	}
	else if(number==5)
	{
		if(m_current_list_super_box[number]==1 || m_current_list_super_box[number]==5 || m_current_list_super_box[number]==6 || m_current_list_super_box[number]==7 || m_current_list_super_box[number]==8 || m_current_list_super_box[number]==9 || m_current_list_super_box[number]==10)
		  $('#content_superbox3').css('backgroundPosition','left 0px');
		else
		  $('#content_superbox3').css('backgroundPosition','left -502px');
		$('#content_superbox3').show();
		$('#button_superbox5').addClass('button_active');
		position_list_services_superbox(2,'top');
		position_list_services_superbox(3,'top');
	}
	else if(number==6)
	{
		if(m_current_list_super_box[number]==1 || m_current_list_super_box[number]==5 || m_current_list_super_box[number]==6 || m_current_list_super_box[number]==7 || m_current_list_super_box[number]==8 || m_current_list_super_box[number]==9 || m_current_list_super_box[number]==10)
		  $('#content_superbox3').css('backgroundPosition','left -251px');
		else
		  $('#content_superbox3').css('backgroundPosition','left -753px');
		$('#content_superbox3').show();
		$('#button_superbox6').addClass('button_active');
		position_list_services_superbox(2,'top');
		position_list_services_superbox(3,'top');
	}
	get_content_superbox(m_current_list_super_box[number]);
}
function create_list_services_superbox(position, number_button)
{
	html_list_services='<div class="list"><div class="list_content">';
	html_list_services+='<input class="flag_hide" type="text" onblur="setTimeout(\'hide_list_services_superbox('+number_button+')\',200)">';
	if(position=='top')
	  html_list_services+='<div class="triangle"><span></span></div>';
	for(i=1;i<=count_item_list_superbox;i++)
	{
	  html_list_services+='<div class="list_item '+m_list_super_box[i]['class']+'" onclick="change_services_superbox('+i+')">'+m_list_super_box[i]['title']+'</div>';
	  if(i<count_item_list_superbox)
	    html_list_services+='<div class="separator"><span></span></div>';
	}
	if(position=='bottom')
	  html_list_services+='<div class="triangle"><span></span></div>';
	html_list_services+='</div></div>';
	return html_list_services;
}
function position_list_services_superbox(line,position)
{
	if(line==1)
	{
		if(position=='top')
		{
			$('#button_superbox1 div.show_menu').html(create_list_services_superbox('top',1));
			$('#button_superbox2 div.show_menu').html(create_list_services_superbox('top',2));
			$('#button_superbox1 div.show_menu div.list').removeClass('list_bottom');
		    $('#button_superbox1 div.show_menu div.list').addClass('list_top');
			$('#button_superbox2 div.show_menu div.list').removeClass('list_bottom');
		    $('#button_superbox2 div.show_menu div.list').addClass('list_top');
		}
		else
		{
			$('#button_superbox1 div.show_menu').html(create_list_services_superbox('bottom',1));
			$('#button_superbox2 div.show_menu').html(create_list_services_superbox('bottom',2));
			$('#button_superbox1 div.show_menu div.list').removeClass('list_top');
		    $('#button_superbox1 div.show_menu div.list').addClass('list_bottom');
			$('#button_superbox2 div.show_menu div.list').removeClass('list_top');
		    $('#button_superbox2 div.show_menu div.list').addClass('list_bottom');
		}
	}
	if(line==2)
	{
		if(position=='top')
		{
			$('#button_superbox3 div.show_menu').html(create_list_services_superbox('top',3));
			$('#button_superbox4 div.show_menu').html(create_list_services_superbox('top',4));
			$('#button_superbox3 div.show_menu div.list').removeClass('list_bottom');
		    $('#button_superbox3 div.show_menu div.list').addClass('list_top');
			$('#button_superbox4 div.show_menu div.list').removeClass('list_bottom');
		    $('#button_superbox4 div.show_menu div.list').addClass('list_top');
		}
		else
		{
			$('#button_superbox3 div.show_menu').html(create_list_services_superbox('bottom',3));
			$('#button_superbox4 div.show_menu').html(create_list_services_superbox('bottom',4));
			$('#button_superbox3 div.show_menu div.list').removeClass('list_top');
		    $('#button_superbox3 div.show_menu div.list').addClass('list_bottom');
			$('#button_superbox4 div.show_menu div.list').removeClass('list_top');
		    $('#button_superbox4 div.show_menu div.list').addClass('list_bottom');
		}
	}
	if(line==3)
	{
		if(position=='top')
		{
			$('#button_superbox5 div.show_menu').html(create_list_services_superbox('top',5));
			$('#button_superbox6 div.show_menu').html(create_list_services_superbox('top',6));
			$('#button_superbox5 div.show_menu div.list').removeClass('list_bottom');
		    $('#button_superbox5 div.show_menu div.list').addClass('list_top');
			$('#button_superbox6 div.show_menu div.list').removeClass('list_bottom');
		    $('#button_superbox6 div.show_menu div.list').addClass('list_top');
		}
		else
		{
			$('#button_superbox5 div.show_menu').html(create_list_services_superbox('bottom',5));
			$('#button_superbox6 div.show_menu').html(create_list_services_superbox('bottom',6));
			$('#button_superbox5 div.show_menu div.list').removeClass('list_top');
		    $('#button_superbox5 div.show_menu div.list').addClass('list_bottom');
			$('#button_superbox6 div.show_menu div.list').removeClass('list_top');
		    $('#button_superbox6 div.show_menu div.list').addClass('list_bottom');
		}
	}
}
function show_list_services_superbox(number)
{
	if(!$('#button_superbox'+number+' div.show_menu div.list').is(':visible'))
	{
	  current_number_list_services_superbox=number;
	  $('div.mail_weather_money_super_box div.button div.show_menu div.list').hide();
	  if(jQuery.browser['msie'])
	  {
	    if(m_current_list_super_box[current_number_button_superbox]==2)
		  if(number==1 || number==3 || number==5)
			$('div.content_weather img.fixme:even').hide();
		  else
	        $('div.content_weather img.fixme:odd').hide();
		if(m_current_list_super_box[current_number_button_superbox]==3)
		{
		    $('#exchange_from').hide();
		    $('#exchange_to').hide();
		}
	  }
	  
	  if(jQuery.browser['msie'])
	  {
		  for(i=1;i<=6;i++)
		  {
			if(i!=number)
			  $('#button_superbox'+i).css('zIndex','');
			else
			  $('#button_superbox'+i).css('zIndex','30');
		  }
	  }
	  
	  $('#button_superbox'+number+' div.show_menu div.list').show();
	  if($('#button_superbox'+number+' div.show_menu div.list .flag_hide').get(0))
	    $('#button_superbox'+number+' div.show_menu div.list .flag_hide').get(0).focus();
	}
	else if(current_number_list_services_superbox==number)
	{
	  hide_list_services_superbox(number);
	}
}
function hide_list_services_superbox(number)
{
	$('#button_superbox'+number+' div.show_menu div.list').hide()
	if(current_number_list_services_superbox==number)
	{
		if(jQuery.browser['msie'])
		{
			if(m_current_list_super_box[current_number_button_superbox]==2)
			{
			  if((number==1 || number==3 || number==5) && (current_number_list_services_superbox==2 || current_number_list_services_superbox==4 || current_number_list_services_superbox==6) || (number==2 || number==4 || number==6) && (current_number_list_services_superbox==1 || current_number_list_services_superbox==3 || current_number_list_services_superbox==5))
			  {
				  if(number==1 || number==3 || number==5)
					$('div.content_weather img.fixme:even').show();
				  else
					$('div.content_weather img.fixme:odd').show();
			  }
			  else
			  {
			    $('div.content_weather img.fixme').show();
			  }
			}
			if(m_current_list_super_box[current_number_button_superbox]==3)
			{
				if(current_number_list_services_superbox==0)
				{
					$('#exchange_from').show();
					$('#exchange_to').show();
				}
			}
		}
		current_number_list_services_superbox=0;
	}
	else
	{
		if(jQuery.browser['msie'])
		{
			if(m_current_list_super_box[current_number_button_superbox]==2)
			{
			  if((number==1 || number==3 || number==5) && (current_number_list_services_superbox==2 || current_number_list_services_superbox==4 || current_number_list_services_superbox==6) || (number==2 || number==4 || number==6) && (current_number_list_services_superbox==1 || current_number_list_services_superbox==3 || current_number_list_services_superbox==5))
			  {
				  if(number==1 || number==3 || number==5)
					$('div.content_weather img.fixme:even').show();
				  else
					$('div.content_weather img.fixme:odd').show();
			  }
			}
			if(m_current_list_super_box[current_number_button_superbox]==3)
			{
				if(current_number_list_services_superbox==0)
				{
					$('#exchange_from').show();
					$('#exchange_to').show();
				}
			}
		}
	}
}
function in_m_current_list_super_box(val)
{
	for(i=1;i<=6;i++)
	{
		if(m_current_list_super_box[i]==val)
		  return i;
	}
	return 0;
}
function change_services_superbox(number)
{
	if(number==m_current_list_super_box[current_number_list_services_superbox])
	  return;
	reload_box=false;
	if(current_number_list_services_superbox==current_number_button_superbox)
	  reload_box=true;
	if(current_number_list_services_superbox>0)
	{
		if(number_button=in_m_current_list_super_box(number))
		{
			  if(number==m_current_list_super_box[current_number_button_superbox])
	            reload_box=true;
			  $('#button_superbox'+number_button+' div.face').removeClass(m_list_super_box[m_current_list_super_box[number_button]]['class']);
			  $('#button_superbox'+number_button+' div.face').addClass(m_list_super_box[m_current_list_super_box[current_number_list_services_superbox]]['class']);
			  $('#button_superbox'+number_button+' div.face div').text(m_list_super_box[m_current_list_super_box[current_number_list_services_superbox]]['title']);
			  m_current_list_super_box[number_button]=m_current_list_super_box[current_number_list_services_superbox];
		}
	    $('#button_superbox'+current_number_list_services_superbox+' div.face').removeClass(m_list_super_box[m_current_list_super_box[current_number_list_services_superbox]]['class']);
	    $('#button_superbox'+current_number_list_services_superbox+' div.face').addClass(m_list_super_box[number]['class']);
	    $('#button_superbox'+current_number_list_services_superbox+' div.face div').text(m_list_super_box[number]['title']);
	    m_current_list_super_box[current_number_list_services_superbox]=number;
	}
	if(current_number_list_services_superbox>0 && reload_box)
	{
		get_content_superbox(m_current_list_super_box[current_number_button_superbox]);
		if(m_current_list_super_box[current_number_button_superbox]==1 || m_current_list_super_box[current_number_button_superbox]==5 || m_current_list_super_box[current_number_button_superbox]==6 || m_current_list_super_box[current_number_button_superbox]==7 || m_current_list_super_box[current_number_button_superbox]==8 || m_current_list_super_box[current_number_button_superbox]==9 || m_current_list_super_box[current_number_button_superbox]==10)
		{
			if(current_number_button_superbox==1)
			  $('#content_superbox1').css('backgroundPosition','left 0px');
			else if(current_number_button_superbox==2)
			  $('#content_superbox1').css('backgroundPosition','left -251px');
			else if(current_number_button_superbox==3)
			  $('#content_superbox2').css('backgroundPosition','left 0px');
			else if(current_number_button_superbox==4)
			  $('#content_superbox2').css('backgroundPosition','left -251px');
			else if(current_number_button_superbox==5)
			  $('#content_superbox3').css('backgroundPosition','left 0px');
			else if(current_number_button_superbox==6)
			  $('#content_superbox3').css('backgroundPosition','left -251px');
		}
		else
		{
			if(current_number_button_superbox==1)
			  $('#content_superbox1').css('backgroundPosition','left -502px');
			else if(current_number_button_superbox==2)
			  $('#content_superbox1').css('backgroundPosition','left -753px');
			else if(current_number_button_superbox==3)
			  $('#content_superbox2').css('backgroundPosition','left -502px');
			else if(current_number_button_superbox==4)
			  $('#content_superbox2').css('backgroundPosition','left -753px');
			else if(current_number_button_superbox==5)
			  $('#content_superbox3').css('backgroundPosition','left -502px');
			else if(current_number_button_superbox==6)
			  $('#content_superbox3').css('backgroundPosition','left -753px');
		}
	}
	for(i=1;i<=6;i++)
	{
		//setCookie( 'service_superbox'+i, m_current_list_super_box[i], 100);
	    setCookie( 'service_superbox'+i, m_current_list_super_box[i], 100, '/', '.ukrbiznes.com');
	}
}
function get_content_superbox(number)
{
	if(current_number_button_superbox==1 || current_number_button_superbox==2)
	  number_content_superbox=1;
	if(current_number_button_superbox==3 || current_number_button_superbox==4)
	  number_content_superbox=2;
	if(current_number_button_superbox==5 || current_number_button_superbox==6)
	  number_content_superbox=3;
	ajaxloader=$('div.mail_weather_money_super_box div.ajaxloader');
	$('#content_superbox'+number_content_superbox+' .box_hide').hide();
	ajaxloader.show();
	$.get(
			'index_files/ajax.php',	
			{
				 action: 'get_content_superbox', 
				 number: number
			},
			function (data)
			{
				data=trim(data);
				ajaxloader.hide();
				$('#content_superbox'+number_content_superbox).html(data);
				if(number==2)
				  if(jQuery.browser['msie'])
				    setTimeout("$('div.content_weather img.fixme').ifixpng()",100);
			    init_stats('stats_entermail');
			}
		  );
}
function show_hide_menu_cities_superbox()
{
	if($('#menu_cities_superbox').is(':visible'))
	{
	  $('#menu_cities_superbox').hide();
	  if(jQuery.browser['msie'])
	    $('div.content_weather img.fixme').show();
	}
	else
	{
	  $('#menu_cities_superbox').show();
	  if(jQuery.browser['msie'])
	    $('div.content_weather img.fixme').hide();
	}
}
function change_city_weather_superbox(city)
{
	setCookie( 'curren_city', city, 100);
	get_content_superbox(2);
}

function show_hide_list_currency()
{
	if($('div.content_exchange div.list_currency').is(':visible'))
	  $('div.content_exchange div.list_currency').hide();
	else
	  $('div.content_exchange div.list_currency').show();
}
function currency_convert()
{
	if($('#exchange_number').val()=='' || $('#exchange_number').val()=='Сумма')
	{
		alert('Введите сумму');
		return;
	}
	var re=new RegExp("([0-9])");
	if(!re.test($('#exchange_number').val()))
	{
		alert('Вы неправильно ввели сумму');
		return;
	}
	if($('#exchange_from').val()==$('#exchange_to').val())
	{
		alert('Валюты совпадают.');
		return;
	}
	from=$('#exchange_from').val();
    to=$('#exchange_to').val();
	tochar=to;
	number=$('#exchange_number').val();
	if(from=='UAH')
	  from=1;
	else
	{
	  from=get_index_currency_for_valuta(from);
	  from=m_list_country_superbox[from]['rate']/m_list_country_superbox[from]['size'];
	}
	if(to=='UAH')
	  to=1;
	else
	{
	  to=get_index_currency_for_valuta(to);
	  to=m_list_country_superbox[to]['rate']/m_list_country_superbox[to]['size'];
	}
	number=(from*number/to).toFixed(2)+' '+tochar;
	$('div.content_exchange div.convertor div.exchange_result').text(number);
}
function get_index_currency_for_valuta(valuta)
{
	for(j=1;j<=28;j++)
	  if(m_list_country_superbox[j]['valuta']==valuta)
	    return j;
	return false;
}
function get_data_currency()
{
	$.get(
			'index_files/ajax.php',	
			{
				 action: 'get_data_currency'
			},
			function (data)
			{
				data=trim(data);
				data=data.split('####');
				i=0;
				while(data[i])
				{
					data[i]=data[i].split('##');
					j=get_index_currency_for_valuta(data[i][0]);
					if(j)
					{
					  m_list_country_superbox[j]['size']=data[i][1];
	                  m_list_country_superbox[j]['rate']=data[i][2];
	                  m_list_country_superbox[j]['changes']=data[i][3];
					}
					i++;
				}
			}
		  );
}

function add_remove_valuta_in_superbox(box,add_box,obj_checkbox)
{
	if(add_box)
	{
		if(!add_list_exchange_superbox(box))
		{
			if(box=='convertor')
			  alert("Нет места для конвертора.\nВы сможете его добавить если в списке курсов будет не больше шести валют.");
			else
			  alert("Добавлено максимальное количество блоков.");
			$(obj_checkbox).get(0).checked=false;
			return false;
		}
		if(box=='convertor')
		{
			  $.get(
				'index_files/ajax.php',	
				{
					 action: 'get_convertor_superbox'
				},
				function (data)
				{
					data=trim(data);
					$('#list_exchange').after(data);
				}
			  );
		}
		else
		{
			
			if(m_list_country_superbox[box]['changes']>0)
			  class_changes='up'; 
			else if(m_list_country_superbox[box]['changes']<0)
			  class_changes='down'; 
			else
			  class_changes='none';
			
			line_valuta='<tr id="line_'+m_list_country_superbox[box]['valuta']+'">';
		      line_valuta+='<td><img width="24" height="18" src="index_files/images/icons_country/big/'+m_list_country_superbox[box]['img']+'" /></td>';
			  line_valuta+='<td class="padding-left-5px"><a>'+m_list_country_superbox[box]['size']+' '+m_list_country_superbox[box]['valuta']+'</a></td>';
			  line_valuta+='<td class="padding-left-5px" align="right">'+m_list_country_superbox[box]['rate']+'</td>';
			  line_valuta+='<td class="padding-left-5px" align="right"><div class="'+class_changes+'">'+m_list_country_superbox[box]['changes']+'</div></td>';
		    line_valuta+='</tr>';
			$('#line_exchange_end').before(line_valuta);
			
		}
	}
	else
	{
		delete_list_exchange_superbox(box);
		if(box=='convertor')
		{
			$('#convertor_superbox').remove();
		}
		else
		{
			$('#line_'+m_list_country_superbox[box]['valuta']).remove();
		}
	}
	update_convertor_valuta_list();
}
function add_list_exchange_superbox(box)
{
	convertor=0;
	exchange=0;
	for(i=0;i<9;i++)
	{
		if(list_exchange_superbox[i]!='')
		{
			if(list_exchange_superbox[i]=='convertor')
			  convertor++;
			else
			  exchange++;
		}
	}
	if(box=='convertor')
	{
		if(exchange>6)
		  return false;
	}
	else
	{
		if(convertor==1 && exchange==6)
		  return false;
		if(convertor==0 && exchange==9)
		  return false;
	}
	for(i=0;i<9;i++)
	{
		if(list_exchange_superbox[i]=='')
		{
		  list_exchange_superbox[i]=box;
		  list_exchange_superbox_txt='';
		  for(j=0;j<9;j++)
		    if(list_exchange_superbox[j]!='')
		      list_exchange_superbox_txt += list_exchange_superbox_txt=='' ? list_exchange_superbox[j] : ','+list_exchange_superbox[j];
		  //setCookie( 'list_exchange_superbox', list_exchange_superbox_txt, 100);
	      setCookie( 'list_exchange_superbox', list_exchange_superbox_txt, 100, '/', '.ukrbiznes.com');
		  return true;
		}
	}
}
function delete_list_exchange_superbox(box)
{
	for(i=0;i<9;i++)
	{
		if(list_exchange_superbox[i]==box)
		{
			for(j=i+1;j<9;j++)
			{
			  list_exchange_superbox[j-1]=list_exchange_superbox[j];
			  list_exchange_superbox[j]='';
			}
			list_exchange_superbox_txt='';
			for(j=0;j<9;j++)
		      if(list_exchange_superbox[j]!='')
		        list_exchange_superbox_txt += list_exchange_superbox_txt=='' ? list_exchange_superbox[j] : ','+list_exchange_superbox[j];
		    //setCookie( 'list_exchange_superbox', list_exchange_superbox_txt, 100);
	        setCookie( 'list_exchange_superbox', list_exchange_superbox_txt, 100, '/', '.ukrbiznes.com');
		    return true;
		}
	}
}
function update_convertor_valuta_list()
{
	if(!$('#convertor_superbox').get(0))
	  return false;
	convertor_valuta_list='<option value="UAH">UAH</option>';
	for(i=0;i<9;i++)
	{
		if(list_exchange_superbox[i]!='' && list_exchange_superbox[i]!='convertor')
		  convertor_valuta_list+='<option value="'+m_list_country_superbox[list_exchange_superbox[i]]['valuta']+'">'+m_list_country_superbox[list_exchange_superbox[i]]['valuta']+'</option>';
	}
	$('#exchange_from').html(convertor_valuta_list);
	$('#exchange_to').html(convertor_valuta_list);
	$('#exchange_from').get(0).selectedIndex=0;
	$('#exchange_to').get(0).selectedIndex=1;
}
/*-------------------------- stats ----------------------------------*/

/*
  1 - link
  2 - form
*/

function init_stats(param)
{
	if(param=='all' || param=='stats_linenews')
      $('.stats_linenews a').each(function(){if(!this.onclick){this.onclick=function() { add_stats(this,1,1) };}});
	  
	if(param=='all' || param=='stats_firmnews')
	  $('.stats_firmnews a').each(function(){if(!this.onclick){this.onclick=function() { add_stats(this,1,2) };}});
	  
	if(param=='all' || param=='stats_topnews')
	  $('.stats_topnews a').each(function(){if(!this.onclick){this.onclick=function() { add_stats(this,1,3) };}});
	  
	if(param=='all' || param=='stats_expressadver')
	  $('.stats_expressadver a').each(function(){if(!this.onclick){this.onclick=function() { add_stats(this,1,4) };}});
	  
	if(param=='all' || param=='stats_catalog')
	  $('.stats_catalog a').each(function(){if(!this.onclick){this.onclick=function() { add_stats(this,1,5) };}});
	  
	if(param=='all' || param=='stats_catalograting')
	  $('.stats_catalograting a').each(function(){if(!this.onclick){this.onclick=function() { add_stats(this,1,6) };}});
	  
	if(param=='all' || param=='stats_catalogpopular')
	  $('.stats_catalogpopular a').each(function(){if(!this.onclick){this.onclick=function() { add_stats(this,1,7) };}});
	  
	if(param=='all' || param=='stats_catalognew')
	  $('.stats_catalognew a').each(function(){if(!this.onclick){this.onclick=function() { add_stats(this,1,8) };}});
	  
	if(param=='all' || param=='stats_packets')
	  $('.stats_packets a').each(function(){if(!this.onclick){this.onclick=function() { add_stats(this,1,9) };}});
	  
	if(param=='all' || param=='stats_goods1')
	  $('.stats_goods1 a').each(function(){if(!this.onclick){this.onclick=function() { add_stats(this,1,10) };}});
	  
	if(param=='all' || param=='stats_goods2')
	  $('.stats_goods2 a').each(function(){if(!this.onclick){this.onclick=function() { add_stats(this,1,11) };}});
	  
	if(param=='all' || param=='stats_goods3')
	  $('.stats_goods3 a').each(function(){if(!this.onclick){this.onclick=function() { add_stats(this,1,12) };}});
	  
	if(param=='all' || param=='stats_goods4')
	  $('.stats_goods4 a').each(function(){if(!this.onclick){this.onclick=function() { add_stats(this,1,13) };}});
	  
	if(param=='all' || param=='stats_topgoods')
	  $('.stats_topgoods a').each(function(){if(!this.onclick){this.onclick=function() { add_stats(this,1,14) };}});
	  
	if(param=='all' || param=='stats_statti1')
	  $('.stats_statti1 a').each(function(){if(!this.onclick){this.onclick=function() { add_stats(this,1,15) };}});
	  
	if(param=='all' || param=='stats_statti2')
	  $('.stats_statti2 a').each(function(){if(!this.onclick){this.onclick=function() { add_stats(this,1,16) };}});
	  
	if(param=='all' || param=='stats_work1')
	  $('.stats_work1 a').each(function(){if(!this.onclick){this.onclick=function() { add_stats(this,1,17) };}});
	  
	if(param=='all' || param=='stats_work2')
	  $('.stats_work2 a').each(function(){if(!this.onclick){this.onclick=function() { add_stats(this,1,18) };}});
	  
	if(param=='all' || param=='stats_work3')
	  $('.stats_work3 a').each(function(){if(!this.onclick){this.onclick=function() { add_stats(this,1,19) };}});
	  
	if(param=='all' || param=='stats_site1')
	  $('.stats_site1 a').each(function(){if(!this.onclick){this.onclick=function() { add_stats(this,1,20) };}});
	  
	if(param=='all' || param=='stats_site2')
	  $('.stats_site2 a').each(function(){if(!this.onclick){this.onclick=function() { add_stats(this,1,21) };}});
	  
	if(param=='all' || param=='stats_site3')
	  $('.stats_site3 a').each(function(){if(!this.onclick){this.onclick=function() { add_stats(this,1,22) };}});
	  
	if(param=='all' || param=='stats_entermail')
	{
	  $('.stats_entermail a').each(function(){if(!this.onclick){this.onclick=function() { add_stats(this,1,23) };}});
	  $('.stats_entermail form').each(function(){if(!this.onsubmit){this.onsubmit=function() { add_stats(this,2,23) };}});
	}
	
	if(param=='all' || param=='stats_translate')
	{
	  $('.stats_translate a').each(function(){if(!this.onclick){this.onclick=function() { add_stats(this,1,24) };}});
	  $('.stats_translate form').each(function(){if(!this.onsubmit){this.onsubmit=function() { add_stats(this,2,24) };}});
	}
	
	if(param=='all' || param=='stats_siteofday')
	  $('.stats_siteofday a').each(function(){if(!this.onclick){this.onclick=function() { add_stats(this,1,25) };}});
	  
	if(param=='all' || param=='stats_gallery')
	  $('.stats_gallery a').each(function(){if(!this.onclick){this.onclick=function() { add_stats(this,1,26) };}});
	  
	if(param=='all' || param=='stats_label1')
	  $('.stats_label1 a').each(function(){if(!this.onclick){this.onclick=function() { add_stats(this,1,27) };}});
	  
	if(param=='all' || param=='stats_label2')
	  $('.stats_label2 a').each(function(){if(!this.onclick){this.onclick=function() { add_stats(this,1,28) };}});
	  
	if(param=='all' || param=='stats_clientsbanner')
	  $('.stats_clientsbanner a').each(function(){if(!this.onclick){this.onclick=function() { add_stats(this,1,29) };}});
	  
	if(param=='all' || param=='stats_allservices')
	  $('.stats_allservices a').each(function(){if(!this.onclick){this.onclick=function() { add_stats(this,1,30) };}});
	
	if(param=='all' || param=='stats_header_menu')
	  $('.stats_header_menu a').each(function(){if(!this.onclick){this.onclick=function() { add_stats(this,1,31) };}});
	
	if(param=='all' || param=='stats_ogol1')
	  $('.stats_ogol1 a').each(function(){if(!this.onclick){this.onclick=function() { add_stats(this,1,32) };}});
	  
	if(param=='all' || param=='stats_ogol2')
	  $('.stats_ogol2 a').each(function(){if(!this.onclick){this.onclick=function() { add_stats(this,1,33) };}});
	
	if(param=='all' || param=='stats_portraits')
	  $('.stats_portraits a').each(function(){if(!this.onclick){this.onclick=function() { add_stats(this,1,34) };}});
	 
	if(param=='all')
	{
	  $('#container a').each(function(){if(!this.onclick){this.onclick=function() { add_stats(this,1,0) };}});
	  $('#container form').each(function(){if(!this.onsubmit){this.onsubmit=function() { add_stats(this,2,0) };}});
	}
}
function add_stats(obj,type_obj,box)
{
	obj=$(obj);
	if(type_obj==1)
	{
	  title=obj.text();
	  url=obj.attr('href');
	}
	if(type_obj==2)
	{
	  title='';
	  url=obj.attr('action');
	}
	$.get(
			'index_files/ajax_add_stats.php',	
			{
				 type: type_obj,
				 title: title,
				 url: url,
				 box: box
			},
			function (data)
			{
			}
		  );
}

// ============================  ind new top news block ===========================================
var start_tab;
function loader_to_container(cont){
	$(cont).html("<div class='loader_in_container'><img src='img/ajax-loader.gif' /><div>");
}
function set_event(ind){
	if(ind==0){
		var inb_page_1=$("#inb_hid_page").val();
		var inb_count_bl_1=$("#inb_hid_count_block").val();
		if(inb_page_1==1) $("#ind_news_block div.cont div.buttools div.inblist img.larr").css("cursor",'default').fadeTo(1,0.5);
		if(inb_page_1==inb_count_bl_1) $("#ind_news_block div.cont div.buttools div.inblist img.rarr").css("cursor",'default').fadeTo(1,0.5);
		$("#ind_news_block div.cont div.buttools div.inblist img").click(function(){
			if($(this).hasClass('larr')){
				if(inb_page_1==1) return;
				inb_page_1--;
				if(inb_page_1<=1){
					inb_page_1=1;
					$("#ind_news_block div.cont div.buttools div.inblist img.larr").css("cursor",'default').fadeTo(1,0.5);
				}
				if(inb_page_1<inb_count_bl_1){
					$("#ind_news_block div.cont div.buttools div.inblist img.rarr").css("cursor",'pointer').css("cursor",'hand').fadeTo(1,1);
				}
				loader_to_container('#ind_news_block div.inb_to_load_top');
				$.post("ajax.php",{action:'get_ind_top_news_content',inbaction:'switch_block',page:inb_page_1},function(data){
					$("#ind_news_block div.inb_to_load_top").html(data);
				});
			}else{
				if(inb_page_1==inb_count_bl_1) return;
				inb_page_1++;
				if(inb_page_1>=inb_count_bl_1){
					inb_page_1=inb_count_bl_1;
					$("#ind_news_block div.cont div.buttools div.inblist img.rarr").css("cursor",'default').fadeTo(1,0.5);
				}
				if(inb_page_1>1){
					$("#ind_news_block div.cont div.buttools div.inblist img.larr").css("cursor",'pointer').css("cursor",'hand').fadeTo(1,1);
				}
				loader_to_container('#ind_news_block div.inb_to_load_top');
				$.post("ajax.php",{action:'get_ind_top_news_content',inbaction:'switch_block',page:inb_page_1},function(data){
					$("#ind_news_block div.inb_to_load_top").html(data);
				});
			}
		});
	}
	if(ind==1){
		page_event(ind);
	}
	if(ind==2){
		page_event(ind);
	}
}
function page_event(ind){
	var inb_ajax_page=1;
	$("#ind_news_block div.inb_ajaxList img.larr").hover(
			function(){
				if(inb_ajax_page!=1)
					$(this).css("background-position",'bottom');
			},
			function(){
				if(inb_ajax_page!=1)
					$(this).css("background-position",'top');
			}
		);
	$("#ind_news_block div.inb_ajaxList img.rarr").hover(
			function(){
				if(inb_ajax_page!=4)
					$(this).css("background-position",'bottom');
			},
			function(){
				if(inb_ajax_page!=4)
					$(this).css("background-position",'top');
			}
		);
	$("#ind_news_block div.inb_ajaxList img.larr").click(function(){
		if(inb_ajax_page==1) return;
		if(inb_ajax_page==4)$("#ind_news_block div.inb_ajaxList img.rarr").css("cursor",'pointer').css("cursor",'hand').css("background-position",'top');
		inb_ajax_page--;
		if(inb_ajax_page==1)$(this).css("cursor",'default').css("background-position",'0px 34px');
		$("#ind_news_block div.inb_ajaxList img.pajax").css("background-position",'0 -'+((inb_ajax_page-1)*7)+'');
		loader_to_container('#ind_news_block div.inb_lent_news');
		$.post("ajax.php",{action:'get_ind_top_news_content',inbaction:'pagination',ind:ind,page:inb_ajax_page},function(data){
			$("#ind_news_block div.inb_lent_news").html(data);
		});
	});
	$("#ind_news_block div.inb_ajaxList img.rarr").click(function(){
		if(inb_ajax_page==4) return;
		if(inb_ajax_page==1)$("#ind_news_block div.inb_ajaxList img.larr").css("cursor",'pointer').css("cursor",'hand').css("background-position",'top');
		inb_ajax_page++;
		if(inb_ajax_page==4)$(this).css("cursor",'default').css("background-position",'0px 34px');
		$("#ind_news_block div.inb_ajaxList img.pajax").css("background-position",'0 -'+((inb_ajax_page-1)*7)+'px');
		loader_to_container('#ind_news_block div.inb_lent_news');
		$.post("ajax.php",{action:'get_ind_top_news_content',inbaction:'pagination',ind:ind,page:inb_ajax_page},function(data){
			$("#ind_news_block div.inb_lent_news").html(data);
		});
	});
}
$(document).ready(function(){
	start_tab=$("#ind_news_block .inb_tabs .tab").index($('#ind_news_block li.indtabcur').get(0));
	set_event(start_tab);
	
	$("#ind_news_block .inb_tabs .tab a").click(function(){
		var ind=$("#ind_news_block .inb_tabs .tab").index($(this).parent().get(0));
		
		if($(this).parent().hasClass('indtabcur')){
			if(ind==0) window.location='http://glavnews.net';
			if(ind==1) window.location='http://glavnews.net';
			if(ind==2) window.location='http://glavnews.net';
		}
		$("#ind_news_block .inb_tabs .tab").removeClass('indtabcur');
		$(this).parent().addClass('indtabcur');
		loader_to_container('#ind_news_block div.cont');
		$.post("ajax.php",{action:'get_ind_top_news_content',inbaction:'switch_tab',ind:ind},function(data){
			$("#ind_news_block div.cont").removeClass('stats_linenews');
			$("#ind_news_block div.cont").removeClass('stats_firmnews');
			$("#ind_news_block div.cont").removeClass('stats_topnews');
			if(ind==0){$("#ind_news_block div.cont").addClass('stats_topnews'); init_stats('stats_topnews');}
			if(ind==1){$("#ind_news_block div.cont").addClass('stats_linenews'); init_stats('stats_linenews');}
			if(ind==2){$("#ind_news_block div.cont").addClass('stats_firmnews'); init_stats('stats_firmnews');}
			$("#ind_news_block div.cont").html(data);
			set_event(ind);
		});
		return false; 
	});	
});
function trim(str) 
{
    return str.replace(/(^[\s\xA0]+|[\s\xA0]+$)/g, '');
}