﻿$(document).ready(function() {
  
 //deklaracja formularza
	
var dialog = document.createElement('div');
	dialog.setAttribute('id', 'dialog');
	
var formul = document.createElement('form');
	formul.setAttribute('id', 'formul');
	formul.setAttribute('name', 'formularz');
	formul.setAttribute('method', 'post');
	formul.setAttribute('action', 'email.php');
	
	
var fieldset = document.createElement('fieldset');
		
var labelnazwa = document.createElement('label');
	labelnazwa.setAttribute('for', 'nazwa');
	labelnazwa.innerHTML="Imię i nazwisko:";
	
var inputnazwa = document.createElement('input');
	inputnazwa.setAttribute('type', 'text');
	inputnazwa.setAttribute('id', 'nazwa');
	inputnazwa.setAttribute('name', 'nazwa');

var labelmiasto = document.createElement('label');
	labelmiasto.setAttribute('for', 'miasto');
	labelmiasto.innerHTML="Miasto:";
	
var inputmiasto = document.createElement('input');
	inputmiasto.setAttribute('type', 'text');
	inputmiasto.setAttribute('id', 'miasto');
	inputmiasto.setAttribute('name', 'miasto');
	
var labeladres = document.createElement('label');
	labeladres.setAttribute('for', 'adres');
	labeladres.innerHTML="Adres e-mail:";
	
var inputadres = document.createElement('input');
	inputadres.setAttribute('type', 'text');
	inputadres.setAttribute('id', 'adres');
	inputadres.setAttribute('name', 'adres');

var labeltelefon = document.createElement('label');
	labeltelefon.setAttribute('for', 'telefon');
	labeltelefon.innerHTML="Telefon:";
	
var inputtelefon = document.createElement('input');
	inputtelefon.setAttribute('type', 'text');
	inputtelefon.setAttribute('id', 'telefon');
	inputtelefon.setAttribute('name', 'telefon');

var labelopis = document.createElement('label');
	labelopis.setAttribute('for', 'opis');
	labelopis.innerHTML="Opis zdarzenia:";
	
var textarea = document.createElement('textarea');
	textarea.setAttribute('name', 'opis');
	textarea.setAttribute('rows', '5');
	textarea.setAttribute('cols', '50');
	textarea.setAttribute('id', 'opis');
	textarea.setAttribute('width', '100');
	textarea.setAttribute('height', '20');
	
var submit = document.createElement('input');
	submit.setAttribute('type', 'submit');
	submit.setAttribute('value', 'wyślij');
	submit.setAttribute('id', 'submit');
	
var labelosw1 = document.createElement('label');
	labelosw1.setAttribute('for', 'osw1');
	labelosw1.setAttribute('id', 'labelosw1');
	labelosw1.innerHTML="Użytkownik sporządzający formularz oświadcza, że jest użytkownikiem lub właścicielem wskazego telefonu i poczty mailowej";
	
var inputosw1 = document.createElement('input');
	inputosw1.setAttribute('type', 'checkbox');
	inputosw1.setAttribute('value', 'tak');
	inputosw1.setAttribute('id', 'osw1');
	inputosw1.setAttribute('name', 'osw1');
	
var labelosw2 = document.createElement('label');
	labelosw2.setAttribute('for', 'osw2');
	labelosw2.setAttribute('id', 'labelosw2');
	labelosw2.innerHTML="Użytkownik wyraża zgodę na wykorzystywanie wskazanego telefonu/adresu mailowego dla celów informacyjnych o usługach Mediator sp.j.";
	
var inputosw2 = document.createElement('input');
	inputosw2.setAttribute('type', 'checkbox');
	inputosw2.setAttribute('value', 'tak');
	inputosw2.setAttribute('id', 'osw2');
	inputosw2.setAttribute('name', 'osw2');

var oswdiv1 = document.createElement('div');
	oswdiv1.setAttribute('class', 'oswdiv');
	oswdiv1.setAttribute('id', 'oswdiv1');
	
var oswdiv2 = document.createElement('div');
	oswdiv2.setAttribute('class', 'oswdiv');
	oswdiv2.setAttribute('id', 'oswdiv2');
	

//ustawienie formularza	- dodawanie kolejnych pól

$('body').append(dialog);
$('#dialog').append(formul);
$('#formul').append(fieldset);
$('fieldset').append(labelnazwa);
$('fieldset').append(inputnazwa);
$('fieldset').append(labelmiasto);
$('fieldset').append(inputmiasto);
$('fieldset').append(labeladres);
$('fieldset').append(inputadres);
$('fieldset').append(labeltelefon);
$('fieldset').append(inputtelefon);
$('fieldset').append(labelopis);
$('fieldset').append(textarea);
$('fieldset').append(oswdiv1);
$('#oswdiv1').append(labelosw1);
$('#oswdiv1').append(inputosw1);
$('fieldset').append(oswdiv2);
$('#oswdiv2').append(labelosw2);
$('#oswdiv2').append(inputosw2);

$('fieldset').append(submit);
  
    
});




