function run_movie(id,arg,w,h)
{
    document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" WIDTH="'+w+'" HEIGHT="'+h+'" id="'+id+'" ALIGN=""><PARAM NAME=movie VALUE="'+arg+'"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#000000> <EMBED src="'+arg+'" quality=high bgcolor=#000000  WIDTH="'+w+'" HEIGHT="'+h+'" NAME="'+id+'" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>');
}

function run_color_movie(id,arg,w,h,color)
{
    document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" WIDTH="'+w+'" HEIGHT="'+h+'" id="'+id+'" ALIGN=""><PARAM NAME=movie VALUE="'+arg+'"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#'+color+'> <EMBED src="'+arg+'" quality=high bgcolor=#'+color+'  WIDTH="'+w+'" HEIGHT="'+h+'" NAME="'+id+'" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>');
}

function open_video(url,wW, wH){
    var parentw = getSize("width");
    var parenth = getSize("height");
    var wc = Math.round((parentw - wW)/2);
    var hc = Math.round((parenth - wH)/2);

    var wparams = 'toolbar=0,location=0,directories=0,status=0,menubar=0,';
    wparams += 'scrollbars=0,resizable=0,width='+wW+',height='+wH+',top='+hc+',left='+wc;

    var windowmy = window.open('/ssi/video.php?src='+url, 'video', wparams);
    windowmy.focus();
}

function changeColorPhoto(v1,v2,v3,vs,vclr,vid)
{
    var dir = "images/main/";
    var dircars = "images/cars/";
    var im1=document.getElementById("comp1");
    var im2=document.getElementById("comp2");
    var im3=document.getElementById("comp3");
    var photocar=document.getElementById("photocar");
    var hm=document.getElementById("modelhref");

    if (dir+v1 != im1.src) {
        im1.src = dir+v1;
    }
    if (dir+v2 != im2.src) {
        im2.src = dir+v2;
    }
    if (dir+v3 != im3.src) {
        im3.src = dir+v3;
    }
    
    if (dircars+vs != photocar.src) {
        photocar.src = dircars+vs;
    }

    if(vid) {
        hm.href="index.php?clr="+vclr+"&level=20&mid="+vid;
    }

}

function changeColorDiv(elem, color)
{
    
    var target=document.getElementById(elem);

    target.style.color = color;

}

function changeRectMontazh(elem)
{

    var rect=document.getElementById("rect");
    var rect_title=document.getElementById("rect_title");
    var rect_txt=document.getElementById("rect_txt");
    var red_spot=document.getElementById("red_spot");

    /*var red_line_zamok_kapota=document.getElementById("red_line_zamok_kapota");
    var red_line_zamok_kpp=document.getElementById("red_line_zamok_kpp");
    var red_line_montazh_salona=document.getElementById("red_line_montazh_salona");
    var red_line_shema=document.getElementById("red_line_shema");

    red_line_zamok_kapota.style.visibility = 'hidden';
    red_line_zamok_kpp.style.visibility = 'hidden';
    red_line_montazh_salona.style.visibility = 'hidden';
    red_line_shema.style.visibility = 'hidden';*/


    switch(elem){
        case 'zamok_kapota':
            rect_title.textContent = "Замок капота";
            rect_txt.textContent = "В конструкции GearLock использован механический замок капота Megalock или электромеханический Defen Time";
            red_spot.style.left = -95;
            red_spot.style.top = 315;
            //red_line_zamok_kapota.style.visibility = 'visible';
            break;
        case 'zamok_kpp':
            rect_title.textContent = "Замок АКПП";
            rect_txt.textContent = "Блокиратор располагается под капотом автомобиля. Замок открывается/закрывается ключом высокой секретности";
            red_spot.style.left = 1;
            red_spot.style.top = 270;
            //red_line_zamok_kpp.style.visibility = 'visible';
            break;
        case 'montazh_salona':
            rect_title.textContent = "Монтаж в салоне";
            rect_txt.textContent = "Все блокирующие элементы установлены под капотом автомобиля и не затрагивают интерьер салона автомобиля";
            red_spot.style.left = 63;
            red_spot.style.top = 231;
            //red_line_montazh_salona.style.visibility = 'visible';
            break;
        case 'shema':
            rect_title.textContent = "Заводская гарантия";
            rect_txt.textContent = "Все элементы замка устанавливаются на «штатные» посадочные места автомобиля. Автомобиль не теряет заводской гарантии";
            red_spot.style.left = 146;
            red_spot.style.top = 311;
            //red_line_shema.style.visibility = 'visible';
            break;
    }

}

function clearRectMontazh(elem)
{

    var rect=document.getElementById("rect");
    rect.style.visibility = 'hidden';

}


function getSize(mymode) {
    var myWidth = 0, myHeight = 0;
    if( typeof( window.innerWidth ) == 'number' ) {
        //Non-IE
        myWidth = window.innerWidth;
        myHeight = window.innerHeight;
    } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
        //IE 6+ in 'standards compliant mode'
        myWidth = document.documentElement.clientWidth;
        myHeight = document.documentElement.clientHeight;
    } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
    }
    if (mymode == "width") {
        return myWidth;
    }
    if (mymode == "height") {
        return myHeight;
    }

}
