function changeImage(img_id,image_name,source_path) {
	if (!(source_path!=undefined)) {
		source_path = '';
	}
	if (document[img_id]) { // Firefox
		document[img_id].src = source_path+image_name;
	} else {
		var obj = document.getElementById(img_id);
		obj.src = source_path+image_name;
//		alert(document.images[0].toString()) // + ' '+ obj.src);
	}
}
function checkZavazne(value) {
	if (value.checked) {
		return true;
	} else {
		alert('Tento produkt sa dá objednať len so súhlasom objednávateľa so zmluvnými podmienkami.\nProsím potvrďte tento súhlas.');
		return false;
	}
}

function zmazat(action) {
	if (window.confirm('Zmazať?')) {
		if (action!=false) {
			document.formular.action.value=action+'_del';
			document.formular.submit();
		}
		return true;
	} else {
		return false;
	}
}
function MakeFirst() {
	var change = false;
	if (opener_location!='') {
		window.opener.location = opener_location;
		window.opener.focus();
		window.close();
	} else {
		if (db_status!='') {
			alert(db_status);
		}
		if (return_path!='') {
			location = return_path;
		}
	}
}

var pict_main = new Array();
var pict_show = new Array();
pict_main[1] = new Image(); pict_main[1].src = 'gfx/pict1_main.jpg';
pict_show[1] = new Image(); pict_show[1].src = 'gfx/pict1_show.jpg';
pict_main[2] = new Image(); pict_main[2].src = 'gfx/pict2_main.jpg';
pict_show[2] = new Image(); pict_show[2].src = 'gfx/pict2_show.jpg';
pict_main[3] = new Image(); pict_main[3].src = 'gfx/pict3_main.jpg';
pict_show[3] = new Image(); pict_show[3].src = 'gfx/pict3_show.jpg';
pict_main[4] = new Image(); pict_main[4].src = 'gfx/pict4_main.jpg';
pict_show[4] = new Image(); pict_show[4].src = 'gfx/pict4_show.jpg';

function changeClass(where,which) {
	var obj = document.getElementById(where);
	if (obj) {
		obj.className = which;
	}
}

function popupinit() {
}
function login_focus() {
}

var zindex = 10;
var menu_show = false;
var menus_show = false;
function show_menu(name,hide) {
	if (hide != true) {
		hide = false;
	}
	var obj = false;
	if (document.all) {
		var obj = eval('document.all.menu_' + name);
	} else if (document.getElementById) {
		var obj = document.getElementById('menu_'+name);
	}
	if (!hide) {
		if (menu_show!=false && name!=menu_show) {
			changeVisibility('menu_'+menu_show,true);
			changeClass('menu'+menu_show,'menu_main');
		}
		menu_show = name;
	}
	if (obj) {
		var timeout = 0;
		if (!hide) {
			obj.style.zIndex = zindex++;
			// Aby ked sa menu prekryvaju, aby nove bolo stale vyssie
		} else {
			timeout = 100;
			menu_show = false;
		}
 		setTimeout("changeVisibility('menu_"+name+"',"+hide+")",timeout);
	}
}
function enterToSubmit() {
	if (window.event && window.event.keyCode == 13 ) {
		document.formular.submit();
	}
}
function mainMenu(number,classname,showit) {
	var style='main';
	var src = pict_main[number].src;
	if (showit==true) {
		style = 'show';
		src = pict_show[number].src;
	}
	changeClass('main'+number.toString(),classname+'_'+style);
	var obj = document.getElementById('pict'+number.toString());
	if (obj) {
		if(document.images){
			document.images[9+number].src = src;
		}
	}
}
function changeDisplay(name,hide) {
	var visibility = "";
	if (hide) {
		visibility = "none";
	}
	if (document.all) {
		var obj = eval('document.all.' + name);
		if (obj) {
			obj.style.display = visibility;
		}
	} else {
		if (document.getElementById) {
			var obj = document.getElementById(name);
			if (obj) {
				obj.style.display = visibility;
			}
		}
	}
}
function submit_form(name_form) {
	var obj_form = eval('document.'+name_form);
	try {
		obj_form.submit();
	} catch (error) {
   		alert('Error submit: Is the path of all included files correct?');
	}
}
