var eqCounter = 0;

function EqualColumns()
{
	this.eqa = 0;
	this.eqth = 0;
	this.eqtw = 0;

	var c, e, el;
    if (document.getElementById)
    {
        this.blocks = new Array();
        for (i = 0; i < arguments.length; i += 2)
        {
            el = null;
            c = document.getElementById(arguments[i]);
            if (c)
            {
                e = c.getElementsByTagName(arguments[i+1]);
                if (e)
                {
                    el = e[e.length-1];
                    if (!el.id)
                    {
                        el.id = "myeq" + (eqCounter++);
                    }
                }
            }
            if (c && el)
            {
                this.blocks.push(c);
                this.blocks.push(el);
            }
        }
        //setInterval("P7_eqT2()",10);
		this.startCalculate();
    }
}

EqualColumns.prototype.startCalculate = function() {
    if (this.eqth != document.body.offsetHeight || this.eqtw != document.body.offsetWidth)
    {
        this._startCalculate();
    }
}

EqualColumns.prototype._startCalculate = function() {
    var i, oh, h = 0, tg, el, np, dA = this.blocks, an = this.eqa;
    if (dA && dA.length)
    {
        for (i = 0; i < dA.length; i += 2)
        {
            dA[i+1].style.paddingBottom = '';
        }
        for (i = 0; i < dA.length; i += 2)
        {
            oh = dA[i].offsetHeight;
            h = (oh > h) ? oh : h;
        }
        for (i = 0; i < dA.length; i += 2)
        {
            oh = dA[i].offsetHeight;
            if (oh < h)
            {
                np = h - oh;
				dA[i+1].style.paddingBottom = np + "px";
            }
        }
        this.eqa = 1;
        this.eqth = document.body.offsetHeight;
        this.eqtw = document.body.offsetWidth;
    }
}
	function WinOnLoad() {
		new EqualColumns('leftBlock', 'div', 'rightBlock', 'div');
	}


function changeColor(b, n) {
	if (b) {
		document.getElementById("topmenu" + n).style.color = "#FEC502";
	} else {
		document.getElementById("topmenu" + n).style.color = "#FFFFFF";
	}
	return true;
}
function goHeaderSearch() {
	if (document.header_search) {
		with(document.header_search) {
			try {
				hstage.value = "search";
				submit();
			} catch (e) {
			}
			return true;
		}
	}  else {
		return false;
	}
}
function SearchFormSubmit(e){
	if (navigator.appName !='Microsoft Internet Explorer') {
		ev = e;
		id = ev.target.id;
 	} else {
		ev = event;
		id = ev.srcElement.id;
	}
	if (ev.keyCode == 13) {
		if( id == 'arch_name_h') {
			goHeaderSearch(); 
		} else {
			goSearch();
		}
		return false;
	}
}
function setEvetKey(){
	if (document.getElementById('arch_name_h')) document.getElementById('arch_name_h').onkeydown = SearchFormSubmit;
	if (document.getElementById('arch_name_f')) document.getElementById('arch_name_f').onkeydown = SearchFormSubmit;
}
