function scroll(_tresc, _suwak){
    var m = this, wys, poz, tresc = _tresc, gala = _suwak;
    var zeroGala = tresc.parentNode.offsetTop + 8, poczMyszy, pozPocz, czyWogole = !0;
    gala.onmousedown = drag;
    if (document.addEventListener) 
        tresc.addEventListener('DOMMouseScroll', wheel, false);
    tresc.onmousewheel = wheel;

    m.reset = function(){
        wys = {
            kont: tresc.parentNode.offsetHeight,
            tresc: tresc.offsetHeight - tresc.parentNode.offsetHeight,
            rynna: tresc.parentNode.offsetHeight - gala.offsetHeight - 16,
            gala: gala.offsetHeight
        }
        poz = {
        	tresc: parseInt(tresc.style.top),
			gala: -1*(Math.round(parseInt(tresc.style.top)*(wys.rynna))/(tresc.offsetHeight - tresc.parentNode.offsetHeight))
        }
        
        czyWogole = true;
        czyWogole = (tresc.offsetHeight - parseInt(tresc.parentNode.style.height) < 0)?false:true;
        
        if(window.newFAQset) {
	        poz.tresc = 0;
			poz.gala = 0;
			
			window.newFAQset = false;
        }
        ustaw('g');
        if (wys.tresc <= 0) 
            czyWogole = false;
        else 
            czyWogole = true;
        gala.onmousedown = drag;
    }
    
    function ustaw(co){
        if (!czyWogole) 
            return;
        if (co == 't') {
            if (poz.tresc > 0) 
                poz.tresc = 0;
            if (poz.tresc < -wys.tresc) 
                poz.tresc = -wys.tresc;
            tresc.style.top = poz.tresc + 'px';
            gala.style.top = zeroGala + (poz.gala = -poz.tresc / wys.tresc * wys.rynna) + 'px'
        }
        else {
            if (poz.gala < 0) 
                poz.gala = 0;
            if (poz.gala > wys.rynna) 
                poz.gala = wys.rynna;
            gala.style.top = zeroGala + poz.gala + 'px';
            tresc.style.top = (poz.tresc = -poz.gala / wys.rynna * wys.tresc) + 'px';
        }
    }
    function drag(e){
        if (!czyWogole) 
            if (wys.tresc > 0) 
                czyWogole = true;
        if (!czyWogole) 
            return;
	    poczMyszy = utils.pozMyszy(e).t;
        pozPocz = gala.offsetTop - zeroGala;
        document.onmousemove = move;
        document.onmouseup = drop;
        return !1;
    }
    function move(e){
        poz.gala = pozPocz + utils.pozMyszy(e).t - poczMyszy;
        ustaw('g');
        return !1;
    }
    function drop(){
        document.onmousemove = document.onmouseup = null;
    }
    function wheel(e){
        e = e || event;
        var delta;
        if (e.wheelDelta) 
            delta = -e.wheelDelta / 120
        else 
            if (e.detail) 
                delta = e.detail / 3
        poz.tresc -= delta * 25;
        ustaw('t');
        
        e.returnValue = false;
        if (e.preventDefault) 
            e.preventDefault();
    }
    window.newFAQset = true;
    m.reset();
}

function leftRigthScroll(){
    var m = this, minLeft = 160, maxLeft = 675, gala = $('przesuwajka'), content1 = $('tresc_lewa'), content2 = $('tresc_prawa');
    try {
        var content1Start = content1.clientWidth, content2Start = content2.clientWidth, leftOffset = Math.ceil((window.screen.availWidth - $('rama').clientWidth) / 2) + content1.offsetLeft;
    } 
    catch (e) {
        alert(document.getElementById('tresc_lewa'));
    }
    var suwak1 = $('suwak'), suwak2 = $('suwak1'), stuff = $('zao_lewa1');
    m.drag = function(e){
        document.onmousemove = m.move;
        document.onmouseup = m.drop;
        return false;
    }
    
    m.move = function(e){
        var offset = utils.pozMyszy(e).l - leftOffset;
        if (offset > minLeft && offset < maxLeft) {
            content1.style.width = offset - 35 + "px";
            suwak2.style.left = offset + 33 + "px";
            
            gala.style.left = offset + 50 + "px";
            
            content2.style.width = 900 - offset - 55 + "px";
            stuff.style.left = offset + 65 + "px"; // 70	
        }
        
        return false;
    }
    
    m.drop = function(e){
        document.onmousemove = null;
        document.onmouseup = null;
        try {
            scroll_lewy.reset();
            scroll_prawy.reset();
        } 
        catch (e) {
        	void(e);
        }
    }
    
    m.init = function(){
        content1.style.width = content1Start - 13 + "px";
        content2.style.width = content2Start - 12 + "px";
    }
    m.init();
    gala.onmousedown = m.drag;
}

function showHideFaq(id){
    $(id).style.display = ($(id).style.display == 'block') ? 'none' : 'block';
    try {
         scrol.reset();
    } 
    catch (e) {
        try {
             scroll_prawy.reset();
        }
        catch (e) {
        
        }
    }
}

var scroll_prawy;
var scroll_lewy;

