	// user's functions

function showBigCenter(src) {
	/*document.getElementById('center_big').src=src;*/
	if (document.getElementById('center_big')) {
		if ( src != '' ) {
			document.getElementById('center_big').src=src;
		}
	}
}

	function flip(id) {
	
	document.getElementById(id).style.display="block";
	document.getElementById('probor').src="probor_" + id + ".gif";
	
	if (id == 'div1') {
		document.getElementById('div2').style.display="none";
		document.getElementById('head_div1').bgColor="#ffffff";
		document.getElementById('head_div2').bgColor="#f0f7f8";
	}
	else {
		document.getElementById('div1').style.display="none";
		document.getElementById('head_div1').bgColor="#f0f7f8";
		document.getElementById('head_div2').bgColor="#ffffff";
	}
	}

function isIE5() { return (navigator.userAgent.indexOf("MSIE 5") > -1); }
function isIE6() { return ((navigator.userAgent.indexOf("MSIE 6") > -1) && (navigator.userAgent.indexOf("Opera") == -1)); }
function isIE() { return (isIE5() || isIE6());}

function fixpng()
{
 for (var i = 0; i < document.images.length; i++)
 {
  var img = document.images[i];
  imgSrc = img.src;
  if (imgSrc.substr(imgSrc.length-3).toLowerCase() == "png")
  {
   var w, h;
   w = img.width, h = img.height;
   img.src = "_mod_files/ce_images/spacer.gif";
   img.width = w, img.height = h;
   img.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'" + imgSrc + "\', sizingMethod='scale');";
  }
 }
}

var isIE = isIE();
if (isIE) window.attachEvent("onload", fixpng); 


var currTreeRow = 1;
var visRows = 4;
var wheelInterval = null;
var onClickTop = null;
var onClickBottom = null;

function tl3_makeScroll(where) {
	var tl3_inner = document.getElementById('tl3_inner');
	var tl3_currrow = document.getElementById('new' + currTreeRow);
	var b=0;
	
	if (where=='top') {
		//check next offsetdiv
		if (document.getElementById('new' + parseInt(currTreeRow - 2))) {
			tl3_nextrow = document.getElementById('new' + parseInt(currTreeRow - 2));
			currTreeRow -= 2;
			b=1;
		} else if (document.getElementById('new' + parseInt(currTreeRow - 1))) {
			tl3_nextrow = document.getElementById('new' + parseInt(currTreeRow - 1));
			currTreeRow -= 1;
			b=1;
		} else {
			return false;
		}
	} else if (where=='bottom') {
		//check next offsetdiv
		if (document.getElementById('new' + parseInt(currTreeRow + visRows + 1))) {
			tl3_nextrow = document.getElementById('new' + parseInt(currTreeRow + 2));
			currTreeRow += 2;
			b=1;
		} else if (document.getElementById('new' + parseInt(currTreeRow + visRows))) {
			tl3_nextrow = document.getElementById('new' + parseInt(currTreeRow + 1));
			currTreeRow += 1;
			b=1;
		} else {
			return false;
		}
	}
	
	if (b==1) {
		onClickTop = document.getElementById('tl3_atop').onclick;
		document.getElementById('tl3_atop').onclick = function(){ return false; };
		onClickBottom = document.getElementById('tl3_abottom').onclick;
		document.getElementById('tl3_abottom').onclick = function(){ return false; };
		
		if (where=='top') { 
			wheelInterval = setInterval(function() { tl3_makeWheel(tl3_inner, where, tl3_inner.offsetTop, -parseInt(tl3_nextrow.offsetTop), 20)}, 30); 
		}
		else if (where=='bottom') { 
			wheelInterval = setInterval(function() { tl3_makeWheel(tl3_inner, where, tl3_inner.offsetTop, -parseInt(tl3_nextrow.offsetTop) , -20)}, 30); 
		}
	}
	
	//tl3_inner.style.top = -parseInt(tl3_nextrow.offsetTop) + 'px';
	return false;
}

function tl3_checkFirstLast() {
	//if topper element - make gray top arrow
	if (document.getElementById('new' + parseInt(currTreeRow - 1))) {
		document.getElementById('tl3_atop').firstChild.src = '_mod_files/ce_images/blue_top.gif';
	} else {
		document.getElementById('tl3_atop').firstChild.src = '_mod_files/ce_images/grey_top.gif';
	}
	
	//if bottomer element - make gray bottom arrow
	if (document.getElementById('new' + parseInt(currTreeRow + visRows))) {
		document.getElementById('tl3_abottom').firstChild.src = '_mod_files/ce_images/blue_bottom.gif';
	} else {
		document.getElementById('tl3_abottom').firstChild.src = '_mod_files/ce_images/grey_bottom.gif';
	}
}

function tl3_makeWheel(what, where, yFrom, yTo, step) {
	//alert(what +':'+ where +':'+ yFrom +':'+ yTo +':'+ step);
	
	if (where=='top') {
		if ((yFrom + step) < yTo) {
			what.style.top = parseInt(what.offsetTop + step) + 'px';
		} else {
			//last step
			what.style.top = parseInt(what.offsetTop + (yTo - yFrom)) + 'px';
			clearInterval(wheelInterval);
			
			document.getElementById('tl3_atop').onclick = onClickTop;
			document.getElementById('tl3_abottom').onclick = onClickBottom;
			
			tl3_checkFirstLast();
		}
		
	} else if (where=='bottom') {
		if ((yFrom + step) > yTo) {
			what.style.top = parseInt(what.offsetTop + step) + 'px';
		} else {
			//last step
			what.style.top = parseInt(what.offsetTop - (yFrom - yTo)) + 'px';
			clearInterval(wheelInterval);
			
			document.getElementById('tl3_atop').onclick = onClickTop;
			document.getElementById('tl3_abottom').onclick = onClickBottom;
			
			tl3_checkFirstLast();
		}
	}
}


function cat_inverse(id, sub_id) {
	
	var BlockElem = document.getElementById(id);
	var subBlockElem = document.getElementById(sub_id);
	
	if (subBlockElem.style.display != 'block') { 
		BlockElem.className="opened";
		subBlockElem.style.display = 'block'; 
	}
	else {
		BlockElem.className="item_normal";
		subBlockElem.style.display = 'none';
	}
}


function __cst_show_picture(script, src) {
    var img = new Image();
    img.src = src;
    img.onload = function(){ onImageLoaded(script, img, src) };
	return false;
}

function onImageLoaded(oScript, oImage, oSrc){
    // alt must be escaped or empty because escape(str) doesn't work with russian symbols
    if (  (oScript.substring(0,7).toLowerCase()) != "http://"  &&  (oScript.substring(0,8).toLowerCase() != "https://" ) ){
        oScript = frontBaseHref + oScript;
    }

    var w_width = 40 + oImage.width;
    var w_height = 100 + oImage.height;

    if (w_height > window.screen.availHeight) w_height = window.screen.availHeight;
    if (w_width > window.screen.availWidth) w_width = window.screen.availWidth;

    oSrc = escape(oSrc);
    oSrc = oSrc.replace(/\//g, '%2F');
    window.open(oScript+"?src=" + oImage.src + "&width="+w_width + "&height=" + w_height, "pic", "resizable=yes, status=yes, scrollbars=yes, width=" + w_width + ", height=" + w_height);
    
	return false;
}
