function ShowProdejceInfo() {
	ShowWindow("shop_prodejce.asp", "610", "450")
}

function ShowDetail(pFile) {
	ShowWindow("shop_pic.asp?pic="+pFile, "610", "450")
}

function ShowProdejce(pID) {
	ShowWindow("shop_prodejce.asp?id="+pID, "500", "350")
}

function ShowWindow() {
	var Okenko, args=ShowWindow.arguments;
	var FNAME = args.length>=1 ? args[0] : "about:blank";
	var iWidth = args.length>=2 ? args[1] : "400";
	var iHeight = args.length>=3 ? args[2] : "300";
	var iOkno = args.length>=4 ? args[3] : "oknoxy";
	var iStatus = args.length>=5 ? args[4] : 1;
	var iScroll = args.length>=6 ? args[5] : 1;
	var iParam = "width="+iWidth+",height="+iHeight+",fullscreen=0,scrollbars="+iScroll+",toolbar=0,location=0,directories=0,status="+iStatus+",menubar=0,copyhistory=0";
	Okenko = window.open(FNAME,iOkno,iParam);
	Okenko.focus();
}

function MakeImg(XSrc, XText, XAlign, XWidth, XHeight) {
	document.write("<table border='0' align='" + XAlign + "'>");
	document.write("<caption valign=bottom align=center nowrap class='nadpisLight'>" + XText + "<br>foto:&nbsp;<a href=mailto:michal.bily@email.cz><font color=#000099>Mgr.&nbsp;Michal&nbsp;Bílý</font></a></caption>");
	document.write("<tr><td align=center nowrap><img src='" + XSrc + "' ");
	if (XWidth != '') { document.write(" width=" + XWidth+ " "); }
	if (XHeight != '') { document.write(" height=" + XHeight + " "); }
	document.write("></td></tr></table>");
}

function MakeImg2(XSrc, XText, XAlign, XWidth, XHeight) {
	document.write("<table border='0' align='" + XAlign + "'>");
	document.write("<caption valign=bottom align=center nowrap class='nadpisLight'>" + XText + "</caption>");
	document.write("<tr><td align=center nowrap><img src='" + XSrc + "' ");
	if (XWidth != '') { document.write(" width=" + XWidth+ " "); }
	if (XHeight != '') { document.write(" height=" + XHeight + " "); }
	document.write("></td></tr></table>");
}

function isEmail(inputik) {
	var re = /^([\w\-]+\.)*([\w\-]+)\@([\w\-]+\.)+\w{2,}$/
	return re.test(eval(inputik+".value"))
}

function isCorrectEmail(inputik,useAlert) {
	var s = eval(inputik+".value")
	if (!((s.length==0) || (isEmail(inputik)))) {
		if (useAlert)
			alert("Chybně zadaný email!\nProsím zadejte správný email nebo nechte políčko nevyplněné.")
		return false
	} else {
		return true
	}
}

function isEmpty(inputik,useAlert) {
	var s = eval(inputik)
	if (s.value.length==0) {
		if (useAlert)
			alert("Políčko "+s.name+" nesmí zůstat nevyplněné.")
		return false
	} else {
		return true
	}
}


function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
		var anchor = anchors[i];
		if (anchor.getAttribute("href")) {
			switch (anchor.getAttribute("rel")) {
				case "external":
					anchor.target = "_blank";
					break;
				case "picture":
					anchor.href = "javascript:doPicturePopup('" + anchor.href + "');";
					break;
			}
		}
	}
}

function doPicturePopup(url) {
	var o = window.open("about:blank", "popup", "width=250,height=150,fullscreen=0,scrollbars=0,toolbar=0,location=0,directories=0,status=0,menubar=0,copyhistory=0");
	var s = "<html>\n";
	s += "<head>\n";
	s += "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1250\" />\n";
	s += "<meta http-equiv=\"Content-language\" content=\"cs\" />\n";
	s += "<meta http-equiv=\"expires\" content=\"-1\" />\n";
	s += "<meta http-equiv=\"pragma\" content=\"no-cache\" />\n";
	s += "<meta http-equiv=\"cache-control\" content=\"private\" />\n";
	s += "<title>Obrázek / aerobics.cz</title>\n";
	s += "</head>\n";
	s += "<body style=\"margin:0\">\n";
	s += "<h1 style=\"font-size:20px;font-family:sans-serif;width:250px;z-index:0;position:absolute;text-align:center;height:150px;background:url(design/bg-status.gif) center no-repeat;\"><span style=\"display:none\">Nahrávám obrázek...</span></h1>\n";
	s += "<a href=\"javascript:self.close();self.opener.focus();\" style=\"display:block;text-align:center;z-index:1;position:absolute;top:0\"><img name=\"obrazek\" src=\"" + url + "\" style=\"border:0;z-index:1;position:absolute;\" onload=\"resizeTo(this.width+20, this.height+40)\" alt=\"Kliknutím zavřete okno\" /></a>\n";
	s += "</body>\n";
	s += "</html>";
	o.document.write(s);
	o.focus();
}

window.onload = externalLinks;
