function commsearch(rcode,rsear)
	{ window.open('comments.php?id='+rcode+'&search='+rsear,'Commsearch','toolbar=0,location=0,directories=0,menuBar=0,resizable=0,scrollbars=yes,width=430,height=512,left=16,top=16'); }

function iopen(url,w,h)
	{ window.open(''+url,'Imgopen','toolbar=0,location=0,directories=0,menuBar=0,resizable=1,scrollbars=yes,width='+w+',height='+h+',left=32,top=16'); }

function popup(code,w,h)
	{ window.open('plug.php?o='+code,'','toolbar=0,location=0,directories=0,menuBar=0,resizable=0,scrollbars=yes,width='+w+',height='+h+',left=32,top=16'); }

function print(pid)
   { window.open('print.php?id='+pid,'Print','toolbar=0,location=0,directories=0,menuBar=0,resizable=0,scrollbars=yes, width=640,height=512,left=165,top=26'); }

function calcprint(url,tmp)
   { window.open(''+url+'?'+tmp+'&print=1','CalcPrint','toolbar=0,location=0,directories=0,menuBar=1,resizable=1,scrollbars=yes, width=640,height=512,left=165,top=26'); }

function pfs(id,c1,c2)
	{ window.open('pfs.php?c1='+c1+'&c2='+c2,'PFS','status=1, toolbar=0,location=0,directories=0,menuBar=0,resizable=1,scrollbars=yes,width=754,height=512,left=32,top=16'); }

function help(rcode,c1,c2)
	{ window.open('plug.php?h='+rcode+'&c1='+c1+'&c2='+c2,'Help','toolbar=0,location=0,directories=0,menuBar=0,resizable=0,scrollbars=yes,width=480,height=512,left=32,top=16'); }

function info(hcode,idinfo)
	{ window.open('plug.php?h='+hcode+'&idinfo='+idinfo,'Help','toolbar=0,location=0,directories=0,menuBar=1,resizable=0,scrollbars=yes,width=300,height=450,left=32,top=16'); }
	
function smile(smcode,c1,c2)
	{ window.open('plug.php?h='+smcode+'&c1='+c1+'&c2='+c2,'Smilehelp','toolbar=0,location=0,directories=0,menuBar=0,resizable=0,scrollbars=yes,width=250,height=570,left=32,top=16'); }

function comments(rcode)
	{ window.open('comments.php?id='+rcode,'Comments','toolbar=0,location=0,directories=0,menuBar=0,resizable=0,scrollbars=yes,width=480,height=512,left=165,top=26'); }

function ratings(rcode)
	{ window.open('ratings.php?id='+rcode,'Ratings','toolbar=0,location=0,directories=0,menuBar=0,resizable=0,scrollbars=yes,width=480,height=512,left=165,top=26'); }

function polls(rcode)
	{ window.open('polls.php?id='+rcode,'Polls','toolbar=0,location=0,directories=0,menuBar=0,resizable=0,scrollbars=yes,width=608,height=410,left=110,top=46'); }

function pollvote(rcode,rvote)
	{ window.open('polls.php?a=send&id='+rcode+'&vote='+rvote,'Polls','toolbar=0,location=0,directories=0,menuBar=0,resizable=0,scrollbars=yes,width=608,height=410,left=16,top=16'); }

function picture(url,sx,sy)
	{ window.open('pfs.php?m=view&v='+url,'Picture','toolbar=0,location=0,directories=0,menuBar=0,resizable=1,scrollbars=yes,width='+sx+',height='+sy+',left=50,top=0'); }

function redirect(url)
	{ location.href = url.options[url.selectedIndex].value; }

//------------------------------------------//

window.name='main';

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function validatepass() 
{
  errors = "";
  
    if(document.reqauth.email.value.length == 0)
      errors = errors+"- Не заполнено поле 'Ваш E-mail'\n";
    if(errors.length != 0)
    {
      alert("Обнаружены следующие ошибки:                  \n\n"+errors+"\n");
      return(false);
    }
}

function validatesvyaz() 
{
  errors = "";
  
    if(document.sendmail.sender_name.value.length == 0)
      errors = errors+"- Представьтесь пожалуйста.\n";
    if((document.sendmail.sender_email.value.length == 0) && (document.sendmail.sender_phone.value.length == 0))
      errors = errors+"- Укажите хотя бы один способ для связи.             \n";
    if(document.sendmail.sender_message.value.length == 0)
      errors = errors+"- Не заполнено поле 'Сообщение'\n";
    if(errors.length != 0)
    {
      alert('Обнаружены следующие ошибки:                   \n\n'+errors+'\n\nПожалуйста заполните все поля формы  ');
      return false;
    }
    
    if (document.sendmail.sender_email.value.length != 0) {
    if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.sendmail.sender_email.value)){
    return true }
      errors = errors+"- Это не похоже на E-mail адрес!                \n";
    }
    if(!document.sendmail.sender_phone.value.match(/^[\d|\-|\s|\(|\)|\+]*$/))
      errors = errors+"- Недопустимые символы в поле 'Телефон'                \n";
    if(errors.length != 0)
    {
      alert('Обнаружены следующие ошибки:\n\n'+errors);
      return false;
    }
   
  }

function validatereg() 
{
  errors = "";
  
    if(document.login.rusername.value.length == 0)
      errors = errors+"- Не заполнено поле 'Имя пользователя'\n";
    if(document.login.remail.value.length == 0)
      errors = errors+"- Не заполнено поле 'Ваш Е-mail'\n";
    if(document.login.rpassword1.value.length == 0)
      errors = errors+"- Вы не ввели пароль\n";
    if(document.login.rpassword2.value.length == 0)
      errors = errors+"- Повторный пароль не введен\n";
    if(errors.length != 0)
    {
      alert("Обнаружены следующие ошибки:                   \n\n"+errors+"\n\nПожалуйста исправьте ошибки и\n заполните все обязательные поля         ");
      return(false);
    }
    
    if(document.login.rpassword1.value.length < 4) 
      errors = errors+"- Введенный пароль недостаточной длины!\n  Введите не менее 4 символов.\n";
    if(document.login.rpassword1.value !== document.login.rpassword2.value) 
      errors = errors+"- Введенные Вами пароли не совпадают!\n";
    if(errors.length != 0)
    {
    alert("Обнаружены следующие ошибки:                   \n\n"+errors);
      return(false);
    }

    if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.login.remail.value)){
    return true } 
      errors = errors+"- Это не похоже на E-mail\n";
    if(errors.length != 0)
    {
      alert("Обнаружены следующие ошибки:            \n\n"+errors);
      return(false);
    }

}

function validate_trent() 
{
  errors = "";
  
    if(document.t_rent.t_rent_name.value.length == 0)
      errors = errors+"Представьтесь пожалуйста.\n";
    if((document.t_rent.t_rent_email.value.length == 0) && (document.t_rent.t_rent_phone.value.length == 0))
      errors = errors+"Укажите хотя бы один способ для связи.             \n";
    if(errors.length != 0)
    {
      alert("\n"+errors+"\n");
      return(false);
    }
    if (document.t_rent.t_rent_email.value.length != 0) {
    if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.t_rent.t_rent_email.value)){
    return true }
      errors = errors+"- Это не похоже на E-mail адрес!                \n";
    }
    if (document.t_rent.t_rent_phone.value.length != 0) {
    if(!document.t_rent.t_rent_phone.value.match(/^[\d|\-|\s|\(|\)|\+]*$/))
      errors = errors+"- Недопустимые символы в поле 'Телефон'                \n";
    }
    if(errors.length != 0)
    {
      alert('Обнаружены следующие ошибки:            \n\n'+errors);
      return false;
    }
}

function validate_grent() 
{
  errors = "";
  
    if(document.g_rent.g_rent_name.value.length == 0)
      errors = errors+"Представьтесь пожалуйста.\n";
    if((document.g_rent.g_rent_email.value.length == 0) && (document.g_rent.g_rent_phone.value.length == 0))
      errors = errors+"Укажите хотя бы один способ для связи.             \n";
    if(errors.length != 0)
    {
      alert("\n"+errors+"\n");
      return(false);
    }
    if (document.g_rent.g_rent_email.value.length != 0) {
    if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(document.g_rent.g_rent_email.value)){
    return true }
      errors = errors+"- Это не похоже на E-mail адрес!                \n";
    }
    if (document.g_rent.g_rent_phone.value.length != 0) {
    if(!document.g_rent.g_rent_phone.value.match(/^[\d|\-|\s|\(|\)|\+]*$/))
      errors = errors+"- Недопустимые символы в поле 'Телефон'                \n";
    }
    if(errors.length != 0)
    {
      alert('Обнаружены следующие ошибки:            \n\n'+errors);
      return false;
    }
}