function zobraz(idecko){
	if(document.getElementById('odkaz_z1'))document.getElementById('odkaz_z1').className='';
	if(document.getElementById('odkaz_z2'))document.getElementById('odkaz_z2').className='';
	if(document.getElementById('odkaz_z3'))document.getElementById('odkaz_z3').className='';
	if(document.getElementById('odkaz_z4'))document.getElementById('odkaz_z4').className='';
	if(document.getElementById('odkaz_z5'))document.getElementById('odkaz_z5').className='';
	if(document.getElementById('odkaz_z6'))document.getElementById('odkaz_z6').className=''; // if pro případ, že záložka není
	document.getElementById('odkaz_'+idecko).className='active';
	
	if(document.getElementById('odkaz_z1'))document.getElementById('obsah_z1').style.display='none';
	if(document.getElementById('odkaz_z2'))document.getElementById('obsah_z2').style.display='none';
	if(document.getElementById('odkaz_z3'))document.getElementById('obsah_z3').style.display='none';
	if(document.getElementById('odkaz_z4'))document.getElementById('obsah_z4').style.display='none';
	if(document.getElementById('odkaz_z5'))document.getElementById('obsah_z5').style.display='none';
	if(document.getElementById('odkaz_z6'))document.getElementById('obsah_z6').style.display='none'; // if pro případ, že obsah není
	document.getElementById('obsah_'+idecko).style.display='block';
}

function secti(){
	var c = 0;
	if(document.formular.cena_schodiste) c = c + cena_to_num(document.formular.cena_schodiste.value);
	if(document.formular.cena_prst) c = c + cena_to_num(document.formular.cena_prst.value);
	if(document.formular.cena_prst_uprava) c = c + cena_to_num(document.formular.cena_prst_uprava.value);
	if(document.formular.cena_uprav) c = c + cena_to_num(document.formular.cena_uprav.value);
	if(document.formular.cena_zabr) c = c + cena_to_num(document.formular.cena_zabr.value);
	if(document.formular.cena_povrch) c = c + cena_to_num(document.formular.cena_povrch.value);
		
	if(isNaN(c)){c="chybná hodnota";}
	else{
		c = num_to_cena(c);
	}
	document.getElementById('celkem').innerHTML = c;
}

function typ_zabradli(typ){
	//alert(typ);
	if(document.getElementById('zabr_smrk_n1')){
		if(typ==4){ // je li buk
			document.getElementById('zabr_smrk_n1').className='zabr_nekup';
			document.getElementById('zabr_buk_n1').className='zabr_kup';
			document.getElementById('zabr_smrk_c1').className='zabr_nekup';
			document.getElementById('zabr_buk_c1').className='zabr_kup';
			document.getElementById('zabr_stand_smrk').disabled=true; 
			document.getElementById('zabr_stand_buk').disabled=false;
			
			if(document.getElementById('zabr_smrk_n2'))document.getElementById('zabr_smrk_n2').className='zabr_nekup';
			if(document.getElementById('zabr_buk_n2'))document.getElementById('zabr_buk_n2').className='zabr_kup';
			if(document.getElementById('zabr_smrk_c2'))document.getElementById('zabr_smrk_c2').className='zabr_nekup';
			if(document.getElementById('zabr_buk_c2'))document.getElementById('zabr_buk_c2').className='zabr_kup';
			if(document.getElementById('zabr_soustr_smrk'))document.getElementById('zabr_soustr_smrk').disabled=true; 
			if(document.getElementById('zabr_soustr_buk'))document.getElementById('zabr_soustr_buk').disabled=false;
			if(document.getElementById('zabr_stand_smrk').checked || document.getElementById('zabr_soustr_smrk').checked) alert("Je vybráno smrkové zábrádlí, je nutno zvolit jiný materiál");
			
		}
		else{
			document.getElementById('zabr_smrk_n1').className='zabr_kup';
			document.getElementById('zabr_buk_n1').className='zabr_nekup';
			document.getElementById('zabr_smrk_c1').className='zabr_kup';
			document.getElementById('zabr_buk_c1').className='zabr_nekup';
			document.getElementById('zabr_stand_smrk').disabled=false; 
			document.getElementById('zabr_stand_buk').disabled=true;
			
			if(document.getElementById('zabr_smrk_n2'))document.getElementById('zabr_smrk_n2').className='zabr_kup';
			if(document.getElementById('zabr_buk_n2'))document.getElementById('zabr_buk_n2').className='zabr_nekup';
			if(document.getElementById('zabr_smrk_c2'))document.getElementById('zabr_smrk_c2').className='zabr_kup';
			if(document.getElementById('zabr_buk_c2'))document.getElementById('zabr_buk_c2').className='zabr_nekup';
			if(document.getElementById('zabr_soustr_smrk'))document.getElementById('zabr_soustr_smrk').disabled=false; 
			if(document.getElementById('zabr_soustr_buk'))document.getElementById('zabr_soustr_buk').disabled=true;
			if(document.getElementById('zabr_stand_buk').checked || document.getElementById('zabr_soustr_buk').checked) alert("Je vybráno bukové zábrádlí, je nutno zvolit jiný materiál");
		}
	}
}

function check_schodiste(){
	if(document.getElementById('zabr_smrk_n1')){
		var mater = '';
		
		//alert(document.formular.schodiste_typ.value);
		if(document.formular.schodiste_typ.value == 'bez postupnice - smrk'){mater = 'smrk';}
		if(document.formular.schodiste_typ.value == 'bez postupnice - smrk 31mm'){mater = 'smrk';}
		if(document.formular.schodiste_typ.value == 'bez postupnice - smrk 28mm'){mater = 'smrk';}
		if(document.formular.schodiste_typ.value == 's postupnicí - smrk'){mater = 'smrk';}
		if(document.formular.schodiste_typ.value == 's postupnicí - smrk 31mm'){mater = 'smrk';}
		if(document.formular.schodiste_typ.value == 's postupnicí - smrk 28mm'){mater = 'smrk';}
		
		if(document.formular.schodiste_typ.value == 's postupnicí - buk'){mater = 'buk';}
		if(document.formular.schodiste_typ.value == 'bez postupnice - buk'){mater = 'buk';}


//		if(document.getElementById('schodiste_typ_1') && document.getElementById('schodiste_typ_1').checked){mater = 'smrk';}
//		if(document.getElementById('schodiste_typ_2') && document.getElementById('schodiste_typ_2').checked){mater = 'buk';}
//		if(document.getElementById('schodiste_typ_3') && document.getElementById('schodiste_typ_3').checked){mater = 'smrk';}
//		if(document.getElementById('schodiste_typ_4') && document.getElementById('schodiste_typ_4').checked){mater = 'buk';}
//		
//		if(document.getElementById('schodiste_typ_5') && document.getElementById('schodiste_typ_5').checked){mater = 'smrk';}
//		if(document.getElementById('schodiste_typ_6') && document.getElementById('schodiste_typ_6').checked){mater = 'buk';}
//		if(document.getElementById('schodiste_typ_7') && document.getElementById('schodiste_typ_7').checked){mater = 'smrk';}
//		if(document.getElementById('schodiste_typ_8') && document.getElementById('schodiste_typ_8').checked){mater = 'buk';}
//		
//		if(document.getElementById('schodiste_typ_9') && document.getElementById('schodiste_typ_9').checked){mater = 'smrk';}
//		if(document.getElementById('schodiste_typ_10') && document.getElementById('schodiste_typ_10').checked){mater = 'buk';}
//		if(document.getElementById('schodiste_typ_11') && document.getElementById('schodiste_typ_11').checked){mater = 'smrk';}
//		if(document.getElementById('schodiste_typ_12') && document.getElementById('schodiste_typ_12').checked){mater = 'buk';}
//		
//		if(document.getElementById('schodiste_typ_13') && document.getElementById('schodiste_typ_13').checked){mater = 'smrk';}
//		if(document.getElementById('schodiste_typ_14') && document.getElementById('schodiste_typ_14').checked){mater = 'buk';}
//		if(document.getElementById('schodiste_typ_15') && document.getElementById('schodiste_typ_15').checked){mater = 'smrk';}
//		if(document.getElementById('schodiste_typ_16') && document.getElementById('schodiste_typ_16').checked){mater = 'buk';}
		
		if(mater == 'smrk'){
			if(document.getElementById('zabr_stand_buk').checked || document.getElementById('zabr_soustr_buk').checked){
				alert("Je vybráno bukové zábrádlí, je nutno zvolit jiný materiál !");
				return false;
			}
		}
		if(mater == 'buk'){
			if(document.getElementById('zabr_stand_smrk').checked || document.getElementById('zabr_soustr_smrk').checked){
				alert("Je vybráno smrkové zábrádlí, je nutno zvolit jiný materiál !");
				return false;
			}
		}
	}
}

function num_to_cena(c){
	var NewTextTemp = '';
	c = '' + c;
	for(var pos=0; pos<c.length; pos++)
	{
		NewTextTemp += c.charAt(pos);
		if(pos == c.length - 4) NewTextTemp += ' '; // oddělit tisíce
	} 
	c = NewTextTemp + ',-';
	return c;
}
function cena_to_num(cena){
	cena = cena.replace(' ','');
	cena = cena.replace(',-','');
	cena = 1 * cena;
	return cena;
}

function zmen(inp, text){
	document.formular[inp].value = text;
	secti();
}

// -------------------------------
// ---------otvírání oken vzorníků
// -------------------------------

var newwindow = '';
function sloupky() {
	if (!newwindow.closed && newwindow.location) {
	}
	else {
		var width = 880;
		var height = 550;
		var left = (screen.availWidth - width) / 2
		var top = (screen.availHeight - height) / 2
		if(left < 0) left = 0
		if(top < 0) top = 0
		newwindow=window.open('/cz/vzornik-sloupky.php?input=sel_sloupek','_blank', 'width=' + width + ',height=' + height + ',top=' + top + ',left=' + left + ',toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1');
	}
	newwindow.opener = window
	if (window.focus) {newwindow.focus()}
}
function winkomaxit() {
	if (!newwindow.closed && newwindow.location) {
	}
	else {
		var width = 880;
		var height = 600;
		var left = (screen.availWidth - width) / 2
		var top = (screen.availHeight - height) / 2
		if(left < 0) left = 0
		if(top < 0) top = 0
		newwindow=window.open('/cz/vzornik-komaxit.php?input=sel_komaxit','_blank', 'width=' + width + ',height=' + height + ',top=' + top + ',left=' + left + ',toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=1');
	}
	newwindow.opener = window
	if (window.focus) {newwindow.focus()}
}


