function PopUp(url,name,width,height,center,resize,scroll,posleft,postop){
	showx="";
	showy="";
	if(posleft!=0){X=posleft}
	if(postop!=0){Y=postop}
	if(!scroll){scroll=1}
	if(!resize){resize=1}
	if((parseInt(navigator.appVersion)>=4)&&(center)){X=(screen.width-width)/2;Y=(screen.height-height)/2;}
	if(X>0){showx=',left='+X;}if(Y>0){showy=',top='+Y;}
	if(scroll!=0){scroll=1}var Win=window.open(url,name,'width='+width+',height='+height+showx+showy+',resizable='+resize+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no');}


function ask(adr, quest)
{
        if (confirm(quest))
                document.location.href=adr;
}
function newWindow(what)
{
  window.open(what);
}

function openWindow(what, w, h)
{
  var pasek='no';
  if (w>=screen.width)
  {
    w+=30;
    pasek='yes';
  }
  if (h>=screen.height)
  {
    h+=30;
    pasek='yes';
  }

  var top;
  var left;
  if (w<screen.width)
    left=(screen.width-w)/2;
  else
    left=0;

  if (h<screen.height)
    top=(screen.height-h)/2;
  else
    top=0;

  okienko=window.open(what,"okno","height="+h+",width="+w+",status=no,toolbar=no,menubar=no, scrollbars="+pasek+", location=no, left="+left+", top="+top);
}

function updateProfile(message)
{
  var tel=document.getElementById('an_my_phone');
  if (trim(tel.value)=='')
    alert(message);
  else
  {
    var wlasciwe=opener.document.getElementById('an_phone');
    wlasciwe.style.display='inline';
    wlasciwe.innerHTML=tel.value;
    var link=opener.document.getElementById('profileUpdate');
    link.style.display='none';
    form=document.getElementById('updateProfile');
    form.submit();
  }
}


function trim(napis)
{
    var temp="";
    var poczatek=0;
    var koniec=napis.length;

    if (napis.charAt(poczatek)==' ')
    {
        poczatek++;
        while (napis.charAt(poczatek)==' ' && poczatek<koniec)
        {
            poczatek++;
        }
    }
    if (poczatek!=koniec+1 && napis.charAt(koniec-1)==' ' && koniec!=-1)
    {

        koniec--;
        while (napis.charAt(koniec-1)==' ' && koniec>poczatek)
        {
            koniec--;
        }
    }

    if (koniec<=poczatek)
        return "";
    else
        return napis.substring(poczatek, koniec);

}


function sendEmail(message)
{
  var title=document.getElementById('title');
  var content=document.getElementById('content');

  if (trim(title.value)=='')
    alert(message);
  else if (trim(content.value)=='')
    alert(message);
  else
  {
    form=document.getElementById('sendEmail');
    form.submit();
  }
}

function sendAbuse(message)
{

  var content=document.getElementById('content');


  if (trim(content.value)=='')
    alert(message);
  else
  {
    form=document.getElementById('sendAbuse');
    form.submit();
  }
}



function sendPW(message)
{
  var title=document.getElementById('title');
  var content=document.getElementById('content');

  if (trim(title.value)=='')
    alert(message);
  else if (trim(content.value)=='')
    alert(message);
  else
  {
    form=document.getElementById('sendEmail');
    form.submit();
  }
}


function sendFile(message)
{
  var desc=document.getElementById('filedesc');
  var plik=document.getElementById('plik');

  if (trim(desc.value)=='')
    alert(message);
  else if (trim(plik.value)=='')
    alert(message);
  else
  {
    var ext=plik.value.substring(plik.value.length-3);
    if (ext=='rtf')
    {
      form=document.getElementById('addFile');
      form.submit();
    }
    else
      alert(message);
  }
}


