function openupload_smlouvu(id, sml) {
	window.open('../../uploadadv.php?krok=1&id='+id+'&sml='+sml, 'editinfo2','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,dependent,copyhistory=yes,width=400,height=250')
}

function chcklik(obj,text) {
		
		obj.style.color= 'black';
		obj.style.borderColor= 'black';
		obj.style.border= 'black 1px solid';
		obj.value=text;
		obj.focus()
	}

function toggleDiv(divid){
    if(document.getElementById(divid).style.display == 'none'){
      document.getElementById(divid).style.display = 'block';

    }else{
      document.getElementById(divid).style.display = 'none';
    }
  }
  
  
function menuover(obj,col) {
		obj.style.cursor = 'hand'; 
		obj.style.backgroundColor= col;
	}	

function menuout(obj,col) {
		obj.style.backgroundColor= col;
		obj.style.cursor = ''; 
	}	

function confirmSubmit()
{
var agree=confirm("POZOR milý uživateli!!!\nJsi si jist, že chceš opravdu provést tuto operaci?\n\nDvakrát měř, jednu fikej");
if (agree)
	return true ;
else
	return false ;
}
	
function menuover2(obj) {
		 obj.style.cursor = 'hand'; 
		obj.style.backgroundColor= '#E8E8E8';
	}		

function borderout(obj,col) {
		obj.style.borderColor= col;
		obj.style.cursor = ''; 
	}
	
function borderover(obj) {
		obj.style.cursor = 'hand'; 
		obj.style.borderColor= '#2F87C6';
	}
	
function menuout(obj,col) {
		obj.style.backgroundColor= col;
		obj.style.cursor = ''; 
	}		
	
function submenuover(obj) {
		document.getElementById('sub1').style.zIndex=0;
		document.getElementById('sub2').style.zIndex=0;
		document.getElementById('sub3').style.zIndex=0;
		obj.style.zIndex+= 1;
		obj.style.visibility = 'visible';
		document.getElementById(obj).style.visibility='visible';
		obj.style.backgroundColor= 'white';
	}	


function gotow(cesta) {
		window.location.href= cesta;
	}
	
function chcklikout(obj, text) {
	
 if(obj.value=='' || obj.value=='@') {
		obj.style.backgroundColor = '';
		obj.style.border= '#CCCCCC 1px solid';
		obj.value=text;
		this.focus();
		}
		
	}

function reFresh() {
  location.reload(true)
}	
	

function open_window(dokument,sirka,vyska,centrovat,pozice_l,pozice_h) {
  if (centrovat == 1) {
  	so = screen.width;
	vo = screen.height;
	zleva = ((so - sirka) / 2) - 13;
	//shora = (vo - vyska) / 2;
	shora = 100;
	} else {
		zleva = pozice_l;
	  	shora = pozice_h;
	}
  popup_win = window.open(dokument,"popup_okno","width="+sirka+",height="+vyska+",left="+zleva+",top="+shora+",location=0,menubar=0,resizable=0,scrollbars=0,status=0,titlebar=0,toolbar=0");
  popup_win.focus();
}

function doCheckAll()
{
  with (document.list) {
    for (var i=0; i < elements.length; i++) {
        if (elements[i].type == 'checkbox')
           elements[i].checked = true;
    }
  }
} 

function doCheckAllsklad()
{
	var sklad = document.getElementsByName("s");
	var chsklad = document.getElementsByName("naskl[]");
    for (var i=0; i < sklad.length; i++) {
        if (sklad[i].type == 'checkbox')
           sklad[i].checked = true;
		   chsklad[i].value = 1;
  }
}


function ShowHide(id, visibility) { 
    obj = document.getElementsByTagName("div"); 
    obj[id].style.visibility = visibility; 
} 


function ValidateForm(){
	//alert("Prosím vlože email")
	
	
	// Prijemni
	if (document.getElementById('inputname[6]').value==""){
		alert("Prosím vložte Přijmení")
		document.getElementById('inputname[6]').focus()
		return false
	}
	
	// Osloveni
	if (document.getElementById('inputname[7]').value==""){
		alert("Prosím vložte Oslovení")
		document.getElementById('inputname[7]').focus()
		return false
	}
	
	// Username
	if (document.getElementById('inputname[14]').value==""){
		alert("Prosím vložte Username")
		document.getElementById('inputname[14]').focus()
		return false
	}
	
	// Heslo
	if (document.getElementById('inputname[15]').value==""){
		alert("Prosím vložte Heslo")
		document.getElementById('inputname[15]').focus()
		return false
	}
	
	return true
 }
 
 
function ValidateFormLVIS(){
	 
	 
	 // Klient
	if (document.getElementById('inputname[1]').value==0){
		alert("Prosím zvolte Klienta")
		//document.getElementById('inputname[1]').focus()
		return false
	}
	
	return true
}	 

function ValidateFormStroje(){
	 
	 
	 // Nazev stroje
	if (document.getElementById('inputname[1]').value==0){
		alert("Prosím zvolte DNS stroje")
		document.getElementById('inputname[1]').focus()
		return false
	}
	
	
	 // Tyz zařízení
	if (document.getElementById('inputname[2]').value==0){
		alert("Prosím zvolte Typ zařízení")
		//document.getElementById('inputname[1]').focus()
		return false
	}
	
	 // Klient
	if (document.getElementById('inputname[8]').value==0){
		alert("Prosím zvolte Klienta")
		//document.getElementById('inputname[1]').focus()
		return false
	}
	
	return true
}	


function countryChange(selectObj) {
	// get the index of the selected option
	var idx = selectObj.selectedIndex;
	// get the value of the selected option
	var which = selectObj.options[idx].value;
	// use the selected option value to retrieve the list of items from the coutnryLists array
	cList = countryLists[which];
	// get the country select element via its known id
	var cSelect = document.getElementById("country");
	// remove the current options from the country select
	var len=cSelect.options.length;
	while (cSelect.options.length > 0) {
		cSelect.remove(0);
	}
	var newOption;
	// create new options
	for (var i=0; i<cList.length; i++) {
		newOption = document.createElement("option");
		newOption.value = cList[i];  // assumes option string and value are the same
		newOption.text=cList[i];
		// add the new option
		try {
			cSelect.add(newOption);  // this will fail in DOM browsers but is needed for IE
		}
		catch (e) {
			cSelect.appendChild(newOption);

		}
	}
}


function hideDivArea(str_area_hide){ 
	document.getElementById(str_area_hide).style.display = "none"; 
} 

function showDivArea(areas_show, areas_hide){ 

	for (var i = 0; i < areas_show.length; i++) 
	{ 
	ge = document.getElementById(areas_show[i]); 
	ge.style.display = "block"; 
	} 
	for (var i = 0; i < areas_hide.length; i++) 
	{ 
	hideDivArea(areas_hide[i]); 
	} 
	document.getElementByName(opttwo).style.display = "block"; 
}