function show_img(img,width,height)
{
   var a
   var b
   var url
   vidWindowWidth=width;
   vidWindowHeight=height;
   a=(screen.height-vidWindowHeight)/5;
   b=(screen.width-vidWindowWidth)/2;
   features="top="+a+",left="+b+",width="+vidWindowWidth+",height="+vidWindowHeight+",toolbar=no,menubar=no,location=no,directories=no,scrollbars=no,resizable=no";
   url="../util/show.php?img="+img;
   window.open(url,'',features,true);
}

function getObject(obj) { 
    var theObj 
    if (document.layers) { 
        if (typeof obj == "string") { 
            return document.layers[obj] 
        } else { 
            return obj 
        } 
    } 
    if (document.all) { 
        if (typeof obj == "string") { 
		   if(document.all(obj)!=null) return document.all(obj).style ;
		   else return null;
        } else { 
            return obj.style 
        } 
    } 
    if (document.getElementById) { 
        if (typeof obj == "string") { 
            return document.getElementById(obj).style 
        } else { 
            return obj.style 
        } 
    } 
    return null 
} 

// Отображение объекта
function show(obj) { 
    var theObj = getObject(obj);
    theObj.visibility = "visible" 
    theObj.display = "block" 	
} 
// Скрытие объекта
function hide(obj)
{ 
    var theObj = getObject(obj) 
    theObj.visibility = "hidden";
    theObj.display = "none" 		 
} 


// Отправка данных для корзины
function add(id_catalog, id_perfo, id_width, mat, size, color)
{
  var a
  var b
  var url
  var wndNewWindow
  titl= "";
  vidWindowWidth=330;
  vidWindowHeight=260;
  a=(screen.height-vidWindowHeight)/2;
  b=(screen.width-vidWindowWidth)/2;
  features="top="+a+",left="+b+",width="+vidWindowWidth+",height="+vidWindowHeight+",toolbar=no,menubar=no,location=no,directories=no,scrollbars=no,resizable=no";
  url="add.php?id_catalog="+id_catalog+"&id_perfo="+id_perfo+"&id_width="+id_width+"&mat="+mat+"&size="+size+"&color="+color;
  name="";
  wndNewWindow = window.open(url,name,features);
}


// Отправка формы с заказом.
// Проверяются значения и открывается скрипт-отправки
function submitorder(name, phone, email, cont)
{
  if (name=="") 
  {
    alert("Не введено имя"); 
    return false;	
  }	
  if (phone=="" && email=="" && cont=="" ) 
  {
    alert("Не введены контактные данные"); 
    return false;
  }	

  var a
  var b
  var url
  var wndNewWindow
  titl= "";
  vidWindowWidth=360;
  vidWindowHeight=250;
  a=(screen.height-vidWindowHeight)/2;
  b=(screen.width-vidWindowWidth)/2;
  features="top="+a+",left="+b+",width="+vidWindowWidth+",height="+vidWindowHeight+",toolbar=no,menubar=no,location=no,directories=no,scrollbars=no,resizable=no";
  url="order.php?name="+name+"&phone=" + phone + "&email=" + email + "&contact="+cont;
  name="";
  wndNewWindow = parent.open(url,name,features);
  
}

// Перемещение мышки над кнопкой
function over(obj)
{
  var d=new getObject(obj)
  x=d.left;
  if (x=="") x=0;
  else x=x.substring(0,x.length-2)
  d.left=parseInt(x);
  y=d.top;
  if (y=="") y=0
  else y=y.substring(0,y.length-2)
  d.top=parseInt(y)+1;
}

// Перемещение мышки над кнопкой
function out(obj)
{
  var d=new getObject(obj)
  x=d.left;
  if (x=="") x=0;
  else x=x.substring(0,x.length-2)
  d.left=parseInt(x);
  y=d.top;
  if (y=="") y=0
  else y=y.substring(0,y.length-2)
  d.top=parseInt(y)-1;
}