function hideSpamInput()
{
	if (document.getElementById('noSpam')) {
	var i = document.getElementById('noSpam');
	i.value = '3';
	var b = document.getElementById('noSpamBox');
	b.style.display = 'none';
	}
}

function preloadImages()
{
    if (document.images)
    {
      preload_image_object = new Image(100, 100);
      image_url = new Array();
      image_url[0] = "http://www.polytechna.eu/style/main-menu-item0-hover.jpg";
      image_url[1] = "http://www.polytechna.eu/style/main-menu-item1-hover.jpg";
      image_url[2] = "http://www.polytechna.eu/style/main-menu-item2-hover.jpg";
      image_url[3] = "http://www.polytechna.eu/style/main-menu-item3-hover.jpg";
      image_url[4] = "http://www.polytechna.eu/style/main-menu-item4-hover.jpg";
      image_url[5] = "http://www.polytechna.eu/style/top-menu-hover.jpg";
      image_url[6] = "http://www.polytechna.eu//lightbox/overlay.gif";

       var i = 0;
       for (i=0; i<=6; i++) { 
         	preload_image_object.src = image_url[i];
        }
    }
}


    function changeImg()
	{
	//alert(actual);
	
	var img;
	img = document.getElementById('sampleImage');
	img.src = sources[actual][0];
	a = document.getElementById('sampleImageA');
	aWidth = Number(sources[actual][1]) + 10;
	aHeight = Number(sources[actual][2]) + 10;
	a.style.width = aWidth + 'px';
	a.style.height = aHeight + 'px';
	img.setAttribute('width', sources[actual][1]);
	img.setAttribute('height', sources[actual][2]);
	
	actual++;
	if (actual == sources.length) {
		actual = 0;
	}
	
	}
	

function checkContactForm(frm) 
{
	var nonEmpty = new Array('company', 'name', 'email', 'subject', 'message', 'noSpam');
	var state = true;
    for (i = 0; i < nonEmpty.length; i++) {
    	var el = document.getElementById(nonEmpty[i]);
        if (el.value == '') {
        	
            el.setAttribute('class', 'error');
            //frm[nonEmpty[i]].class = 'error';
            el.style.background = '#ffcccc';
            state = false;
        }
    }
    return state;
}



/**
 * Neprázdná pole
 *
 * Ověří, zda jsou daná pole neprázdná.
 *
 * @param string frm formulář
 * @param array fields neprázdná pole
 */
function checkFields(frm, lang)
{
//povinne polozky: jmeno, prijmei,datum narozeni, Ulice, c.p, Mesto, PSC, mobil nebo telefon,
//  jeden email, jedna profese vcetne praxe a specifikce, zivotopis a samozrejme souhlas se zpracovanim
    var status = true;
    var fields = ["oZivotopisCJ", "oJmeno", "oPrijmeni", "oDatum", "oUlice", "oCP", "oMesto", "oPSC", "oEmail1", "oPraxe1", "oProfese1"];
    var oneOf = ["oMobil", "oTelefon"];
    for (i = 0; i < fields.length; i++) {
        if (frm[fields[i]].value  == '') {
            frm[fields[i]].style.background = '#ffaaaa';
            status = false;
        } else {
            frm[fields[i]].style.background = '#dee0ef';
        }
    }
    var oneOfStatus = false;
    for (i = 0; i < oneOf.length; i++) {
        if (frm[oneOf[i]].value != '') {
            oneOfStatus = true;
        }
    }
   
    for (i = 0; i < oneOf.length; i++) {
    	if (!oneOfStatus) {
            frm[oneOf[i]].style.background = '#ffaaaa';
            status = false;
        } else {
            frm[oneOf[i]].style.background = '#dee0ef';
        }
    }
    

    if (!status) {
    	if (lang == 'En') {
    		alert('Fill in all compulsory fields.');
    	} else {
        	alert('Vyplňte všechny povinné položky.');
        }
    }
    return status;
}


