<script>
/*///////////////////////////////////////////////////////////////////////////////////////
//////////CUSTOMER/PART//////////////////////////////////////////////////////////////////
*////////////////////////////////////////////////////////////////////////////////////////
<?php if($checkCustomer==FALSE){ ?>
document.addEventListener("keyup", function(){
	if ((document.getElementById("customerNameChecker").innerHTML==1) && (document.getElementById("customerCityChecker").innerHTML==1) && (document.getElementById("customerStreetChecker").innerHTML==1) && (document.getElementById("customerStreetNumberChecker").innerHTML==1) && (document.getElementById("newTypeCompanyChecker").innerHTML==1)){		
		var status=0;
		var countCustomers=parseInt(document.getElementById("countCustomers").innerHTML);
		for(i = 1; i < (countCustomers+1); i++){
			if(
				(document.getElementById("newNameCompany").value.toUpperCase()==document.getElementById("companyName"+i).innerHTML.toUpperCase())&&
				(document.getElementById("newCityCompany").value.toUpperCase()==document.getElementById("companyCity"+i).innerHTML.toUpperCase())&&
				(document.getElementById("newStreetCompany").value.toUpperCase()==document.getElementById("companyStreet"+i).innerHTML.toUpperCase())
				){
				status=1;
			};
		}
		if(status==1){
			document.getElementById("finallyCheckerCustomer").innerHTML="<h3 style='padding-top:12px'><img src='http://martinbendik.studenthosting.sk/pictures/yes.png' height='20' width='20' align='middle' style='padding-bottom:12px;padding-right:15px'>Zákazník "+document.getElementById("newNameCompany").value+" - "+document.getElementById("newCityCompany").value+" už existuje.</h3>";
			document.getElementById("finallyStatusCustomer").innerHTML="1";
		}else{	
			document.getElementById("finallyCheckerCustomer").innerHTML="<h3 style='padding-top:12px'><img src='http://martinbendik.studenthosting.sk/pictures/yes.png' height='20' width='20' align='middle' style='padding-bottom:12px;padding-right:15px'>Zákazník "+document.getElementById("newNameCompany").value+" - "+document.getElementById("newCityCompany").value+".</h3>";
			document.getElementById("finallyStatusCustomer").innerHTML="1";			
		};
	}else{
		document.getElementById("finallyStatusCustomer").innerHTML="0";
		document.getElementById("finallyCheckerCustomer").innerHTML="<h3 style='padding-top:12px'><img src='http://martinbendik.studenthosting.sk/pictures/Exclamation.png' height='20' width='20' align='middle' style='padding-bottom:12px;padding-right:15px'>Zákazník</h3>";			
	};	
});

document.addEventListener("click", function(){
	if ((document.getElementById("customerNameChecker").innerHTML==1) && (document.getElementById("customerCityChecker").innerHTML==1) && (document.getElementById("customerStreetChecker").innerHTML==1) && (document.getElementById("customerStreetNumberChecker").innerHTML==1) && (document.getElementById("newTypeCompanyChecker").innerHTML==1)){		
		var status=0;
		var countCustomers=parseInt(document.getElementById("countCustomers").innerHTML);
		for(i = 1; i < (countCustomers+1); i++){
			if(
				(document.getElementById("newNameCompany").value.toUpperCase()==document.getElementById("companyName"+i).innerHTML.toUpperCase())&&
				(document.getElementById("newCityCompany").value.toUpperCase()==document.getElementById("companyCity"+i).innerHTML.toUpperCase())&&
				(document.getElementById("newStreetCompany").value.toUpperCase()==document.getElementById("companyStreet"+i).innerHTML.toUpperCase())
				){
				status=1;
			};
		}
		if(status==1){
			document.getElementById("finallyCheckerCustomer").innerHTML="<h3 style='padding-top:12px'><img src='http://martinbendik.studenthosting.sk/pictures/yes.png' height='20' width='20' align='middle' style='padding-bottom:12px;padding-right:15px'>Zákazník "+document.getElementById("newNameCompany").value+" - "+document.getElementById("newCityCompany").value+" už existuje.</h3>";
			document.getElementById("finallyStatusCustomer").innerHTML="1";
		}else{	
			document.getElementById("finallyCheckerCustomer").innerHTML="<h3 style='padding-top:12px'><img src='http://martinbendik.studenthosting.sk/pictures/yes.png' height='20' width='20' align='middle' style='padding-bottom:12px;padding-right:15px'>Zákazník "+document.getElementById("newNameCompany").value+" - "+document.getElementById("newCityCompany").value+".</h3>";
			document.getElementById("finallyStatusCustomer").innerHTML="1";			
		};
	}else{
		document.getElementById("finallyStatusCustomer").innerHTML="0";
		document.getElementById("finallyCheckerCustomer").innerHTML="<h3 style='padding-top:12px'><img src='http://martinbendik.studenthosting.sk/pictures/Exclamation.png' height='20' width='20' align='middle' style='padding-bottom:12px;padding-right:15px'>Zákazník</h3>";			
	};	
});


/*kontrola text area Nazov Spolocnosti*/
function checkCustomerName(){
	if(document.getElementById("newNameCompany").value!=""){
		if(document.getElementById("newNameCompany").value.length<3){
			document.getElementById("customerNameError").innerHTML="Minimálne 3 znaky!";
			document.getElementById("customerNameStatus").innerHTML = "<img src='http://martinbendik.studenthosting.sk/pictures/no.png' height='17' width='18' style='margin-top:6px'>";			
			document.getElementById("customerNameChecker").innerHTML="0";
		}else{
			document.getElementById("customerNameError").innerHTML="";
			document.getElementById("customerNameStatus").innerHTML = "<img src='http://martinbendik.studenthosting.sk/pictures/yes.png' height='17' width='18' style='margin-top:6px'>";	
			document.getElementById("customerNameChecker").innerHTML="1";
		}		
	}else{
		document.getElementById("customerNameError").innerHTML="";
		document.getElementById("customerNameStatus").innerHTML = "<img src='http://martinbendik.studenthosting.sk/pictures/no.png' height='17' width='18' style='margin-top:6px'>";	
		document.getElementById("customerNameChecker").innerHTML="0";
	}
};
/*kontrola text area Mesto Spolocnosti*/
function checkCustomerCity(){
	if(document.getElementById("newCityCompany").value!=""){
		if(document.getElementById("newCityCompany").value.length<3){
			document.getElementById("customerCityError").innerHTML="Minimálne 3 znaky!";
			document.getElementById("customerCityStatus").innerHTML = "<img src='http://martinbendik.studenthosting.sk/pictures/no.png' height='17' width='18' style='margin-top:6px'>";			
			document.getElementById("customerCityChecker").innerHTML="0";
		}else{
			document.getElementById("customerCityError").innerHTML="";
			document.getElementById("customerCityStatus").innerHTML = "<img src='http://martinbendik.studenthosting.sk/pictures/yes.png' height='17' width='18' style='margin-top:6px'>";	
			document.getElementById("customerCityChecker").innerHTML="1";
		}		
	}else{
		document.getElementById("customerCityError").innerHTML="";
		document.getElementById("customerCityStatus").innerHTML = "<img src='http://martinbendik.studenthosting.sk/pictures/no.png' height='17' width='18' style='margin-top:6px'>";	
		document.getElementById("customerCityChecker").innerHTML="0";
	}
};
/*kontrola text area Ulica Spolocnosti*/
function checkCustomerStreet(){
	if(document.getElementById("newStreetCompany").value!=""){
		if(document.getElementById("newStreetCompany").value.length<3){
			document.getElementById("customerStreetError").innerHTML="Minimálne 3 znaky!";
			document.getElementById("customerStreetStatus").innerHTML = "<img src='http://martinbendik.studenthosting.sk/pictures/no.png' height='17' width='18' style='margin-top:6px'>";			
			document.getElementById("customerStreetChecker").innerHTML="0";
		}else{
			document.getElementById("customerStreetError").innerHTML="";
			document.getElementById("customerStreetStatus").innerHTML = "<img src='http://martinbendik.studenthosting.sk/pictures/yes.png' height='17' width='18' style='margin-top:6px'>";	
			document.getElementById("customerStreetChecker").innerHTML="1";
		}		
	}else{
		document.getElementById("customerStreetError").innerHTML="";
		document.getElementById("customerStreetStatus").innerHTML = "<img src='http://martinbendik.studenthosting.sk/pictures/no.png' height='17' width='18' style='margin-top:6px'>";	
		document.getElementById("customerStreetChecker").innerHTML="0";
	}
};
/*kontrola text area Cislo domu Spolocnosti*/
function checkCustomerPostCode(){
	if(document.getElementById("newStreetPostCodeCompany").value!=""){		
		if(isNaN(document.getElementById("newStreetPostCodeCompany").value)===true) {
			document.getElementById("customerStreetNumberError").innerHTML="Iba číslice.";
			document.getElementById("customerStreetNumberStatus").innerHTML = "<img src='http://martinbendik.studenthosting.sk/pictures/no.png' height='17' width='18' style='margin-top:6px'>";			
			document.getElementById("customerStreetNumberChecker").innerHTML="0";		
		}else if(document.getElementById("newStreetPostCodeCompany").value.length!=5){
			document.getElementById("customerStreetNumberError").innerHTML="5 číslic.";
			document.getElementById("customerStreetNumberStatus").innerHTML = "<img src='http://martinbendik.studenthosting.sk/pictures/no.png' height='17' width='18' style='margin-top:6px'>";			
			document.getElementById("customerStreetNumberChecker").innerHTML="0";
		}else{
			document.getElementById("customerStreetNumberError").innerHTML="";
			document.getElementById("customerStreetNumberStatus").innerHTML = "<img src='http://martinbendik.studenthosting.sk/pictures/yes.png' height='17' width='18' style='margin-top:6px'>";	
			document.getElementById("customerStreetNumberChecker").innerHTML="1";
		}		
	}else{
		document.getElementById("customerStreetNumberError").innerHTML="";
		document.getElementById("customerStreetNumberStatus").innerHTML = "<img src='http://martinbendik.studenthosting.sk/pictures/no.png' height='17' width='18' style='margin-top:6px'>";	
		document.getElementById("customerStreetNumberChecker").innerHTML="0";
	}
};
/*kontrola ci je vybrany typ zakaznika*/
function checkCustomerType(){
	if(document.getElementById("newTypeCompany").value==0){
		document.getElementById("newTypeCompanyStatus").innerHTML = "<img src='http://martinbendik.studenthosting.sk/pictures/no.png' height='17' width='18' style='margin-top:6px'>";	
		document.getElementById("newTypeCompanyChecker").innerHTML="0";				
	}else{
		document.getElementById("newTypeCompanyStatus").innerHTML = "<img src='http://martinbendik.studenthosting.sk/pictures/yes.png' height='17' width='18' style='margin-top:6px'>";	
		document.getElementById("newTypeCompanyChecker").innerHTML="1";	
	};	
};
<?php }; ?>
/*///////////////////////////////////////////////////////////////////////////////////////
//////////IVENTORY/PART//////////////////////////////////////////////////////////////////
*////////////////////////////////////////////////////////////////////////////////////////

function checkInventoryRange(){
	if((document.getElementById("newDriveRange").value!="") && (document.getElementById("newTypeInventory").value!=0)){		
		if(/^\d+$/.test(document.getElementById("newDriveRange").value)) {
 			document.getElementById("newDriveRangeError").innerHTML="";
			document.getElementById("newDriveRangeStatus").innerHTML = "<img src='http://martinbendik.studenthosting.sk/pictures/yes.png' height='17' width='18' style='margin-top:6px'>";	
			document.getElementById("newDriveRangeChecker").innerHTML="1";
		} else {
 			document.getElementById("newDriveRangeError").innerHTML="Iba číslice!";
			document.getElementById("newDriveRangeStatus").innerHTML="<img src='http://martinbendik.studenthosting.sk/pictures/no.png' height='17' width='18' style='margin-top:6px'>";			
			document.getElementById("newDriveRangeChecker").innerHTML="0";
		};	
	}else{
		document.getElementById("newDriveRangeError").innerHTML="";
		document.getElementById("newDriveRangeStatus").innerHTML = "<img src='http://martinbendik.studenthosting.sk/pictures/no.png' height='17' width='18' style='margin-top:6px'>";	
		document.getElementById("newDriveRangeChecker").innerHTML="0";	
	};
};

function checkInventoryDriveTime(){
	if((document.getElementsByName('newDriveTimeHours')[0].value!=99)&&(document.getElementsByName('newDriveTimeMinutes')[0].value!=99)){		
		document.getElementById("newDriveTimeStatus").innerHTML = "<img src='http://martinbendik.studenthosting.sk/pictures/yes.png' height='17' width='18' style='margin-top:6px'>";	
		document.getElementById("newDriveTimeChecker").innerHTML="1";
	}else{
		document.getElementById("newDriveTimeStatus").innerHTML = "<img src='http://martinbendik.studenthosting.sk/pictures/no.png' height='17' width='18' style='margin-top:6px'>";	
		document.getElementById("newDriveTimeChecker").innerHTML="0";	
	};
};

function checkInventoryJoinDateTime(){
	if((document.getElementsByName('newInventoryJoinDate')[0].value!="Dátum")&&(document.getElementsByName('newInventoryJoinDate')[0].value!="Dátum")&&(document.getElementsByName('newInventoryJoinHours')[0].value!=99)&&(document.getElementsByName('newInventoryJoinMinutes')[0].value!=99)){
		var DateTimeNow = new Date();
		var DateTimeJoin = new Date(parseInt(document.getElementsByName('newInventoryJoinDate')[0].value.substring(6,10)),parseInt(document.getElementsByName('newInventoryJoinDate')[0].value.substring(3,5))-1,parseInt(document.getElementsByName('newInventoryJoinDate')[0].value.substring(0,2)),parseInt(document.getElementsByName('newInventoryJoinHours')[0].value),parseInt(document.getElementsByName('newInventoryJoinMinutes')[0].value));
		if(DateTimeJoin<DateTimeNow){
			document.getElementById("newInventoryJoinStatus").innerHTML = "<img src='http://martinbendik.studenthosting.sk/pictures/Exclamation.png' height='17' width='18' style='margin-top:6px'>";	
			document.getElementById("newInventoryJoinChecker").innerHTML="0";
			document.getElementById("newInventoryJoinError").innerHTML="Väčšie ako teraz!";	
		}else{
			document.getElementById("newInventoryJoinStatus").innerHTML = "<img src='http://martinbendik.studenthosting.sk/pictures/yes.png' height='17' width='18' style='margin-top:6px'>";	
			document.getElementById("newInventoryJoinChecker").innerHTML="1";
			document.getElementById("newInventoryJoinError").innerHTML="";	
		}		
	}else{
		document.getElementById("newInventoryJoinStatus").innerHTML = "<img src='http://martinbendik.studenthosting.sk/pictures/no.png' height='17' width='18' style='margin-top:6px'>";	
		document.getElementById("newInventoryJoinChecker").innerHTML="0";
		document.getElementById("newInventoryJoinError").innerHTML="";
	};
};

function checkInventoryStartDateTime(){
	if((document.getElementsByName('newInventoryStartDate')[0].value!="Dátum")&&(document.getElementsByName('newInventoryStartHours')[0].value!=99)&&(document.getElementsByName('newInventoryStartMinutes')[0].value!=99)){
		var DateTimeNow = new Date();
		var DateTimeJoin = new Date(parseInt(document.getElementsByName('newInventoryStartDate')[0].value.substring(6,10)),parseInt(document.getElementsByName('newInventoryStartDate')[0].value.substring(3,5))-1,parseInt(document.getElementsByName('newInventoryStartDate')[0].value.substring(0,2)),parseInt(document.getElementsByName('newInventoryStartHours')[0].value),parseInt(document.getElementsByName('newInventoryStartMinutes')[0].value));
		if(DateTimeJoin<DateTimeNow){
			document.getElementById("newInventoryStartStatus").innerHTML = "<img src='http://martinbendik.studenthosting.sk/pictures/Exclamation.png' height='17' width='18' style='margin-top:6px'>";	
			document.getElementById("newInventoryStartChecker").innerHTML="0";
			document.getElementById("newInventoryStartError").innerHTML="Väčšie ako teraz!";	
		}else{
			document.getElementById("newInventoryStartStatus").innerHTML = "<img src='http://martinbendik.studenthosting.sk/pictures/yes.png' height='17' width='18' style='margin-top:6px'>";	
			document.getElementById("newInventoryStartChecker").innerHTML="1";
			document.getElementById("newInventoryStartError").innerHTML="";	
		}	
	}else{
		document.getElementById("newInventoryStartStatus").innerHTML = "<img src='http://martinbendik.studenthosting.sk/pictures/no.png' height='17' width='18' style='margin-top:6px'>";	
		document.getElementById("newInventoryStartChecker").innerHTML="0";
		document.getElementById("newInventoryStartError").innerHTML="";
	};	
};

function checkInventoryEndDateTime(){
	if((document.getElementsByName('newInventoryEndDate')[0].value!="Dátum")&&(document.getElementsByName('newInventoryEndHours')[0].value!=99)&&(document.getElementsByName('newInventoryEndMinutes')[0].value!=99)){
		var DateTimeNow = new Date();
		var DateTimeJoin = new Date(parseInt(document.getElementsByName('newInventoryEndDate')[0].value.substring(6,10)),parseInt(document.getElementsByName('newInventoryEndDate')[0].value.substring(3,5))-1,parseInt(document.getElementsByName('newInventoryEndDate')[0].value.substring(0,2)),parseInt(document.getElementsByName('newInventoryEndHours')[0].value),parseInt(document.getElementsByName('newInventoryEndMinutes')[0].value));
		if(DateTimeJoin<DateTimeNow){
			document.getElementById("newInventoryEndStatus").innerHTML = "<img src='http://martinbendik.studenthosting.sk/pictures/Exclamation.png' height='17' width='18' style='margin-top:6px'>";	
			document.getElementById("newInventoryEndChecker").innerHTML="0";
			document.getElementById("newInventoryEndError").innerHTML="Väčšie ako teraz!";	
		}else{
			document.getElementById("newInventoryEndStatus").innerHTML = "<img src='http://martinbendik.studenthosting.sk/pictures/yes.png' height='17' width='18' style='margin-top:6px'>";	
			document.getElementById("newInventoryEndChecker").innerHTML="1";
			document.getElementById("newInventoryEndError").innerHTML="";	
		}	
	}else{
		document.getElementById("newInventoryEndStatus").innerHTML = "<img src='http://martinbendik.studenthosting.sk/pictures/no.png' height='17' width='18' style='margin-top:6px'>";	
		document.getElementById("newInventoryEndChecker").innerHTML="0";
		document.getElementById("newInventoryEndError").innerHTML="";
	};	
};

function checkCorrectInventoryPart(){
	if((document.getElementById("newDriveRangeChecker").innerHTML==1)&&(document.getElementById("newDriveTimeChecker").innerHTML==1)&&(document.getElementById("newInventoryJoinChecker").innerHTML==1)&&(document.getElementById("newInventoryStartChecker").innerHTML==1)&&(document.getElementById("newInventoryEndChecker").innerHTML==1)){
		var DriveTime = ((parseInt(document.getElementsByName('newDriveTimeHours')[0].value)*3600000)+(parseInt(document.getElementsByName('newDriveTimeMinutes')[0].value)*60000));	
		var DateTimeJoin = new Date(parseInt(document.getElementsByName('newInventoryJoinDate')[0].value.substring(6,10)),parseInt(document.getElementsByName('newInventoryJoinDate')[0].value.substring(3,5))-1,parseInt(document.getElementsByName('newInventoryJoinDate')[0].value.substring(0,2)),parseInt(document.getElementsByName('newInventoryJoinHours')[0].value),parseInt(document.getElementsByName('newInventoryJoinMinutes')[0].value));	
		var DateTimeStart = new Date(parseInt(document.getElementsByName('newInventoryStartDate')[0].value.substring(6,10)),parseInt(document.getElementsByName('newInventoryStartDate')[0].value.substring(3,5))-1,parseInt(document.getElementsByName('newInventoryStartDate')[0].value.substring(0,2)),parseInt(document.getElementsByName('newInventoryStartHours')[0].value),parseInt(document.getElementsByName('newInventoryStartMinutes')[0].value));
		var DateTimeEnd = new Date(parseInt(document.getElementsByName('newInventoryEndDate')[0].value.substring(6,10)),parseInt(document.getElementsByName('newInventoryEndDate')[0].value.substring(3,5))-1,parseInt(document.getElementsByName('newInventoryEndDate')[0].value.substring(0,2)),parseInt(document.getElementsByName('newInventoryEndHours')[0].value),parseInt(document.getElementsByName('newInventoryEndMinutes')[0].value));		

		if(DateTimeJoin>DateTimeStart){
			document.getElementById("finallyStatusInventory").innerHTML="0";
			document.getElementById("finallyCheckerInventory").innerHTML="<h3 style='margin-top:0px style='padding-top:12px'><img src='http://martinbendik.studenthosting.sk/pictures/Exclamation.png' height='20' width='20' align='middle' style='padding-bottom:12px;padding-right:15px'>Prihlasovanie musí byť skôr ako začiatok inventúry.</h3>";	
			document.getElementById("startListener").innerHTML="1";
			document.getElementById("numberOfChecked").innerHTML="0";
		}else if (DateTimeStart>DateTimeEnd){
			document.getElementById("finallyStatusInventory").innerHTML="0";
			document.getElementById("finallyCheckerInventory").innerHTML="<h3 style='margin-top:0px style='padding-top:12px'><img src='http://martinbendik.studenthosting.sk/pictures/Exclamation.png' height='20' width='20' align='middle' style='padding-bottom:12px;padding-right:15px'>Začiatok musí byť skôr ako koniec inventúry.</h3>";	
			document.getElementById("startListener").innerHTML="1";	
			document.getElementById("numberOfChecked").innerHTML="0";
		}else if ((DateTimeStart.getTime()-DateTimeJoin.getTime())<3600000){
			document.getElementById("finallyStatusInventory").innerHTML="0";
			document.getElementById("finallyCheckerInventory").innerHTML="<h3 style='margin-top:0px style='padding-top:12px'><img src='http://martinbendik.studenthosting.sk/pictures/Exclamation.png' height='20' width='20' align='middle' style='padding-bottom:12px;padding-right:15px'>Prihlasovanie musí končiť 60 minút pred začiatkom.</h3>";	
			document.getElementById("startListener").innerHTML="1";
			document.getElementById("numberOfChecked").innerHTML="0";	
		}else if ((DateTimeEnd.getTime()-DateTimeStart.getTime())<10800000){
			document.getElementById("finallyStatusInventory").innerHTML="0";
			document.getElementById("finallyCheckerInventory").innerHTML="<h3 style='margin-top:0px style='padding-top:12px'><img src='http://martinbendik.studenthosting.sk/pictures/Exclamation.png' height='20' width='20' align='middle' style='padding-bottom:12px;padding-right:15px'>Minimálna doba inventúry je 3 hodiny.</h3>";
			document.getElementById("startListener").innerHTML="1";	
			document.getElementById("numberOfChecked").innerHTML="0";	
		}else if(((2*DriveTime)+10800000)>(DateTimeEnd.getTime()-DateTimeStart.getTime())){
			document.getElementById("finallyStatusInventory").innerHTML="0";
			document.getElementById("finallyCheckerInventory").innerHTML="<h3 style='margin-top:0px style='padding-top:12px'><img src='http://martinbendik.studenthosting.sk/pictures/Exclamation.png' height='20' width='20' align='middle' style='padding-bottom:12px;padding-right:15px'>Doba inventúry nie je vrátane dvoch ciest.</h3>";
			document.getElementById("startListener").innerHTML="1";	
			document.getElementById("numberOfChecked").innerHTML="0";	
		}else{
		document.getElementById("finallyStatusInventory").innerHTML="1";
		document.getElementById("finallyCheckerInventory").innerHTML="<h3 style='margin-top:0px style='padding-top:12px'><img src='http://martinbendik.studenthosting.sk/pictures/yes.png' height='20' width='20' align='middle' style='padding-bottom:12px;padding-right:15px'>Inventúra</h3>";		
		}		
	}else{
		document.getElementById("finallyStatusInventory").innerHTML="0";
		document.getElementById("finallyCheckerInventory").innerHTML="<h3 style='margin-top:0px style='padding-top:12px'><img src='http://martinbendik.studenthosting.sk/pictures/Exclamation.png' height='20' width='20' align='middle' style='padding-bottom:12px;padding-right:15px'>Inventúra</h3>";	
		document.getElementById("startListener").innerHTML="1";
		document.getElementById("numberOfChecked").innerHTML="0";
	};	
}

function checkReservationPart(){
	if(document.getElementById("startListener").innerHTML==1){
		if(document.getElementById("finallyStatusInventory").innerHTML==1){	
		document.getElementById("reservationDiv").innerHTML="";
		
		var DateTimeStart = new Date(parseInt(document.getElementsByName('newInventoryStartDate')[0].value.substring(6,10)),parseInt(document.getElementsByName('newInventoryStartDate')[0].value.substring(3,5))-1,parseInt(document.getElementsByName('newInventoryStartDate')[0].value.substring(0,2)),parseInt(document.getElementsByName('newInventoryStartHours')[0].value)-3,parseInt(document.getElementsByName('newInventoryStartMinutes')[0].value));
		
		var DateTimeEnd = new Date(parseInt(document.getElementsByName('newInventoryEndDate')[0].value.substring(6,10)),parseInt(document.getElementsByName('newInventoryEndDate')[0].value.substring(3,5))-1,parseInt(document.getElementsByName('newInventoryEndDate')[0].value.substring(0,2)),parseInt(document.getElementsByName('newInventoryEndHours')[0].value)+3,parseInt(document.getElementsByName('newInventoryEndMinutes')[0].value));
	
		for(i=1;i<(parseInt(document.getElementById("countActiveVehicles").innerHTML)+1);i++){
			var countInvSameTime = 0;  
			var VehicleId = parseInt(document.getElementById('activeVehicleID'+i).innerHTML);
			var VehicleIdType = parseInt(document.getElementById('activeVehicleType'+i).innerHTML);
			for(j=1;j<(parseInt(document.getElementById("countEngagedInventories").innerHTML)+1);j++){
				var engagedDatetimeStart = new Date(parseInt(document.getElementById('engageStart'+j).innerHTML.substring(0,4)),(parseInt(document.getElementById('engageStart'+j).innerHTML.substring(5,7))-1),parseInt(document.getElementById('engageStart'+j).innerHTML.substring(8,10)),parseInt(document.getElementById('engageStart'+j).innerHTML.substring(11,13)),parseInt(document.getElementById('engageStart'+j).innerHTML.substring(14,16)));
				var engagedDatetimeEnd = new Date(parseInt(document.getElementById('engageEnd'+j).innerHTML.substring(0,4)),(parseInt(document.getElementById('engageEnd'+j).innerHTML.substring(5,7))-1),parseInt(document.getElementById('engageEnd'+j).innerHTML.substring(8,10)),parseInt(document.getElementById('engageEnd'+j).innerHTML.substring(11,13)),parseInt(document.getElementById('engageEnd'+j).innerHTML.substring(14,16))); 					
				var engagedVehicleId = parseInt(document.getElementById('engageIdVoz'+j).innerHTML);
				
				if ((
                ((DateTimeStart>=engagedDatetimeStart) && (DateTimeStart<=engagedDatetimeEnd)) ||
                ((DateTimeEnd>=engagedDatetimeStart) && (DateTimeEnd<=engagedDatetimeEnd)) ||
                ((DateTimeStart<=engagedDatetimeStart) && (DateTimeEnd>=engagedDatetimeEnd))
                ) && (VehicleId==engagedVehicleId)){
					countInvSameTime=countInvSameTime+1;	
				}			
			}
			if (countInvSameTime==0){
				document.getElementById("startListener").innerHTML="0";
				if(VehicleIdType==1){
					document.getElementById("reservationDiv").innerHTML=document.getElementById("reservationDiv").innerHTML+"<div id='divForCar"+VehicleId+"' class='divForInventoryCreateVehicle'><input type='checkbox' name='vehicle[]' value='"+VehicleId+"' hidden><img onclick='javascript:changeImageGreen("+VehicleId+","+VehicleIdType+")' src='http://martinbendik.studenthosting.sk/pictures/sedan_sivy.png' width='130px' style='margin-top:30px'><input type='checkbox' onclick='' name='vehicle[]' class='vehicle5'' value='' hidden></div>";		
				}else if(VehicleIdType==2){
					document.getElementById("reservationDiv").innerHTML=document.getElementById("reservationDiv").innerHTML+"<div id='divForCar"+VehicleId+"' class='divForInventoryCreateVehicle'><input type='checkbox' name='vehicle[]' value='"+VehicleId+"' hidden><img onclick='javascript:changeImageGreen("+VehicleId+","+VehicleIdType+")'  src='http://martinbendik.studenthosting.sk/pictures/combi_sivy.png' width='130px' style='margin-top:30px'></div>";		
				}else if(VehicleIdType==3){
					document.getElementById("reservationDiv").innerHTML=document.getElementById("reservationDiv").innerHTML+"<div id='divForCar"+VehicleId+"' class='divForInventoryCreateVehicle'><input type='checkbox' name='vehicle[]' value='"+VehicleId+"' hidden><img onclick='javascript:changeImageGreen("+VehicleId+","+VehicleIdType+")'  src='http://martinbendik.studenthosting.sk/pictures/van_sivy.png' width='130px' style='margin-top:30px'></div>";		
				}else{
					document.getElementById("reservationDiv").innerHTML=document.getElementById("reservationDiv").innerHTML+"<div id='divForCar"+VehicleId+"' class='divForInventoryCreateVehicle'><input type='checkbox' name='vehicle[]' value='"+VehicleId+"' hidden><img onclick='javascript:changeImageGreen("+VehicleId+","+VehicleIdType+")'  src='http://martinbendik.studenthosting.sk/pictures/bus_sivy.png' width='130px' style='margin-top:30px'></div>";		
				}					
			}
										
		}	
	}else{
		document.getElementById("reservationDiv").innerHTML="<h3 style='text-align:center; padding-left:0px'><img src='http://martinbendik.studenthosting.sk/pictures/Exclamation.png' height='20' width='20' align='middle' style='padding-bottom:12px;padding-right:15px'> Vyplnte správne sekciu: Inventúra.</h3>";
	}	
	}
};

function changeImageGreen(id,idType){
	document.getElementById("numberOfChecked").innerHTML=(parseInt(document.getElementById('numberOfChecked').innerHTML)+1);
	if(idType==1){
		document.getElementById("divForCar"+id).innerHTML="<input type='checkbox' name='vehicle[]' value='"+id+"' checked hidden><img onclick='javascript:changeImageGrey("+id+","+idType+")' src='http://martinbendik.studenthosting.sk/pictures/sedan_zeleny.png' width='130px' style='margin-top:30px'>";	
	}else if(idType==2){
		document.getElementById("divForCar"+id).innerHTML="<input type='checkbox' name='vehicle[]' value='"+id+"' checked hidden><img onclick='javascript:changeImageGrey("+id+","+idType+")' src='http://martinbendik.studenthosting.sk/pictures/combi_zeleny.png' width='130px' style='margin-top:30px'>";	
	}else if(idType==3){
		document.getElementById("divForCar"+id).innerHTML="<input type='checkbox' name='vehicle[]' value='"+id+"' checked hidden><img onclick='javascript:changeImageGrey("+id+","+idType+")' src='http://martinbendik.studenthosting.sk/pictures/van_zeleny.png' width='130px' style='margin-top:30px'>";	
	}else{
		document.getElementById("divForCar"+id).innerHTML="<input type='checkbox' name='vehicle[]' value='"+id+"' checked hidden><img onclick='javascript:changeImageGrey("+id+","+idType+")' src='http://martinbendik.studenthosting.sk/pictures/bus_zeleny.png' width='130px' style='margin-top:30px'>";	
	}
}

function changeImageGrey(id,idType){
	document.getElementById("numberOfChecked").innerHTML=(parseInt(document.getElementById('numberOfChecked').innerHTML)-1);
	if(idType==1){
		document.getElementById("divForCar"+id).innerHTML="<input type='checkbox' name='vehicle[]' value='"+id+"' hidden><img onclick='javascript:changeImageGreen("+id+","+idType+")' src='http://martinbendik.studenthosting.sk/pictures/sedan_sivy.png' width='130px' style='margin-top:30px'>";	
	}else if(idType==2){
		document.getElementById("divForCar"+id).innerHTML="<input type='checkbox' name='vehicle[]' value='"+id+"' hidden><img onclick='javascript:changeImageGreen("+id+","+idType+")' src='http://martinbendik.studenthosting.sk/pictures/combi_sivy.png' width='130px' style='margin-top:30px'>";	
	}else if(idType==3){
		document.getElementById("divForCar"+id).innerHTML="<input type='checkbox' name='vehicle[]' value='"+id+"' hidden><img onclick='javascript:changeImageGreen("+id+","+idType+")' src='http://martinbendik.studenthosting.sk/pictures/van_sivy.png' width='130px' style='margin-top:30px'>";	
	}else{
		document.getElementById("divForCar"+id).innerHTML="<input type='checkbox' name='vehicle[]' value='"+id+"' hidden><img onclick='javascript:changeImageGreen("+id+","+idType+")' src='http://martinbendik.studenthosting.sk/pictures/bus_sivy.png' width='130px' style='margin-top:30px'>";	
	}

}

function checkCheckedVehicles(){
	if(parseInt(document.getElementById('numberOfChecked').innerHTML)!=0 && parseInt(document.getElementById('finallyStatusCustomer').innerHTML)==1){
		document.getElementById("submitSpan").style.visibility = "visible";
	}else{
		document.getElementById("submitSpan").style.visibility = "hidden";
	}
}

document.addEventListener('click',function(){
	checkInventoryRange();
	checkInventoryDriveTime();
	checkInventoryJoinDateTime();	
	checkInventoryStartDateTime();
	checkInventoryEndDateTime();
 	checkCorrectInventoryPart();
	checkReservationPart();	
	checkCheckedVehicles();
});

document.addEventListener('keyup',function(){
	checkInventoryRange();
	checkInventoryDriveTime();
	checkInventoryJoinDateTime();	
	checkInventoryStartDateTime();
	checkInventoryEndDateTime();
 	checkCorrectInventoryPart();
	checkReservationPart();	
	checkCheckedVehicles();
});







</script>
<?php

	if ($this->session->userdata('permisson')==1) {		
		$CI =& get_instance();
		$CI->load->library('libraryprofile');		
		$CI->libraryprofile->showMenuBarManager($this->session->userdata('meno'),$this->session->userdata('priezvisko')); 	
		$this->load->helper(array('form', 'url'));
		
		if($checkCustomer==FALSE){
			echo form_open(base_url('manager/saveNewInventory/0','onkeypress="return event.keyCode != 13;"'));
		}else{
			echo form_open(base_url('manager/saveNewInventory/'.$checkCustomer->ID_Zakaznik),'onkeypress="return event.keyCode != 13;"');
		}
		
		$options = array('0'=>'','1'=>'Lekáreň','2'=>'Hračkárstvo','3'=>'Kníhkupectvo','4'=>'Supermarket','5'=>'Pošta','6'=>'Odevy','7'=>'Papierníctvo','8'=>'Kvetinárstvo','9'=>'Potraviny','10'=>'Železiarstvo','11'=>'Drogéria','12'=>'Iné');
		$options2 = array('99' => 'hod','00'  => '00','01'  => '01','02'  => '02','03'  => '03','04'  => '04','05'  => '05','06'  => '06','07'  => '07','08'  => '08','09'  => '09','10'  => '10','11'  => '11','12'  => '12','13'  => '13','14'  => '14','15'  => '15','16'  => '16','17'  => '17','18'  => '18','19'  => '19','20'  => '20','21'  => '21','22'  => '22','23'  => '23');		
		$options3 = array('99' => 'min','00'  => '00','05'  => '05','10'  => '10','15'  => '15','20'  => '20','25'  => '25','30'  => '30','35'  => '35','40'  => '40','45'  => '45','50'  => '50','55'  => '55');
		$options4 = array('0' => '','1' => 'Sklad 1', '2' => 'Sklad 2', '3' => 'Sklad 3', '4' => 'Predajňa 1', '5' => 'Predajňa 2', '6' => 'Predajňa 3');
		
		echo '<table id="customerInfoTable" hidden>';
			echo '<td id="countCustomers">'.count($customers).'</td>';	
			$countCustomers=0;
			foreach($customers as $customer){
				$countCustomers++;
				echo "<td id='companyName".$countCustomers."'>".$customer->Nazov_spolocnosti."</td><td id='companyCity".$countCustomers."'>".$customer->Mesto."</td><td id='companyStreet".$countCustomers."'>".$customer->Ulica."</td>";
			}
		echo '</table>';
////////////////////////////////		
		echo '<table id="activeVehiclesTable" hidden>';
			echo '<td id="countActiveVehicles">'.count($vehicles).'</td>';	
			$countVehicles=0;
			foreach($vehicles as $vehicle){
				$countVehicles++;
				echo "<td id='activeVehicleID".$countVehicles."'>".$vehicle->ID_VOZ."</td><td id='activeVehicleType".$countVehicles."'>".$vehicle->Typ_vozidla."</td>";
			}
		echo '</table>';
		
		echo '<table id="engageInventories" hidden>';
			echo '<td id="countEngagedInventories">'.count($engageTimes).'</td>';	
			$countengageTimes=0;
			foreach($engageTimes as $engageTime){
				$countengageTimes++;
				echo "<td id='engageIdVoz".$countengageTimes."'>".$engageTime->ID_VOZ."</td><td id='engageStart".$countengageTimes."'>".$engageTime->Datum_zaciatku."</td><td id='engageEnd".$countengageTimes."'>".$engageTime->Datum_konca."</td>";
			}
		echo '</table>';
///////////////////////////////		
		
		echo '<div id="numberOfChecked" hidden>0</div>';
		echo '<div id="startListener" hidden>1</div>';
		echo '<div id="default_container">';
			if($checkCustomer==FALSE){
				echo '<div id="finallyStatusCustomer" hidden>0</div>';
			echo '<span id="finallyCheckerCustomer">';
				echo "<h3 style='padding-top:12px'><img src='http://martinbendik.studenthosting.sk/pictures/Exclamation.png' height='20' width='20' align='middle' style='padding-bottom:12px;padding-right:15px'>Zákazník</h3>";
			echo '</span>';
			echo '<table id="newCustomerInfoTable" style="margin-left:50px; margin-top:10px">';
				echo '<tr>';
					echo '<td width="120px">';
						echo "Názov spoločnosti:";
					echo '</td>';
					echo '<td style="padding-left:20px">';
						echo form_input("newNameCompany",'','onkeyup="checkCustomerName()" id="newNameCompany" class="login_textarea"');
					echo '</td>';
					echo '<td id="customerNameStatus" style="padding-left:5px">';
						echo "<img src='http://martinbendik.studenthosting.sk/pictures/no.png' height='17' width='18' style='margin-top:6px'>";
					echo '</td>';
					echo '<td id="customerNameError" style="font-style: italic; font-size:13px;padding-left:10px">';
					echo '</td>';
					echo '<td id="customerNameChecker" hidden>';
						echo '0';
					echo '</td>';
				echo '</tr>';
				
				echo '<tr>';
					echo '<td>';
						echo "Mesto:";
					echo '</td>';
					echo '<td style="padding-left:20px">';
						echo form_input("newCityCompany",'','onkeyup="checkCustomerCity()" id="newCityCompany" class="login_textarea"');
					echo '</td>';
					echo '<td id="customerCityStatus" style="padding-left:5px">';
						echo "<img src='http://martinbendik.studenthosting.sk/pictures/no.png' height='17' width='18' style='margin-top:6px'>";
					echo '</td>';
					echo '<td id="customerCityError" style="font-style: italic; font-size:13px;padding-left:10px">';
					echo '</td>';
					echo '<td id="customerCityChecker" hidden>';
						echo '0';
					echo '</td>';
				echo '</tr>';
				
				echo '<tr>';
					echo '<td>';
						echo "Ulica, číslo domu:";
					echo '</td>';
					echo '<td style="padding-left:20px">';
						echo form_input("newStreetCompany",'','onkeyup="checkCustomerStreet()" id="newStreetCompany" class="login_textarea"');
					echo '</td>';
					echo '<td id="customerStreetStatus" style="padding-left:5px">';
						echo "<img src='http://martinbendik.studenthosting.sk/pictures/no.png' height='17' width='18' style='margin-top:6px'>";
					echo '</td>';
					echo '<td id="customerStreetError" style="font-style: italic; font-size:13px;padding-left:10px">';
					echo '</td>';
					echo '<td id="customerStreetChecker" hidden>';
						echo '0';
					echo '</td>';
				echo '</tr>';
				
				echo '<tr>';
					echo '<td>';
						echo "PSČ:";
					echo '</td>';
					echo '<td style="padding-left:20px">';
						echo form_input("newStreetPostCodeCompany",'','onkeyup="checkCustomerPostCode()" id="newStreetPostCodeCompany" class="login_textarea"');
					echo '</td>';
					echo '<td id="customerStreetNumberStatus" style="padding-left:5px">';
						echo "<img src='http://martinbendik.studenthosting.sk/pictures/no.png' height='17' width='18'  style='margin-top:6px'>";
					echo '</td>';
					echo '<td id="customerStreetNumberError" style="font-style: italic; font-size:13px;padding-left:10px">';
					echo '</td>';
					echo '<td id="customerStreetNumberChecker" hidden>';
						echo '0';
					echo '</td>';
				echo '</tr>'; 
				
				echo '<tr>';
					echo '<td>';
						echo "Typ spoločnosti:";
					echo '</td>';
					echo '<td style="padding-left:20px">';
						echo form_dropdown('newTypeCompany',$options,'','onclick="checkCustomerType()" id="newTypeCompany" class="login_textarea" style="width:228px"');
					echo '</td>';
					echo '<td id="newTypeCompanyStatus" style="padding-left:5px">';
						echo "<img src='http://martinbendik.studenthosting.sk/pictures/no.png' height='17' width='18'  style='margin-top:6px'>";
					echo '</td>';
					echo '<td id="newTypeCompanyError" style="font-style: italic; font-size:13px;padding-left:10px">';
					echo '</td>';
					echo '<td id="newTypeCompanyChecker" hidden>';
						echo '0';
					echo '</td>';
				echo '</tr>';				 
			echo '</table>';
								
			}else {
				echo '<div id="finallyStatusCustomer" hidden>1</div>';
			echo '<span id="finallyCheckerCustomer">';
				echo "<h3 style='padding-top:12px'><img src='http://martinbendik.studenthosting.sk/pictures/yes.png' height='20' width='20' align='middle' style='padding-bottom:12px;padding-right:15px'>Zákazník</h3>";
			echo '</span>';
			echo '<table id="newCustomerInfoTable" style="margin-left:50px; margin-top:10px">';
				echo '<tr>';
					echo '<td width="120px">';
						echo "Názov spoločnosti:";
					echo '</td>';
					echo '<td style="padding-left:20px; width:227px">';
						echo $checkCustomer->Nazov_spolocnosti;
					echo '</td>';
					echo '<td id="customerNameStatus" style="padding-left:5px">';
						echo "<img src='http://martinbendik.studenthosting.sk/pictures/yes.png' height='17' width='18' style='margin-top:6px'>";
					echo '</td>';
					echo '<td id="customerNameError" style="font-style: italic; font-size:13px;padding-left:10px">';
					echo '</td>';
					echo '<td id="customerNameChecker" hidden>';
						echo '1';
					echo '</td>';
				echo '</tr>';
				
				echo '<tr>';
					echo '<td>';
						echo "Mesto:";
					echo '</td>';
					echo '<td style="padding-left:20px">';
						echo $checkCustomer->Mesto;
					echo '</td>';
					echo '<td id="customerCityStatus" style="padding-left:5px">';
						echo "<img src='http://martinbendik.studenthosting.sk/pictures/yes.png' height='17' width='18' style='margin-top:6px'>";
					echo '</td>';
					echo '<td id="customerCityError" style="font-style: italic; font-size:13px;padding-left:10px">';
					echo '</td>';
					echo '<td id="customerCityChecker" hidden>';
						echo '1';
					echo '</td>';
				echo '</tr>';
				
				echo '<tr>';
					echo '<td>';
						echo "Ulica, číslo domu:";
					echo '</td>';
					echo '<td style="padding-left:20px">';
						echo $checkCustomer->Ulica." ".$checkCustomer->Cislo;
					echo '</td>';
					echo '<td id="customerStreetStatus" style="padding-left:5px">';
						echo "<img src='http://martinbendik.studenthosting.sk/pictures/yes.png' height='17' width='18' style='margin-top:6px'>";
					echo '</td>';
					echo '<td id="customerStreetError" style="font-style: italic; font-size:13px;padding-left:10px">';
					echo '</td>';
					echo '<td id="customerStreetChecker" hidden>';
						echo '1';
					echo '</td>';
				echo '</tr>';
				
				echo '<tr>';
					echo '<td>';
						echo "PSČ:";
					echo '</td>';
					echo '<td style="padding-left:20px">';
						echo $checkCustomer->PSC;
					echo '</td>';
					echo '<td id="customerStreetNumberStatus" style="padding-left:5px">';
						echo "<img src='http://martinbendik.studenthosting.sk/pictures/yes.png' height='17' width='18'  style='margin-top:6px'>";
					echo '</td>';
					echo '<td id="customerStreetNumberError" style="font-style: italic; font-size:13px;padding-left:10px">';
					echo '</td>';
					echo '<td id="customerStreetNumberChecker" hidden>';
						echo '1';
					echo '</td>';
				echo '</tr>'; 
				
				echo '<tr>';
					echo '<td>';
						echo "Typ spoločnosti:";
					echo '</td>';
					echo '<td style="padding-left:20px">';
						$this->load->helper('manager_helper');
						echo getTypeCustomerName($checkCustomer->ID_TYP_I);
					echo '</td>';
					echo '<td id="newTypeCompanyStatus" style="padding-left:5px">';
						echo "<img src='http://martinbendik.studenthosting.sk/pictures/yes.png' height='17' width='18'  style='margin-top:6px'>";
					echo '</td>';
					echo '<td id="newTypeCompanyError" style="font-style: italic; font-size:13px;padding-left:10px">';
					echo '</td>';
					echo '<td id="newTypeCompanyChecker" hidden>';
						echo '1';
					echo '</td>';
				echo '</tr>';
			echo '</table>';
			}
				
			
			echo '<div class="div_curve2"></div>';
//inventura					
			echo '<div id="finallyStatusInventory" hidden>0</div>';
			echo '<span id="finallyCheckerInventory">';
				echo "<h3 style='margin-top:0px'><img src='http://martinbendik.studenthosting.sk/pictures/Exclamation.png' height='20' width='20' align='middle' style='padding-bottom:12px;padding-right:15px'>Inventúra</h3>";
			echo '</span>';
		
			echo '<table id="newInventoryInfoTable" style="margin-left:50px; margin-top:10px">';
			
				echo '<tr>';
					echo '<td width="120px">';
						echo "Cesta km | Rozloha:";
					echo '</td>';
					echo '<td style="padding-left:20px">';
						echo form_input("newDriveRange","",' id="newDriveRange" class="login_textarea" style="width:80px"');
						echo form_dropdown('newTypeInventory',$options4,'','onclick="checkInventoryRange()" id="newTypeInventory" class="login_textarea" style="margin-left:10px;width:129px"');						
					echo '</td>';
					echo '<td id="newDriveRangeStatus" style="padding-left:5px">';
						echo "<img src='http://martinbendik.studenthosting.sk/pictures/no.png' height='17' width='18'  style='margin-top:6px'>";
					echo '</td>';
					echo '<td id="newDriveRangeError" style="font-style: italic; font-size:13px;padding-left:10px">';
					echo '</td>';
					echo '<td id="newDriveRangeChecker" hidden>';
						echo '0';
					echo '</td>';
				echo '</tr>';
								
				echo '<tr>';
					echo '<td width="120px">';
						echo "Čas cesty:";
					echo '</td>';
					echo '<td style="padding-left:108px">';
						echo form_dropdown('newDriveTimeHours', $options2,"", 'onclick="checkInventoryDriveTime()" id="hodiny3"' );
						echo '&nbsp' . '<b> : </b>' . '&nbsp';						
						echo form_dropdown('newDriveTimeMinutes', $options3,"", 'onclick="checkInventoryDriveTime()" id="hodiny4"' );
					echo '</td>';
					echo '<td id="newDriveTimeStatus" style="padding-left:5px">';
						echo "<img src='http://martinbendik.studenthosting.sk/pictures/no.png' height='17' width='18'  style='margin-top:6px'>";
					echo '</td>';
					echo '<td id="newDriveTimeError" style="font-style: italic; font-size:13px;padding-left:10px">';
					echo '</td>';
					echo '<td id="newDriveTimeChecker" hidden>';
						echo '0';
					echo '</td>';
				echo '</tr>';
				
				echo '<tr>';
					echo '<td width="120px">';
						echo "Prihlasovanie do:";
					echo '</td>';
					echo '<td style="padding-left:20px">';
						echo '<input type="text" name="newInventoryJoinDate" id="calendar" alt="date" class="IP_calendar" title="d.m.Y" value="Dátum">';										
							echo form_dropdown('newInventoryJoinHours', $options2,"", 'onclick="checkInventoryJoinDateTime()" id="hodiny3"' );
							echo '&nbsp' . '<b> : </b>' . '&nbsp';						
							echo form_dropdown('newInventoryJoinMinutes', $options3,"", 'onclick="checkInventoryJoinDateTime()" id="hodiny4"' );
					echo '</td>';
					echo '<td id="newInventoryJoinStatus" style="padding-left:5px">';
						echo "<img src='http://martinbendik.studenthosting.sk/pictures/no.png' height='17' width='18'  style='margin-top:6px'>";
					echo '</td>';
					echo '<td id="newInventoryJoinError" style="font-style: italic; font-size:13px;padding-left:10px">';
					echo '</td>';
					echo '<td id="newInventoryJoinChecker" hidden>';
						echo '0';
					echo '</td>';
				echo '</tr>';
				
				echo '<tr>';
					echo '<td width="120px">';
						echo "Začiatok:";
					echo '</td>';
					echo '<td style="padding-left:20px">';
						echo '<input type="text" name="newInventoryStartDate" id="calendar" alt="date" class="IP_calendar" title="d.m.Y" value="Dátum">';										
							echo form_dropdown('newInventoryStartHours', $options2,"", 'onclick="checkInventoryStartDateTime()" id="hodiny3"' );
							echo '&nbsp' . '<b> : </b>' . '&nbsp';						
							echo form_dropdown('newInventoryStartMinutes', $options3,"", 'onclick="checkInventoryStartDateTime()" id="hodiny4"' );
					echo '</td>';
					echo '<td id="newInventoryStartStatus" style="padding-left:5px">';
						echo "<img src='http://martinbendik.studenthosting.sk/pictures/no.png' height='17' width='18'  style='margin-top:6px'>";
					echo '</td>';
					echo '<td id="newInventoryStartError" style="font-style: italic; font-size:13px;padding-left:10px">';
					echo '</td>';
					echo '<td id="newInventoryStartChecker" hidden>';
						echo '0';
					echo '</td>';
				echo '</tr>';
				
				echo '<tr>';
					echo '<td width="120px">';
						echo "Koniec:";
					echo '</td>';
					echo '<td style="padding-left:20px">';
						echo '<input type="text" name="newInventoryEndDate" id="calendar" alt="date" class="IP_calendar" title="d.m.Y" value="Dátum">';										
							echo form_dropdown('newInventoryEndHours', $options2,"", 'onclick="checkInventoryEndDateTime()" id="hodiny3"' );
							echo '&nbsp' . '<b> : </b>' . '&nbsp';						
							echo form_dropdown('newInventoryEndMinutes', $options3,"", 'onclick="checkInventoryEndDateTime()" id="hodiny4"' );
					echo '</td>';
					echo '<td id="newInventoryEndStatus" style="padding-left:5px">';
						echo "<img src='http://martinbendik.studenthosting.sk/pictures/no.png' height='17' width='18'  style='margin-top:6px'>";
					echo '</td>';
					echo '<td id="newInventoryEndError" style="font-style: italic; font-size:13px;padding-left:10px">';
					echo '</td>';
					echo '<td id="newInventoryEndChecker" hidden>';
						echo '0';
					echo '</td>';
				echo '</tr>';
				
			echo '</table>';
			
			echo '<div class="div_curve2"></div>';
			
			echo '<div id="buttonsId" class="button-group" style="margin-left:50px;margin-top:30px">';
				echo '<a href="javascript:window.history.go(-1);" class="button">Späť</a>';	
				echo '<span id="submitSpan">';
					echo form_submit('submit_new', 'Vytvoriť', 'class="button"');
				echo '<span>';			
			echo '</div>';
			
			echo '<div class="divForInventoryCreate" id="reservationDiv">';
				echo "<h3 style='text-align:center; padding-left:0px'><img src='http://martinbendik.studenthosting.sk/pictures/Exclamation.png' height='20' width='20' align='middle' style='padding-bottom:12px;padding-right:15px'> Vyplnte správne sekciu: Inventúra.</h3>";			
			echo '</div>';
		echo '</div>';	
		
	echo form_close();	
		

		
		
	} else {
		redirect(base_url('main/restricted'));
	}	
?>
	


