var pressed_button;
/***************************************************************************/
  function sortArr(pForm, pField, pAsc){
      pForm.elements[pForm.name+'[field]'].value = pField;
      pForm.elements[pForm.name+'[asc]'].value = pAsc;   
			pForm.submit();
   }
   
  function poponload(pHref){
    cvWindow = window.open (pHref, "mywindow", "resizable=allow,scrollbars=1,width=600,height=600");
    cvWindow.moveTo(0,0);
  }
  
  function highlight(what,how){
    what.style.backgroundColor = (how==1 ? "#FAF1F5" : "transparent"); 
  }
  
  /* **************** Pokazywanie i ukrywanie *************************/
  
  function HideShowButton(buttonId,formId){
    if (document.getElementById){
      if (document.getElementById(buttonId).value=="Pokaż filtr"){
        document.getElementById(buttonId).value="Ukryj filtr";
        document.getElementById(formId).style.display="block";
      }
      else{
        document.getElementById(buttonId).value="Pokaż filtr";
        document.getElementById(formId).style.display="none";
      }
    }
  }
  
  function HideShow(idName){
    if (document.getElementById) {
      if (document.getElementById(idName).style.display=="none"){
        document.getElementById(idName).style.display="block"
      }
      else{
        document.getElementById(idName).style.display="none"
      }
    }
  }
  
  function Show(idName){
    if (document.getElementById) {
      if (document.getElementById(idName).style.display=="none"){   
        document.getElementById(idName).style.display=""
      }
    }
  }
  
  function Hide(idName){
    if (document.getElementById) {
      if (document.getElementById(idName).style.display==""){
        document.getElementById(idName).style.display="none"
      }
    }
  }
  
  function Enable(){
    if (document.getElementById) {
      for (var i=0; i<arguments.length; i++) {
        if (document.getElementById(arguments[i]).disabled==true)
        document.getElementById(arguments[i]).disabled = false;
      }
    }
  }
  
  function Disable(){
    if (document.getElementById) {
      for (var i=0; i<arguments.length; i++) {
        if (document.getElementById(arguments[i]).disabled==false)
        document.getElementById(arguments[i]).disabled = true;
      }
    }
  }
  
  function HideShowFormPart(idFormPart,idDecField){
    if (document.getElementById) {
      if (document.getElementById(idDecField).value != "")
        Hide(idFormPart);
      else
        Show(idFormPart);
    }
  }
  
  function DisableEnable(pId,pCondition){
    if (document.getElementById) {
      if (pCondition){
        Disable(pId);
      }  
      else{
        Enable(pId);
      }
    }
  }
  
  /* **************** Zatwierdzanie formularzy *************************/
  
  function submitForm(pText){     
    return confirm('Czy na pewno chcesz '+pText+ '?');
  }
  
  function isChecked(pNumber,pIdName){
    for (var i=0;i<pNumber;i++){
      if (document.getElementById(pIdName+i).checked)
        return true;
    }
    return false;
  }
  
  function submitFormIfChecked(pNumber,pIdName,pConfirmText,pAlertText){
    if (isChecked(pNumber,pIdName)){
      return submitForm(pConfirmText);
    }
    else{
      alert(pAlertText);
      return false;
    }
  }
  
  /* ******************** Zaznaczanie i odznaczanie checkboxow ***************** */
  
  function changeAll(pNumber,pIdName,pOption){
    if (document.getElementById(pOption).value == '1'){
      for(var i=0; i<pNumber; i++){
        document.getElementById(pIdName+i).checked = true
      }
      document.getElementById(pOption).value = '0'
    }
    else{
      for(var i=0; i<pNumber; i++){
        document.getElementById(pIdName+i).checked = false
      }
      document.getElementById(pOption).value = '1'
    }    
  }
  
  /***************************************************************************/
  
  function statFormCheck(pField,pAdv){
    if (document.getElementById) {
      if ((document.getElementById(pField).value == '') && (document.getElementById(pAdv).value != '')){
          alert('Przy wyborze konkretnej oferty pracy należy wybrać również daną');
          return false;
      }
      return true;
    }
  }

