if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" && window.attachEvent) {
	window.onload = fnLoadPngs;
}

function fnLoadPngs() {
	var rslt = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
	var itsAllGood = (rslt!=null && Number(rslt[1])>=5.0);
	var img = document.images;
	for (var i = img.length - 1; i>=0; i--) {
		if (itsAllGood && img[i].src.match(/\.png$/i)) {
			var src = img[i].src;
			img[i].style.width = img[i].width + "px";
			img[i].style.height = img[i].height + "px";
			img[i].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='scale')";
			img[i].src = "images/1pix.gif";
		}
	}
}




OldLis='0';OldCol='0';OldPr='0';
SetBut='<div class="but"><input type="button" value="Оформить заказ" onmouseover="this.className=cur" onmouseout="this.className=" onclick="Hide1('+"'View'"+', 0);obj = document.getElementById('+"'Order'"+');obj.style.top='+"'-505'"+';obj.style.left='+"'100'"+';Show('+"'Order'"+', 1);" /></div>';

var hT, sT, hT1, sT1;

function Show(objId, x) {
var obj = document.getElementById(objId);
op = (obj.style.opacity)?parseFloat(obj.style.opacity):parseInt(obj.style.filter)/100;
if(op < x) {
clearTimeout(hT);
op += 0.1;
obj.style.opacity = op;
obj.style.filter='alpha(opacity='+op*100+')';
sT=setTimeout('Show(\''+objId+'\', '+x+')',60);
}
}
function Hide(objId, x) {
var obj = document.getElementById(objId);
op = (obj.style.opacity)?parseFloat(obj.style.opacity):parseInt(obj.style.filter)/100;
if(op > x) {
clearTimeout(sT);
op -= 0.1;
obj.style.opacity = op;
obj.style.filter='alpha(opacity='+op*100+')';
hT=setTimeout('Hide(\''+objId+'\', '+x+')',60);
}
}
function Show1(objId, x) {
var obj = document.getElementById(objId);
op = (obj.style.opacity)?parseFloat(obj.style.opacity):parseInt(obj.style.filter)/100;
if(op < x) {
clearTimeout(hT1);
op += 0.1;
obj.style.opacity = op;
obj.style.filter='alpha(opacity='+op*100+')';
sT1=setTimeout('Show1(\''+objId+'\', '+x+')',60);
}
}
function Hide1(objId, x) {
var obj = document.getElementById(objId);
op = (obj.style.opacity)?parseFloat(obj.style.opacity):parseInt(obj.style.filter)/100;
if(op > x) {
clearTimeout(sT1);
op -= 0.1;
obj.style.opacity = op;
obj.style.filter='alpha(opacity='+op*100+')';
hT1=setTimeout('Hide1(\''+objId+'\', '+x+')',60);
}
if ((objId=='Order')&&(op.toFixed(1)==0)) {
  obj = document.getElementById('Order');
  obj.style.top='0';
  obj.style.left='0';
}
}

function OrderWindow() {
   var frm = document.getElementById('ord');
   File="order.php?id="+frm.Choice.value+"&STir="+frm.STir.value+"&SCol="+frm.SCol.value+"&SZak="+frm.SZak.value+"&SItog="+frm.SItog.value+"&Name="+frm.Name.value+"&Tel="+frm.Tel.value;
   window.open(File,"mywindow","width=370,height=335,toolbar=no,scrollbars=no");

   lis="t"+OldLis;
   col="c"+OldCol;
   lis_y="y"+OldLis+OldCol;
   document.getElementById(lis).style.backgroundColor="#efefee";
   document.getElementById(lis_y).style.backgroundColor="#efefee";
   document.getElementById(col).style.backgroundColor="#efefee";
   OldLis=0;
   OldCol=0;

   var obj = document.getElementById('Sum');
   obj.style.opacity = 0;
   obj.style.filter='alpha(opacity=0)';

   Hide1('Order', 0);Show('View', 1);

}




function SelectChoice() {

   var TypeOfChoice  = document.getElementById('Choice');
   var Zak           = document.getElementById('Zak');
   var Col           = document.getElementById('Col');
   var Tir           = document.getElementById('Tir');
   Tir.innerHTML = document.getElementById('a'+OldLis).innerHTML;

   if (TypeOfChoice.value=="1") {
	Zak.innerHTML="Тейбл-тенты А5";
	Col.innerHTML="4+0";
   } else if (TypeOfChoice.value=="2") {
//Листовки
      if ((OldCol=="1")||(OldCol=="2")) {
	Zak.innerHTML="Листовки А5 (148х210 мм)";
      } else {
	Zak.innerHTML="Листовки А4 (210х297 мм)";
      }

      if ((OldCol=="1")||(OldCol=="3")) {
	Col.innerHTML="4+0";
      } else {
	Col.innerHTML="4+4";
      }
   } else if (TypeOfChoice.value=="3") {
	Zak.innerHTML="Брошюры А4 (210х297 мм в сложенном виде)";
        if (OldCol=="1") {
          Col.innerHTML="4+4 (8 полос)";
        } else if (OldCol=="2") {
          Col.innerHTML="4+4 (16 полос)";
        } else if (OldCol=="3") {
          Col.innerHTML="4+4 (32 полосы)";
        } else if (OldCol=="4") {
          Col.innerHTML="4+4 (64 полосы)";
        }
   } else if (TypeOfChoice.value=="4") {
	Zak.innerHTML="Плакаты А2 (450х600 мм)";
	Col.innerHTML="4+0";
   } else if (TypeOfChoice.value=="5") {
	Zak.innerHTML="Визитки (50х90 мм)";
        if (OldCol=="1") {
          Col.innerHTML="4+0";
        } else {
	  Col.innerHTML="4+4";
        }
   } else if (TypeOfChoice.value=="6") {
	Zak.innerHTML="Папки А4 в сложенном виде";
        if (OldCol=="1") {
          Col.innerHTML="4+0 без ламинации";
        } else {
	  Col.innerHTML="4+0 с ламинацией";
        }
   } else if (TypeOfChoice.value=="7") {
	Zak.innerHTML="Буклеты А4";
        if (OldCol=="1") {
          Col.innerHTML="4+4 (1 фальц)";
        } else if (OldCol=="2") {
          Col.innerHTML="4+4 (2 фальца)";
        } else if (OldCol=="3") {
	  Zak.innerHTML="Буклеты А3";
          Col.innerHTML="4+4 (1 фальц)";
        }
   } else if (TypeOfChoice.value=="8") {
	Zak.innerHTML="Фирменные бланки А4";
        if (OldCol=="1") {
          Col.innerHTML="4+0";
        } else if (OldCol=="2") {
          Col.innerHTML="4+1";
        } else if (OldCol=="3") {
          Col.innerHTML="4+4";
        }
   } else if (TypeOfChoice.value=="9") {
        Col.innerHTML="4+0";
        if (OldCol=="1") {
	  Zak.innerHTML="Наклейки А5 (148х210 мм)";
        } else if (OldCol=="2") {
	  Zak.innerHTML="Наклейки А4 (210х297 мм)";
        }
   } else if (TypeOfChoice.value=="10") {
        Zak.innerHTML="Флаеры (210х99 мм)";
        if (OldCol=="1") {
          Col.innerHTML="4+0";
        } else if (OldCol=="2") {
          Col.innerHTML="4+4";
        }
   }

   var Itog           = document.getElementById('Itog');
   Itog.innerHTML = eval(document.getElementById('a'+OldLis).innerHTML * eval(document.getElementById('y'+OldLis+OldCol).innerHTML.replace(",",".")).toFixed(2)).toFixed(0);


   var SZak        = document.getElementById('SZak');
   SZak.value  = Zak.innerHTML;
   var SCol        = document.getElementById('SCol');
   SCol.value  = Col.innerHTML;
   var STir        = document.getElementById('STir');
   STir.value  = Tir.innerHTML;
   var SItog       = document.getElementById('SItog');
   SItog.value = Itog.innerHTML;

}
	
function SelectList(lisIn) {

   lis="t"+lisIn;
   lis_y="y"+OldLis+OldCol;

   var Sum      = document.getElementById('Sum');
   var Cell     = document.getElementById(lis);
   var Cell_y   = document.getElementById(lis_y);
   var Cell_t   = document.getElementById('t'+OldLis);
   var Cell_tir = document.getElementById('y'+lisIn+OldCol);
   var Cell_a   = document.getElementById('a'+lisIn);

   if (Cell.style.backgroundColor=="#a5a5a5") {
      Cell.style.backgroundColor="#efefee";
      if ((OldCol!=0)&&(OldLis!=0)) {Cell_y.style.backgroundColor="#efefee";}
      Hide('Sum', 0);
      OldLis=0;
   } else {

      if (OldLis!=0) {Cell_t.style.backgroundColor="#efefee";}
      if ((OldCol!=0)&&(OldLis!=0)) {Cell_y.style.backgroundColor="#efefee";}
      Cell.style.backgroundColor="#a5a5a5";
      OldLis=lisIn;
      if ((OldCol!=0)&&(OldLis!=0)) {
        Cell_tir.style.backgroundColor="#8FC8E7";
        Sum.innerHTML='<center>Итого по заказу: <b>'+(eval(Cell_a.innerHTML) * eval(Cell_tir.innerHTML.replace(",","."))).toFixed(0)+'</b> руб.'+SetBut;
        Show('Sum', 1);
      }
   }

    SelectChoice();
}

function SelectCol(colIn) {

   col="c"+colIn;
   lis_y="y"+OldLis+OldCol;
   var Sum     = document.getElementById('Sum');
   var Cell    = document.getElementById(col);
   var Cell_y  = document.getElementById(lis_y);
   var Cell_C  = document.getElementById('c'+OldCol);
   var Cell_Pr = document.getElementById('y'+OldLis+colIn);
   var Cell_A  = document.getElementById('a'+OldLis);

   if (Cell.style.backgroundColor=="#a5a5a5") {
      Cell.style.backgroundColor="#efefee";
      if ((OldCol!=0)&&(OldLis!=0)) {Cell_y.style.backgroundColor="#efefee";}
      Hide('Sum', 0);
      OldCol=0;
   } else {

      if (OldCol!=0) {Cell_C.style.backgroundColor="#efefee";}
      if ((OldCol!=0)&&(OldLis!=0)) {Cell_y.style.backgroundColor="#efefee";}
      Cell.style.backgroundColor="#a5a5a5";
      OldCol=colIn;
      if ((OldCol!=0)&&(OldLis!=0)) {
         Cell_Pr.style.backgroundColor="#8FC8E7";
         Sum.innerHTML='<center>Итого по заказу: <b>'+(eval(Cell_A.innerHTML) * eval(Cell_Pr.innerHTML.replace(",","."))).toFixed(0)+'</b> руб.'+SetBut;
         Show('Sum', 1);
      }
   }

    SelectChoice();

}




