var last_obj;


var bFlag = false;


function changefoto(obj) {


    document.getElementById("PhotoLarge").src = obj.href;


    obj.className = "click";


    if (bFlag) {


        last_obj.className = "";


    }


    else {


        bFlag = true;


    }


    last_obj = obj;


}


function wopenFromFlash(url, w, resize, scrollbars) {


    if (!resize) {


        resize = true;


    }


    if (!scrollbars) {


        scrollbars = true;


    }


    if (!w || !h) {


        var w = window.screen.availWidth;


        var h = window.screen.availHeight;


        if (document.layers)


        {


            var tmp1 = window.outerWidth - window.innerWidth;


            var tmp2 = window.outerHeight - window.innerHeight;


            w -= tmp1;


            h -= tmp2;


        }


    }


    var pParameter =


            "toolbar=no,status=yes,location=no,resizable=" + resize + ",scrollbars=" + scrollbars + ",width=" +


            w + ",height=" + h + ",left=0,top=0";


    //window.alert(pUrl);


    var win = window.open(url, "FSwin", pParameter);


    win.resizeTo(w, h);


    win.moveTo(0, 0);


    win.focus();


}


// Выпадающие меню


flymenu = function(id) {


    if (document.getElementById(id)) {


        menu_h1 = document.getElementById(id)


        menu_h1.onclick = function() {
            menu_click(id);
        }


        menu_h1.onmouseout = function() {
            menu_mouseout(id);
        }


        menu_h1.onmouseover = function() {
            menu_mouseover(id);
        }


        menu_div = document.getElementById(id + "open")


        menu_div.onmouseout = function() {
            menu_mouseout(id);
        }


        menu_div.onmouseover = function() {
            menu_mouseover(id);
        }


        if (menu_h1.innerHTML.length > 18) {
            menu_h1.title = menu_h1.innerHTML;
            menu_h1.innerHTML = menu_h1.innerHTML.substr(0, 17) + "...";
        }
        ;


        for (i = 0; i < menu_div.childNodes.length; i++) {


            menu_item = menu_div.childNodes[i];


            if (menu_item.nodeName == "A") {


                if (menu_item.innerHTML.length > 18) {


                    menu_item.title = menu_item.innerHTML;
                    menu_item.innerHTML = menu_item.innerHTML.substr(0, 17) + "...";


                }


            }


        }


    }


}


var timer = Array();


menu_click = function(id) {


    document.getElementById(id + "open").style.display = "block";


    window.clearTimeout(timer[id]);


}


menu_mouseout = function(id) {
    timer[id] = setTimeout("do_close('" + id + "')", 300);
}


menu_mouseover = function(id) {
    window.clearTimeout(timer[id]);
}


do_close = function(id) {


    document.getElementById(id + "open").style.display = "none";


    window.clearTimeout(timer[id]);


}











// Фото галлерея


startList = function() {


    if (document.all && document.getElementById) {


        navRoot = document.getElementById("nav");


        for (i = 0; i < navRoot.childNodes.length; i++) {


            node = navRoot.childNodes[i];


            if (node.nodeName == "LI") {


                node.onmouseover = function() {
                    this.className += " over";
                }


                node.onmouseout = function() {
                    this.className = this.className.replace(" over", "");
                }


            }


        }


    }


}


function GetImg(imgName) {


    document.getElementById('car').src = "/files/Objects/" + imgName + ".jpg";


}


// Ширина для IE


var winIE = (navigator.userAgent.indexOf("Opera") == -1 && (document.getElementById && document.documentElement.behaviorUrns)) ? true : false;


body_minwidth = function () {


    if (winIE && document.documentElement.clientWidth) {


        document.body.style.width = (document.documentElement.clientWidth < 960) ? "960" : "100%";


    }


}


if (winIE) {


    window.onload = function() {
        flymenu("menu_lvl2");
        flymenu("menu_lvl1");
        body_minwidth();
    }


    window.onresize = body_minwidth;


}


else



    window.onload = function() {
        flymenu("menu_lvl2");
        flymenu("menu_lvl1");
    }


function openWindow(theURL, winName, features)


{


    window.open(theURL, winName, features);


}


// Конфигуратор


function _agfKonf(f) {


    var ref = document.getElementById(f);


    if (ref != null) {


        fv = ref.options[ref.selectedIndex].value;


        if (fv == 0) {
            fv = false
        }


        return fv;


    }


}


function openConfigurator() {


    url = _agfKonf('mlkonf');


    if (url) {


        sat = window.open(url, "Configurator", "scrollbars=yes,directories=no,menubar=no,toolbar=no,width=816,height=597,status=yes,resizable=yes");


        sat.focus();


    }


}


