// JavaScript Document
function inputOver(objekt) {
	objekt.style.backgroundColor = '#E2E2E2';
}

function inputOut(objekt) {
	objekt.style.backgroundColor = '#FFFFFF';
}

function goUrl(url) {
	document.location.href = url;
}

function kommaReplace(objekt) {
	var string = document.getElementById(objekt).value;
	string.replace(',', '.');
	document.getElementById(objekt).value = string;
}

function todoCheckbox() {
	if(document.getElementById('status').checked == true) {
		document.getElementById('status').checked = true;
		document.getElementById('status').value = '1';
	} else {
		document.getElementById('status').checked = false;
		document.getElementById('status').value = '0';
	}
}

function todoChange(objekt) {
	var suche = objekt.value.search(/pdf.+/);
	if(suche != -1) {
		window.open(objekt.value, 'PDF', '');
	} else {
		document.location.href = objekt.value;
	}
}

function objektCheck() {
	var strasse = document.form.strasse.value;
	var plz = document.form.plz.value;
	var stadt_id = document.form.stadt_id.value;
	var ort = document.form.ort.value;
	window.open('popup_objekt_check.php?strasse='+strasse+'&plz='+plz+'&stadt_id='+stadt_id+'&ort='+ort, 'Check', 'width=300,height=300,top=100,left=100')
}

function wareSpeichern() {
	document.getElementById('modus').value = '2';
	document.wareform.submit();
}

function addLieferant() {
	var anz = document.getElementById('anzahl_lieferanten').value;
	anz = parseInt(anz)+1;
	document.getElementById('anzahl_lieferanten').value = anz; 
	document.wareform.submit();
}

function delLieferant(id, ware) {
	window.open('ware_lieferant_loeschen.php?id='+id+'&waren_id='+ware, 'WL', 'width=300,height=300,top=100,left=100');
}

function addRabatt() {
	var anz = document.getElementById('anzahl_rabatt').value;
	anz = parseInt(anz)+1;
	document.getElementById('anzahl_rabatt').value = anz; 
	document.wareform.submit();
}

function delRabatt(id) {
	window.open('lieferant_rabatt_loeschen.php?id='+id, 'WL', 'width=500,height=350,top=100,left=100');
}

