// JavaScript stranek Kostym.cz pro nastaveni fontu a velikosti pisma

var isOP6 = (window.opera && !document.createComment);
var isIE4 = (document.all && !window.opera);
var isIE5;
var isNS4 = (document.layers);
var isMac = (navigator.appVersion.indexOf("Mac") != -1);
var isWin = (navigator.appVersion.indexOf("Win") != -1);

var font0 = "Courier New, Courier";
var width0 = 600;
var font1 = "Times New Roman, Times";
var width1 = 450;
var font2 = "Monotype Corsiva";
var width2 = 600;
var font3 = "Uechi-Gothic";
var width3 = 600;
var font4 = "Apple Chancery";
var width4 = 600;
var font5 = "Blackmoor LET";
var width5 = 600;

teststr = "ABC&nbsp;aáb&nbsp;cçd&#271;eé&#283;f&nbsp;ghiíjkl&nbsp;mn&#328;oópq&nbsp;r&#345;sšt&#357;uú&#367;vwx&nbsp;yýzž&nbsp;123456789";

var pfont = "Times New Roman, Times";
var pheight = 11;
var pwidth = 381;
var hfont = "Times New Roman, Times";
var hheight = 9;
var hwidth = 333;

if (isNS4 || isOP6 || isIE4){isIE5=0;}
else {isIE5=1;}

if (isIE4) {
  document.write("<span id= 'fntLyr0' style='position: absolute; visibility: hidden; font: 12pt "+font0+"'>"+teststr+"</span>");
  width0 = (isMac) ? fntLyr0.offsetWidth : fntLyr0.scrollWidth;
  document.write("<span id= 'fntLyr1' style='position: absolute; visibility: hidden; font: 12pt "+font1+", "+font0+"'>"+teststr+"</span>");
  width1 = (isMac) ? fntLyr1.offsetWidth : fntLyr1.scrollWidth;
  document.write("<span id= 'fntLyr2' style='position: absolute; visibility: hidden; font: 12pt "+font2+", "+font0+"'>"+teststr+"</span>");
  width2 = (isMac) ? fntLyr2.offsetWidth : fntLyr2.scrollWidth;
  document.write("<span id= 'fntLyr3' style='position: absolute; visibility: hidden; font: 12pt "+font3+", "+font0+"'>"+teststr+"</span>");
  width3 = (isMac) ? fntLyr3.offsetWidth : fntLyr3.scrollWidth;
  document.write("<span id= 'fntLyr4' style='position: absolute; visibility: hidden; font: 12pt "+font4+", "+font0+"'>"+teststr+"</span>");
  width4 = (isMac) ? fntLyr4.offsetWidth : fntLyr4.scrollWidth;
  document.write("<span id= 'fntLyr5' style='position: absolute; visibility: hidden; font: 12pt "+font5+", "+font0+"'>"+teststr+"</span>");
  width5 = (isMac) ? fntLyr5.offsetWidth : fntLyr5.scrollWidth;
  }

if (isIE5) {
  document.write("<span id= 'fntLyr0' style='position: absolute; visibility: hidden; font: 12pt "+font0+"'>"+teststr+"</span>");
  width0 = (isMac) ? document.getElementById("fntLyr0").offsetWidth : document.getElementById("fntLyr0").scrollWidth;
  document.write("<span id= 'fntLyr1' style='position: absolute; visibility: hidden; font: 12pt "+font1+", "+font0+"'>"+teststr+"</span>");
  width1 = (isMac) ? document.getElementById("fntLyr1").offsetWidth : document.getElementById("fntLyr1").scrollWidth;
  document.write("<span id= 'fntLyr2' style='position: absolute; visibility: hidden; font: 12pt "+font2+", "+font0+"'>"+teststr+"</span>");
  width2 = (isMac) ? document.getElementById("fntLyr2").offsetWidth : document.getElementById("fntLyr2").scrollWidth;
  document.write("<span id= 'fntLyr3' style='position: absolute; visibility: hidden; font: 12pt "+font3+", "+font0+"'>"+teststr+"</span>");
  width3 = (isMac) ? document.getElementById("fntLyr3").offsetWidth : document.getElementById("fntLyr3").scrollWidth;
  document.write("<span id= 'fntLyr4' style='position: absolute; visibility: hidden; font: 12pt "+font4+", "+font0+"'>"+teststr+"</span>");
  width4 = (isMac) ? document.getElementById("fntLyr4").offsetWidth : document.getElementById("fntLyr4").scrollWidth;
  document.write("<span id= 'fntLyr5' style='position: absolute; visibility: hidden; font: 12pt "+font5+", "+font0+"'>"+teststr+"</span>");
  width5 = (isMac) ? document.getElementById("fntLyr5").offsetWidth : document.getElementById("fntLyr5").scrollWidth;
  }

if (isOP6) {
  document.write("<table id='idTable0' style='font:12pt "+font0+";position:absolute;visibility:hidden;'><tr><td>"+teststr+"</td></tr></table> ");
  width0 = document.getElementById("idTable0").offsetWidth - 6;
  document.write("<table id='idTable1' style='font:12pt "+font1+", "+font0+";position:absolute;visibility:hidden;'><tr><td>"+teststr+"</td></tr></table> ");
  width1 = document.getElementById("idTable1").offsetWidth - 6;
  document.write("<table id='idTable2' style='font:12pt "+font2+", "+font0+";position:absolute;visibility:hidden;'><tr><td>"+teststr+"</td></tr></table> ");
  width2 = document.getElementById("idTable2").offsetWidth - 6;
  document.write("<table id='idTable3' style='font:12pt "+font3+", "+font0+";position:absolute;visibility:hidden;'><tr><td>"+teststr+"</td></tr></table> ");
  width3 = document.getElementById("idTable3").offsetWidth - 6;
  document.write("<table id='idTable4' style='font:12pt "+font4+", "+font0+";position:absolute;visibility:hidden;'><tr><td>"+teststr+"</td></tr></table> ");
  width4 = document.getElementById("idTable4").offsetWidth - 6;
  document.write("<table id='idTable5' style='font:12pt "+font5+", "+font0+";position:absolute;visibility:hidden;'><tr><td>"+teststr+"</td></tr></table> ");
  width5 = document.getElementById("idTable5").offsetWidth - 6;
  }

if (isNS4) {
  document.write('<LAYER VISIBILITY=HIDE><FONT FACE="'+font0+'" POINT-SIZE=12>'+teststr+'</FONT></LAYER> ');
  fntLyr0 = document.layers[document.layers.length-1];
  width0 = fntLyr0.clip.width;
  document.write('<LAYER VISIBILITY=HIDE><FONT FACE="'+font1+', '+font0+'" POINT-SIZE=12>'+teststr+'</FONT></LAYER> ');
  fntLyr0 = document.layers[document.layers.length-1];
  width1 = fntLyr0.clip.width;
  document.write('<LAYER VISIBILITY=HIDE><FONT FACE="'+font2+', '+font0+'" POINT-SIZE=12>'+teststr+'</FONT></LAYER> ');
  fntLyr0 = document.layers[document.layers.length-1];
  width2 = fntLyr0.clip.width; 
  document.write('<LAYER VISIBILITY=HIDE><FONT FACE="'+font3+', '+font0+'" POINT-SIZE=12>'+teststr+'</FONT></LAYER> ');
  fntLyr0 = document.layers[document.layers.length-1];
  width3 = fntLyr0.clip.width;
  document.write('<LAYER VISIBILITY=HIDE><FONT FACE="'+font4+', '+font0+'" POINT-SIZE=12>'+teststr+'</FONT></LAYER> ');
  fntLyr0 = document.layers[document.layers.length-1];
  width4 = fntLyr0.clip.width;
  document.write('<LAYER VISIBILITY=HIDE><FONT FACE="'+font5+', '+font0+'" POINT-SIZE=12>'+teststr+'</FONT></LAYER> ');
  fntLyr0 = document.layers[document.layers.length-1];
  width5 = fntLyr0.clip.width;
  }

if (width2 != width0) {
  pfont = font2;
  pheight = parseInt(pwidth*12/width2);} 
else {
  if (width4 != width0) {
    pfont = font4;
    pheight = parseInt(pwidth*12/width4);}
  else {
    pfont = font1;
    pheight = parseInt(pwidth*12/width1);}
  }

if (width3 != width0) {
  hfont = font3;
  hheight = parseInt(hwidth*12/width3);}
else {
  if (width5 != width0) {
    hfont = font5;
    hheight = parseInt(hwidth*12/width5);}
  else {
    hfont = font1;
    hheight = parseInt(hwidth*12/width1);}
  }

if (!isNS4) {
document.writeln("<style type='text/css'> body {font-weight: normal; font-style: italic; font-size: "+pheight+"pt; font-family: "+pfont+"; vertical-align: baseline; text-indent: 0; word-spacing: 0; line-height: 100%; color:#221100; margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0;} p, p td {font: normal italic "+pheight+"pt; font-family: "+pfont+"; vertical-align: baseline; text-indent: 0; word-spacing: 0; line-height: 100%; color:#221100; margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0;} a {text-decoration: none;} a:link {color: #CC3300;} a:visited {color: #991100;} a:active {color: #CC3300; text-decoration: underline;} a:hover {color: #CC3300; text-decoration: underline;} h1, h1 p, h1 a, h1 td {font-style: normal; font-size: "+(hheight+7)+"pt; font-family: "+hfont+"; vertical-align: baseline; text-align: center; text-indent: 0; word-spacing: 0; line-height: 100%; margin-top: 4; margin-right: 0; margin-bottom: 5; margin-left: 0;} h2, h2 p, h2 a, h1 td {font-style: normal; font-size: "+(hheight+3)+"pt; font-family: "+hfont+"; vertical-align: baseline; text-align: left; text-indent: 0; word-spacing: 0; line-height: 100%; margin-top: 5; margin-right: 0; margin-bottom: 5; margin-left: 0;} h3, h3 p, h3 a, h1 td {font-style: normal; font-size: "+(hheight+2)+"pt; font-family: "+hfont+"; vertical-align: baseline; text-align: left; text-indent: 0; word-spacing: 0; line-height: 100%; margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0;} h4, h4 p, h4 a, h1 td {font-style: italic; font-size: "+pheight+"pt; font-family: "+pfont+"; vertical-align: baseline; text-align: left; text-indent: 0; word-spacing: 0; line-height: 100%; margin-top: 4; margin-right: 0; margin-bottom: 4; margin-left: 0;} h5, h5 p, h5 a, h1 td {font-style: italic; font-size: "+(pheight-2)+"pt; font-family: "+pfont+"; vertical-align: baseline; text-indent: 0; word-spacing: 0; line-height: 100%; margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0;} h6, h6 p, h6 a, h1 td {font-weight: normal; font-style: italic; font-size: "+(pheight-3)+"pt; font-family: "+pfont+"; vertical-align: baseline; text-indent: 0; word-spacing: 0; line-height: 100%; color:#D0C080; margin-top: 1; margin-right: 0; margin-bottom: 1; margin-left: 0;} h6 a:link {color: #D0C080;} h6 a:visited {color: #D0C080;} h6 a:active {color: #CC3300; text-decoration: underline;} h6 a:hover {color: #CC3300; text-decoration: underline;}</style>");}
else {
document.writeln("<style type='text/css'> body, body td {font-weight: normal; font-style: italic; font-size: "+pheight+"pt; font-family: "+pfont+"; vertical-align: baseline; text-indent: 0; word-spacing: 0; line-height: 100%; color:#221100; margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0;} p, p td {font: normal italic "+pheight+"pt; font-family: "+pfont+"; vertical-align: baseline; text-indent: 0; word-spacing: 0; line-height: 100%; color:#221100; margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0;} a {text-decoration: none;} a:link {color: #CC3300;} a:visited {color: #991100;} a:active {color: #CC3300; text-decoration: underline;} a:hover {color: #CC3300; text-decoration: underline;} h1, h1 p, h1 a, h1 td {font-style: normal; font-size: "+(hheight+7)+"pt; font-family: "+hfont+"; vertical-align: baseline; text-align: center; text-indent: 0; word-spacing: 0; line-height: 100%; margin-top: 4; margin-right: 0; margin-bottom: 5; margin-left: 0;} h2, h2 p, h2 a, h1 td {font-style: normal; font-size: "+(hheight+3)+"pt; font-family: "+hfont+"; vertical-align: baseline; text-align: left; text-indent: 0; word-spacing: 0; line-height: 100%; margin-top: 5; margin-right: 0; margin-bottom: 5; margin-left: 0;} h3, h3 p, h3 a, h1 td {font-style: normal; font-size: "+(hheight+2)+"pt; font-family: "+hfont+"; vertical-align: baseline; text-align: left; text-indent: 0; word-spacing: 0; line-height: 100%; margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0;} h4, h4 p, h4 a, h1 td {font-style: italic; font-size: "+pheight+"pt; font-family: "+pfont+"; vertical-align: baseline; text-align: left; text-indent: 0; word-spacing: 0; line-height: 100%; margin-top: 4; margin-right: 0; margin-bottom: 4; margin-left: 0;} h5, h5 p, h5 a, h1 td {font-style: italic; font-size: "+(pheight-2)+"pt; font-family: "+pfont+"; vertical-align: baseline; text-indent: 0; word-spacing: 0; line-height: 100%; margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0;} h6, h6 p, h6 a, h1 td {font-weight: normal; font-style: italic; font-size: "+(pheight-3)+"pt; font-family: "+pfont+"; vertical-align: baseline; text-indent: 0; word-spacing: 0; line-height: 100%; color:#D0C080; margin-top: 1; margin-right: 0; margin-bottom: 1; margin-left: 0;} h6 a:link {color: #D0C080;} h6 a:visited {color: #D0C080;} h6 a:active {color: #CC3300; text-decoration: underline;} h6 a:hover {color: #CC3300; text-decoration: underline;}</style>");}