function rollOver(element) {
	    //change the colour
    	element.className += (element.className?' ':'') + 'CSStoHighlight';
	    //change display of child
    	for( var x = 0; element.childNodes[x]; x++ ){
	    	if( element.childNodes[x].tagName == 'UL' ) { element.childNodes[x].className += (element.childNodes[x].className?' ':'') + 'CSStoShow'; }
    		if( element.childNodes[x].tagName == 'A' ) { element.childNodes[x].className += (element.childNodes[x].className?' ':'') + 'CSStoHighLink'; }
	    }
    }

    function rollOff(element) {
	    //change the colour
    	element.className = element.className.replace(/ ?CSStoHighlight$/,'');
	    //change display of child
    	for( var x = 0; element.childNodes[x]; x++ ){
	    	if( element.childNodes[x].tagName == 'UL' ) { element.childNodes[x].className = element.childNodes[x].className.replace(/ ?CSStoShow$/,''); }
    		if( element.childNodes[x].tagName == 'A' ) { element.childNodes[x].className = element.childNodes[x].className.replace(/ ?CSStoHighLink$/,''); }
	    }
    }


function start() {
	if (exist(document.myform)){
	document.myform.cena.disabled = true;
	document.myform.cena.style.color='#CECECE';
	}
	onload = start;
	function chgtx() {
	document.myform.cena.disabled = !document.myform.cb.checked;
	document.myform.cena.style.color='#CECECE';
	if (document.myform.cena.disabled == false){
		document.myform.cena.style.color='#3B43FE';
	}
	}
}
function change(){
		var id_user2=document.form.idZaznam.value;
		var kat=document.form.kat.value;
		if(kat==-1){
			odkaz="pridelenie_sluzieb_zakaznikom.html?com=add&idZaznam="+id_user2;
		}else{
			odkaz="pridelenie_sluzieb_zakaznikom.html?com=add&idZaznam="+id_user2+"&com2="+kat;
		}
		location.href=odkaz;
	}
function change2(){
		var id_user2=document.form.idZaznam.value;
		var kat=document.form.kat.value;
		var kat2=document.form.kat2.value;
		if(kat==-1){
			odkaz="pridelenie_sluzieb_zakaznikom.html?com=add&idZaznam="+id_user2+"&com2="+kat;
		}else{
			odkaz="pridelenie_sluzieb_zakaznikom.html?com=add&idZaznam="+id_user2+"&com2="+kat+"&com3="+kat2;
		}
		location.href=odkaz;
	}

function change3(){
		var id_user2=document.form.idZaznam.value;
		var kat=document.form.kat.value;
		if(kat==-1){
			odkaz="komplet1.html?com=add&idZaznam="+id_user2;
		}else{
			odkaz="komplet1.html?com=add&idZaznam="+id_user2+"&com2="+kat;
		}
		location.href=odkaz;
	}

function change4(){
		var id_user2=document.form.idZaznam.value;
		var kat=document.form.kat.value;
		var kat2=document.form.kat2.value;
		if(kat==-1){
			odkaz="komplet1.html?com=add&idZaznam="+id_user2+"&com2="+kat;
		}else{
			odkaz="komplet1.html?com=add&idZaznam="+id_user2+"&com2="+kat+"&com3="+kat2;
		}
		location.href=odkaz;
	}
	
function change5(){
		var id_user2=document.form.idZaznam.value;
		var kat=document.form.kat.value;
		if(kat==-1){
			odkaz="komplet4.html?com=add&idZaznam="+id_user2;
		}else{
			odkaz="komplet4.html?com=add&idZaznam="+id_user2+"&com2="+kat;
		}
		location.href=odkaz;
	}

function change6(){
		var id_user2=document.form.idZaznam.value;
		var kat=document.form.kat.value;
		var kat2=document.form.kat2.value;
		if(kat==-1){
			odkaz="komplet4.html?com=add&idZaznam="+id_user2+"&com2="+kat;
		}else{
			odkaz="komplet4.html?com=add&idZaznam="+id_user2+"&com2="+kat+"&com3="+kat2;
		}
		location.href=odkaz;
	}
function change7(){
		var id_user2=document.form.idZaznam.value;
		var kat=document.form.kat.value;
		if(kat==-1){
			odkaz="karta_zakaznika.html?com=add&idZaznam="+id_user2;
		}else{
			odkaz="karta_zakaznika.html?com=add&idZaznam="+id_user2+"&com2="+kat;
		}
		location.href=odkaz;
	}
function change8(){
		var id_user2=document.form.idZaznam.value;
		var kat=document.form.kat.value;
		var kat2=document.form.kat2.value;
		if(kat==-1){
			odkaz="karta_zakaznika.html?com=add&idZaznam="+id_user2+"&com2="+kat;
		}else{
			odkaz="karta_zakaznika.html?com=add&idZaznam="+id_user2+"&com2="+kat+"&com3="+kat2;
		}
		location.href=odkaz;
	}
function GoBackAuto() {
	history.back();
}	
function client_zone()
	{
		var login=document.client.login.value;
		var passw=document.client.passw.value;
    	if (login.length==0)
		{
	 	 	alert("Zadajte meno!");
	 		document.client.login.focus();
	 		return 0;
   		} 
		else if (passw.length==0)
		{
		    alert ("Zadajte heslo!");
		    document.client.passw.focus();
		    return 0;
		}
  		else{
 			return 1;
		}
	}
function passw_ver(em,emA,pict,zad,zadA)
	{
		var login=document.passw.login.value;
		var email=document.passw.email.value;
		var otazka=document.passw.otazka.value;
		re = new RegExp("^[^@]+@[^.]+\..+$");
		
		if (login.length<4)
		{
		    alert (zad +" - "+ em +"!");
		    document.passw.login.focus();
		    return 0;
		} 
    	else if (email.length<5)
		{
		    alert (zad +" - "+ emA +"!");
		    document.passw.email.focus();
		    return 0;
		} 
		else if (!re.test(email))
		{
			alert(pict +"!");
			document.passw.email.focus();
			return 0;	 
		}
		else if (otazka.length<5)
		{
		    alert (zadA +"?");
		    document.passw.otazka.focus();
		    return 0;
		} 
  		else{
 			return 1;
		}
	}

function newsletter_ver(emA,pict,zad)
	{
		
		var email=document.newsletter.email.value;
		
		re = new RegExp("^[^@]+@[^.]+\..+$");
		
		if (email.length<5)
		{
		    alert (zad +" - "+ emA +"!");
		    document.newsletter.email.focus();
		    return 0;
		} 
		else if (!re.test(email))
		{
			alert(pict +"!");
			document.newsletter.email.focus();
			return 0;	 
		}
  		else{
 			return 1;
		}
	}

	function res_ver(em,emA,pict,zad,zadA,tela,datea,date1a,date2a,osob1a,osob2a)
	{
		var login=document.res.login.value;
		var email=document.res.email.value;
		var tel=document.res.tel.value;
		var date_nar=document.res.date_nar.value;
		var date1=document.res.date1.value;
		var suhlas=document.res.osob8;
		re = new RegExp("^[^@]+@[^.]+\..+$");
		
		if (login.length<4)
		{
		    alert (zad +" - "+ em +"!");
		    document.res.login.focus();
		    return 0;
		} 
    	/*else if (email.length<5)
		{
		    alert (zad +" - "+ emA +"!");
		    document.res.email.focus();
		    return 0;
		} 
		else if (!re.test(email))
		{
			alert(pict +"!");
			document.res.email.focus();
			return 0;	 
		}*/
		else if (tel.length<5)
		{
		    alert (zad +" - "+ tela +"!");
		    document.res.tel.focus();
		    return 0;
		}
		else if (date_nar.length<8)
		{
		    alert (zad +" - "+ osob2a +"!");
		    document.res.date_nar.focus();
		    return 0;
		} 
		else if (date1.length<8)
		{
		    alert (zad +" - "+ datea +" - "+ date1a +"!");
		    document.res.date1.focus();
		    return 0;
		} 
		else if (suhlas.checked == false)
		{
		    alert ("Odsúhlaste evidenciu osobných údajov pre interné potreby spoločnosti MANU!");
		    return 0;
		} 
  		else{
 			return 1;
		}
	}
	
	function res_ver2(em,emA,pict,zad,zadA,tela,datea,date1a,date2a,osob1a,osob2a)
	{
		var login=document.res.login.value;
		var email=document.res.email.value;
		var tel=document.res.tel.value;
		var date_nar=document.res.date_nar.value;
		var date_nar2=document.res.date_nar2.value;
		var suhlas=document.res.osob11.value;
		re = new RegExp("^[^@]+@[^.]+\..+$");
		
		if (login.length<4)
		{
		    alert (zad +" - "+ em +"!");
		    document.res.login.focus();
		    return 0;
		} 
    	else if (email.length<5)
		{
		    alert (zad +" - "+ emA +"!");
		    document.res.email.focus();
		    return 0;
		} 
		else if (!re.test(email))
		{
			alert(pict +"!");
			document.res.email.focus();
			return 0;	 
		}
		else if (tel.length<5)
		{
		    alert (zad +" - "+ tela +"!");
		    document.res.tel.focus();
		    return 0;
		}
		else if (date_nar.length<8)
		{
		    alert (zad +" - "+ osob2a +"!");
		    document.res.date_nar.focus();
		    return 0;
		} 
		else if (date_nar2.length<5)
		{
		    alert (zad +" - "+ osob1a +"!");
		    document.res.date_nar2.focus();
		    return 0;
		} 
  		else{
 			return 1;
		}
	}
	
	function verifyDelete(nazov,presmerovanie) {
    	if (confirm(nazov)) {
	    	location.href=presmerovanie;
    	} else {
		    return false;
	    }
    }
	
	NewWindow1 = null;
	function ShowWin(href, w, h){
		if(NewWindow1){ NewWindow1.close(); }
		if(NewWindow1==null || NewWindow1.closed){
			var top = screen.height/2 - h/2;
			var left = screen.width/2 - w/2;
			var settings =
		 		"left=" + left + "px,"
				+"top=" + top + "px,"
				+"width=" + w + "px,"
				+"height=" + h + "px,"
				+"toolbar=no,"
				+"location=no,"
				+"directories=no,"
				+"status=no,"
				+"menubar=no,"
				+"scrollbars=yes,"
				+"resizable=yes";
			NewWindow1 = window.open(href,'okno',settings);
		}
		NewWindow1.focus();
	}
	NewWindow=null;
	function PrintDetails(content) {
		if(NewWindow){NewWindow.close();}
		if(NewWindow==null || NewWindow.closed){
			var top = screen.height/2 - 160;
			var left = screen.width/2 - 200;
		 	settings = "left="+left+",top="+top+",width=500px,height=420px,toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes"
	 		NewWindow = window.open("",'Detaily',settings);
		}
		NewWindow.document.open();
		NewWindow.document.clear();
		NewWindow.document.write(
			"<html><head><title></title></head><style>table {font-size:11px; border: 1px solid #000;}</style>\n"
			+"<body topmargin=10 leftmargin=10 onload=\"window.print();\" bgcolor=#FFFFFF style=\"font-family:Verdana,Arial;font-size:10px;\">\n"
			+ content
			+"</body>\n"
			+"</html>"
		);
		NewWindow.document.close();
		NewWindow.focus();
	}
	function PrintDetails2(content) {
		if(NewWindow){NewWindow.close();}
		if(NewWindow==null || NewWindow.closed){
			var top = screen.height/2 - 160;
			var left = screen.width/2 - 200;
		 	settings = "left="+left+",top="+top+",width=830px,height=500px,toolbar=no,location=no,directories=no,status=no,menubar=yes,scrollbars=yes,resizable=yes"
	 		NewWindow = window.open("",'Detaily',settings);
		}
		NewWindow.document.open();
		NewWindow.document.clear();
		NewWindow.document.write(
			"<html><head><title></title></head><style>table {font-size:11px; border: 1px solid #000;}</style>\n"
			+"<body topmargin=10 leftmargin=10 onload=\"window.print();\" bgcolor=#FFFFFF style=\"font-family:Verdana,Arial;font-size:10px;\">\n"
			+ content
			+"</body>\n"
			+"</html>"
		);
		NewWindow.document.close();
		NewWindow.focus();
	}

function addEvent(o,e,f){
	if (o.addEventListener){ o.addEventListener(e,f,true); return true; }
	else if (o.attachEvent){ return o.attachEvent("on"+e,f); }
	else { return false; }
}

var timer = null;
var IMG = null;
var NewWindow = null;
function ViewImage(Isrc,title) {
	IMG = new Image;
	IMG.src = Isrc;
	if (typeof(title)=="undefined" || title=="") title="Gallery";
	if (NewWindow) { NewWindow.close(); }
	if (NewWindow==null || NewWindow.closed) {
		settings=
		 "left="+50+","
		 +"top="+50+","
		 +"width="+640+","
		 +"height="+480+","
		 +"toolbar=no,"
		 +"location=no,"
		 +"directories=no,"
		 +"status=no,"
		 +"menubar=no,"
		 +"scrollbars=no,"
		 +"resizable=yes"
		 NewWindow = window.open("",'Gallery',settings);
	}
	NewWindow.document.open();
	//NewWindow.document.clear();
	NewWindow.document.write(
         "<html><head><title>"+ title +"</title>"
        +"</head>\n"
        +"<body onclick=\"window.close();\" style=\"text-align:left;margin:15px;\">\n"
        +"<img src=\"" + IMG.src + "\" border=\"0\" alt=\""+title+"\" />\n"
        +"</body>\n"
        +"</html>"
	);
	NewWindow.document.close();
	NewWindow.focus();
	timer = setInterval("resize()",250);
}

function resize() {
    if(!IMG.complete){ return; }
    clearInterval(timer);
	resizeWindowTo(NewWindow,(IMG.width+40),(IMG.height+100));
	IMG = null;
}

function resizeWindowTo(WindowObject,w,h) {
	if (parseInt(navigator.appVersion)>3) {
		if (navigator.appName=="Netscape") {
			WindowObject.outerWidth=w;
			WindowObject.outerHeight=h;
		}
		else WindowObject.resizeTo(w,h);
	}
}

function ProceedShowImage()
{
    var ImagesAnchors = document.getElementsByTagName('A');
    var Images = null;
    for (var i = 0 ; i < ImagesAnchors.length ; i++)
    {
        if (ImagesAnchors[i].className.indexOf('ShowImage') != -1)
        {
            ImagesAnchors[i].onclick = function() {
                ViewImage(this.href,"Gallery");
                return false;
            };
        }
    }
}


//onload
addEvent(window,'load',ProceedShowImage);