 function newImage(arg) {
                  if (document.images) {
                      rslt = new Image();
                      rslt.src = arg;
                      return rslt;
                     }
                  }


      function changeImages() {
                      preloadFlag = true;
                      if (document.images && (preloadFlag == true)) {
                        for (var i=0; i<changeImages.arguments.length; i+=2) {
                          document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
                        }
                      }
                    }

     var preloadFlag = false;

   function preloadImages() {
                    if (document.images) {
                        oferty_on = newImage('images/oferty_.gif');
                        mojpj_on = newImage('images/mojpj_.gif');
                        przewodnik_on = newImage('images/przewodnik_.gif');
                        wiadomosci_on = newImage('images/wiadomosci_.gif');
                        pharmajobs_on = newImage('images/pharmajobs_.gif');
                        preloadFlag = true;
                      }
                    }
 function popup_scroll(url, width, height)
{
var pagename='pj'+Math.floor(Math.random()*100);
        LeftPosition=(screen.width)?(screen.width-width)/2:100;
     TopPosition=(screen.height)?(screen.height-height)/2:100;
        var Win = window.open(url,pagename,'width=' + width + ',height=' + height + ',top='+TopPosition+',left='+LeftPosition+',resizable=0,scrollbars=yes,menubar=no,toolbar=no,status=no')
}

 function popup_scroll_thesame(url, width, height)
{
var pagename='pj';
        LeftPosition=(screen.width)?(screen.width-width)/2:100;
     TopPosition=(screen.height)?(screen.height-height)/2:100;
        var Win = window.open(url,pagename,'width=' + width + ',height=' + height + ',top='+TopPosition+',left='+LeftPosition+',resizable=0,scrollbars=yes,menubar=no,toolbar=no,status=no')
}

 function popup(url, width, height)
{
        LeftPosition=(screen.width)?(screen.width-width)/2:100;
     TopPosition=(screen.height)?(screen.height-height)/2:100;
        var Win = window.open(url,'showpic','width=' + width + ',height=' + height + ',top='+TopPosition+',left='+LeftPosition+',resizable=0,scrollbars=no,menubar=no,toolbar=no,status=no')
}

 function advpopup(url, width, height)
{
        LeftPosition=(screen.width)?(screen.width-width)/2:100;
     TopPosition=(screen.height)?(screen.height-height)/2:100;
        var Win = window.open(url,'adv','width=' + width + ',height=' + height + ',top='+TopPosition+',left='+LeftPosition+',resizable=0,scrollbars=no,menubar=no,toolbar=no,status=no')
}

function checkemail(which, alerttext)
{
    var testresult=true;
    var x=which.value
    var filter=/^([\w-]+(?:\.\w+)*)@((?:\w+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
    if(x.length==0) testresult=false;
    else {
    if (filter.test(x)) //sprawdzanie czy podano poprawny email
        testresult=true
    else
        testresult=false
  }
    if (!testresult) //jesli cos nie tak wyswietlamy stosowny komunikat
    {
        if (alerttext.length!=0) alert(alerttext)
        which.focus();
        //which.value="";
    }
    return (testresult)
}


function checkname(which, alerttext)
{
    var testresult=true;
    var x=which.value
     if(x.length==0) testresult=false;
    else
        testresult=true;

    if (!testresult) //jesli cos nie tak wyswietlamy stosowny komunikat
    {
        if (alerttext.length!=0) alert(alerttext)
    }
    return (testresult)
}


function checkagree(which, alerttext)
{
    var testresult=true;
 if (which.checked==true) testresult=true;
    else
        testresult=false;

    if (!testresult) //jesli cos nie tak wyswietlamy stosowny komunikat
    {
        if (alerttext.length!=0) alert(alerttext)
    }
    return (testresult)
}

function checkpass(which,which2, alerttext)
{
    var testresult=true;
 if (which.value==which2.value) testresult=true;
    else
        testresult=false;

    if (!testresult) //jesli cos nie tak wyswietlamy stosowny komunikat
    {
        if (alerttext.length!=0) alert(alerttext)
    }
    return (testresult)
}

function checkpasswds(which,which2, alerttext)
{
    var testresult=true;
 if ((which2.value!="" && which.value!="" ) || (which2.value=="" && which.value=="")) testresult=true;
    else
        testresult=false;

    if (!testresult) //jesli cos nie tak wyswietlamy stosowny komunikat
    {
        if (alerttext.length!=0) alert(alerttext)
    }
    return (testresult)
}

function checkpasslength(which, alerttext)
{
    var testresult=true;
 if (which.value.length>=6) testresult=true;
    else
        testresult=false;

    if (!testresult) //jesli cos nie tak wyswietlamy stosowny komunikat
    {
        if (alerttext.length!=0) alert(alerttext)
    }
    return (testresult)
}

function checkbody(which, alerttext)
{
    var testresult=true;
    var x=which.value;

     if(x.length==0) testresult=false;
    else
        testresult=true;

    if (!testresult) //jesli cos nie tak wyswietlamy stosowny komunikat
    {
        if (alerttext.length!=0) alert(alerttext);
    }
    return (testresult);
}


function CheckForm(form) {
  if (    checkemail(document.forms[form].nadawcaemail,"Podałeś nieprawidłowy adres e-mail nadawcy!") && checkemail(document.forms[form].odbiorcaemail,"Podałeś nieprawidłowy adres odbiorcy!"))  return true;

  return false;
}


function CheckContactForm(form) {
  if (    checkemail(document.forms[form].nadawcaemail,"Podałeś nieprawidłowy adres e-mail nadawcy!") && checkname(document.forms[form].nadawca,"Nie podałeś imienia i nazwiska!")      && checkbody(document.forms[form].tresc,"Musisz wpisać treść zapytania!"))
  return true;
else
  return false;
}


function CheckRegisterForm(form) {
  if (

       checkname(document.forms[form].login,"Nie podałeś loginu!") &&
       checkname(document.forms[form].passwd,"Nie podałeś hasła!") &&
       checkpasslength(document.forms[form].passwd,"Podane hasło musi mieć minimum 6 znaków!") &&
       checkpass(document.forms[form].passwd,document.forms[form].passwd2,"Podane hasła różnią się!") &&
       checkemail(document.forms[form].email,"Podałeś nieprawidłowy adres e-mail!") &&
       checkagree(document.forms[form].accept,"Musisz oświadczyć, że zgadzasz się z warunkami regulaminu!")
  )
  return true;
else
  return false;
}

function CheckRetrieveForm(form) {
  if (
    checkemail(document.forms[form].email,"Podałeś nieprawidłowy adres e-mail!"))
  return true;
else
  return false;
}
function CheckQuestionForm(form) {
  if (
    checkemail(document.forms[form].email,"Podałeś nieprawidłowy adres e-mail!"))
  return true;
else
  return false;
}

function CheckSettings(form) {
  if ( checkname(document.forms[form].login,"Nie podałeś loginu!")&&
       checkpasswds(document.forms[form].oldpasswd,document.forms[form].passwd,"Musisz podać stare hasło aby ustalić nowe!")
  &&
       checkemail(document.forms[form].email,"Podałeś nieprawidłowy adres e-mail!"))
  return true;
else
  return false;
}

function CheckLogged(logged) {
    if (logged==1) return true;
    else if (logged==0) {
      alert ('Musisz być zalogowany aby dodać tą ofertę do listy obserwowanych ofert!');
      return false;
    }
}

function CheckLogged2(logged) {
    if (logged==1) return true;
    else if (logged==0) {
      alert ('Musisz być zalogowany aby dodać tego pracodawcę do czarnej listy!');
      return false;
    }
}

function CheckNewsletter(form) {
  if ( checkemail(document.forms[form].email,"Podałeś nieprawidłowy adres e-mail!"))
  return true;
else
  return false;
}

function Checkaccept(form) {
  if ( checkagree(document.forms[form].acceptreg,"Musisz zaakceptować warunki regulaminu aby dopisać się do Newslettera!"))
  return true;
else
  return false;
}