function window_print(url,name,width,height,scroll)
{
  var id='';
  var NewWin = window.open(url,name,'align=center,toolbar=no,status=no,location=no,directories=no,resizable=no,width='+width+',height='+height+',scrollbars='+scroll+', left=0px, top=0px, menubar=no')
  NewWin.focus();
  //id = NewWin.setTimeout(_doAlert(),50000);
  //NewWin.print();
}


//----------------------------------
function _thisWindowPrint() {  
  window.print();
}

//--------------------------------------------
function window_open(url,name,width,height,scroll)
{
  var NewWin = window.open(url,name,'align=center,toolbar=no,status=no,location=no,directories=no,resizable=yes,width='+width+',height='+height+',scrollbars='+scroll+', left=0px, top=0px, menubar=no')
  NewWin.focus();
}
//-------------------------------------------------
//---------------------------------- 
function formCheck(formobj, formName){

  if (formName == 'SearchForm') { 
    // Enter name of mandatory fields
    var fieldRequired = Array("category", "operation");
    // Enter field description to appear in the dialog box
    var fieldDescription = Array("Rodzaj nieruchomości", "Operacja");  
  }


  // dialog message
  var alertMsg = "Proszę uzupełnić następujące pola:\n";
  
  var l_Msg = alertMsg.length;
  
  for (var i = 0; i < fieldRequired.length; i++){
    var obj = formobj.elements[fieldRequired[i]];
    if (obj){
      switch(obj.type){
      case "select-one":
        if (((obj.selectedIndex == -1 || obj.options[obj.selectedIndex].value == "")) && (formobj.elements['signature'].value == "")) {
          alertMsg += " - " + fieldDescription[i] + "\n";
        }
        break;
      case "select-multiple":
        if (obj.selectedIndex == -1){
          alertMsg += " - " + fieldDescription[i] + "\n";
        }
        break;
      case "text":
      case "password":
      case "textarea":
        if (obj.value == "" || obj.value == null){
          alertMsg += " - " + fieldDescription[i] + "\n";
        } 
        break;
      default:
      }
      if (obj.type == undefined){
        var blnchecked = false;
        for (var j = 0; j < obj.length; j++){
          if (obj[j].checked){
            blnchecked = true;
          }
        }
        if (!blnchecked){
          alertMsg += " - " + fieldDescription[i] + "\n";
        }
      }
    }
  }

  //**************************
  if (alertMsg.length == l_Msg){
    return true;
  }else{
    alert(alertMsg);
    return false;
  }
}




//---------------------------------- 
function _mpFormCheck(formobj, formName){

  if (formName == 'SendMesageForm') { 
    // Enter name of mandatory fields
    var fieldRequired = Array("email", "phone", "mailtext");
    // Enter field description to appear in the dialog box
    var fieldDescription = Array("Adres e-mail", "Numer telefonu");  
  }


  // dialog message
  var alertMsg = "Uwaga:\n";
  
  var l_Msg = alertMsg.length;
  
  var obj_0 = formobj.elements[fieldRequired[0]];
  var obj_1 = formobj.elements[fieldRequired[1]];
  var obj_2 = formobj.elements[fieldRequired[2]];
  
  if ((obj_0.value.length == 0) && (obj_1.value.length == 0)) {  
    alertMsg += "Proszę wpisać adres e-mail lub numer telefonu !\n";
  }
  
  if (obj_2.value.length == 0) {  
    alertMsg += "Proszę wpisać treść wiadomości !\n";
  }


  //**************************
  if (alertMsg.length == l_Msg){
    return true;
  }else{
    alert(alertMsg);
    return false;
  }
}