i=0;
function insertField() {
  i++;
  var tekst = document.createTextNode('Image ');
  var tekst2 = document.createTextNode('<- click to add an image (JPG, 10MB max file size)');
  var input = document.createElement('input');
      input.setAttribute('type', 'text');
      input.setAttribute('name', 'imgset[]');
      input.setAttribute('id', 'dImg'+i);
      input.onclick = new Function("return dupload(this.id)");
      input.setAttribute('readonly', 'readonly');
  var br    = document.createElement('br');
  var div   = document.createElement('div');
 
      div.appendChild(tekst);
      div.appendChild(input);
      div.appendChild(tekst2);
      div.appendChild(br);
  document.getElementById('pola').appendChild(div);
}


function show_log() {
    document.getElementById('loginBox').style.display='block';  
}

function upload(pole, section) {
  o = window.open("upload.php?fieldId="+pole+"&amp;section="+section, "k", "width=400, height=100,"
   + " innerwidth=200,innerheight=200,location=0,status=0,"
   + " directories=0, scrollbars=0, menubar=0, toolbar=0, resizable=1");
  o.moveTo(screen.width/2-400/2,screen.height/2-100/2);
  o.focus();
   
  return false;
}

function dupload(pole) {
  o = window.open("dupload.php?fieldId="+pole, "k", "width=400, height=100,"
   + " innerwidth=200,innerheight=200,location=0,status=0,"
   + " directories=0, scrollbars=0, menubar=0, toolbar=0, resizable=1");
  o.moveTo(screen.width/2-400/2,screen.height/2-100/2);
  o.focus();
   
  return false;
}


function viewer(mId) {
  o = window.open("viewer.php?mId="+mId, "k", "width=800, height=500,"
   + " innerwidth=200,innerheight=200,location=0,status=0,"
   + " directories=0, scrollbars=1, menubar=0, toolbar=0, resizable=1");
  o.moveTo(screen.width/2-600/2,screen.height/2-500/2);
  o.focus();
   
  return false;
}


function antyspam(t) {
  t.spam.value=2;
  return true;
}

function formCheck(t) {

  if (t.yname.value=="") {
    alert("Type your name please...");
    t.yname.focus();
    return false;
  }
  
  
  if (!t.yemail.value.match(/^[0-9a-z_.-]+@([0-9a-z-]+\.)+[a-z]{2,6}$/)) {
    alert("Please make sure your e-mail is correct!");
    t.yemail.focus();
    return false;
  }
  
  
  
  if (!t.femail.value.match(/^[0-9a-z_.-]+@([0-9a-z-]+\.)+[a-z]{2,6}$/)) {
    alert("Your friend's e-mail address doesn't seem to be correct!");
    t.femail.focus();
    return false;
  }
  
  
  
  
  return true;
}




function przesun(f, k) {
  var i = f.selectedIndex;
  if (i<0) alert("Select a category!");
  if ((k==1 && i-k>=0) || (k==-1 && i-k<f.options.length)) {
    tmp = f.options[i];
    f.options[i] = new Option(f.options[i-k].text,f.options[i-k].value);
    f.options[i-k] = new Option(tmp.text,tmp.value);
    for(j=0;j<f.options.length;j++) f.options[j].selected = false;
    f.options[i-k].selected = true;
  }
}
function wyslij(f) {
  for(i=0;i<f.options.length;i++) f.options[i].selected = true;
}


function klik() {
  if (event.button==2) {
    alert("If you have any questions regarding our products please contact us.");
  }
}
document.onmousedown=klik;
