
function ShowQuestWin(pict)
 {
 window.open(pict, "new_w", "width=3,height=2,top=1000,left=10000,resizable=no,scrollbars=no,status=no,dependent=no");
// window.open(pict, "new_w", "width=3,height=2,top=10,left=10,resizable=no,scrollbars=no,status=no,dependent=no");
 }

function is_email_valid(an_email)
{
  return (an_email.search(/[a-zA-Z0-9_][a-zA-Z0-9_-]*@([a-zA-Z0-9_-]+\.)*[a-zA-Z0-9_-]+/i)>=0);
}

function is_empty_str(str)
{
 return (str.toString().replace(/ +/i,"")=="");
}

// Вывод в отдельном окне
function ShowWinFull(pict, namew)
{
   OutInWin(pict, 880, 600, "_blank");
}

// Вывод в отдельном окне
function ShowPic(pict, namew) {
  window.open(pict, "_blank", "width=350,height=500,resizable=no,status=no,dependent=no,scrollbars=no");
 }

// открывает окно, которое по центру
// Параметры: pict - web путь к файлу
// xw - ширина окна (ex. 400)
// yw - высота окна (ex.300)
// namew - название окна (ex. "_blank" или "")
function OutInWin(pict, xw, yw, namew)
{
    var x_width, y_height;
    x_width  = xw;
    y_height = yw;

    w_top=0; w_left=0;

    w_top = (screen.height - y_height)/2-50;
    w_left= (screen.width - x_width)/2;

    window.open(pict, namew, "top="+w_top+",left="+w_left+",width="+x_width+",height="+y_height+",resizable=yes,scrollbars=yes,status=no,dependent=no");
    return false;
 }

 // Изменяет размер окна, чтобы оно было без скролбара
 // и по размерам совпадала с контентом
 // Вариант использования:
 // <body onLoad="resizeDialogToContent()">
 function resizeDialogToContent()
 {
   // resize window so there are no scrollbars visible
   var dw = window.dialogWidth;
   while (isNaN(dw))
   {
     dw = dw.substr(0,dw.length-1);
   }
   difw = dw - this.document.body.clientWidth;
   window.dialogWidth = this.document.body.scrollWidth+difw+'px';

   var dh = window.dialogHeight;
   while (isNaN(dh))
   {
     dh = dh.substr(0,dh.length-1);
   }
   difh = dh - this.document.body.clientHeight;
   window.dialogHeight = this.document.body.scrollHeight+difh+'px';
 }

