function nw(url,window_name,width,height,status,toolbar,menubar) {
  myWindow=window.open(url, window_name, 'width='+width+',height='+height+',status='+status+',toolbar='+toolbar+',menubar='+menubar+',scrollbars=yes,resizable=yes');
  myWindow.focus();
  return;
}

function nw2(url,window_name,width,height,status,toolbar,menubar) {
  myWindow=window.open(url, window_name, 'width='+width+',height='+height+',status='+status+',toolbar='+toolbar+',menubar='+menubar+',scrollbars=no,resizable=no');
  myWindow.focus();
  return;
 }


var off = new Array();
for(i=1; i<=5; ++i) {
 off[i] = new Image();
 off[i].src = "img/menu"+i+".gif";
}
var on = new Array();
for(i=1; i<=5; ++i) {
 on[i] = new Image();
 on[i].src = "img/menu"+i+"_1.gif";
}

objPatternName = /^.+$/;
objPatternComment = /^.+$/;  
objPatternCode = /^[1-9]{4}$/; 
objPatternEmail =/^([a-zA-Z0-9])+([.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-]+)+/;

function checkField (theForm, theField, theFieldDisplay, objRegex) { 
 objField = eval("document." + theForm + "." + theField);
 if (!objRegex.test(objField.value)) {
   alert ("Пожалуйста, заполните или введите правильно поле: " + theFieldDisplay + "");
   objField.select();
   objField.focus();
   return (false);
 }
 return (true);
}

function CheckEMailForm(theForm) {
 if (checkField(theForm, "name", "Имя", objPatternName) && checkField(theForm, "email", "E-mail", objPatternEmail) && checkField(theForm, "comment", "Сообщение", objPatternComment) && checkField(theForm, "code", "Анти-спам код", objPatternCode)) {
   return (true);
 } else {
   return (false);
 }
}

