function show_img_gd(id_image,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="../gallery/showorigin.php?id_photo="+id_image+"&style=origin";
   window.open(url,'',features,true);
   return false;
}

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="../shared/show.php?img="+img;
   window.open(url,'',features,true);
   return false;
}

function photo_info(id_photo,width,height)
{
   var a
   var b
   var url
   vidWindowWidth=width+150;
   vidWindowHeight=height+140;
   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=1,resizable=1";
   url="../shared/photoinfo.php?id_photo="+id_photo;
   window.open(url,'',features,true);
   return false;
}

function printpage()
{
  window.print();

}

function submit(id_product)
{
  var a
  var b
  var url
  var wndNewWindow
  titl= "";
  vidWindowWidth=330;
  vidWindowHeight=240;
  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="addproduct.php?id_product="+id_product+"&rand="+Math.random();
  name="";
  wndNewWindow = parent.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 submitgb(name, msg)
{
  if (name=="") 
  {
    alert("Не введено имя"); 
    return false;	
  }	
  if (msg=="") 
  {
    alert("Не введено сообщение"); 
    return false;
  }	
  
  return true;
  
}

function submitorder(prod, count, name, phone, email, address)
{
  if (prod=="") 
  {
    alert("You have not fill in a production"); 
    return false;	
  }	
  if (count=="") 
  {
    alert("You have not fill in a count production"); 
    return false;	
  }	
  if (name=="") 
  {
    alert("You have not fill in a your name"); 
    return false;	
  }	

  if (phone=="") 
  {
    alert("You have not fill in a telephone"); 
    return false;	
  }	
  if (email=="") 
  {
    alert("You have not fill in a e-mail"); 
    return false;
  }	
  if (address=="") 
  {
    alert("You have not fill in a address"); 
    return false;
  }	
  
  return true;
  
}

// Перемещение мышки над кнопкой
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;
}

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);
  if (theObj==null) return 0;
  if (typeof theObj.visibility != "undefined") 
                                       theObj.visibility = "visible" 
  if (typeof theObj.display != "undefined") theObj.display = "block" 	
} 
// Функция для скрытия объектов
function hide(obj)
{ 
  var theObj = getObject(obj) 
  if (theObj==null) return 0;
  if (typeof theObj.visibility != "undefined") 
                                       theObj.visibility = "hidden"
  if (typeof theObj.display != "undefined") theObj.display = "none" 		 
} 

function resize(w,h) { 
  if (navigator.userAgent.indexOf("Mac")!=-1 || 
      navigator.userAgent.indexOf("Gecko")!=-1 ||   
      navigator.userAgent.indexOf("Netscape")!=-1) 
    var offset = 0; 
  else     var offset = 4; 
  window.moveTo(50, 50); 
  window.resizeTo(w, h) 
} 

function maxwind() { 
  if (navigator.userAgent.indexOf("Mac")!=-1 || 
      navigator.userAgent.indexOf("Gecko")!=-1 ||   
      navigator.userAgent.indexOf("Netscape")!=-1) 
    var offset = 0; 
  else     var offset = 4; 
  window.moveTo(-offset, -offset); 
  window.resizeTo(screen.availWidth+(2*offset), screen.availHeight+(2*offset)) 
}

/////////////////////////// 
// Java-script меню
/////////////////////////////
// Идентификатор предыдущего открытого меню
var oldsubmenu;
// Открытое меню закрывается по таймеру
var timeOnMenu;
// Функция скрытия блока выпадающего меню
function showmenu(obj)
{
  if (timeOnMenu) {
  // Если установлено скрытие меню, по таймеру,
  // то удалить таймер и отменить скрытие
    clearTimeout(timeOnMenu);
  }
  // Скрыть существующий открытый блок выпадающего меню
  if (oldsubmenu) hide(oldsubmenu);
  // Показать блок выпадающего меню с идентификатором obj
  show(obj);
  // Идентификатор текущего открытого меню
  oldsubmenu=obj;
}
// Функция скрытия блока выпадающего меню
function hidemenu()
{
  // Если есть открытий блок выпадающего меню, то 
  // скрыть его через 0.5 секунды по таймеру
  if (oldsubmenu) timeOnMenu = setTimeout("hide(oldsubmenu)",200)
}