var Vers=parseInt(navigator.appVersion);
var Nav=navigator.appName;
var Netscape4=(document.layers) ? true : false;
var IExplorer4=((document.all)&&(Vers>=4))?true:false;
var Netscape6=(!IExplorer4 && document.getElementById) ? true : false;

var OpenMenu=new Array();
var Timer=null;

function activate(imgName) {
  if (document.images)
    document[imgName].src = eval(imgName + 'on.src')
}
function inactivate(imgName) {
  if (document.images)
    document[imgName].src = eval(imgName + 'off.src')
}
function a(imgName) {
  if (document.images)
    document[imgName].src = eval(imgName + 'on.src')
}

function stat(ln) {
	window.status="г. Казань, Россия, тел./факс: (843) 265-65-50, 265-95-50, e-mail: info@ionization.ru";
}

function ShowMenu(id, level)
  {
   clearTimer();
   if (IExplorer4)
     return ShowMenuE(id, level);
   if (Netscape6)
     return ShowMenuN(id, level);
   return true;
  }

function ShowMenuE(id, level)
  {
   elem = eval (id);
   if (OpenMenu[level] && OpenMenu[level]!=elem)
     CloseAll(level);
   if (document.all.item(id) == null)
     return true;
   elem.style.display = "block";
   elem.style.visibility = "visible";
   OpenMenu[level]=elem;
   return false;
  }

function ShowMenuN(id, level)
  {
   if (OpenMenu[level] && OpenMenu[level]!=id)
     CloseAll(level);
   elem = document.getElementById(id);
   if (elem == undefined)
     return true;
   elem.style.visibility = "visible";
   elem.style.display = "block";
   OpenMenu[level]=id;
   return false;
  }

function CloseMenu(level)
  {
   if (IExplorer4)
     return CloseMenuE(level);
   if (Netscape6)
     return CloseMenuN(level);
   return true;
  }

function CloseMenuE(level)
  {
   if (OpenMenu[level])
     {
      OpenMenu[level].style.display = "none";
      OpenMenu[level].style.visibility = "hidden";
     }
   OpenMenu[level]=null;
  }

function CloseMenuN(level)
  {
   if (OpenMenu[level])
     {
      document.getElementById(OpenMenu[level]).style.visibility = "hidden";
      document.getElementById(OpenMenu[level]).style.display = "none";
     }
   OpenMenu[level]=null;
  }

function CloseAll(level)
  {
   clearTimer();
   for (i=level; i<OpenMenu.length; i++)
     CloseMenu(i);
  }

function clearTimer()
  {
   if (Timer)
     {
      clearTimeout (Timer);
      Timer = null;
     }
  }

function setTimer()
  {
   Timer = window.setTimeout('CloseAll(0)', 250);
  }

function OpenPod(mail,d)
  {
   if (true_Email(mail)) {
   var newURL="podpis.php?email="+mail+"&d="+d;
   Widb=window.open(newURL,'pod','toolbar=0,scrollbars=0,location=0,directories=0,status=0,menubar=0,width=380,height=200,border=thin,top=100,left=100,help=0');
   Widb.focus();
     }
  }

function true_Email (mail) {
if (mail.length==0) {
alert ('Вы должны ввести свой E-mail!');
} else if (mail.indexOf ('\@',0)==-1) {
alert ("Не верный E-mail адрес! Символ '\@' отсутствует!");
} else {
return true;
}
}

function OpenImage(id)
  {
   var newURLb="http://ionization.ru/i/tov/ser/"+id;
   Widi=window.open(newURLb,'img','toolbar=0,scrollbars=yes,location=0,directories=0,status=0,menubar=0,width=600,height=500,border=thin,top=0,left=0,help=0');
   Widi.focus();
}

function isNewForm(form){
var errors='';
if (form.name.value == "") errors = 'Вы не ввели свои данные: ФИО\n';
if (form.ad.value == "") errors = errors + 'Вы не ввели свои данные: адрес\n';
c1=parseFloat(form.kl.value);
if (c1<0 || c1>1000) errors = errors + 'Неправильно ввели: количество заказываемых ионизаторов\n';
if (!true_Email(form.email.value)) errors = errors + 'Не верный E-mail адрес\n';
if (errors) alert(errors);
document.returnValue = (errors == '')
}

function cleer(form)
  {
	  if (form.email.value == 'Ваш e-mail')
		form.email.value = '';
  }
  
function ch(id) {
	var c = document.getElementById(id);
	if (c.checked == false) {
		c.checked = true;
		return true;
	} else {
		return false;
	}
}
