timer = null;
IMG = null;
NewWindow_img = null;
function ViewImage(Isrc,title) {
	IMG = new Image;
	IMG.src = Isrc;
	if (typeof(title)=="undefined" || title=="") title="Gallery";
	if (NewWindow_img) { NewWindow_img.close(); }
	if (NewWindow_img==null || NewWindow_img.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_img = window.open("",'Gallery',settings);
	}
	NewWindow_img.document.open();
	NewWindow_img.document.clear();
	NewWindow_img.document.write(
 	 "<html><head><title>"+ title +"</title>"
	+"</head>\n"
	+"<body topmargin=0 leftmargin=0 bgcolor=\"#FFFFFF\" onclick=\"window.close();\">\n"
	+"<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" height=\"100%\"><tr><td align=\"center\" valign=\"middle\"><img src=" + IMG.src + " border=0 alt=\""+title+"\"></td></tr></table>\n"
	+"</body>\n"
	+"</html>"
	);
	NewWindow_img.document.close();
	NewWindow_img.focus();
	timer = setInterval("resize()",250);
}

function resize() {
    if(!IMG.complete){ return; }
    clearInterval(timer);
	resizeWindowTo(NewWindow_img,(IMG.width-18+80),(IMG.height-18+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);
	}
}

    NewWindow=null;
	function ShowItem(src, w, h, title){
		if(NewWindow){NewWindow.close();}
		if(NewWindow==null || NewWindow.closed){
		if (typeof(title)=="undefined") title="Galéria";
			var top = screen.height/2 - h/2;
			var left = screen.width/2 - w/2;
			settings=
				 "left=" + left + "px,"
				 +"top=" + top + "px,"
				 +"width=" + w + "px,"
				 +"height=" + h + "px,"
				 +"toolbar=no,"
				 +"location=no,"
				 +"directories=no,"
				 +"status=no,"
				 +"menubar=no,"
				 +"scrollbars=no,"
				 +"resizable=no";
			NewWindow = window.open("",'Klose',settings);
		}
		NewWindow.document.open();
		NewWindow.document.clear();
		NewWindow.document.write(
			"<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1250\">"
			+"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1250\"><title>"
			+ title +"</title></head>\n"
			+"<body topmargin=0 leftmargin=0 onclick=window.close(); onblur=\"window.close();\" bgcolor=#FFFFFF>\n"
			+"<table width=\"100%\" height=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=0><tr><td align=\"center\" valign=\"middle\"><img src=" + src + " border=1></td></tr></table>\n"
			+"</body>\n"
			+"</html>"
		);
		NewWindow.document.close();
		NewWindow.focus();
	}

	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=no";
			NewWindow1 = window.open(href,'okno',settings);
		}
		NewWindow1.focus();
	}
    
    function PrintDetails(content) {
		if(NewWindow){NewWindow.close();}
		if(NewWindow==null || NewWindow.closed){
			var top = screen.height/2 - 450/2;
			var left = screen.width/2 - 600/2;
		 	settings = "left="+left+",top="+top+",width=600px,height=450px,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>Tlač prihlášky</title></head><style>table {font-size:11px;}</style>\n"
			+"<body topmargin=10 leftmargin=10 onload=\"window.print();\" bgcolor=#FFFFFF style=\"font-family:Tahoma,Arial;font-size:11px;\">\n"
			+ content
			+"</body>\n"
			+"</html>"
		);
		NewWindow.document.close();
		NewWindow.focus();
	}

function check_faq(f){
	if(f.faq_email.value == ""){
		alert("Nezadali ste E-Mailovú adresu!");
		f.faq_email.focus();
		return false;
	} else {
		if (f.faq_msg.value == ""){
			alert("Text správy musíte vyplniť!");
			f.faq_msg.focus();
			return false;
		} else {
			if (window.RegExp){
				re = new RegExp("^[^.]+(\.[^.]+)*@([^.]+[.])+[a-z]{2,3}$");
				if (!re.test(f.faq_email.value)){
					alert("Zadaná e-mailová adresa je neplatná!");
					f.faq_email.focus();
					return false;
				} else {
					return true;
				}
			} else {
				return true;
			}
		}
	}
}

function check_katalog_request(f){
    if(f.firma.value == ""){
        alert("Nezadali ste názov firmy!");
        f.firma.focus();
        return false;
    } else {
        if(f.ulica.value == ""){
            alert("Nezadali ste názov ulice!");
            f.ulica.focus();
            return false;
        } else {
            if(f.mesto.value == ""){
                alert("Nezadali ste názov mesta!");
                f.mesto.focus();
                return false;
            } else {
                if(f.psc.value == ""){
                    alert("Nezadali ste psč!");
                    f.psc.focus();
                    return false;
                } else {
                    if(f.email.value == ""){
                        alert("Nezadali ste Váš e-mail!");
                        f.email.focus();
                        return false;
                    } else {
                        if (window.RegExp){
            				re = new RegExp("^[^.]+(\.[^.]+)*@([^.]+[.])+[a-z]{2,3}$");
			            	if (!re.test(f.email.value)){
            					alert("Zadaná e-mailová adresa je neplatná!");
			            		f.email.focus();
            					return false;
			            	} else {
            					return true;
			            	}
            			} else {
			            	return true;
            			}
                    }
                }
            }
        }
    }
}
