function screen_dim()
{
var width=0;
if (self.screen)
{     // for NN4 and IE4
        width = screen.width
}
//alert(document.cookie)
dopfontsize=0
thisCookie = document.cookie.split("; ")
for (i = 0; i < thisCookie.length; i++)
{ if ('fontsizedop' == thisCookie[i].split("=")[0]){dopfontsize=thisCookie[i].split("=")[1]}
}

if (width==800){document.write('<STYLE type="text/css"> table{font-size:'+(9+eval(dopfontsize))+'pt}</STYLE>')}
if (width==1024)document.write('<STYLE type="text/css"> table{font-size:'+(10+eval(dopfontsize))+'pt}</STYLE>');
if (width==1152)document.write('<STYLE type="text/css"> table{font-size:'+(11+eval(dopfontsize))+'pt}</STYLE>');
if (width==1280)document.write('<STYLE type="text/css"> table{font-size:'+(12+eval(dopfontsize))+'pt}</STYLE>');

}
//-------------------------------------
function only_kop(x)
{return(Math.round(100*x)/100)
}
//
function win_open(file_name)
{
window.open(file_name,'New_Window','width=300pt,height=280pt,toolbar=yes,top=10,scrollbars=yes,menubar=yes')
}
function win_open_big(file_name)
{
window.open(file_name,'New_Window','width=550pt,height=550pt,toolbar=yes,top=10,scrollbars=yes,menubar=yes')
}

//-----------------------------------
function randomNumber(max){
 now= new Date();
 num=Math.round(Math.abs(Math.sin(now.getTime()))*(max));

 // num - целое от 0 до max
 return num;
 }
//-----------------------------------

function tell2()     // простые ошибки при заполнении формы
{
        var error = 0;
        var msg = "При заполнении формы вы допустили ошибку\n\n";
        nik = document.board1.kontakt.value;
        message = document.board1.text_mes.value;
       // if(!nik) { error = 1; msg += " - Не указали контактную информацию\n"; }
      //  if(!message) { error = 1; msg += " - Не ввели сообщение\n"; }
        if(!error) { document.board1.submit(); }
        else { alert(msg); }
}

function form_er2()     // простые ошибки при заполнении формы(anketa)
{
        var error =0;
        var msg = "При заполнении формы вы допустили ошибку\n\n";
        ss= document.anketa.city_kl.value ;
        ss1=document.anketa.login_kl.value ;
        ss2= document.anketa.password_kl.value ;
        ss3= document.anketa.email_kl.value ;
        if (ss==0 || ss=="") {error = 1; msg +="    - Не указан город\n";};
        if (ss1==0 || ss1==""){error = 1; msg +="    - Не указан Логин\n";};
        if (ss2==0 || ss2==""){error = 1; msg +="    - Не указан Пароль\n";};
        if (ss3==0 || ss3==""){error = 1; msg +="    - Не указан email\n";};
        if (checkmail(ss3)!=""){error=1; msg +="    - Не правильный email\n";};
        //msg+=document.anketa.login_kl.value
        if(error!=0) {alert(msg); }
        else {
        changecooki('login_kl',document.anketa.login_kl.value);
        changecooki('password_kl',document.anketa.password_kl.value);
        //msg=""
        document.anketa.submit() ; }

}

function checkmail(f)
{
var errMSG = "";

ss =  f.indexOf('@');
ss1=  f.indexOf('.');
//if(ss< 1  || ss1<1 ||  ss > ss1 ){ errMSG = "1" ;};
if(ss< 1  ){ errMSG = "1" ;};
return errMSG;
}
//--------------------

//--------------------
function isEmpty_______(str) {
   for (var i = 0; i < str.length; i++)
      if (" " != str.charAt(i))
          return false;
      return true;
}
//--------------------


function onkey_er1()
{
 if ((event.keyCode < 46) || (event.keyCode > 57) || (event.keyCode == 47))
  {event.returnValue = false;}
}



function changecooki(cookieName,newValue) {
thisCookie = document.cookie.split("; ")

   for (i = 0; i < thisCookie.length; i++) {
         if (cookieName == thisCookie[i].split("=")[0]) {

        document.cookie =cookieName+"= "+ newValue;

 //          document.write('<br> мы в функции changecooki поменяли куки <br>');

              return thisCookie[i].split("=")[1];
                           }
       }
        return 0;

}


 //-------------------- для отладки   -------------------------------
function cookieVal(cookieName) {
        thisCookie = document.cookie.split("; ")
        document.write('мы в функции<br>')
                for (i = 0; i < thisCookie.length; i++) {
                        if (cookieName == thisCookie[i].split("=")[0]) {
                        document.write( document.cookie)
                        document.cookie = "login_kl= "+"sereza;";
                        document.write( document.cookie)
                                return thisCookie[i].split("=")[1];
                           }
                }
        return 0;
}




function dump_props(obj, obj_name)  {
   var result = ""
   for (var i in obj) {
      result += obj_name + "." + i + " = " + obj[i] + "<BR>"
   }
   result += "<HR>"
   document.write (result)
   return result}

