function sizediv() {

obj = document.getElementById("middle");

k=obj.offsetHeight;

n=obj.offsetWidth;

obj2 = document.getElementById("back_middle");

obj2.style.height=k+"px";

obj2.style.width=n+"px";

if(document.getElementById("top_layer")) document.getElementById("top_layer").style.width=n+"px";

if(document.getElementById("flash_layer")) document.getElementById("flash_layer").style.width=n+"px";

if(document.getElementById("flash_layer")) document.getElementById("flash_layer").style.display="block";

if(k>375) document.getElementById("rasporka").style.height=k-275+"px";

}



/* 

Класс ImgRadio

В конструктор передаются параметры:

    imgId        id картинки, которая будет служить кнопкой

    inputId      id «настоящего» чекбокс-элемента формы

    imgOn        url картинки «включённой» кнопки

    imgOff       url картинки «выключённой» кнопки

*/

function ImgRadio(imgId, inputId, imgOn, imgOff) {

    this.imgOn   = imgOn

    this.imgOff  = imgOff

    this.image   = document.getElementById(imgId)

    this.input   = document.getElementById(inputId)



    // предзагрузка картинок

    this.preload_imgOn      = new Image()

    this.preload_imgOn.src  = imgOn

    this.preload_imgOff     = new Image()

    this.preload_imgOff.src = imgOff



    // скрываем обычный чекбокс…

    this.input.style.display = "none"

    // и показываем чекбокс-картинку

    this.image.style.display = "inline"

    

    // установка начального состояния кнопки

    this.setState(this.input.checked)

}



// установка состояния кнопки

ImgRadio.prototype.setState = function(state) {

    // меняем состояние скрытой кнопки

    this.input.checked     = state

    // меняем картинку

    this.image.src   = state ? this.imgOn : this.imgOff

}



// изменение состояния кнопки на обратное (вкл -> выкл и наоборот)

ImgRadio.prototype.flip = function(k) {

    

    if(typeof(myRadio1)!='undefined') myRadio1.setState(0) 

    if(typeof(myRadio2)!='undefined') myRadio2.setState(0)

    if(typeof(myRadio3)!='undefined') myRadio3.setState(0) 

    if(typeof(myRadio4)!='undefined') myRadio4.setState(0)

    if(typeof(myRadio5)!='undefined') myRadio5.setState(0)

    if(typeof(myRadio6)!='undefined') myRadio6.setState(0) 

    if(typeof(myRadio7)!='undefined') myRadio7.setState(0)

    if(typeof(myRadio8)!='undefined') myRadio8.setState(0) 

    if(typeof(myRadio9)!='undefined') myRadio9.setState(0)

    if(typeof(myRadio10)!='undefined') myRadio10.setState(0)

    if(typeof(myRadio11)!='undefined') myRadio11.setState(0) 

    if(typeof(myRadio12)!='undefined') myRadio12.setState(0)

    if(typeof(myRadio13)!='undefined') myRadio13.setState(0) 

    if(typeof(myRadio14)!='undefined') myRadio14.setState(0)

    if(typeof(myRadio15)!='undefined') myRadio15.setState(0)

    if(typeof(myRadio16)!='undefined') myRadio16.setState(0) 

    if(typeof(myRadio17)!='undefined') myRadio17.setState(0)

    if(typeof(myRadio18)!='undefined') myRadio18.setState(0) 

    if(typeof(myRadio19)!='undefined') myRadio19.setState(0)

    if(typeof(myRadio20)!='undefined') myRadio20.setState(0)

    this.setState(!this.input.checked) 

    

}



function scroll_block_bot() {

 obj = document.getElementById("album");

 htbl=obj.offsetHeight;

 margin = (obj.style.marginTop.substr(0,obj.style.marginTop.length-2))*1;

 if(255-margin!=htbl) {

 margin=margin-85;

 obj.style.marginTop = 1*margin+"px";

  if(255-margin==htbl) {

    document.getElementById("barraw").src="/d/0.gif";

    document.getElementById("barraw").style.cursor="default";

  }

  if(margin<0) {

    document.getElementById("tarraw").src="/d/arrow_tcar.gif";

    document.getElementById("tarraw").style.cursor="pointer";

  }

  }

}



function scroll_block_top() {

 obj = document.getElementById("album");

 htbl=obj.offsetHeight;

 margin = (obj.style.marginTop.substr(0,obj.style.marginTop.length-2))*1;

 if(margin!=0) {

 margin=margin+85;

 obj.style.marginTop = 1*margin+"px";

  if(255-margin!=htbl) {

    document.getElementById("barraw").src="/d/arrow_bcar.gif";

    document.getElementById("barraw").style.cursor="pointer";

  }

  if(margin==0) {

    document.getElementById("tarraw").src="/d/0.gif";

    document.getElementById("tarraw").style.cursor="default";

  }

  }

}



function view_img(idimg, evtObj){

  /*var newImage = new Image();

  newImage.src = img;

  x=evtObj.clientX;

  y=evtObj.clientY+5;

  x -= w/2;

  y -= h/2;*/

  newWin = window.open("/show_foto.php?idimg="+idimg, null, "top=200, left=200, resizable=1");

}



function description() {

  obj = document.getElementById("all_doc");

  k=obj.offsetHeight;

  n=obj.offsetWidth;

  obj2 = document.getElementById("transparent");

  obj2.style.height=k+17+"px";

  obj2.style.width=n+40+"px";

  obj2.style.display="block";

  obj3 = document.getElementById("descr_car");

  obj3.style.display="block";

}



function closewin() {

  obj2 = document.getElementById("transparent");

  obj2.style.height=1+"px";

  obj2.style.width=1+"px";

  obj2.style.display="none";

  obj3 = document.getElementById("descr_car");

  obj3.style.display="none";  

}



function checkForm() {

var err = 0;

var arrpole = new Array("marka", "model", "year", "mail", "phone", "zch");



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

if (document.getElementById(arrpole[i]).value == '') {

document.getElementById(arrpole[i]).style.border = "1px solid #FF0000";

document.getElementById("texterr").innerHTML = "Поля не заполнены.";

err = 1;

}

}



if (err == 0) document.getElementById("maledate").submit();

}



function printblank(secid2, sec_name3, sec_name4, sec_name5, curr_sec) {

  newWin = window.open("/tpl_blank_print.php?secid2="+secid2+" &sec_name3="+sec_name3+"&sec_name4="+sec_name4+" &sec_name5="+sec_name5+"&curr_sec="+curr_sec, null, "width='100%', height='100%', top='0', left='0', resizable=1, scrollbars=1");

}