function OpenPhoto( HRef, width, height ) {

 win = window.open(HRef,'_blank','location=no,scrollbars=yes,status=no,menubar=no,resizable=yes,width='+(width+30)+',height='+height);
// win.document.body.topMargin = 0;
// win.document.body.leftMargin = 0;
// onclick="window.close();" title="Закрыть окно"
 return false;
}

/*function ShowSorry( text = 'Извините, но пока этот раздел не доступен...' ) {*/
function ShowSorry( text ) {

 if( !text )
  text = 'Извините, но пока этот раздел не доступен...';

 window.alert(text);
 return false;

}

function ChangePhoto(Source, DistId){
 element = document.getElementById(DistId);
 element.src = Source.value;
}


function _ask_del_str(str){
 return confirm('Вы действительно хотите удалить '+str+'!?.');

}

function valid_email(email){
 if(email.length < 5) 
 	return false;
 at_location = email.indexOf('@');
 dot_location = email.lastIndexOf('.');
 if(at_location == -1 || dot_location == -1 || at_location > dot_location)
 	return false;
 if(at_location == 0)
 	return false;
 if(dot_location - at_location < 2)
 	return false;
 if(email.length - dot_location < 2)
 	return false;
}

function SearchClick( text, where ){
 var path = "";
 var mane = "";
 var param = "";

 if (text.value.length == 0){
  alert("Введите строку поиска.");
  GoToField(text);
  return false;
 }

 if (text.value.length < 3 && (where != 1 || where != 7)){
  alert("Необходимо как минимум 3 символа в строке поиска.");
  GoToField(text);
  return false;
 }

 name = "name";
 if (where==0)
   path = "/search/";
 if (where==1){
   path = "/search/works/";
   param = "&"+"where=1";
 }
 if (where==2){
   path = "/search/";
 }

 var whereStr = "";
 if (where==5){
   path = "/search/";
   whereStr = "&where=5";
 }
 if (where==6){
   path = "/search/";
   whereStr = "&where=6";
 }
 if (where==7){
   path = "/search/works/";
   param = "&"+"where=7";
 }

 location.href=path+"?"+name+"="+text.value+param+whereStr; 
}                       

function SubcribeClick(frm, fld){
 if(fld.value!='' && fld.value!='ваш@е-майл') 
  location.href = frm.action+"?"+fld.name+"="+fld.value;
  else
  return false;
}

function CheckNews(frm){
 
 if (frm.DatePublish.value == ''){
  alert("Введите дату публикации!");
  frm.DatePublish.focus();
  return false;
 }

 if (frm.Caption.value == ''){
  alert("Введите название!");
  frm.Caption.focus();
  return false;
 }

 if (frm.Content)
  if (frm.Content.value == ''){
   alert("Введите содержание!");
   return false;
  }

 return true;

}

function CheckPage(frm){
 

 if (frm.Caption.value == ''){
  alert("Введите название меню!");
  frm.Caption.focus();
  return false;
 }

 if (frm.Header.value == ''){
  alert("Введите полное название!");
  frm.Header.focus();
  return false;
 }

 return true;

}
