function submitCampaign() {
    alert(document.kampaania.vastus[0].value +" "+ document.kampaania.sober[0].value)
}

function bg(a, change) {
	a.style.backgroundColor = change;
}

function navigate(group) {
	parent.main.document.location.href="main.php?group_id="+ group;
	parent.left.document.location.href="left.php?group_id="+ group;
	parent.menu.document.location.href="top.php?group_id="+ group;
}

function clearField(objField,strDefaultValue) {
    if(objField.value == strDefaultValue) objField.value = '';
}

function restoreField(objField,strDefaultValue) {
    if(objField.value == '') objField.value = strDefaultValue;
}

function colourLinks(doc, links) {
	if(links != null && document.getElementById("link_"+ doc) != null) {
		for(i=0; i<links.length; i++) {
			document.getElementById("link_"+ links[i]).style["color"] = "#FFFFFF";
		}
		document.getElementById("link_"+ doc).style["color"] = "#FFFF00";
	}
}

function changeAmount(product, amount) {
	if(document.getElementById("main_product_"+ product) != null) {
		var total = eval(document.getElementById("main_product_"+ product).innerHTML) + amount;
	} else {
		if(document.getElementById("product_"+ product) != null) {
			var total = eval(document.getElementById("product_"+ product).innerHTML) + amount;
		}
	}
	if(total < 0) {
		var total = 0;
	}
	if(document.getElementById("main_product_"+ product) != null) {
		document.getElementById("main_product_"+ product).innerHTML = total;
	}
	if(document.getElementById("product_"+ product) != null) {
		document.getElementById("product_"+ product).innerHTML = total;
	}
	getCalculateFinalSum("product="+ product +"&number="+ total);
}

function toggle_visibility(id) {
	var e = document.getElementById(id);
	if(e) {
		if(e.style.display == 'none') {
			e.style.display = 'block';
		} else {
			e.style.display = 'none';
		}
	}
}

function open_menu(id, current_boss) {
	var list_of_main_links = l;

	for(i=0; i<list_of_main_links.length; i++) {
		if(list_of_main_links[i] != current_boss) {
			var e = document.getElementById("lahter_"+ list_of_main_links[i]);
			e.style.display = 'none';
		}
	}
	toggle_visibility(id);
}

function show_jur_field() {
		if(document.register.tyyp.options[document.register.tyyp.selectedIndex].value == "eraisik") {
			document.register.adr_jur.disabled = true;
			document.register.workers.disabled = true;
		} else {
			document.register.adr_jur.disabled = false;
			document.register.workers.disabled = false;
		}
	/*
	var e1 = document.getElementById('adr_jur_1');
	var e2 = document.getElementById('adr_jur_2');
	if(e1 && e2) {
		if(document.register.tyyp.options[document.register.tyyp.selectedIndex].value == "eraisik") {
			e1.style.display = 'none';
			e2.style.display = 'none';
		} else {
			e1.style.display = 'block';
			e2.style.display = 'block';
		}
	}
	*/
}

function picture(id) {
	aken = window.open("popup.php?id="+id, "popwindow", "toolbar=no,width=500,height=500,top=0,left="+((screen.width/2)-(450/2))+"");
	aken.focus();
}
