window.addEvent('domready', function () {
    if (navigator.appName == 'Netscape') var language = navigator.language;
    else var language = navigator.browserLanguage;
    if (language.indexOf('en') > -1) english();
    else if (language.indexOf('pl') > -1) polish();
    else english();
    function polish() {};
    function english() {
        var links = $$('#link');
        $('prod').setProperty('src', 'images_htm/hanger_producer.png');
        links.each(function (link1) {
            link1.setProperty('href', 'news.html?setLang=en-GB')
        });
        $('stopka').replaceWith($('english_footer'));
        $('english_footer').setStyle('display', 'block')
    };
    var list1 = $$('#glowny a');
    list1.each(function (element1) {
        var fx1 = new Fx.Styles(element1, {
            duration: 150,
            wait: false
        });
        element1.addEvent('mouseenter', function () {
            fx1.start({
                'color': '#FFF'
            })
        });
        element1.addEvent('mouseleave', function () {
            fx1.start({
                'color': '#777'
            })
        })
    });
    var roz1 = new Fx.Styles($('zapraszamy1'), {
        duration: 150,
        wait: false
    });
    var roz2 = new Fx.Styles($('zapraszamy2'), {
        duration: 150,
        wait: false
    });
    var roz3 = new Fx.Styles($('zapraszamy3'), {
        duration: 150,
        wait: false
    });
    $('logo_male').addEvent('mouseenter', function () {
        $('zapraszamy1').setStyle('display', 'block');
        roz1.start({
            'color': '#CCC'
        })
    });
    $('logo_male').addEvent('mouseleave', function () {
        roz1.start({
            'color': '#404040'
        });
        $('zapraszamy1').setStyle('display', 'none')
    });
    $('logo_duze').addEvent('mouseenter', function () {
        $('zapraszamy2').setStyle('display', 'block');
        roz2.start({
            'color': '#CCC'
        })
    });
    $('logo_duze').addEvent('mouseleave', function () {
        roz2.start({
            'color': '#404040'
        });
        $('zapraszamy2').setStyle('display', 'none')
    });
    $('producent23').addEvent('mouseenter', function () {
        $('zapraszamy3').setStyle('display', 'block');
        roz3.start({
            'color': '#CCC'
        })
    });
    $('producent23').addEvent('mouseleave', function () {
        roz3.start({
            'color': '#404040'
        });
        $('zapraszamy3').setStyle('display', 'none')
    });
    var timer = 0;
    var sideblocks = $$('#lewy li');
    var slidefxs = [];
    var colorfxs = [];
    sideblocks.each(function (el, i) {
        el.setStyle('margin-left', '-155px');
        timer += 150;
        slidefxs[i] = new Fx.Style(el, 'margin-left', {
            duration: 400,
            transition: Fx.Transitions.backOut,
            wait: false
        });
        slidefxs[i].start.delay(timer, slidefxs[i], 0)
    },
    this);
    var timer2 = 0;
    var sideblocks = $$('#prawy li');
    var slidefxs = [];
    var colorfxs = [];
    sideblocks.each(function (el, i) {
        el.setStyle('margin-right', '-155px');
        timer2 += 150;
        slidefxs[i] = new Fx.Style(el, 'margin-right', {
            duration: 400,
            transition: Fx.Transitions.backOut,
            wait: false
        });
        slidefxs[i].start.delay(timer2, slidefxs[i], 0)
    },
    this);
    var sidetext1 = $$('#lewy li');
    var sidetext2 = $$('#prawy li');
    var jass = [];
    var jass2 = [];
    function rozjasnianie() {
        sidetext1.each(function (el, i) {
            timer += 500;
            jass[i] = new Fx.Styles(el, {
                duration: 500,
                wait: false
            });
            (function () {
                jass[i].start({
                    'color': '#fff',
                    'opacity': '1'
                })
            }).delay(timer);
            (function () {
                jass[i].start({
                    'color': '#434443',
                    'opacity': '0'
                })
            }).delay(timer + 500)
        },
        this);
        sidetext2.each(function (el2, j) {
            timer2 += 800;
            jass2[j] = new Fx.Styles(el2, {
                duration: 500,
                wait: false
            });
            (function () {
                jass2[j].start({
                    'color': '#fff',
                    'opacity': '1'
                })
            }).delay(timer2);
            (function () {
                jass2[j].start({
                    'color': '#434443',
                    'opacity': '0'
                })
            }).delay(timer2 + 800)
        },
        this);
        return true
    };
    var wieszak1 = new Fx.Slide('wieszak1', {
        duration: 800
    });
    var wieszak2 = new Fx.Slide('wieszak2', {
        duration: 800
    });
    var wieszak3 = new Fx.Slide('wieszak3', {
        duration: 800
    });
    var wieszak4 = new Fx.Styles('wieszak1', {
        duration: 800,
        wait: false
    });
    var wieszak5 = new Fx.Styles('wieszak2', {
        duration: 800,
        wait: false
    });
    var wieszak6 = new Fx.Styles('wieszak3', {
        duration: 800,
        wait: false
    });
    wieszak1.hide();
    wieszak2.hide();
    wieszak3.hide();
    var image_dol = new Array();
    var obecny_image_dol;
    var los_dol;
    if (navigator.appName == 'Microsoft Internet Explorer') if (navigator.appVersion.indexOf('MSIE 6') > 0 && navigator.appVersion.indexOf('MSIE 7') < 1 && navigator.appVersion.indexOf('MSIE 8') < 1) {
        image_dol[0] = 'images_htm/wieszak_norm.jpg';
        image_dol[1] = 'images_htm/wieszak2_norm.jpg';
        image_dol[2] = 'images_htm/wieszak3_norm.jpg';
        pic1 = new Image(170, 90);
        pic1.src = "images_htm/wieszak_norm.jpg";
        pic2 = new Image(170, 90);
        pic2.src = "images_htm/wieszak2_norm.jpg";
        pic3 = new Image(170, 90);
        pic3.src = "images_htm/wieszak3_norm.jpg";
        $('logo_male_ie6').setProperty('src', 'images_htm/logo_male.jpg');
        $('logo_duze_ie6').setProperty('src', 'images_htm/logo_duze.jpg');
        $('prod').setProperty('src', 'images_htm/producent.jpg');
        $('wieszak11').setProperty('src', 'images_htm/wieszak_norm.jpg');
        $('wieszak22').setProperty('src', 'images_htm/wieszak_norm.jpg');
        $('wieszak33').setProperty('src', 'images_htm/wieszak_norm.jpg')
    } else {
        image_dol[0] = 'images_htm/wieszak_norm.png';
        image_dol[1] = 'images_htm/wieszak2_norm.png';
        image_dol[2] = 'images_htm/wieszak3_norm.png';
        pic1 = new Image(170, 90);
        pic1.src = "images_htm/wieszak_norm.png";
        pic2 = new Image(170, 90);
        pic2.src = "images_htm/wieszak2_norm.png";
        pic3 = new Image(170, 90);
        pic3.src = "images_htm/wieszak3_norm.png"
    } else {
        image_dol[0] = 'images_htm/wieszak_norm.png';
        image_dol[1] = 'images_htm/wieszak2_norm.png';
        image_dol[2] = 'images_htm/wieszak3_norm.png';
        pic1 = new Image(170, 90);
        pic1.src = "images_htm/wieszak_norm.png";
        pic2 = new Image(170, 90);
        pic2.src = "images_htm/wieszak2_norm.png";
        pic3 = new Image(170, 90);
        pic3.src = "images_htm/wieszak3_norm.png"
    }
    function los_obrazek() {
        obecny_image_dol = document.getElementById('wieszak11').getAttribute('src');
        los_dol = Math.floor(Math.random() * 3);
        while (image_dol[los_dol] == obecny_image_dol) {
            los_dol = Math.floor(Math.random() * 3)
        }
        document.getElementById('wieszak11').setAttribute('src', image_dol[los_dol]);
        obecny_image_dol = document.getElementById('wieszak22').getAttribute('src');
        los_dol = Math.floor(Math.random() * 3);
        while (image_dol[los_dol] == obecny_image_dol) {
            los_dol = Math.floor(Math.random() * 3)
        }
        document.getElementById('wieszak22').setAttribute('src', image_dol[los_dol]);
        obecny_image_dol = document.getElementById('wieszak33').getAttribute('src');
        los_dol = Math.floor(Math.random() * 3);
        while (image_dol[los_dol] == obecny_image_dol) {
            los_dol = Math.floor(Math.random() * 3)
        }
        document.getElementById('wieszak33').setAttribute('src', image_dol[los_dol]);
        return true
    };
    function slide_down() { (function () {
            wieszak1.slideIn()
        }).delay(0);
        (function () {
            wieszak2.slideIn()
        }).delay(400);
        (function () {
            wieszak3.slideIn()
        }).delay(800);
        (function () {
            anim_down()
        }).delay(1600);
        rozjasnianie()
    };
    function slide_up() { (function () {
            wieszak1.slideOut()
        }).delay(0);
        (function () {
            wieszak2.slideOut()
        }).delay(200);
        (function () {
            wieszak3.slideOut()
        }).delay(400);
        (function () {
            los_obrazek()
        }).delay(1200);
        (function () {
            slide_down()
        }).delay(1500)
    };
    function anim_down() {
        wieszak4.start({
            'padding-top': 86,
            'height': 0
        });
        (function () {
            wieszak5.start({
                'padding-top': 86,
                'height': 0
            })
        }).delay(200);
        (function () {
            wieszak6.start({
                'padding-top': 86,
                'height': 0
            })
        }).delay(400);
        (function () {
            anim_up()
        }).delay(1250)
    };
    function anim_up() {
        wieszak4.start({
            'padding-top': 0,
            'height': 86
        });
        (function () {
            wieszak5.start({
                'padding-top': 0,
                'height': 86
            })
        }).delay(200);
        (function () {
            wieszak6.start({
                'padding-top': 0,
                'height': 86
            })
        }).delay(400);
        (function () {
            slide_up()
        }).delay(1000)
    };
    (function () {
        slide_down()
    }).delay(1000)
});
