home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2001 January
/
Chip_2001-01_cd1.bin
/
firmy
/
Pohoda
/
www
/
Pohoda_files
/
_tbar.js
< prev
next >
Wrap
Text File
|
2000-10-25
|
9KB
|
277 lines
var newLineChar;
newLineChar = String.fromCharCode(10) + String.fromCharCode(13);
var char34 = String.fromCharCode(34);
var LastSTWMenu= "";
var openMenuIDStr = "";
var HTMLStr;
var x = 0;
var y = 0;
var x2 = 0;
var y2 = 0;
var x3 = 0;
var aCurSTWColor = new Array(3);
var ToolbarMenu;
aCurSTWColor[0] = "#4245b5"; // bgcolor;
aCurSTWColor[1] = "white"; // text font color
aCurSTWColor[2] = "red"; // mouseover font color
document.write("<SPAN ID='StartMenu' STYLE='display:none;'></SPAN>");
var ToolbarBGColor = "white";
var STWFont = " STYLE='color: ";
function setSTWMenuColor(bgColor, fontColor, mouseoverColor)
{
if (bgColor != "") aCurSTWColor[0] = bgColor;
if (fontColor != "") aCurSTWColor[1] = fontColor;
if (mouseoverColor != "") aCurSTWColor[2] = mouseoverColor;
HTMLStr =
"<TABLE ID='idToolbar' HEIGHT='80' WIDTH='100%' CELLPADDING=0 CELLSPACING=0 BORDER=0 BGCOLOR=#FFFFFF><TR><TD>" +
"<TABLE ID='idRow1' HEIGHT='20' WIDTH='100%' CELLPADDING=0 CELLSPACING=0 BORDER=0 MARGIN=0><TR>" +
"<TD ID='idSTWBanner' HEIGHT='60' WIDTH='350' ALIGN='left' VALIGN='top'><!--BEG_STW_BANNER--><!--END_STW_BANNER--></TD>" +
"<TD ID='idADSBanner' HEIGHT='60' ALIGN='right' VALIGN='bottom' CLASS='ADSokraj'><!--BEG_ADS_BANNER--><!--END_ADS_BANNER--></TD>" +
"</TR></TABLE>" +
"<TABLE ID='idRow3' HEIGHT='20' VALIGN='top' WIDTH='100%' CELLPADDING=0 CELLSPACING=0 BORDER=0><TR HEIGHT='20' VALIGN='top'>" +
"<TD VALIGN='top' ID='idSTWMenuPane' HEIGHT='20' COLOR=#FFFFFF BGCOLOR=" + aCurSTWColor[0] + " NOWRAP><!--STW_MENU_TITLES--></TD>" +
"</TR></TABLE>" +
"</TD></TR></TABLE>" +
"<SCRIPT LANGUAGE='JavaScript'>" +
" var ToolbarMenu = StartMenu;" +
"</SCRIPT>";
HTMLStr += "<SCRIPT FOR=idToolbar EVENT=onmouseover>hideMenu();</SCRIPT>";
}
function drawToolbar()
{
document.write(HTMLStr);
idToolbar.style.backgroundColor = ToolbarBGColor;
idSTWMenuPane.style.backgroundColor = aCurSTWColor[0];
idSTWMenuPane.style.color = aCurSTWColor[1];
}
function setAds(Gif,Url,AltStr)
{ setBanner(Gif,Url,AltStr,"<!--BEG_ADS_BANNER-->","<!--END_ADS_BANNER-->");
}
function setSTWBanner(Gif,Url,AltStr)
{ setBanner(Gif,Url,AltStr,"<!--BEG_STW_BANNER-->","<!--END_STW_BANNER-->");
}
function setBanner(BanGif, BanUrl, BanAltStr, BanBegTag, BanEndTag)
{
begPos = HTMLStr.indexOf(BanBegTag);
endPos = HTMLStr.indexOf(BanEndTag) + BanEndTag.length;
SubStr = HTMLStr.substring(begPos, endPos);
SrcStr = "";
if (BanUrl != "")
SrcStr += "<A Target='_top' HREF='" + formatURL(BanUrl) + "'>";
SrcStr += "<IMG SRC='" + BanGif + "' ALT='" + BanAltStr + "' BORDER=0>";
if (BanUrl != "")
SrcStr += "</A>";
SrcStr = BanBegTag + SrcStr + BanEndTag;
HTMLStr = HTMLStr.replace(SubStr, SrcStr);
}
function addSTWMenu(MenuIDStr, MenuDisplayStr, MenuHelpStr, MenuURLStr)
{
TBLStr = "<TABLE ALIGN='left' CLASS='menuTBL' CELLPADDING=0 CELLSPACING=0><TR CLASS='menuTR'><!--STW_MENU_TITLES--></TR></TABLE>";
TBLStr += "<TABLE ALIGN='right' CLASS='menuTBL' CELLPADDING=0 CELLSPACING=0><TR CLASS='menuTR'>";
TBLStr += "<TD ID='oDateTime2' BGCOLOR=" + aCurSTWColor[0] + " CLASS='datumTD' NOWRAP" + STWFont + aCurSTWColor[1] + "'></TD>";
TBLStr += "</TR></TABLE>";
if (LastSTWMenu == "") HTMLStr = HTMLStr.replace("<!--STW_MENU_TITLES-->", TBLStr);
tempID = "STW_" + MenuIDStr;
addMenu(tempID, MenuDisplayStr, MenuHelpStr, MenuURLStr);
LastSTWMenu = tempID;
}
function addMenu(MenuIDStr, MenuDisplayStr, MenuHelpStr, MenuURLStr)
{
cColor0 = aCurSTWColor[0];
cColor1 = aCurSTWColor[1];
cColor2 = aCurSTWColor[2];
tagStr = "<!--STW_MENU_TITLES-->";
if (MenuHelpStr == "") MenuHelpStr = MenuDisplayStr;
MenuStr = newLineChar;
MenuStr += "<TD CLASS='mainTD' BGCOLOR=" + aCurSTWColor[0] + " NOWRAP>";
MenuStr += "<A CLASS='menuMain' TARGET='_top'" +
" TITLE=" + char34 + MenuHelpStr + char34;
if (MenuURLStr != "")
MenuStr += " HREF='" + formatURL(MenuURLStr) + "'";
else
MenuStr += " HREF='' onclick='window.event.returnValue=false;'";
MenuStr += " onmouseout=" + char34 + "MvClr(0,'" + MenuIDStr + "'); " + char34 +
" onmouseover=" + char34 + "doMenu('"+ MenuIDStr + "', this); MvClr(1,'" + MenuIDStr + "');" + char34 + "" +
STWFont + aCurSTWColor[1] + "'> "+
MenuDisplayStr + " </A></TD>";
MenuStr += "<TD CLASS='mainTD' " + STWFont + aCurSTWColor[1] + "'>|</TD>";
MenuStr += tagStr;
HTMLStr = HTMLStr.replace(tagStr, MenuStr);
}
function addSTWSubMenu(MenuIDStr, SubMenuStr, SubMenuURLStr)
{
MenuIDStr = "STW_" + MenuIDStr;
cColor0 = aCurSTWColor[0];
cColor1 = aCurSTWColor[1];
cColor2 = aCurSTWColor[2];
var MenuPos = MenuIDStr.toUpperCase().indexOf("MENU");
if (MenuPos == -1) { MenuPos = MenuIDStr.length; }
URLStr = formatURL(SubMenuURLStr);
var LookUpTag = "<!--" + MenuIDStr + "-->";
var sPos = HTMLStr.indexOf(LookUpTag);
if (sPos <= 0)
{
HTMLStr += newLineChar + newLineChar;
HTMLStr += "<SPAN ID='" + MenuIDStr +
"' CLASS='subSPAN' STYLE='background-color:" + cColor0 +
"' onmouseout='hideMenu();'>";
HTMLStr += "<TABLE CLASS='subTABLE' CELLPADDING=0 CELLSPACING=0>";
}
TempStr = newLineChar +
"<TR CLASS='subTR'" +
" onmouseout=" + char34 + "MvClr2(0,'" + MenuIDStr + "', this);" + char34 +
" onmouseover=" + char34 + "MvClr2(1,'" + MenuIDStr + "', this);" + char34 +
" onclick=" + char34 + "window.top.navigate('" + URLStr + "');" + char34 +
"><TD CLASS='subTD' BGCOLOR=" + aCurSTWColor[0] +
"><A CLASS='subF' " +
" HREF='" + URLStr + "' TARGET='_top'" +
STWFont + aCurSTWColor[1] + "'>" +
"" + SubMenuStr + "</A></TD></TR>" + LookUpTag;
if (sPos <= 0)
HTMLStr += TempStr + "</TABLE></SPAN>";
else
HTMLStr = HTMLStr.replace(LookUpTag, TempStr);
}
function addSTWSubMenuLine(MenuIDStr)
{
var LookUpTag = "<!--STW_" + MenuIDStr + "-->";
var sPos = HTMLStr.indexOf(LookUpTag);
if (sPos > 0)
{
TempStr = /*newLineChar + */"<TR><TD BGCOLOR=" + aCurSTWColor[0] + "><HR WIDTH=150 COLOR=" + aCurSTWColor[1] + " SIZE=1 NOSHADE></TD></TR>" + LookUpTag;
HTMLStr = HTMLStr.replace(LookUpTag, TempStr);
}
}
function PruhDatum()
{
if (objDatumTargetA && objDatumTarget && oDateTime)
{
Loaded();
objDatumTargetA.innerText = 'Aktualizovßno ';
sDatum = '' + oDateTime.innerText;
objDatumTarget.innerText = '' + sDatum.substr(6,2) + '.' + sDatum.substr(4,2) + '.' + sDatum.substr(0,4);
if (sShowVisit == 'A')
oDateTime2.innerText = 'Aktualizovßno ' + objDatumTarget.innerText;
else if (sShowVisit == 'D')
{
oDateTime2.innerText = '' + sToday.substr(6,2) + '.' + sToday.substr(4,2) + '.' + sToday.substr(0,4);
oDateTime2.title = 'DneÜnφ datum';
}
}
}
function MvClr(over, MenuIDStr)
{
window.event.srcElement.style.color = aCurSTWColor[over ? 2 : 1];
}
function MvClr2(over, MenuIDStr, obj)
{
obj.children(0).children(0).style.color = aCurSTWColor[over ? 2 : 1];
}
function doMenu(MenuIDStr, obj)
{
var thisMenu = document.all(MenuIDStr);
if (ToolbarMenu == null || thisMenu == null || thisMenu == ToolbarMenu)
{
window.event.cancelBubble = true;
return false;
}
// Reset dropdown menu
window.event.cancelBubble = true;
ToolbarMenu.style.display = "none";
ToolbarMenu = thisMenu;
// Set dropdown menu display position
x = window.event.srcElement.offsetLeft +
window.event.srcElement.offsetParent.offsetLeft;
y = (idRow1.offsetHeight + idRow3.offsetHeight);
// Get main menu width
x2 = x + window.event.srcElement.offsetWidth;
// Get dropdown menu width
x3 = x + 150;
thisMenu.style.top = y;
thisMenu.style.left = x;
thisMenu.style.display = "block";
// delay 2 millsecond to allow the value of ToolbarMenu.offsetHeight be set
window.setTimeout("showMenu()", 2);
return true;
}
function showMenu()
{
if (ToolbarMenu != null)
{
// Get dropdown menu height
y2 = y + ToolbarMenu.offsetHeight;
x3 = x + ToolbarMenu.offsetWidth;
}
}
function hideMenu()
{
if (ToolbarMenu != null && ToolbarMenu != StartMenu)
{
var cX = event.clientX + document.body.scrollLeft;
var cY = event.clientY + document.body.scrollTop;
var bHideMenu = true;
if (cY >= (y - idRow3.offsetHeight+10) && cY < y)
{
if (cX >= (x+5) && cX <= x2) bHideMenu = false;
}
else if (cY >= y && cY <= y2)
{
if (cX > (x+5) && cX <= x3) bHideMenu = false;
}
if (bHideMenu)
{
ToolbarMenu.style.display = "none";
ToolbarMenu = StartMenu;
}
window.event.cancelBubble = true;
}
}
function formatURL(URLStr)
{
return URLStr;
}