home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Joystick Magazine 2003 November
/
CD1_JOY_153.iso
/
demos
/
NHL2004Demo.exe
/
fe
/
nhl
/
htc
/
tab
/
TeamOptionTab.htc
< prev
Wrap
Text File
|
2003-08-20
|
5KB
|
150 lines
<!-- Copyright (c) 2002 Electronic Arts Inc. All rights reserved. -->
<PUBLIC:COMPONENT tagName="Tab">
<PUBLIC:PROPERTY NAME="imgSrc" />
<PUBLIC:PROPERTY NAME="caption" />
<PUBLIC:PROPERTY NAME="firstTab" />
<PUBLIC:PROPERTY NAME="group" />
<PUBLIC:METHOD NAME="doSelect" />
<ATTACH EVENT="ondocumentready" HANDLER="doInit" />
<ATTACH EVENT="onmousedown" HANDLER="doMouseDown" />
<ATTACH EVENT="onselectstart" HANDLER="cancelCursorSelect" />
<PUBLIC:EVENT NAME="onchange" ID="OnTabChange" />
<script language="javascript">
var aButton = new Array();
var strImgSrc, strImgPath, strImgName, strText,btnText,btnImg, strGroup;
function doInit()
{
strImgSrc = (imgSrc != null) ? System.getInstallFolder() + imgSrc : "fe/NHL/images/button/controller_config_nml.gif";
strImgName = strImgSrc.split('/');
strImgName.reverse();
strImgName = strImgName[0];
strImgPath = strImgSrc.substr(0, strImgSrc.length - strImgName.length);
strText = (caption !=null) ? nhlMsg(caption) : "";
strGroup = (group != null ) ? group : "00";
aButton[ "normal" ] = strImgPath + strImgName;
aButton[ "down" ] = aButton[ "normal" ].toString().replace(/nml/ , "dwn" );
setDefaults();
createButton();
if(firstTab)
doMouseDown();
}
function setDefaults()
{
NormalDefault("fontFamily", "Times New Roman", "Verdana");
NormalDefault("fontSize", "12pt", "7pt");
NormalDefault("fontStyle", "normal", "normal");
NormalDefault("fontWeight", "400", "400");
NormalDefault("cursor", "auto", "hand");
NormalDefault("left", "0px", "0px");
NormalDefault("top", "0px", "0px");
CustomDefault('nml-text-color', 'nmlTextColor', '#666666');
CustomDefault('dwn-text-color', 'dwnTextColor', 'black');
}
function NormalDefault(sCSSName, sIEDefault, sDefault)
{
if (currentStyle[sCSSName] == sIEDefault
&& (style[sCSSName] == "" || style[sCSSName] == null))
{
style[sCSSName] = sDefault;
}
else style[sCSSName] = currentStyle[sCSSName];
}
function CustomDefault(sCSSName, sScriptName, sDefault)
{
if (currentStyle[sCSSName] == null)
{
style[sCSSName] = sDefault;
}
else style[sCSSName] = currentStyle[sCSSName];
style[sScriptName] = style[sCSSName];
}
function createButton()
{
var oImg = element.document.createElement("IMG");
oImg.id = element.id + "_img";
oImg.src = strImgPath + strImgName;
with(oImg.style)
{
position = 'absolute';
top = '0px';//currentStyle.top;
left = '0px';//currentStyle.left;
}
btnImg = oImg;
element.appendChild(oImg);
var oSpan = element.document.createElement("SPAN");
oSpan.id = element.id + "_text";
oSpan.innerText = strText;
with(oSpan.style)
{
position = 'absolute';
fontFamily = 'verdana';
color = currentStyle.nmlTextColor;
fontSize = '7pt';
fontStyle = currentStyle.fontStyle;
fontWeight = currentStyle.fontWeight;
height = String(oImg.clientHeight) + 'px';
width = String(oImg.clientWidth) + 'px';
overflowY = "hidden";
overflowX = "hidden";
paddingTop = "3px";
paddingLeft = "4px";
top = '0px';//currentStyle.top;
left = '0px';//currentStyle.left;
textAlign = 'left';
}
btnText = oSpan;
element.appendChild(oSpan);
}
function doSelect()
{
oAudioInterface.PlayTabSelectSFX();
doMouseDown( true )
}
function doMouseDown( NoEvent )
{
var selectedId = btnText.parentElement.document.body.getAttribute( "selected_" + strGroup );
var oPreviousEl = btnText.parentElement.document.getElementById(selectedId);
if(oPreviousEl != null && btnText.parentElement.id != selectedId)
{
oPreviousEl.childNodes(1).style.color = element.currentStyle.nmlTextColor;
oPreviousEl.childNodes(0).src = aButton[ "normal" ];
oPreviousEl.style.pixelTop = oPreviousEl.style.pixelTop - 1;
}
if(btnText.parentElement.id != selectedId )
{
btnText.style.color = element.currentStyle.dwnTextColor;
btnImg.src = aButton[ "down" ];
btnText.parentElement.style.pixelTop = btnText.parentElement.style.pixelTop + 1;
}
btnText.parentElement.document.body.setAttribute( "selected_" + strGroup , btnText.parentElement.id );
//fire event
if(!NoEvent)
{
var oEvent = createEventObject();
OnTabChange.fire( oEvent );
event.cancelBubble = true;
event.returnValue = false;
}
}
function cancelCursorSelect()
{
event.cancelBubble = true;
event.returnValue = false;
}
</script>
</PUBLIC:COMPONENT>