var id = 0;
var krajProdukcji_max_id = 0;
var filmOperator_id = 0;
var filmRezyser_id = 0;
var filmProducent_id = 0;
var filmObsada_id = 0;
var filmScenariusz_id = 0;
var filmMontaz_id = 0;
var filmScenografia_id = 0;
var filmMuzyka_id = 0;
var filmFestiwal_id = 0;
var szkola_id = 0;
var filmOpiekun_id = 0;
var firmaProd_id = 0;
var firmaDystPl_id = 0;
var firmaDystPoza_id = 0;
firmaProdKontakt = new Array();
firmaDystPlKontakt = new Array();
firmaDystPozaKontakt = new Array();
szkolaKontakt = new Array();
firmaProdKontakt[0] = 0;
firmaDystPlKontakt[0] = 0;
firmaDystPozaKontakt[0] = 0;
szkolaKontakt[0] = 0;
function checkEmail(object)
{
if ( object.className != 'req' && object.className != 'bladreq' )
return;
allowcheck = /^.+@.+\..+$/;
if ( trim(object.value) == '' ) {
alert('Wymagane pole pozostało puste. Proszę wprowadzić poprawne dane.');
object.className = 'bladreq';
} else if ( !allowcheck.test(object.value)) {
object.className = 'bladreq';
alert('Wprowadzone dane są niepoprawne. Proszę sprawdzić dane i wprowadzić ponownie.');
} else {
object.className = 'req';
}
}
Array.prototype.inArray = function(v){
for(var i in this){
if(this[i] == v){
return true;}
}
return false;
}
function additionalInfoAlert() {
alert('Uwaga! Po wypełnieniu pól na dane jakiejkolwiek osoby, firmy czy festiwalu, istnieje możliwość wpisania danych kolejnej osoby (np. drugiego reżysera), firmy lub festiwalu.');
}
function checkName(e) {
var KeyID = (window.event) ? event.keyCode : e.keyCode;
notAllowed = new Array (32, 44, 47, 55, 59, 186, 188);
if(notAllowed.inArray(KeyID) ){
additionalInfoAlert();
}
}
function checkRunningTime(object)
{
allowcheck = /^[0-9]{1,3}[,\.]{0,1}[0-9]{0,1}$/;
if ( !allowcheck.test(object.value)) {
object.className = 'bladreq';
alert('Sprawdź poprawność wprowadzonych danych');
} else {
object.className = 'req';
}
}
function checkShow( inputsContainer, showId, onlyReq ) {
showId = document.getElementById(showId);
showId.style.display="";
inputsContainer = document.getElementById(inputsContainer);
var lista = inputsContainer.getElementsByTagName('input');
for( i = 0; i < lista.length; i++ ) {
if ( onlyReq && lista[i].className == 'req' && lista[i].value == '' ) {
showId.style.display="none";
return;
} else if ( !onlyReq && lista[i].value == '' ){
showId.style.display="none";
return;
}
}
showId.style.display="";
}
function potwierdz(submitId)
{
var potwierdzono = true;
var a = arguments;
for ( i = 1; i < a.length; i++ ){
var checkbox = document.getElementById(a[i]);
if ( !checkbox.checked ) {
potwierdzono = false;
}
}
var submit = document.getElementById(submitId);
if ( potwierdzono ) {
submit.disabled=false;
} else {
submit.disabled=true;
}
}
function ustawPole( select, pole )
{
var s = document.getElementById(select);
var wartosc = s.value;
var p = document.getElementById(pole);
if ( wartosc == "inny" || wartosc == "Inny" || wartosc == "other" || wartosc == "Other" ) {
p.style.display="";
if ( s.id.indexOf('Festiwal') != -1 ) {
p.className = "req";
p.style.color='gray';
p.value= 'Wpisz nazwę festiwalu';
} else if ( s.id.indexOf('jezykOryginalny') != -1 ) {
p.style.color='gray';
p.value= 'Wpisz język';
}else if ( s.id.indexOf('szkola') != -1 ) {
p.className = "req";
p.style.color='gray';
p.value= 'Wpisz nazwę szkoły';
} else {
p.value= '';
}
} else {
if ( s.id.indexOf('Festiwal') != -1 ) {
p.className = "text";
}
p.value = wartosc;
p.style.display="none";
}
}
function usunDomyslnyWpis ( object, wpis )
{
obj = document.getElementById(object);
if ( obj.value == wpis ) {
obj.value = '';
obj.style.color = '';
}
}
function nieDotyczy( poleBlokowane, checkbox, nieDotyczyInfo )
{
kalendarz = document.getElementById(poleBlokowane + 'Kalendarz');
object = document.getElementById(checkbox);
poleTxt = document.getElementById(poleBlokowane);
if ( object.checked ) {
poleTxt.readOnly=true;
poleTxt.value=nieDotyczyInfo;
poleTxt.style.backgroundColor='#dddddd';
if ( kalendarz ) {
kalendarz.style.display='none';
poleTxt.style.color='#dddddd';
poleTxt.value='0000.00.00';
}
} else {
poleTxt.readOnly=false;
poleTxt.value='';
poleTxt.style.backgroundColor='';
if ( kalendarz ) {
kalendarz.style.display='inline';
poleTxt.readOnly=true;
poleTxt.style.color='';
}
}
}
function usunChild(parent, child)
{
if (id = document.getElementById(child)) {
document.getElementById(parent).removeChild(id);
}
}
function dodajKraj(parentId, childGroupArrayId, childIndexArrayId )
{
var id = childGroupArrayId + '[' + childIndexArrayId + ']';
if (!document.getElementById(id)) {
var div = document.createElement('div');
div.setAttribute('id', id);
document.getElementById(parentId).appendChild(div);
var kraj = document.createElement('input');
kraj.setAttribute('type', 'text');
kraj.setAttribute('class', 'text');
kraj.className = 'text';
kraj.setAttribute('style', 'margin-top:5px;');
kraj.setAttribute('name', id)
document.getElementById(id).appendChild(kraj);
var del = document.createElement('a');
del.setAttribute('href','javascript:usunChild("' + parentId + '", "' + div.id + '");');
del.innerHTML = ' [Usuń]';
document.getElementById(id).appendChild(del);
}
}
function trim(str) {
return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
}
function validForm()
{
var poprawny = true;
lista = document.getElementsByTagName('input');
for(i = 0; i < lista.length; i++) {
if ( lista[i].className == 'req' || lista[i].className == 'bladreq' ) {
if ( trim(lista[i].value) == ''
|| lista[i].value == 'Wpisz język'
|| lista[i].value == 'Type in a language'
|| lista[i].value == 'Wpisz nazwę festiwalu'
|| lista[i].value == 'Type in a festival name'
|| lista[i].value == 'Wpisz nazwę szkoły'
|| lista[i].value == 'Type in a shool name'
) {
lista[i].className = 'bladreq';
poprawny = false;
} else if ( lista[i].name.indexOf('mail') != -1 ) {
allowcheck = /^.+@.+\..+$/;
if ( !allowcheck.test(lista[i].value) ) {
lista[i].className = 'bladreq';
poprawny = false;
} else {
lista[i].className = 'req';
}
} else if ( lista[i].name.indexOf('[Czas]') != -1 ) {
// alert(lista[i].name);
allowcheck = /^[0-9]{1,3}[,\.]{0,1}[0-9]{0,1}$/;
if ( !allowcheck.test(lista[i].value) ) {
lista[i].className = 'bladreq';
poprawny = false;
} else {
lista[i].className = 'req';
}
} else {
lista[i].className = 'req';
}
}
}
lista = document.getElementsByTagName('textarea');
for(i = 0; i < lista.length; i++) {
if ( lista[i].className == 'req' ) {
if ( lista[i].value == '' ) {
lista[i].className = 'bladreq';
poprawny = false;
} else {
lista[i].className = 'req';
}
}
}
lista = document.getElementsByTagName('select');
for(i = 0; i < lista.length; i++) {
if ( lista[i].className == 'req' || lista[i].className == 'bladreq' ) {
if ( lista[i].value == '-------' || lista[i].value == '' ) {
var spanId = lista[i].name + '_span';
span = document.getElementById(spanId);
if (span){
span.className = 'selectblad';
}
poprawny = false;
} else {
lista[i].className = 'req';
var spanId = lista[i].name + '_span';
span = document.getElementById(spanId);
if (span){
span.className = 'select';
}
}
}
}
return poprawny;
}
function sprawdzDodajSzczegoly ( nazwa )
{
var imieVal = document.getElementById(nazwa + 'Imie').value;
var nazVal = document.getElementById(nazwa + 'Nazwisko').value;
var email = document.getElementById(nazwa + 'Email');
if (email) {
emailVal = email.value;
} else {
emailVal = ' ';
}
if ( nazVal != '' && imieVal != '' && emailVal != '' ) {
szczegoly = document.getElementById(nazwa + 'Szczegoly');
if (szczegoly){
szczegoly.style.display = '';
return true;
}
}
return false;
}
function show (id) {
ob = document.getElementById(id);
if ( ob ) {
ob.style.display='';
}
}
function utworzTabele(container, id, grupa, nazwaGrupy, opcja_wymagane, stanowisko){
/*
opcja_wymagane = 2
- imie
- nazwisko
- telefon
- email
*/
if ( stanowisko == 1 ) {
var stanowiskoStr = '
' +
'
Stanowisko:
' +
'
'+
'
';
} else {
var stanowiskoStr = '';
}
if ( nazwaGrupy != 'Obsada' && nazwaGrupy != 'Cast' && nazwaGrupy != 0 ){
var nazwaGrupyStr = '
' +
'
' + nazwaGrupy + '
' +
'
'+
'
';
} else {
var nazwaGrupyStr = '';
}
var div = document.createElement('div');
div.setAttribute('id', grupa + '_' + id)
document.getElementById(container).appendChild(div);
var str = '