

//zmena obrazku
function zmena_obr(objImage){
	var strPics=objImage.attributes["alt"];
		if (!strPics)
		return false;
		
	var curPic=objImage.attributes["title"];
		if (!curPic)
		return false;
			
		strPics=objImage.attributes["alt"].value;
		curPic=objImage.attributes["title"].value;
		curPic=(curPic)*(-1)*(-1);
	
	var arrPics=strPics.split(",");
		curPic = ((curPic+1) % arrPics.length);
		objImage.src = arrPics[curPic];
		objImage.attributes["title"].value = (curPic+"");
}

//skryty
function ukaz(id){
var lajer =  document.getElementById(id)

if (lajer.style.display != 'none')
	lajer.style.display = 'none';
else
	lajer.style.display = 'block';
}

function ukaz2(id){
var lajer =  document.getElementById(id)
if (lajer.style.display == 'none')
	lajer.style.display = 'block';
else
	lajer.style.display = 'none';
}

function ukaz3(id){
var lajer =  document.getElementById(id)
if (lajer.style.display != 'none')
	lajer.style.display = 'none';
else
	lajer.style.display = 'block';
}

// check data
function isblank(co){
	for (var i=0; i < co.length; i++)
	{
		var c=co.charAt(i);
   		if ((c != ' ') && (c != '\n') && (c != '\t')) return false;
	}
	return true;
}

function kontrola_uziv(){
	if ((document.forms.uziv.uziv_jmeno.value == "") || (isblank(document.forms.uziv.uziv_jmeno.value))) {
		alert("Není vyplněné jméno uživatele.");
		document.forms.uziv.uziv_jmeno.focus();
		return false;
	};
	if ((document.forms.uziv.uziv_kontakt.value == "") || (isblank(document.forms.uziv.uziv_kontakt.value))) {
		alert("Není vyplněný kontakt.");
		document.forms.uziv.uziv_kontakt.focus();
		return false;
	};
	if ((document.forms.uziv.uziv_login.value == "") || (isblank(document.forms.uziv.uziv_login.value))) {
		alert("Není vyplněný login.");
		document.forms.uziv.uziv_login.focus();
		return false;
	};
	if ((document.forms.uziv.uziv_heslo.value == "") || (isblank(document.forms.uziv.uziv_heslo.value))) {
		alert("Není vyplněné heslo.");
		document.forms.uziv.uziv_heslo.focus();
		return false;
	};
	if ((document.forms.uziv.uziv_heslo2.value == "") || (isblank(document.forms.uziv.uziv_heslo2.value))) {
		alert("Není vyplněné heslo znovu (pro kontrolu).");
		document.forms.uziv.uziv_heslo2.focus();
		return false;
	};
	if (document.forms.uziv.uziv_heslo.value != document.forms.uziv.uziv_heslo2.value) {
		alert("Heslo a heslo znovu se neshodují.");
		document.forms.uziv.uziv_heslo.focus();
		return false;
	};
}

function kontrola_ukol(){
	if ((document.forms.ukol.ukol_datumod.value == "") || (isblank(document.forms.ukol.ukol_datumod.value))) {
		alert("Není zadaný datum - začátek.");
		return false;
	};
	if ((document.forms.ukol.ukol_casod.value == "") || (isblank(document.forms.ukol.ukol_casod.value))) {
		alert("Není zadaný čas - začátek.");
		document.forms.ukol.ukol_casod.focus();
		return false;
	};
	if ((document.forms.ukol.ukol_nadpis.value == "") || (isblank(document.forms.ukol.ukol_nadpis.value))) {
		alert("Není zadaný nadpis úkolu.");
		document.forms.ukol.ukol_nadpis.focus();
		return false;
	};
	if ((document.forms.ukol.ukol_text.value == "") || (isblank(document.forms.ukol.ukol_text.value))) {
		alert("Není zadaný text úkolu.");
		document.forms.ukol.ukol_text.focus();
		return false;
	};
}

function kontrolaPozice(){
	if ((document.forms.pozice.pozice_name.value == "") || (isblank(document.forms.pozice.pozice_name.value))) {
		alert("Není zadaný název pozice.");
		document.forms.pozice.pozice_name.focus();
		return false;
	};
}

function kontrola_doc(){
	if ((document.forms.sablona.sablona_nazev.value == "") || (isblank(document.forms.sablona.sablona_nazev.value))) {
		alert("Není zadaný název dokumentu.");
		document.forms.sablona.sablona_nazev.focus();
		return false;
	};
	if ((document.forms.sablona.sablona.value == "") || (isblank(document.forms.sablona.sablona.value))) {
		alert("Není vložený žádný dokument.");
		document.forms.sablona.sablona.focus();
		return false;
	};
}

function kontrola_alert(){
	if ((document.forms.alert.alert_datum.value == "") || (isblank(document.forms.alert.alert_datum.value))) {
		alert("Není zadané datum.");
		return false;
	};
	if (document.forms.alert.uzivatele.value == 0) {
		alert("Není vybraný žádný uživatel.");
		document.forms.alert.uzivatele.focus();
		return false;
	};
	if ((document.forms.alert.alert_poznamka.value == "") || (isblank(document.forms.alert.alert_poznamka.value))) {
		alert("Není vložena žádná poznámka.");
		document.forms.alert.alert_poznamka.focus();
		return false;
	};
}

function kontrola_pozn(){
	if ((document.forms.poznamka.pozn_datum.value == "") || (isblank(document.forms.poznamka.pozn_datum.value))) {
		alert("Není zadané datum.");
		return false;
	};
	if ((document.forms.poznamka.pozn_poznamka.value == "") || (isblank(document.forms.poznamka.pozn_poznamka.value))) {
		alert("Není vložena žádná poznámka.");
		document.forms.poznamka.pozn_poznamka.focus();
		return false;
	};
}

function kontrola_doc2(){
	if ((document.forms.sablona.sablona_nazev.value == "") || (isblank(document.forms.sablona.sablona_nazev.value))) {
		alert("Není zadaný název dokumentu.");
		document.forms.sablona.sablona_nazev.focus();
		return false;
	};
}

function kontrola_dotaz(){
	if ((document.forms.dotaz.dotaz_text.value == "") || (isblank(document.forms.dotaz.dotaz_text.value))) {
		alert("Není zadaný žádný text.");
		document.forms.dotaz.dotaz_text.focus();
		return false;
	};
}

function kontrola_partdoc(){
	if ((document.forms.partdoc.partdoc_nazev.value == "") || (isblank(document.forms.partdoc.partdoc_nazev.value))) {
		alert("Není zadaný název dokumentu.");
		document.forms.partdoc.partdoc_nazev.focus();
		return false;
	};
	if ((document.forms.partdoc.partdoc.value == "") || (isblank(document.forms.partdoc.partdoc.value))) {
		alert("Není zadaný žádný dokumentu.");
		document.forms.partdoc.partdoc.focus();
		return false;
	};
}

function kontrola_kandoc(){
	if ((document.forms.kandoc.kandoc_nazev.value == "") || (isblank(document.forms.kandoc.kandoc_nazev.value))) {
		alert("Není zadaný název dokumentu.");
		document.forms.kandoc.kandoc_nazev.focus();
		return false;
	};
	if ((document.forms.kandoc.kandoc.value == "") || (isblank(document.forms.kandoc.kandoc.value))) {
		alert("Není zadaný žádný dokumentu.");
		document.forms.kandoc.kandoc.focus();
		return false;
	};
}

function kontrola_kandoc2(){
	if ((document.forms.kandoc.kandoc_nazev.value == "") || (isblank(document.forms.kandoc.kandoc_nazev.value))) {
		alert("Není zadaný název dokumentu.");
		document.forms.kandoc.kandoc_nazev.focus();
		return false;
	};
}

function kontrola_partner(){

phone=/[0-9]{9}/
phone2=/[0-9]{9}/
ic2=/[0-9]{9}/

	if ((document.forms.partner.part_nazev.value == "") || (isblank(document.forms.partner.part_nazev.value))) {
		alert("Není zadaný název partnera.");
		document.forms.partner.part_nazev.focus();
		return false;
	};
	if ((document.forms.partner.part_ulice.value == "") || (isblank(document.forms.partner.part_ulice.value))) {
		alert("Není zadaná ulice partnera.");
		document.forms.partner.part_ulice.focus();
		return false;
	};
	if ((document.forms.partner.part_mesto.value == "") || (isblank(document.forms.partner.part_mesto.value))) {
		alert("Není zadané město partnera.");
		document.forms.partner.part_mesto.focus();
		return false;
	};
	if ((document.forms.partner.part_psc.value == "") || (isblank(document.forms.partner.part_psc.value))) {
		alert("Není zadané psč partnera.");
		document.forms.partner.part_psc.focus();
		return false;
	};
	if ((document.forms.partner.part_ic.value == "") || (isblank(document.forms.partner.part_ic.value))) {
		alert("Není zadané IČ partnera.");
		document.forms.partner.part_ic.focus();
		return false;
	};

	if((document.forms.regform.part_mobil.value) && (false==phone2.test(document.forms.regform.part_mobil.value))){
        alert("Vyplňte prosím mobil v požadovaném formátu (např. 777123456).");
		    document.forms.regform.part_mobil.focus();
		    return false;
	};

	if((document.forms.regform.part_telefon.value) && (false==phone2.test(document.forms.regform.part_telefon.value))){
		    alert("Vyplňte prosím telefon v požadovaném formátu (např. 553123456).");
		    document.forms.regform.part_telefon.focus();
		    return false;
	};

	if((document.forms.regform.part_ic.value) && (false==ic.test(document.forms.regform.part_ic.value))){
		    alert("Vyplňte prosím ic v požadovaném formátu (např. 553123456).");
		    document.forms.regform.part_ic.focus();
		    return false;
	};

}

function kontrola_pozice(){
	if ((document.forms.pozice.pozice_nazev.value == "") || (isblank(document.forms.pozice.pozice_nazev.value))) {
		alert("Není zadaný název pozice.");
		document.forms.pozice.pozice_nazev.focus();
		return false;
	};
	if ((document.forms.pozice.pozice_pozadujeme.value == "") || (isblank(document.forms.pozice.pozice_pozadujeme.value))) {
		alert("Není vyplněno \"požadujeme\".");
		document.forms.pozice.pozice_pozadujeme.focus();
		return false;
	};
	if ((document.forms.pozice.pozice_nabizime.value == "") || (isblank(document.forms.pozice.pozice_nabizime.value))) {
		alert("Není vyplněno \"nabízíme\".");
		document.forms.pozice.pozice_nabizime.focus();
		return false;
	};
	if(document.forms.pozice.zapati.value == 0){
		alert("Není vybrané žádné zápatí.");
		return false;
	};
	if((document.forms.pozice.pozice_vlozeno.value == "") || (isblank(document.forms.pozice.pozice_vlozeno.value))) {
		alert("Není vyplněno datum vložení.");
		document.forms.pozice.pozice_vlozeno.focus();
		return false;
	};
}

function kontrola_poptavka(){
	if ((document.forms.poptavka.popt_pozice.value == "") || (isblank(document.forms.poptavka.popt_pozice.value))) {
		alert("Není vyplněná pozice.");
		document.forms.poptavka.popt_pozice.focus();
		return false;
	};
	if ((document.forms.poptavka.typ_vzdelani.value == "") || (isblank(document.forms.poptavka.typ_vzdelani.value))) {
		alert("Není vybrané žádný stupeň vzdělání.");
		document.forms.poptavka.typ_vzdelani.focus();
		return false;
	};
	if ((document.forms.poptavka.dhtmlgoodies_praxe11.value == "") || (isblank(document.forms.poptavka.dhtmlgoodies_praxe11.value))) {
		alert("Není vybrané žádný obor u praxe.");
		document.forms.poptavka.dhtmlgoodies_praxe11.focus();
		return false;
	};
	if ((document.forms.poptavka.delka_praxe.value == "") || (isblank(document.forms.poptavka.delka_praxe.value))) {
		alert("Není vybrané délka praxe.");
		document.forms.poptavka.delka_praxe.focus();
		return false;
	};
	if ((document.forms.poptavka.dhtmlgoodies11.value == "") || (isblank(document.forms.poptavka.dhtmlgoodies11.value))) {
		alert("Není vybraná žádná pozice u praxe.");
		document.forms.poptavka.dhtmlgoodies11.focus();
		return false;
	};
	if ((document.forms.poptavka.popt_honorar.value == "") || (isblank(document.forms.poptavka.popt_honorar.value))) {
		alert("Není vyplněný honorář.");
		document.forms.poptavka.popt_honorar.focus();
		return false;
	};
	if ((document.forms.poptavka.popt_pocet.value == "") || (isblank(document.forms.poptavka.popt_pocet.value))) {
		alert("Není vyplněný počet uchazečů.");
		document.forms.poptavka.popt_pocet.focus();
		return false;
	};
	if ((document.forms.poptavka.popt_od.value == "") || (isblank(document.forms.poptavka.popt_od.value))) {
		alert("Není vyplněný začátek platnosti poptávky.");
		return false;
	};
	
}

function kontrola_schuzka(){
	if (document.forms.schuzka.partner_sel.value == 0){
		alert("Není vybraný žádný partner.");
		document.forms.schuzka.partner_sel.focus();
		return false;
	};
	if ((document.forms.schuzka.schuzka_datum.value == "") || (isblank(document.forms.schuzka.schuzka_datum.value))) {
		alert("Není vyplněný datum schůzky.");
		document.forms.schuzka.schuzka_datum.focus();
		return false;
	};	
}

function kontrola_pozadavek(){
	if ((document.forms.pozadavek.pozad_pozice.value == "") || (isblank(document.forms.pozadavek.pozad_pozice.value))) {
		alert("Není zadaná pozice požadavku.");
		document.forms.pozadavek.pozad_pozice.focus();
		return false;
	};
	if ((document.forms.pozadavek.pozad_platod.value == "") || (isblank(document.forms.pozadavek.pozad_platod.value))) {
		alert("Není zadaný žádný plat od.");
		document.forms.pozadavek.pozad_platod.focus();
		return false;
	};
}

function kontrola_pozadavek2(){
	
	if ((document.forms.pozadavek2.partner_sel.value == 0) || (isblank(document.forms.pozadavek2.partner_sel.value))) {
		alert("Není vybraná firma.");
		document.forms.pozadavek2.partner_sel.focus();
		return false;
	};
	if ((document.forms.pozadavek2.pozad2_pozice.value == "") || (isblank(document.forms.pozadavek2.pozad2_pozice.value))) {
		alert("Není zadaná žádná pozice.");
		document.forms.pozadavek2.pozad2_pozice.focus();
		return false;
	};
}

function kontrola_foto(){
	if(document.forms.foto_nastav.foto_smazat.checked == false){
		if ((document.forms.foto_nastav.fotka.value == "") || (isblank(document.forms.foto_nastav.fotka.value))) {
			alert("Není vložena žádná fotografie.");
			document.forms.foto_nastav.fotka.focus();
			return false;
		};
	}
}

function kontrola_kandidat(){

phone=/[0-9]{9}/
phone2=/[0-9]{9}/

	if(false==document.forms.regform.kan_jmeno.value){
		    alert("Vyplňte prosím jméno.");
		    document.forms.regform.kan_jmeno.focus();
		    return false;
	};

	if(false==document.forms.regform.kan_prijmeni.value){
		    alert("Vyplňte prosím přijmení.");
		    document.forms.regform.kan_prijmeni.focus();
		    return false;
	};

/*
	if(false==document.forms.regform.kan_narozeni.value){
		    alert("Vyplňte prosím datum narození.");
		    document.forms.regform.kan_narozeni.focus();
		    return false;
	};

	if(false==document.forms.regform.kan_email.value){
		    alert("Vyplňte prosím email.");
		    document.forms.regform.kan_email.focus();
		    return false;
	};

	if(false==document.forms.regform.kan_mobil.value){
		    alert("Vyplňte prosím mobil.");
		    document.forms.regform.kan_mobil.focus();
		    return false;
	};
*/

	if(false==document.forms.regform.agree.checked){
		    alert("Podtvrďte prosím souhlas s prohlášením.");
		    document.forms.regform.agree.focus();
		    return false;
	};

	if((document.forms.regform.kan_mobil.value) && (false==phone2.test(document.forms.regform.kan_mobil.value))){
        alert("Vyplňte prosím mobil v požadovaném formátu (např. 777123456).");
		    document.forms.regform.kan_mobil.focus();
		    return false;
	};

	if((document.forms.regform.kan_telefon.value) && (false==phone2.test(document.forms.regform.kan_telefon.value))){
		    alert("Vyplňte prosím telefon v požadovaném formátu (např. 553123456).");
		    document.forms.regform.kan_telefon.focus();
		    return false;
	};

	if((document.forms.regform.kan_telefon.value != "") || (!isblank(document.forms.regform.kan_telefon.value))){
		
		var myVal = parseInt(document.forms.regform.kan_telefon.value);
		if (isNaN(myVal)){
		    alert("Telefonní číslo má špatný formát.");
		    document.forms.regform.kan_telefon.focus();
		    return false;
		}
	};

	if((document.forms.regform.kan_telefon.value != "") || (!isblank(document.forms.regform.kan_telefon.value))){
		
		var myVal = parseInt(document.forms.regform.kan_telefon.value);
		if (isNaN(myVal)){
		    alert("Telefonní číslo má špatný formát.");
		    document.forms.regform.kan_telefon.focus();
		    return false;
		}
	};
	if((document.forms.regform.kan_mobil.value != "") || (!isblank(document.forms.regform.kan_mobil.value))){
		var myVal2 = parseInt(document.forms.regform.kan_mobil.value);
		if (isNaN(myVal2)){
		    alert("Telefoní číslo má špatný formát.");
		    document.forms.regform.kan_mobil.focus();
		    return false;
		}
	};
}


function kontrola_kandidat2(){


phone=/[0-9]{9}/
phone2=/[0-9]{9}/



	if(false==document.forms.regform.kan_jmeno.value){
		    alert("Vyplňte prosím jméno.");
		    document.forms.regform.kan_jmeno.focus();
		    return false;
	};

	if(false==document.forms.regform.kan_prijmeni.value){
		    alert("Vyplňte prosím přijmení.");
		    document.forms.regform.kan_prijmeni.focus();
		    return false;
	};


	if(false==document.forms.regform.kan_narozeni.value){
		    alert("Vyplňte prosím datum narození.");
		    document.forms.regform.kan_narozeni.focus();
		    return false;
	};

	if(false==document.forms.regform.kan_email.value){
		    alert("Vyplňte prosím email.");
		    document.forms.regform.kan_email.focus();
		    return false;
	};

	if(false==phone.test(document.forms.regform.kan_mobil.value)){
		    alert("Vyplňte prosím mobil v požadovaném formátu (např. 777123456).");
		    document.forms.regform.kan_mobil.focus();
		    return false;
	};

	if((document.forms.regform.kan_telefon.value) && (false==phone2.test(document.forms.regform.kan_telefon.value))){
		    alert("Vyplňte prosím telefon v požadovaném formátu (např. 553123456).");
		    document.forms.regform.kan_telefon.focus();
		    return false;
	};

	if(false==document.forms.regform.dhtmlgoodies_city.value)
  {
		    alert("Vyplňte prosím dosažené vzdělání");
		    document.forms.regform.dhtmlgoodies_city.focus();
		    return false;
	};

	if(false==document.getElementById('cv1').value){
		    alert("Vložte prosím životopis.");
		    document.getElementById('cv1').focus();
		    return false;
	};

	
	if(false==document.forms.regform.agree.checked){
		    alert("Podtvrďte prosím souhlas s prohlášením.");
		    document.forms.regform.agree.focus();
		    return false;
	};

/*
	if((document.forms.regform.kan_telefon.value != "") || (!isblank(document.forms.regform.kan_telefon.value))){
		
		var myVal = parseInt(document.forms.regform.kan_telefon.value);
		if (isNaN(myVal)){
		    alert("Telefoní číslo má špatný formát.");
		    document.forms.regform.kan_telefon.focus();
		    return false;
		}
	};

	if((document.forms.regform.kan_telefon.value != "") || (!isblank(document.forms.regform.kan_telefon.value))){
		
		var myVal = parseInt(document.forms.regform.kan_telefon.value);
		if (isNaN(myVal)){
		    alert("Telefoní číslo má špatný formát.");
		    document.forms.regform.kan_telefon.focus();
		    return false;
		}
	};
	if((document.forms.regform.kan_mobil.value != "") || (!isblank(document.forms.regform.kan_mobil.value))){
		var myVal2 = parseInt(document.forms.regform.kan_mobil.value);
		if (isNaN(myVal2)){
		    alert("Telefoní číslo má špatný formát.");
		    document.forms.regform.kan_mobil.focus();
		    return false;
		}
	};
*/
}

function kontrola_sms(){
	if ((document.forms.sms.odeslat_hodina.value == "") || (isblank(document.forms.sms.odeslat_hodina.value))) {
		alert("Není zadaná hodina odeslání zprávy.");
		document.forms.sms.odeslat_hodina.focus();
		return false;
	};
	if ((document.forms.sms.odeslat_minuta.value == "") || (isblank(document.forms.sms.odeslat_minuta.value))) {
		alert("Není zadaná minuta odeslání zprávy.");
		document.forms.sms.odeslat_minuta.focus();
		return false;
	};
	if ((document.forms.sms.sms_text.value == "") || (isblank(document.forms.sms.sms_text.value))) {
		alert("Není napsaný žádný text.");
		document.forms.sms.sms_text.focus();
		return false;
	};
	if(document.forms.sms.sms_text.value.length > 160){
		alert("Napsaný text je delsi jak 160 znaků, bude odeslaný ve více zprávách.");
	}
}

function kontrola_sms2(){
	if ((document.forms.myForm.odeslat_hodina.value == "") || (isblank(document.forms.myForm.odeslat_hodina.value))) {
		alert("Není zadaná hodina odeslání zprávy.");
		document.forms.myForm.odeslat_hodina.focus();
		return false;
	};
	if ((document.forms.myForm.odeslat_minuta.value == "") || (isblank(document.forms.myForm.odeslat_minuta.value))) {
		alert("Není zadaná minuta odeslání zprávy.");
		document.forms.myForm.odeslat_minuta.focus();
		return false;
	};
	if ((document.forms.myForm.sms_text.value == "") || (isblank(document.forms.myForm.sms_text.value))) {
		alert("Není napsaný žádný text.");
		document.forms.myForm.sms_text.focus();
		return false;
	};
	if ((document.forms.myForm.goals.value == "") || (isblank(document.forms.myForm.goals.value))) {
		alert("Není vložený žádný příjemce.");
		document.forms.myForm.goals.focus();
		return false;
	};
}

function kontrola_stat(){
	if ((document.forms.statistika.uzivatele.value == "0") || (isblank(document.forms.statistika.uzivatele.value))) {
		alert("Není vybraný zádný kontakt.");
		document.forms.statistika.uzivatele.focus();
		return false;
	};
	
	if (document.forms.statistika.stat_od.value != ""){
		if ((document.forms.statistika.stat_do.value == "0") || (isblank(document.forms.statistika.stat_do.value))) {
			alert("Není zadané kompletní časové období (od - do).");
			document.forms.statistika.stat_do.focus();
			return false;
		};
	};
}

function kontrola_mail(){
	if ((document.forms.kanmail.mail_predmet.value == "") || (isblank(document.forms.kanmail.mail_predmet.value))) {
		alert("Není vyplněný předmět emailu.");
		document.forms.kanmail.mail_predmet.focus();
		return false;
	};
	if ((document.forms.kanmail.mail_text.value == "") || (isblank(document.forms.kanmail.mail_text.value))) {
		alert("Není vyplněný text emailu.");
		document.forms.kanmail.mail_text.focus();
		return false;
	};
}

function vlozitCAS(text) {
        text = '' + text + '';
	
        document.forms['ukol'].ukol_casod.focus();
        document.forms['ukol'].ukol_casod.value  = text;
        document.forms['ukol'].ukol_casod.focus();
}

function vlozitCAS2(text) {
        text = '' + text + '';
	
        document.forms['ukol'].ukol_casdo.focus();
        document.forms['ukol'].ukol_casdo.value  = text;
        document.forms['ukol'].ukol_casdo.focus();
}

function doplneni(id){
	
	var str = document.getElementById(id).value

	if(str.indexOf(":") == -1){
		if(str.length == 0){
			return true;
		}else if(str.length == 1){
			document.getElementById(id).value = '0' +str + ':00';
		}else if(str.length >= 3){
			alert("Zadaný čas má nestandardní formát.\n Zadejte buď pouze hodinu(maximálně 2 čísla) nebo\n celý čas ve formátu HH:MM:(sekunda je nepovinná)");
			document.getElementById(id).value = '';			
		}else{
			document.getElementById(id).value = str + ':00';
		}
	}else{
		if(str.length == 5){
			return true; 
		}else{
			if(str.length == 2){
				document.getElementById(id).value = '0' +str + '00';
			}else if(str.length >= 4){
				alert("Zadaný čas má nestandardní formát.\n Zadejte buď pouze hodinu(maximálně 2 čísla) nebo\n celý čas ve formátu HH:MM:(sekunda je nepovinná)");
				document.getElementById(id).value = '';
			}else{
				document.getElementById(id).value = str + '00';
			}
		}
	}
}

function max_vyber(obj, pocet, xtext) {
	if (xtext == '')  xtext = 'položky';
	var i = 0, mx = 0;
	for (i = 0; i < obj.length; i++) {
		if (obj[i].selected == true) { 
			mx++;
		}
	}

	if (mx > pocet) {
		alert('Můžete vybrat maximálně ' + pocet + ' ' + xtext);
		for (i = 0; i < obj.length; i++) {
			obj[i].selected = false;
		}
		return false;
	} else return true;		
}

/***********************************************
* Overlapping Content link- © Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

function getposOffset(overlay, offsettype){
var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
var parentEl=overlay.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function overlay(curobj, subobj){
if (document.getElementById){
var subobj=document.getElementById(subobj)
subobj.style.left=getposOffset(curobj, "left")+"px"
subobj.style.top=getposOffset(curobj, "top")+"px"
subobj.style.display="block"
return false
}
else
return true
}

function overlayclose(subobj){
document.getElementById(subobj).style.display="none"
}

//////////limiter bar
function textCounter(field,counter,maxlimit,linecounter) {
	// text width//
	var fieldWidth =  parseInt(field.offsetWidth);
	var charcnt = field.value.length;        

	// trim the extra text
	if (charcnt > maxlimit) { 
		field.value = field.value.substring(0, maxlimit);
	}

	else { 
	// progress bar percentage
	var percentage = parseInt(100 - (( maxlimit - charcnt) * 100)/maxlimit) ;
	document.getElementById(counter).style.width =  parseInt((fieldWidth*percentage)/100)+"px";
	document.getElementById(counter).innerHTML="Limit: "+percentage+"%"
	// color correction on style from CCFFF -> CC0000
	setcolor(document.getElementById(counter),percentage,"background-color");
	}
}

function setcolor(obj,percentage,prop){
	obj.style[prop] = "rgb(80%,"+(100-percentage)+"%,"+(100-percentage)+"%)";
}

//popup okno
var win = null;
function NewWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}

function setCheckboxesRange(the_form, do_check, basename, min, max)
{
    for (var i = min; i < max; i++) {
        if (typeof(document.forms[the_form].elements[basename + i]) != 'undefined') {
            document.forms[the_form].elements[basename + i].checked = do_check;
        }
        if (typeof(document.forms[the_form].elements[basename + i + 'r']) != 'undefined') {
            document.forms[the_form].elements[basename + i + 'r'].checked = do_check;
        }
    }

    return true;
}

//image
/*
	Header Information------------------------------------[Do Not Remove This Header]--
	Title: OO Dom Image Rollover
	Description: This script makes it easy to add rollover/ mousedown 
  	effects to any image on the page, including image submit buttons. Automatically 
  	preloads images as well. Script works in all DOM capable browsers- IE5+, NS6+, 
  	Opera7+.
	
	Legal: Copyright 2005 Adam Smith
	Author Email Address: ibulwark@hotmail.com
	Date Created: June 6, 2005
	Website: Codevendor.com | eBadgeman.com
	Script featured on Dynamic Drive: http://www.dynamicdrive.com
	-----------------------------------------------------------------------------------
*/

function imageholderclass(){
	this.over=new Array();
	this.down=new Array();
	this.src=new Array();
	this.store=store;
	
	function store(src, down, over){
		var AL=this.src.length;
		this.src[AL]=new Image(); this.src[AL].src=src;
		this.over[AL]=new Image(); this.over[AL].src=over;
		this.down[AL]=new Image(); this.down[AL].src=down;
	}
}

var ih = new imageholderclass();
var mouseisdown=0;

function preloader(t){
	for(i=0;i<t.length;i++){
		if(t[i].getAttribute('srcover')||t[i].getAttribute('srcdown')){
			
			storeimages(t[i]);
			var checker='';
			checker=(t[i].getAttribute('srcover'))?checker+'A':checker+'';
			checker=(t[i].getAttribute('srcdown'))?checker+'B':checker+'';
			
			switch(checker){
			case 'A' : mouseover(t[i]);mouseout(t[i]); break;
			case 'B' : mousedown(t[i]); mouseup2(t[i]); break;
			case 'AB' : mouseover(t[i]);mouseout(t[i]); mousedown(t[i]); mouseup(t[i]); break;
			default : return;			
			}
			
			if(t[i].src){t[i].setAttribute("oldsrc",t[i].src);}
		}
	}
}
function mouseup(t){
	var newmouseup;
	if(t.onmouseup){
		t.oldmouseup=t.onmouseup;
		newmouseup=function(){mouseisdown=0;this.src=this.getAttribute("srcover");this.oldmouseup();}

	}
	else{newmouseup=function(){mouseisdown=0;this.src=this.getAttribute("srcover");}}
	t.onmouseup=newmouseup;
}

function mouseup2(t){
	var newmouseup;
	if(t.onmouseup){
		t.oldmouseup=t.onmouseup;
		newmouseup=function(){mouseisdown=0;this.src=this.getAttribute("oldsrc");this.oldmouseup();}
		}
	else{newmouseup=function(){mouseisdown=0;this.src=this.getAttribute("oldsrc");}}
	t.onmouseup = newmouseup;
}

function mousedown(t){
	var newmousedown;
	if(t.onmousedown){
		t.oldmousedown=t.onmousedown;
		newmousedown=function(){if(mouseisdown==0){this.src=this.getAttribute("srcdown");this.oldmousedown();}}
	}
	else{newmousedown=function(){if(mouseisdown==0){this.src=this.getAttribute("srcdown");}}}
	t.onmousedown=newmousedown;
}

function mouseover(t){
	var newmouseover;
	if(t.onmouseover){
		t.oldmouseover=t.onmouseover;
		newmouseover=function(){this.src=this.getAttribute("srcover");this.oldmouseover();}
	}
	else{newmouseover=function(){this.src=this.getAttribute("srcover");}}
	t.onmouseover=newmouseover;
}

function mouseout(t){
	var newmouseout;
	if(t.onmouseout){
		t.oldmouseout=t.onmouseout;
		newmouseout=function(){this.src=this.getAttribute("oldsrc");this.oldmouseout();}
	}
	else{newmouseout=function(){this.src=this.getAttribute("oldsrc");}}
	t.onmouseout=newmouseout;
}

function storeimages(t){
	var s=(t.getAttribute('src'))?t.getAttribute('src'):'';
	var d=(t.getAttribute('srcdown'))?t.getAttribute('srcdown'):'';
	var o=(t.getAttribute('srcover'))?t.getAttribute('srcover'):'';
	ih.store(s,d,o);
}

function preloadimgsrc(){
	if(!document.getElementById) return;
	var it=document.getElementsByTagName('IMG');
	var it2=document.getElementsByTagName('INPUT');
	preloader(it);
	preloader(it2);
}

if(window.addEventListener){window.addEventListener("load", preloadimgsrc, false);} 
else{
	if(window.attachEvent){window.attachEvent("onload", preloadimgsrc);}
	else{if(document.getElementById){window.onload=preloadimgsrc;}}
}

function pc_skill()
{
  if (!document.getElementById('pc_user'))
  {
    return false;
  }
  if (true==document.getElementById('pc_user').checked)
  {
    document.getElementById('odbornik').style.display='none';
  }
}

function znalosti()
{

  var i;
  var istr;
  var istr2;
  var last=0;
  var tmp;
  
  for (i=1; i<=10; i++)
  {
    istr='znalost'+i;
    istr2='znalost-'+i;

    if (''!=document.getElementById(istr).value)
    {
      document.getElementById(istr2).style.display='block';
      last=i;
    }
    else
    {
   //   document.getElementById(istr2).style.display='none';
      tmp=i;
      while ( (tmp<10) && (''!=document.getElementById('znalost'+(tmp+1)).value) )
      {
        document.getElementById('znalost'+tmp).value=document.getElementById('znalost'+(tmp+1)).value;
        last=tmp;
        tmp++;
      }
      
      if (tmp<=10)
      {
         document.getElementById('znalost-'+(tmp)).style.display='none';
         document.getElementById('znalost'+(tmp)).value='';
      }
    }
  }
  
  if (10>last)
  {
    istr='znalost-'+(last+1);
    document.getElementById(istr).style.display='block';
  }

}



function cvs()
{

  var i;
  var istr;
  var istr2;
  var last=0;
  var tmp;
  
  for (i=1; i<=10; i++)
  {
    istr='cv'+i;
    istr2='cv-'+i;

    if (''!=document.getElementById(istr).value)
    {
      document.getElementById(istr2).style.display='block';
      last=i;
    }
    else
    {
   //   document.getElementById(istr2).style.display='none';
      tmp=i;
      while ( (tmp<10) && (''!=document.getElementById('cv'+(tmp+1)).value) )
      {
        document.getElementById('cv'+tmp).value=document.getElementById('cv'+(tmp+1)).value;
        last=tmp;
        tmp++;
      }
      
      if (tmp<=10)
      {
         document.getElementById('cv-'+(tmp)).style.display='none';
         document.getElementById('cv'+(tmp)).value='';
      }
    }
  }
  
  if (10>last)
  {
    istr='cv-'+(last+1);
    document.getElementById(istr).style.display='block';
  }

}

function poptHide(stat)
{

  if (0==stat)
  {
    document.getElementById('pop-option').innerHTML='<a style="cursor: pointer" onclick="poptHide(1);">Zobrazit pouze aktivní poptávky</a>';
    document.getElementById('hidden').style.display='block';
  }
  else
  {
    document.getElementById('pop-option').innerHTML='<a style="cursor: pointer" onclick="poptHide(0);">Zobrazit i neaktivní poptávky</a>';
    document.getElementById('hidden').style.display='none';
  }
}

function inzHide(stat)
{

  if (0==stat)
  {
    document.getElementById('inz-option').innerHTML='<a style="cursor: pointer" onclick="inzHide(1);">Zobrazit pouze aktivní inzeráty</a>';
    document.getElementById('hidden').style.visibility='visible';
  }
  else
  {
    document.getElementById('inz-option').innerHTML='<a style="cursor: pointer" onclick="inzHide(0);">Zobrazit i neaktivní inzeráty</a>';
    document.getElementById('hidden').style.visibility='hidden';
  }
}


function alertHide(stat)
{

  if (0==stat)
  {
    document.getElementById('al-option').innerHTML='<a style="cursor: pointer" onclick="alertHide(1);">Zobrazit pouze aktivní upozornění</a>';
    document.getElementById('hiddena').style.display='block';
  }
  else
  {
    document.getElementById('al-option').innerHTML='<a style="cursor: pointer" onclick="alertHide(0);">Zobrazit i neaktivní upozornění</a>';
    document.getElementById('hiddena').style.display='none';
  }
}


function factSwitch(stat)
{

  if (0==stat)
  {
    document.getElementById('fact-switch').innerHTML='<a style="cursor: pointer" onclick="factSwitch(1)">Nezadávat fakturační adresu</a>';
    document.getElementById('fact-adr').style.display='block';
  }
  else
  {
    document.getElementById('fact-switch').innerHTML='<a style="cursor: pointer" onclick="factSwitch(0)">Zadat fakturační adresu</a>';
    document.getElementById('fact-adr').style.display='none';
    document.getElementById('part_fac_ulice').value=document.getElementById('part_fac_mesto').value=document.getElementById('part_fac_psc').value='';
  }
}


// potvrzeni, ze nechci pouzit postaka (vlozeni noveho inzeratu)
function postak()
{
	if (document.forms.novy_inzerat.pozice_odeslat.checked == false)
	{
		if (true==confirm("Opravdu opravdu inzerat uložit bez použití AC pošťáka?"))
    {
      return true;
    }
    else
    {
      return false;
    }
    ;
	}
	else
	{
	 return true;
	}
}



function uvs()
{

  var i;
  var istr;
  var istr2;
  var last=0;
  var tmp;
  
  for (i=1; i<=10; i++)
  {
    istr='uvl'+i;
    istr2='uv-'+i;
    if ((''!=document.getElementById(istr).value) && ('999999'!=(''!=document.getElementById(istr).value)))
    {
     // alert(i+'-'+document.getElementById(istr).value);
      document.getElementById(istr2).style.display='block';
    
      last=i;
    }
    else
    {
   //   document.getElementById(istr2).style.display='none';
      tmp=i;
      while ( (tmp<10) && (''!=document.getElementById('uvl'+(tmp+1)).value)  && ('999999'!=document.getElementById('uvl'+(tmp+1)).value))
      {
        document.getElementById('uvl'+tmp).value=document.getElementById('uvl'+(tmp+1)).value;
        last=tmp;
        tmp++;
      }
      
      if (tmp<=11)
      {
         document.getElementById('uv-'+(tmp)).style.display='none';
         document.getElementById('uvl'+(tmp)).value='';
      }
    }
  }
  
  
  
  if (10>last)
  {
    istr='uv-'+(last+1);
    document.getElementById(istr).style.display='block';
  }

}


function ups()
{

  var i;
  var istr;
  var istr2;
  var last=0;
  var tmp;
  
  for (i=1; i<=10; i++)
  {
    istr='upl'+i;
    istr2='up-'+i;
    if ((''!=document.getElementById(istr).value) && ('999999'!=(''!=document.getElementById(istr).value)))
    {
     // alert(i+'-'+document.getElementById(istr).value);
      document.getElementById(istr2).style.display='block';
    
      last=i;
    }
    else
    {
   //   document.getElementById(istr2).style.display='none';
      tmp=i;
      while ( (tmp<10) && (''!=document.getElementById('upl'+(tmp+1)).value)  && ('999999'!=document.getElementById('upl'+(tmp+1)).value))
      {
        document.getElementById('upl'+tmp).value=document.getElementById('upl'+(tmp+1)).value;
        last=tmp;
        tmp++;
      }
      
      if (tmp<=11)
      {
         document.getElementById('up-'+(tmp)).style.display='none';
         document.getElementById('upl'+(tmp)).value='';
      }
    }
  }
  
  
  
  if (10>last)
  {
    istr='up-'+(last+1);
    document.getElementById(istr).style.display='block';
  }

}


function setStatus(user, e)
{ 
  document.getElementById('status-form').style.visibility='visible';
  document.getElementById('status_candidate').value=user;
}


function setGive(user, obj)
{ 
  document.getElementById('give-form').style.visibility='visible';
  document.getElementById('delid').value=user;
}


function poptavky(partnerId, popt, def)
{
  
  var pattern, character;
  var flag;
  var output;
  var partner, popKey, popText;
  var sel;
  
  document.getElementById('poptavka').innerHTML='';
  flag=1;
  output=partner='';
  document.getElementById('poptavka').innerHTML+='<option value="0">- Seznam poptávek -</option>';
  
  for (i=0; i<popt.length; i++)
  {
    pattern=popt.substring(i, i+3);
    character=popt.substring(i, i+1);
      
    if ('$$$'==pattern)
    {
      flag=2;
      i+=2;
      popKey='';
    }
    else if ('%%%'==pattern)
    {
      flag=3;
      i+=2;
      popText='';
    }
    else if ('~~~'==pattern)
    {
      flag=2;
      i+=2;
      if (partner==partnerId)
      {
        if (def==popKey)
        {
          sel=' selected="selected"';
        }
        else
        {
          sel='';
        }
        document.getElementById('poptavka').innerHTML+='<option value="'+popKey+'"'+sel+'>'+popText+'</option>';
      }
      popKey='';
    }    
    else if ('|||'==pattern)
    {
        if (def==popKey)
        {
          sel=' selected="selected"';
        }
        else
        {
          sel='';
        }
      if (partner==partnerId)
      {
        document.getElementById('poptavka').innerHTML+='<option value="'+popKey+'"'+sel+'>'+popText+'</option>';
      }
      flag=1;
      i+=2;
      partner='';
    }  
    else if (1==flag)
    {
      partner+=character;
    }  
    else if (2==flag)
    {
      popKey+=character;
    }  
    else if (3==flag)
    {
      popText+=character;
    }  
    
  }
  

  
}
