function oblicz_zamowienie(form,lang,klik){

var div = document.getElementById("kwota");
var cena1 = 600.00;
var cena2 = 800.00;
var cena3 = 0.00;
//var cena4 = 125.00;

var koszt=0;
if(klik=='forma2')form.forma3.checked=false;
if(klik=='forma3')form.forma2.checked=false;
if(form.forma1.checked==true) {
   koszt = koszt + cena1;
}
if(form.forma2.checked==true) {
   koszt = koszt + cena2;
}
if(form.forma3.checked==true) {
   koszt = koszt + cena3;
}
/*if(form.forma4.checked==true) {
   koszt = koszt + cena4;
}*/

//if(form.forma4.checked==true || form.forma3.checked==true || form.forma2.checked==true || form.forma1.checked==true){
if(form.forma3.checked==true || form.forma2.checked==true || form.forma1.checked==true){
  
    if (navigator.appName=="Microsoft Internet Explorer") {
      document.all['faktura'].style.visibility = 'visible';
      document.all['faktura'].style.display = 'block';
    }
    else{
      document.getElementById('faktura').style.visibility = 'visible';
      document.getElementById('faktura').style.display = 'block';
    }
    
}
else {
    if (navigator.appName=="Microsoft Internet Explorer") {
      document.all['faktura'].style.visibility = 'hidden';
      document.all['faktura'].style.display = 'none';
    }
    else{
      document.getElementById('faktura').style.visibility = 'hidden';
      document.getElementById('faktura').style.display = 'none';
    }
}

var zloty;

if(lang=='1')zloty = "<b>" + koszt + " zł</b> brutto";
else zloty = "<b>" + koszt + " PLN</b> brutto";
div.innerHTML = zloty;
}

function firma_pokaz(lang){
  if (navigator.appName=="Microsoft Internet Explorer") {
      document.all['nazwa_firma'].style.visibility = 'visible';
      document.all['nip_firma'].style.visibility = 'visible';
      if(lang=='1')document.all['regon_firma'].style.visibility = 'visible';
    }
    else{
      document.getElementById('nazwa_firma').style.visibility = 'visible';
      document.getElementById('nip_firma').style.visibility = 'visible';
      if(lang=='1')document.getElementById('regon_firma').style.visibility = 'visible';
    }
}

function osoba_fizyczna(lang){
     if (navigator.appName=="Microsoft Internet Explorer") {
      document.all['nazwa_firma'].style.visibility = 'hidden';
      document.all['nip_firma'].style.visibility = 'hidden';
      if(lang=='1')document.all['regon_firma'].style.visibility = 'hidden';
    }
    else{
      document.getElementById('nazwa_firma').style.visibility = 'hidden';
      document.getElementById('nip_firma').style.visibility = 'hidden';
      if(lang=='1')document.getElementById('regon_firma').style.visibility = 'hidden';
    }
}

function pokaz_firme(id)
{
    if (navigator.appName=="Microsoft Internet Explorer") {
      document.all[id].style.visibility = 'visible';
      document.all[id].style.display = 'block';
    }
    else{
      document.getElementById(id).style.visibility = 'visible';
      document.getElementById(id).style.display = 'block';
    }
}

function ukryj_firme(id){
    if (navigator.appName=="Microsoft Internet Explorer") {
      document.all[id].style.visibility = 'hidden';
      document.all[id].style.display = 'none';
    }
    else{
      document.getElementById(id).style.visibility = 'hidden';
      document.getElementById(id).style.display = 'none';
    }
}

function popup(id){
  plik='http://www.konferencja.clarkuni.eu/foto_oryginal.php?id_foto=' + id;
  window.open(plik, 'oryginal','toolbar=no,menubar=no,scrollbars,resizable, height=400,width=400');
}

function show(id,lang) {
nazwa = "button_"+id;
document[nazwa].src = "gfx/menu/" + lang + "_menu_1_" + id + ".jpg"; 
}

function hide(id,lang) {
nazwa = "button_"+id;
document[nazwa].src = "gfx/menu/" + lang + "_menu_0_" + id + ".jpg"; 
}

function checkform_sugestie (form){
if(form.uwagi.value==false) {
   alert("Proszę wpisać swoje uwagi lub sugestie!");
   return false;
}
}

function checkform_formularzmain (form){
if(form.imienazwisko.value==false) {
   alert("Proszę wpisać imię i nazwisko!");
   return false;
}
if(form.telefon.value==false) {
   alert("Proszę wpisać numer telefonu!");
   return false;
}
if (form.email.value=='') 
 {
   alert("Proszę wpisać adres e-mail!");
   return false;
 }
if(form.email.value!=''){
    var wzor_adres = /^([\w\.+_\-]+)@([\w\.\-_]+)\.([a-z]{2,6})$/; 
    var str_adres = form.email.value; 
    if(!(wzor_adres.test(str_adres))){
      alert('"' + str_adres + '" to nie jest poprawny adres e-mail!');
      return false;
    }
}
if(form.tresc.value==false) {
   alert("Proszę wpisać tresc wiadomości!");
   return false;
}
}

function checkform_rejestracja (form, lang){
function checkControlSum(str, weights, modulo, allow_high)
    {
        str = str.replace(/[^\d]/g,"");
        if(!str.length) return false;

        var nsize = str.length;
        var j = 0, sum = 0, control = 0;
        var csum = str.substring(nsize - 1);

        for (var i = 0; i < nsize - 1; i++)
        {
                j = parseInt(str.charAt(i));
                sum += j * weights[i];
        }
        if(sum == 0 || str.length < 9)
        {
            return false;
        }
        control = sum % modulo;

        if(allow_high == false) {
                control = 10 - control;
        }

        if (control == 10) {
            control = 0;
        }
        return control == csum;
    }

if(form.akceptacja.checked==false) {
   alert("Proszę wyrazić zgodę na przetwarzanie danych osobowych!");
   return false;
}
/*if (form.tytul.value=='0') 
 {
   alert("Proszę podać tytuł naukowy!");
   return false;
 }
if (form.imie.value=='') 
 {
   alert("Proszę podać swoje imię!");
   return false;
 }

if (form.nazwisko.value=='') 
 {
   alert("Proszę podać swoje nazwisko!");
   return false;
 }
if (form.organizacja.value=='') 
 {
   alert("Proszę podać nazwę uniwersytetu / organizacji!");
   return false;
 }
if(lang=='2'){
  if (form.miasto.value=='') 
  {
   alert("Proszę podać nazwę miasta!");
   return false;
  }
  if (form.kraj.value=='') 
  {
   alert("Proszę podać nazwę kraju!");
   return false;
  }
}
if (form.email.value=='') 
 {
   alert("Proszę podać adres e-mail!");
   return false;
 }
if(form.email.value!=''){
    var wzor_adres = /^([\w\.+_\-]+)@([\w\.\-_]+)\.([a-z]{2,6})$/; 
    var str_adres = form.email.value; 
    if(!(wzor_adres.test(str_adres))){
      alert('"' + str_adres + '" to nie jest poprawny adres e-mail!');
      return false;
    }
}

if (form.tel_sluzbowy.value=='') 
 {
   alert("Proszę podać numer telefonu służbowego!");
   return false;
 }
if (form.tel_prywatny.value=='') 
 {
   alert("Proszę podać numer telefonu prywatnego!");
   return false;
 }
 if (form.fax.value=='') 
 {
   alert("Proszę podać numer FAX!");
   return false;
 }
if(form.forma3.checked==false & form.forma2.checked==false & form.forma1.checked==false){
  alert("Proszę wybrac formę uczestnictwa w konferencji! ");
  return false;
}
 
if(form.forma3.checked==true || form.forma2.checked==true || form.forma1.checked==true){
 if(form.typosoby[0].checked==true){
    if (form.imienazwisko.value=='') 
    {
      alert("Proszę podać imię i nazwisko! ");
      return false;
    } 
    if (form.firmakod.value=='') 
    {
      alert("Proszę podać kod pocztowy i miasto! ");
      return false;
    }
    if(lang=='2'){
      if (form.firmakraj.value=='') 
      {
        alert("Proszę podać nazwę kraju! ");
        return false;
      }
    }
    if (form.firmaulica.value=='') 
    {
      alert("Proszę podać ulicę i numer domu! ");
      return false;
    }
 }
 else {
    if (form.firma.value=='') 
    {
      alert("Proszę podać nazwę firmy do faktury! ");
      return false;
    }
    if (form.imienazwisko.value=='') 
    {
      alert("Proszę podać imię i nazwisko! ");
      return false;
    } 
    if (form.firmakod.value=='') 
    {
      alert("Proszę podać kod pocztowy i miasto! ");
      return false;
    }
    if(lang=='2'){
      if (form.firmakraj.value=='') 
      {
        alert("Proszę podać nazwę kraju! ");
        return false;
      }
    }
    if (form.firmaulica.value=='') 
    {
      alert("Proszę podać ulicę i numer domu! ");
      return false;
    }
 
    var nip=form.nip.value;   
    var weights = [6,5,7,2,3,4,5,6,7];
    if( nip == null || !checkControlSum(nip, weights,11,true))
      {
        alert("Proszę podać poprawny NIP!");
        return false;
      }
    if(lang=='1'){
      var regon=form.regon.value;
      var weights = [8,9,2,3,4,5,6,7];
      if( regon == null || !checkControlSum(regon, weights,11,true))
        {
          alert("Proszę podać poprawny REGON!");
          return false;
        }
    }
 }
}*/
}

function checkform_abstrakty (form){

function checkControlSum(str, weights, modulo, allow_high)
    {
        str = str.replace(/[^\d]/g,"");
        if(!str.length) return false;

        var nsize = str.length;
        var j = 0, sum = 0, control = 0;
        var csum = str.substring(nsize - 1);

        for (var i = 0; i < nsize - 1; i++)
        {
                j = parseInt(str.charAt(i));
                sum += j * weights[i];
        }
        if(sum == 0 || str.length < 9)
        {
            return false;
        }
        control = sum % modulo;

        if(allow_high == false) {
                control = 10 - control;
        }

        if (control == 10) {
            control = 0;
        }
        return control == csum;
    }

if(form.akceptacja.checked==false) {
   alert("Proszę wyrazić zgodę na przetwarzanie danych osobowych!");
   return false;
}
/*if (form.tytul.value=='0') 
 {
   alert("Proszę podać tytuł naukowy!");
   return false;
 }
if (form.imie.value=='') 
 {
   alert("Proszę podać swoje imię!");
   return false;
 }

if (form.nazwisko.value=='') 
 {
   alert("Proszę podać swoje nazwisko!");
   return false;
 }
if (form.organizacja.value=='') 
 {
   alert("Proszę podać nazwę uniwersytetu / organizacji!");
   return false;
 }

if (form.email.value=='') 
 {
   alert("Proszę podać adres e-mail!");
   return false;
 }
if(form.email.value!=''){
    var wzor_adres = /^([\w\.+_\-]+)@([\w\.\-_]+)\.([a-z]{2,6})$/; 
    var str_adres = form.email.value; 
    if(!(wzor_adres.test(str_adres))){
      alert('"' + str_adres + '" to nie jest poprawny adres e-mail!');
      return false;
    }
}

if (form.tel_sluzbowy.value=='') {
   alert("Proszę podać numer telefonu służbowego!");
   return false;
}
if (form.tel_prywatny.value=='') {
   alert("Proszę podać numer telefonu prywatnego!");
   return false;
}
if (form.fax.value=='') {
   alert("Proszę podać numer FAX!");
   return false;
}
if (form.tytulpl.value=='') {
   alert("Proszę podać tytuł referatu po polsku!");
   return false;
}
if (form.tytuleng.value=='') {
   alert("Proszę podać tytuł referatu po angielsku!");
   return false;
}
if (form.jezykreferatu.value=='') {
   alert("Proszę podać język referatu!");
   return false;
}
if (form.jezykprezentacji.value=='') {
   alert("Proszę podać język prezentacji!");
   return false;
}
if (form.wspolautorzy.value=='') {
   alert("Proszę podać współautorów!");
   return false;
}
if (form.abstraktpolski.value=='') {
   alert("Proszę podać treść zgłaszanego abstraktu po polsku!");
   return false;
}
if(form.abstraktpolski.value.length>'1000'){
   alert("Abstrakt polski powinien zawierać nie więcej niż 1000 słów!");
   return false;
}
if (form.abstraktangielski.value=='') {
   alert("Proszę podać treść zgłaszanego abstraktu po angielsku!");
   return false;
}
if(form.abstraktangielski.value.length>'1000'){
   alert("Abstrakt angielski powinien zawierać nie więcej niż 1000 słów!");
   return false;
}*/
}

function wstawobiektflash(nazwa,szerokosc,wysokosc)
{
document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="'+szerokosc+'" height="'+wysokosc+'" id="testNaStr" align="middle">');
document.write('<param name="allowScriptAccess" value="sameDomain" />');
document.write('<param name="movie" value="'+nazwa+'" />');
document.write('<param name="quality" value="high" />');
document.write('<param name="wmode" value="opaque" />');
document.write('<param name="bgcolor" value="#ffffff" />');
document.write('<embed wmode="opaque" src="'+nazwa+'" quality="high" bgcolor="#ffffff" width="'+szerokosc+'" height="'+wysokosc+'" name="testNaStr" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
document.write('</object>');
}

