home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Joystick Magazine 2003 November
/
CD1_JOY_153.iso
/
demos
/
NHL2004Demo.exe
/
fe
/
nhl
/
js
/
dhtml_library.js
< prev
next >
Wrap
Text File
|
2003-08-20
|
34KB
|
1,140 lines
//Copyright (c) 2002 Electronic Arts Inc. All rights reserved.
var aImgs = new Array();
/* BUTTON EVENT HANDLERS */
function doMouseEnter( oEl)
{
oEl.children(0).src = aImgs[ oEl.id + "_hov" ];
if(oEl.children.length > 1 && oEl.children(1).id.toString().match(/caption/))
{
oEl.children(1).style.color = oEl.hovTextColor;
}
}
function doMouseLeave( oEl )
{
oEl.children(0).src = aImgs[ oEl.id + "_nml" ];
if(oEl.children.length > 1 && oEl.children(1).id.toString().match(/caption/))
{
oEl.children(1).style.color = oEl.nmlTextColor;
}
}
function doMouseDown( oEl )
{
oEl.children(0).src = aImgs[ oEl.id + "_dwn" ];
event.cancelBubble = true;
event.returnValue = false;
if(oEl.children.length > 1 && oEl.children(1).id.toString().match(/caption/))
{
oEl.children(1).style.color = oEl.dwnTextColor;
}
}
function doMouseUp( oEl )
{
oEl.children(0).src = aImgs[ oEl.id + "_hov" ];
if(oEl.children.length > 1 && oEl.children(1).id.toString().match(/caption/))
{
oEl.children(1).style.color = oEl.hovTextColor;
}
event.cancelBubble = true;
event.returnValue = false;
}
/* END BUTTON EVENT HANDLERS */
/* TABS */
function doTabMouseLeave( oEl )
{
var selectedId = document.body.getAttribute( "selected" );
if (oEl.id != selectedId)
{
oEl.children(0).src = aImgs[ oEl.id + "_nml" ];
if(oEl.children.length > 1 && oEl.children(1).id.toString().match(/caption/))
{
oEl.children(1).style.color = oEl.nmlTextColor;
}
}
else
{
oEl.children(0).src = aImgs[ oEl.id + "_dwn" ];
if(oEl.children.length > 1 && oEl.children(1).id.toString().match(/caption/))
{
oEl.children(1).style.color = oEl.nmlTextColor;
}
}
if (event != null)
{
event.cancelBubble = true;
event.returnValue = false;
}
}
/* END TABS */
/* BUTTON CONSTRUCTOR */
function initButton( oEl )
{
var strImgSrc = oEl.children(0).src.toString();
aImgs[ oEl.id + "_nml" ] = strImgSrc;
aImgs[ oEl.id + "_hov" ] = aImgs[ oEl.id + "_nml" ].toString().replace( /nml/ , "hov" );
aImgs[ oEl.id + "_dwn" ] = aImgs[ oEl.id + "_nml" ].toString().replace( /nml/ , "dwn" );
}
/* TOGGLE CONSTRUCTOR */
function initToggle( oEl )
{
var strImgSrc = oEl.src.toString();
aImgs[ oEl.id + "_nml" ] = strImgSrc;
aImgs[ oEl.id + "_dwn" ] = aImgs[ oEl.id + "_nml" ].toString().replace( "00.gif" , "01.gif" );
}
/* END TOGGLE CONSTRUCTOR */
/* TOGGLE HANDLERS */
function doSwap( oImg )
{
if(oImg.src.match(/00.gif/))
{
oImg.src = aImgs[ oImg.id + "_dwn" ];
if(oImg.id.match(/off/))
{
oImg.selected = 0;
var oEl;
var strImgId = oImg.id;
strImgId = strImgId.replace(/off/ , "on" );
oEl = document.all[ strImgId ];
oEl.src = aImgs[ strImgId + "_nml" ];
oEl.selected = 1;
}
else
{
oImg.selected = 1;
var strImgId = oImg.id.replace(/on/ , "off" );
oEl = document.all[ strImgId ];
oEl.src = aImgs[ strImgId + "_nml" ];
oEl.selected = 0;
}
}
}
/* END TOGGLE HANDLER */
/* BODY EVENT HANDLERS */
function doBodySelectStart()
{
event.cancelBubble = true;
event.returnValue = false;
}
/* END BODY EVENT HANDLERS */
function setInputText( oTag , sText )
{
oTag.value = nhlMsg( sText );
}
/* Cycler Class */
function Cycler( htmlObj, sIdentifier, nWidth )//htmlObj = html element , sIdentifier = unique identifier
{
this.oHtmlObj = htmlObj;
this.oHtmlObj.Cycler = this;
this.btnPressed = false;
this.btnTimerID = 0;
this.btnDownCounter = 0;
this.sLeftBtn = "btnLeft" + sIdentifier;
this.sRightBtn = "btnRight" + sIdentifier;
this.sText = "text" + sIdentifier;
this.nWidth = nWidth;
this.aItems = new Array();
this.aValues = new Array();
this.nCurIndex = 0;
this.bSimpleArray = true;
this.index = 0;
this.value = 0;
this.text = "";
var strHTML ="<img id=\"" + this.sLeftBtn + "\" style=\"position:absolute;top:0px;left:0px;cursor:hand;\" src=\"../images/cycler/cycle_left_nml.gif\" />";
strHTML +="<img id=\"" + this.sRightBtn + "\" style=\"position:absolute;top:0px;left:14px;;cursor:hand;\" src=\"../images/cycler/cycle_right_nml.gif\" />";
strHTML +="<img style=\"position:absolute;top:0px;left:29px;width:3px;height:20px;\" src=\"../images/cycler/pull_down0_nml.gif\" />";
strHTML +="<img style=\"position:absolute;top:0px;left:32px;width:" + nWidth + "px;height:20px;\" src=\"../images/cycler/pull_down1_nml.gif\" />";
strHTML +="<img style=\"position:absolute;top:0px;left:" +(32 + nWidth) +"px;width:4px;height:20px;\" src=\"../images/cycler/pull_down3_nml.gif\" />";
strHTML +="<span id=\"" + this.sText + "\" style=\"position:absolute;top:0px;left:32px;font-family:Verdana;font-size:7pt;font-weight:bold;color:black;font-style:normal;padding-top:3px;cursor:default;word-wrap:normal;height:16px;width:" + nWidth + "px;overflow:hidden;\">";
strHTML +="</span>";
this.doInit( strHTML );
}
Cycler.prototype.doCyclerLeftClick = function ()
{
var nPreviousIndex = this.nCurIndex - 1;
( nPreviousIndex >= 0 ) ? this.nCurIndex = nPreviousIndex : this.nCurIndex = this.aItems.length - 1;
this.setText( this.aItems[this.nCurIndex]);
this.setCurrentValue();
}
Cycler.prototype.setCurrentValue = function()
{
this.index = this.nCurIndex;
this.value = this.nCurIndex;
this.text = this.aItems[this.nCurIndex];
if(!this.bSimpleArray)
this.value = this.aValues[this.nCurIndex];
}
Cycler.prototype.doCyclerRightClick = function ()
{
var nNextIndex = this.nCurIndex + 1;
( nNextIndex < this.aItems.length ) ? this.nCurIndex = nNextIndex : this.nCurIndex = 0;
this.setText( this.aItems[this.nCurIndex]);
this.setCurrentValue();
//this.doStuff( this.oHtmlObj );
}
Cycler.prototype.doInit = function( sHTML )
{
this.oHtmlObj.insertAdjacentHTML( "afterbegin" , sHTML );
this.initButton( this.oHtmlObj.children(0));
this.initButton( this.oHtmlObj.children(1));
//this.setSelectionIndex(0);
with(this.oHtmlObj.children(0))
{
onmouseup = this.doCyclerMouseUp;
onmousedown = this.doCyclerMouseDown;
onmouseenter = this.doCyclerMouseEnter;
onmouseleave = this.doCyclerMouseLeave;
ondblclick = this.doCyclerDblClick;
}
with(this.oHtmlObj.children(1))
{
onmouseup = this.doCyclerMouseUp;
onmousedown = this.doCyclerMouseDown;
onmouseenter = this.doCyclerMouseEnter;
onmouseleave = this.doCyclerMouseLeave;
ondblclick = this.doCyclerDblClick;
}
}
Cycler.prototype.doCyclerMouseEnter = function( )
{
this.src = aImgs[ this.id + "_hov" ];
var isLeftBtn = (this.id.match(/Left/)!=null) ? 1 : 0;
(isLeftBtn) ? this.parentElement.children(1).src = aImgs[ this.parentElement.children(1).id + "_nml" ] : this.parentElement.children(0).src = aImgs[ this.parentElement.children(0).id + "_nml" ];
event.cancelBubble = true;
event.returnValue = false;
//test.innerHTML += "ENTER<BR>"
}
Cycler.prototype.initButton = function( oEl )
{
var strImgSrc = oEl.src.toString();
aImgs[ oEl.id + "_nml" ] = strImgSrc;
aImgs[ oEl.id + "_hov" ] = aImgs[ oEl.id + "_nml" ].toString().replace( /nml/ , "hov" );
aImgs[ oEl.id + "_dwn" ] = aImgs[ oEl.id + "_nml" ].toString().replace( /nml/ , "dwn" );
}
Cycler.prototype.doCyclerMouseLeave = function( )
{
this.src = aImgs[ this.id + "_nml" ];
this.parentElement.Cycler.btnPressed = false;
event.cancelBubble = true;
event.returnValue = false;
//test.innerHTML += "LEAVE<BR>";
}
Cycler.prototype.doCyclerMouseDown = function( )
{
oCycler = this.parentElement.Cycler;
this.src = aImgs[ this.id + "_dwn" ];
oCycler.btnPressed = true;
oCycler.btnDownCounter = 0;
var isLeftBtn = (this.id.match(/Left/)!=null) ? 1 : 0;
(isLeftBtn) ? this.parentElement.children(1).src = aImgs[ this.parentElement.children(1).id + "_nml" ] : this.parentElement.children(0).src = aImgs[ this.parentElement.children(0).id + "_nml" ];//forcing nml state for other arrow
window.clearInterval(oCycler.btnTimerID); //failsafe
oCycler.btnTimerID = window.setInterval( "setIncrementValue(" + this.parentElement.id + "," + isLeftBtn +")" , 10 );
event.cancelBubble = true;
event.returnValue = false;
//test.innerHTML += "DOWN<BR>";
}
Cycler.prototype.doCyclerDblClick = function( )
{
oCycler = this.parentElement.Cycler;
this.src = aImgs[ this.id + "_dwn" ];
oCycler.btnPressed = true;
oCycler.btnDownCounter = 0;
var isLeftBtn = (this.id.match(/Left/)!=null) ? 1 : 0;
window.clearInterval(oCycler.btnTimerID);
(isLeftBtn) ? oCycler.doCyclerLeftClick(): oCycler.doCyclerRightClick();
oCycler.doStuff( oCycler.oHtmlObj );
event.cancelBubble = true;
event.returnValue = false;
//test.innerHTML += "DOUBLE<BR>";
}
Cycler.prototype.doCyclerMouseUp = function( )
{
oCycler = this.parentElement.Cycler;
this.src = aImgs[ this.id + "_hov" ];
oCycler.btnPressed = false;
oCycler.doStuff( oCycler.oHtmlObj );
event.cancelBubble = true;
event.returnValue = false;
//test.innerHTML += "UP<BR>";
}
Cycler.prototype.setOptionByValue = function( uValue )
{
if(this.bSimpleArray)
return;
for(var nIndex = 0 ; nIndex < this.aValues.length ; nIndex ++ )
{
if(this.aValues[nIndex].toString() == uValue)
{
this.setSelectionIndex(nIndex);
break;
}
}
}
Cycler.prototype.setSelectionIndex = function( nIndex )
{
if(nIndex < this.aItems.length || nIndex >= 0 )
{
this.nCurIndex = nIndex;
this.setCurrentValue();
this.setText( this.aItems[nIndex]);
}
}
Cycler.prototype.setText = function( sText )
{
this.oHtmlObj.children(5).innerText = sText;
}
Cycler.prototype.deleteOptionAtIndex = function( nIndex )
{
if(this.nCurIndex == nIndex )
{
this.setSelectionIndex(nIndex -1 );
}
this.aItems.splice(nIndex, 1 );
this.oHtmlObj.setAttribute("length", this.aItems.length);
if(!this.bSimpleArray)
this.aValues.splice(nIndex, 1 );
}
Cycler.prototype.deleteOptionByValue = function( uValue )//unknown type
{
if(this.bSimpleArray)
return;
for(nIndex = 0 ; nIndex < this.aValues.length ; nIndex ++ )
{
if(this.aValues[nIndex].toString() == uValue)
{
if(this.nCurIndex == nIndex )
this.setSelectionIndex(nIndex -1 );
this.aValues.splice(nIndex, 1 );
this.aItems.splice(nIndex, 1 );
this.oHtmlObj.setAttribute("length", this.aItems.length);
break;
}
}
}
Cycler.prototype.setOptions = function( aItems , bSimpleArray)
{
this.bSimpleArray = bSimpleArray;
this.aItems = new Array();
this.aValues = new Array();
if(bSimpleArray)
{
this.aItems = aItems;
}
else
{
for( var nIndex = 0 ; nIndex < aItems.length ; nIndex+=2 )
{
this.aValues.push(aItems[ nIndex ]);
}
for( var nIndex = 1 ; nIndex < aItems.length ; nIndex+=2 )
{
this.aItems.push(aItems[nIndex]);
}
}
this.oHtmlObj.setAttribute("length", this.aItems.length);
this.setSelectionIndex(0);
}
function setIncrementValue( oObj , bLeft )
{
oCycler = oObj.Cycler;
oCycler.btnDownCounter++;
if ((oCycler.btnPressed) && (oCycler.btnDownCounter > 20))
{
(bLeft) ? oCycler.doCyclerLeftClick(): oCycler.doCyclerRightClick();
}
else if (!oCycler.btnPressed)
{
window.clearInterval(oCycler.btnTimerID);
oCycler.btnDownCounter = 0;
oCycler.btnTimerID = 0;
(bLeft) ? oCycler.doCyclerLeftClick():oCycler.doCyclerRightClick();
}
}
Cycler.prototype.doStuff = function( )
{
}
/* End Cycler Class */
/* Drag and Drop Manager Class */
/*
constructor : DDManager( drag icon , invalid player/team id);
-simply override startDrag and endDrag
-use currentDragElement and currentDropElement. note dropElement may be null if outside a target element
example:
DDManager.prototype.startDrag = function()
{
_DDManager.document.body.oDDManager;
var myDragElement = _DDManager.currentDragElement;
var myDragElement = _DDManager.currentDropElement;
}
*/
function DDManager( oDragEl , nInvalidId)
{
this.dragElements = new Array();
this.dropElements = new Array();
this.srcElement = null;
this.dragStart = false;
this.isDown = false;
this.nInvalidId = nInvalidId;
this.nId = this.nInvalidId;
this.currentDropElement = null;
this.currentDragElement = null;
this.isDragElGrid = false;
this.isDropElGrid = false;
this.draggableElement = oDragEl;
this.nPlayerIDColumn = 0;
this.nGridHiddenLayer = 1;
this.nDelay = 200;
document.body.onmousedown = this.doMouseDown;
document.body.onmouseup = this.doMouseUp;
document.body.onmousemove = this.doMouseMove;
//document.body.onmouseleave = this.doMouseLeave;
document.body.oDDManager = this;
this.browser = new BrowserDetectLite();
}
DDManager.prototype.doMouseLeave = function()
{
_DDManager = document.body.oDDManager;
if(_DDManager.dragStart)
{
_DDManager.draggableElement.style.visibility = 'hidden';
_DDManager.draggableElement.releaseCapture();
document.body.style.cursor = 'default';
_DDManager.dragStart = false;
_DDManager.isDown = false;
_DDManager.currentDropElement = null;
_DDManager.doDragEnd();
}
}
DDManager.prototype.doMouseUp = function()
{
_DDManager = document.body.oDDManager;
_DDManager.isDown = false;
if(!_DDManager.dragStart)
return;
_DDManager.draggableElement.releaseCapture();
_DDManager.dragStart = false;
_DDManager.draggableElement.style.visibility = 'hidden';
document.body.style.cursor = 'default';
_DDManager.doDragEnd();
}
DDManager.prototype.doMouseDown = function()
{
_DDManager = document.body.oDDManager;
_DDManager.isDragElGrid = false;
_DDManager.isDropElGrid = false;
_DDManager.currentDropElement = null;
if(event != null) //IE6
{
_DDManager.srcElement = event.srcElement;
}
if(_DDManager.dragElements[_DDManager.srcElement.id] == undefined || _DDManager.dragElements[_DDManager.srcElement.id] == false)
return;
_DDManager.isDown = true;
_DDManager.setDragElement( _DDManager.srcElement );
if(_DDManager.currentDragElement != null)
(event) ? window.setTimeout("document.body.oDDManager.doDragStart( " + event.y +" ," + event.x +" )" , _DDManager.nDelay) : window.setTimeout("document.body.oDDManager.doDragStart( )" , _DDManager.nDelay);
}
DDManager.prototype.setSrcElement = function( oEl )
{
_DDManager = document.body.oDDManager;
_DDManager.srcElement = oEl;
}
DDManager.prototype.doMouseMove = function()
{
_DDManager = document.body.oDDManager;
if(!_DDManager.dragStart)
return;
_DDManager.currentDropElement = null;
if(_DDManager.dropElements[event.srcElement.id] || _DDManager.dragElements[event.srcElement.id])
{
if(_DDManager.browser.versionMinor != 5.5 )//IE 6. release capture
{
_DDManager.draggableElement.releaseCapture();
}
else if(event.srcElement.tagName != 'OBJECT')//IE5.5 and drop target isnt grid
{
_DDManager.draggableElement.releaseCapture();
}
}
else
{
_DDManager.draggableElement.setCapture(true);
}
if(_DDManager.dropElements[ event.srcElement.id] && _DDManager.currentDropElement == null)//entering on top of a drop element
{
_DDManager.currentDropElement = event.srcElement;
}
if(!_DDManager.dropElements[ event.srcElement.id] && _DDManager.currentDropElement != null)//leaving a drop element
{
_DDManager.currentDropElement = event.srcElement;
_DDManager.draggableElement.setCapture(true);
_DDManager.currentDropElement = null;
}
_DDManager.draggableElement.style.pixelTop = event.clientY + 5;
_DDManager.draggableElement.style.pixelLeft = event.clientX + 5;
if(_DDManager.draggableElement.style.visibility == 'hidden')
_DDManager.draggableElement.style.visibility = 'visible';
}
DDManager.prototype.doDragStart = function( nY , nX )
{
_DDManager = document.body.oDDManager;
if(!_DDManager.isDown) //mouse still down?
{
return;
}
_DDManager.getPlayerId();
_DDManager.currentDragElement.fireEvent("onmouseout");//forcing onmouse out on drag element before setCapture()
_DDManager.draggableElement.setCapture(true);
_DDManager.dragStart = true;
(_DDManager.currentDragElement.tagName == 'OBJECT')?_DDManager.isDragElGrid = true : _DDManager.isDragElGrid = false;
document.body.style.cursor = 'hand';
if(_DDManager.browser.versionMinor != 5.5)
{
_DDManager.draggableElement.style.pixelTop = nY + 5;
_DDManager.draggableElement.style.pixelLeft = nX + 5;
_DDManager.draggableElement.style.visibility = 'visible';
}
_DDManager.startDrag();
window.external.GameInterface.AudioInterface.PlayDragDropClickSFX();
};
DDManager.prototype.startDrag = function()//override if necessary
{
_DDManager = document.body.oDDManager;
createDraggableElement( this.nId );
if(_DDManager.currentDragElement.tagName != 'OBJECT')
_DDManager.currentDragElement.children(1).style.visibility = 'hidden';
};
DDManager.prototype.doDragEnd = function()
{
_DDManager = document.body.oDDManager;
oCurrentDropElement = _DDManager.getCurrentDropElement();
if(oCurrentDropElement != null)
{
(oCurrentDropElement.tagName == 'OBJECT')?_DDManager.isDropElGrid = true : _DDManager.isDropElGrid = false;
}
_DDManager.endDrag();
window.external.GameInterface.AudioInterface.PlayDragDropReleaseSFX();
};
DDManager.prototype.endDrag = function( )//override if necessary
{
_DDManager = document.body.oDDManager;
oCurrentDropElement = _DDManager.getCurrentDropElement();
if(oCurrentDropElement == null)// no drop element, return
{
if(!_DDManager.isDragElGrid && _DDManager.nId != _DDManager.nInvalidId)//no drop element,but drag element was slot so show it again
{
oCurrentDropElement.children(1).style.visibility = 'inherit';
}
return;
}
if(_DDManager.isDragElGrid && !_DDManager.isDropElGrid)//add free agents, grid to slot
{
AddAgentToTalk(_DDManager.nId);
}
else if(!_DDManager.isDragElGrid && _DDManager.isDropElGrid)//remove free agents, slot to grid
{
RemoveAgentFromTalk(_DDManager.nId);
}
else if(!_DDManager.isDragElGrid && !_DDManager.isDropElGrid) //slot to slot
{
//nothing yet
refreshForecasts();
}
};
DDManager.prototype.addDragElement = function( oEl )
{
_DDManager = document.body.oDDManager;
//append new element to array
if(oEl.id !="")
this.dragElements[ oEl.id ] = true;
if(oEl.children.length != 0 )
{
for(nIndex = 0 ; nIndex < oEl.children.length ; nIndex ++ )
{
this.addDragElement(oEl.children(nIndex));
}
}
};
DDManager.prototype.removeDragElement = function( oEl )
{
//check for existence
_DDManager = document.body.oDDManager;
var re = new RegExp(oEl.id);
for(key in _DDManager.dragElements)
{
if(key.toString().match(re))
{
_DDManager.dragElements[key] = false;
}
}
};
DDManager.prototype.addDropElement = function( oEl )
{
//append new element to array
if(oEl.id !="")
this.dropElements[ oEl.id ] = true;
if(oEl.children.length != 0 )
{
for(nIndex = 0 ; nIndex < oEl.children.length ; nIndex ++ )
{
this.addDropElement(oEl.children(nIndex));
}
}
};
DDManager.prototype.removeDropElement = function( oEl )
{
//check for existence
_DDManager = document.body.oDDManager;
var re = new RegExp(oEl.id);
for(key in _DDManager.dropElements)
{
if(key.toString().match(re))
{
_DDManager.dropElements[key] = false;
}
}
};
DDManager.prototype.listDropElements = function()
{
_DDManager = document.body.oDDManager;
var nIndex = 0;
for(key in _DDManager.dropElements)
{
nIndex++;
}
return nIndex;
};
DDManager.prototype.listDragElements = function()
{
_DDManager = document.body.oDDManager;
var nIndex = 0;
for(key in _DDManager.dragElements)
{
nIndex++;
}
return nIndex;
};
/* End Drag and Drop Manager Class */
DDManager.prototype.getPlayerId = function( )
{
_DDManager = document.body.oDDManager;
if(_DDManager.currentDragElement.tagName == 'OBJECT')
{
_DDManager.getPlayerIdFromGrid();
}
else
{
_DDManager.getPlayerIdFromSlot( _DDManager.currentDragElement );
}
};
DDManager.prototype.getPlayerIdFromGrid = function()//override if necessary
{
_DDManager = document.body.oDDManager;
if(aSelectedPlayer[0] == -1 || aSelectedPlayer[0] == _DDManager.nInvalidId)
{
_DDManager.nId = _DDManager.nInvalidId;
return;
}
var oGrid = aSelectedPlayer[1];
_DDManager.nId = oGrid.GetCellDataFromLayer( aSelectedPlayer[0] ,this.nPlayerIDColumn , this.nGridHiddenLayer );
//alert(_DDManager.nId + "=" +aSelectedPlayer[0] +"." + this.nPlayerIDColumn + "." + this.nGridHiddenLayer);
aSelectedPlayer[0] = -1;
};
DDManager.prototype.setDragElement = function( oDragEl )
{
if(oDragEl == null)
{
return;
}
if(oDragEl.tagName =='OBJECT')
{
this.currentDragElement = oDragEl;
return;
}
if(oDragEl.getAttribute("playerId") == null && oDragEl.getAttribute("teamId") == null && oDragEl.getAttribute("rosterId") == null)
{
this.setDragElement( oDragEl.parentElement );
}
else
{
this.currentDragElement = oDragEl;
}
}
DDManager.prototype.setDropElement = function( oDropEl )
{
if(oDropEl == null)
{
return;
}
if(oDropEl.tagName =='OBJECT')
{
this.currentDropElement = oDropEl;
return;
}
if(oDropEl.getAttribute("playerId") == null && oDropEl.getAttribute("teamId") == null && oDropEl.getAttribute("rosterId") == null)
{
this.setDropElement( oDropEl.parentElement );
}
else
{
this.currentDropElement = oDropEl;
}
}
DDManager.prototype.getCurrentDropElement = function()
{
if(this.currentDropElement == null)
return this.currentDropElement;
this.setDropElement(this.currentDropElement);
return this.currentDropElement;
}
DDManager.prototype.getCurrentDragElement = function()
{
return this.currentDragElement;
}
DDManager.prototype.getDropElement = function( oDropEl )
{
_DDManager = document.body.oDDManager;
if(oDropEl.tagName =='OBJECT')
{
_DDManager.currentDropElement = oDropEl;
return;
}
if(oDropEl.getAttribute("playerId") == null && oDropEl.getAttribute("teamId") == null && oDropEl.getAttribute("rosterId") == null)
{
_DDManager.getDropElement( oDropEl.parentElement );
}
else
{
_DDManager.currentDropElement = oDropEl;
}
}
DDManager.prototype.getPlayerIdFromSlot = function( oDragEl )//override if necessary
{
if(oDragEl == null)
{
this.nId = null;
return;
}
if(oDragEl.playerId == undefined && oDragEl.teamId == undefined && oDragEl.rosterId == undefined)
{
this.getPlayerIdFromSlot( oDragEl.parentElement );
}
else
{
if(oDragEl.playerId != undefined)
{
this.nId = oDragEl.playerId;
}
else if(oDragEl.teamId != undefined)
{
this.nId = oDragEl.teamId;
}
else
{
this.nId = oDragEl.rosterId;
}
}
};
DDManager.prototype.getCurrentId = function ()
{
return this.nId;
};
DDManager.prototype.setDelay = function ( nDelay )
{
this.nDelay = nDelay;
};
//init Slider
function initGridScrollBar( oSlider , oGrid )
{
if(oSlider.orient =='vertical' && oGrid.NumRows != -1)
{
if(oGrid.NumElements <= oGrid.NumRows)//disable slider
{
oSlider.style.visibility = 'hidden';
}
else//set max_value and thumbsize
{
oSlider.max_value = oGrid.NumElements - oGrid.NumRows;
oSlider.page_value = oGrid.NumRows;
setVertThumbSize( oSlider , oGrid);
oSlider.style.visibility = 'visible';
oGrid.PageStartRow = 0;
}
}
else
{
nGridWidth = oGrid.GetTotalColWidth( );
nGridVisWidth = getGridWidth( oGrid );
if(oGrid.NumRows == -1 || nGridWidth <= nGridVisWidth )//disable slider
{
oSlider.style.visibility = 'hidden';
}
else//set max_value and thumbsize
{
oSlider.max_value = oGrid.NumColumns - (oGrid.NumColumns - oGrid.ScrollAnchorColumn);
oSlider.page_value = oGrid.NumColumns - oGrid.ScrollAnchorColumn;
setHorThumbSize( oSlider , oGrid );
oSlider.style.visibility = 'visible';
oGrid.CurrentColumn = 0;
}
}
}
// set thumb size
function setVertThumbSize( oSlider, oGrid )
{
nRowHeight = 18;
nGridHeight = oGrid.NumRows * nRowHeight;
nThumbSizeRatio = (nGridHeight + (oSlider.max_value * nRowHeight))/oSlider.track_size;
oSlider.thumb_size = oSlider.track_size / nThumbSizeRatio;
//alert(oSlider.max_value);
}
function setHorThumbSize( oSlider , oGrid)
{
nRowHeight = 18;
var nGridWidth = oGrid.GetTotalColWidth( );
var nGridVisWidth = getGridWidth( oGrid );
if(isNaN(nGridWidth))
alert('grid height not set');
nThumbSizeRatio = (nGridWidth + nGridVisWidth)/oSlider.track_size;
oSlider.thumb_size = oSlider.track_size / nThumbSizeRatio;
}
function getGridWidth( oGrid )
{
var nGridWidth = NaN;
if(!isNaN(oGrid.style.pixelWidth))
{
nGridWidth = parseInt(oGrid.style.pixelWidth);
}
else if(!isNaN(oGrid.width))
{
nGridWidth = parseInt(oGrid.width);
}
return nGridWidth;
}
function BrowserDetectLite() {
var ua = navigator.userAgent.toLowerCase();
// browser name
this.isGecko = (ua.indexOf('gecko') != -1);
this.isMozilla = (this.isGecko && ua.indexOf("gecko/") + 14 == ua.length);
this.isNS = ( (this.isGecko) ? (ua.indexOf('netscape') != -1) : ( (ua.indexOf('mozilla') != -1) && (ua.indexOf('spoofer') == -1) && (ua.indexOf('compatible') == -1) && (ua.indexOf('opera') == -1) && (ua.indexOf('webtv') == -1) && (ua.indexOf('hotjava') == -1) ) );
this.isIE = ( (ua.indexOf("msie") != -1) && (ua.indexOf("opera") == -1) && (ua.indexOf("webtv") == -1) );
this.isOpera = (ua.indexOf("opera") != -1);
this.isKonqueror = (ua.indexOf("konqueror") != -1);
this.isIcab = (ua.indexOf("icab") != -1);
this.isAol = (ua.indexOf("aol") != -1);
this.isWebtv = (ua.indexOf("webtv") != -1);
// spoofing and compatible browsers
this.isIECompatible = ( (ua.indexOf("msie") != -1) && !this.isIE);
this.isNSCompatible = ( (ua.indexOf("mozilla") != -1) && !this.isNS && !this.isMozilla);
// browser version
this.versionMinor = parseFloat(navigator.appVersion);
// correct version number for NS6+
if (this.isNS && this.isGecko) {
this.versionMinor = parseFloat( ua.substring( ua.lastIndexOf('/') + 1 ) );
}
// correct version number for IE4+
else if (this.isIE && this.versionMinor >= 4) {
this.versionMinor = parseFloat( ua.substring( ua.indexOf('msie ') + 5 ) );
}
// correct version number for Opera
else if (this.isOpera) {
if (ua.indexOf('opera/') != -1) {
this.versionMinor = parseFloat( ua.substring( ua.indexOf('opera/') + 6 ) );
}
else {
this.versionMinor = parseFloat( ua.substring( ua.indexOf('opera ') + 6 ) );
}
}
// correct version number for Konqueror
else if (this.isKonqueror) {
this.versionMinor = parseFloat( ua.substring( ua.indexOf('konqueror/') + 10 ) );
}
// correct version number for iCab
else if (this.isIcab) {
if (ua.indexOf('icab/') != -1) {
this.versionMinor = parseFloat( ua.substring( ua.indexOf('icab/') + 6 ) );
}
else {
this.versionMinor = parseFloat( ua.substring( ua.indexOf('icab ') + 6 ) );
}
}
// correct version number for WebTV
else if (this.isWebtv) {
this.versionMinor = parseFloat( ua.substring( ua.indexOf('webtv/') + 6 ) );
}
this.versionMajor = parseInt(this.versionMinor);
this.geckoVersion = ( (this.isGecko) ? ua.substring( (ua.lastIndexOf('gecko/') + 6), (ua.lastIndexOf('gecko/') + 14) ) : -1 );
// platform
this.isWin = (ua.indexOf('win') != -1);
this.isWin32 = (this.isWin && ( ua.indexOf('95') != -1 || ua.indexOf('98') != -1 || ua.indexOf('nt') != -1 || ua.indexOf('win32') != -1 || ua.indexOf('32bit') != -1) );
this.isMac = (ua.indexOf('mac') != -1);
this.isUnix = (ua.indexOf('unix') != -1 || ua.indexOf('linux') != -1 || ua.indexOf('sunos') != -1 || ua.indexOf('bsd') != -1 || ua.indexOf('x11') != -1)
// specific browser shortcuts
this.isNS4x = (this.isNS && this.versionMajor == 4);
this.isNS40x = (this.isNS4x && this.versionMinor < 4.5);
this.isNS47x = (this.isNS4x && this.versionMinor >= 4.7);
this.isNS4up = (this.isNS && this.versionMinor >= 4);
this.isNS6x = (this.isNS && this.versionMajor == 6);
this.isNS6up = (this.isNS && this.versionMajor >= 6);
this.isIE4x = (this.isIE && this.versionMajor == 4);
this.isIE4up = (this.isIE && this.versionMajor >= 4);
this.isIE5x = (this.isIE && this.versionMajor == 5);
this.isIE55 = (this.isIE && this.versionMinor == 5.5);
this.isIE5up = (this.isIE && this.versionMajor >= 5);
this.isIE6x = (this.isIE && this.versionMajor == 6);
this.isIE6up = (this.isIE && this.versionMajor >= 6);
this.isIE4xMac = (this.isIE4x && this.isMac);
}
function xFadeTransition (oImage, sNewImage)
{
oImage.style.filter = "progid:DXImageTransform.Microsoft.Fade(duration=.15);";
oImage.filters[0].Apply();
oImage.src=sNewImage;
oImage.filters[0].Play();
}
function pixelateTransition (oImage, sNewImage)
{
oImage.style.filter = "progid:DXImageTransform.Microsoft.Pixelate(MaxSquare=50, Duration=.3, Enabled=false)";
oImage.filters[0].enabled = true;
oImage.filters[0].Apply();
oImage.src = sNewImage;
oImage.filters[0].Play();
}
var imageFolder = "../images2/widgets/";
function writeButton(divId, label, bGreenBtn, bSmallSize)
{
var s = "";
if (bGreenBtn)
{
s = "<table border=0 cellpadding=0 cellspacing=0 style='cursor:hand' onmouseover='doGreenBtnMouseOver(\"" + divId + "\")' onmouseout='doGreenBtnMouseOut(\"" + divId + "\")'><tr>";
s += "<td><img id='" + divId + "left' src='" + imageFolder + "lg_button_l_green.gif' /></td>";
s += "<td id='" + divId + "middle' background='" + imageFolder + "lg_button_m_green.gif' width=100 align=center><span id='" + divId + "text' class='btnText'>" + label + "</span></td>";
s += "<td><img id='" + divId + "right' src='" + imageFolder + "lg_button_r_green.gif' /></td>";
s += "</tr></table>";
}
else
{
if (bSmallSize)
{
s = "<table border=0 cellpadding=0 cellspacing=0 style='cursor:hand' onmouseover='doBtnMouseOver(\"" + divId + "\", true)' onmouseout='doBtnMouseOut(\"" + divId + "\", true)'><tr>";
s += "<td><img id='" + divId + "left' src='" + imageFolder + "med_button_l.gif' /></td>";
s += "<td id='" + divId + "middle' background='" + imageFolder + "med_button_m.gif' width=200 align=center><span id='" + divId + "text' class='btnText'>" + label + "</span></td>";
s += "<td><img id='" + divId + "right' src='" + imageFolder + "med_button_r.gif' /></td>";
s += "</tr></table>";
}
else
{
s = "<table border=0 cellpadding=0 cellspacing=0 style='cursor:hand' onmouseover='doBtnMouseOver(\"" + divId + "\")' onmouseout='doBtnMouseOut(\"" + divId + "\")'><tr>";
s += "<td><img id='" + divId + "left' src='" + imageFolder + "lg_button_l.gif' /></td>";
s += "<td id='" + divId + "middle' background='" + imageFolder + "lg_button_m.gif' width=100 align=center><span id='" + divId + "text' class='btnText'>" + label + "</span></td>";
s += "<td><img id='" + divId + "right' src='" + imageFolder + "lg_button_r.gif' /></td>";
s += "</tr></table>";
}
}
var divBtn = document.getElementById(divId);
divBtn.innerHTML = s;
}
function doBtnMouseOver(divId, bSmallSize)
{
var oLeft = document.getElementById(divId + "left");
var oMiddle = document.getElementById(divId + "middle");
var oRight = document.getElementById(divId + "right");
var oText = document.getElementById(divId + "text");
if (bSmallSize)
{
oLeft.src = imageFolder + "med_button_l01.gif";
oMiddle.background = imageFolder + "med_button_m01.gif";
oRight.src = imageFolder + "med_button_r01.gif";
}
else
{
oLeft.src = imageFolder + "lg_button_l01.gif";
oMiddle.background = imageFolder + "lg_button_m01.gif";
oRight.src = imageFolder + "lg_button_r01.gif";
}
oText.className = "btnTextGold";
}
function doBtnMouseOut(divId, bSmallSize)
{
var oLeft = document.getElementById(divId + "left");
var oMiddle = document.getElementById(divId + "middle");
var oRight = document.getElementById(divId + "right");
var oText = document.getElementById(divId + "text");
if (bSmallSize)
{
oLeft.src = imageFolder + "med_button_l.gif";
oMiddle.background = imageFolder + "med_button_m.gif";
oRight.src = imageFolder + "med_button_r.gif";
}
else
{
oLeft.src = imageFolder + "lg_button_l.gif";
oMiddle.background = imageFolder + "lg_button_m.gif";
oRight.src = imageFolder + "lg_button_r.gif";
}
oText.className = "btnText";
}
function doGreenBtnMouseOver(divId)
{
var oLeft = document.getElementById(divId + "left");
var oMiddle = document.getElementById(divId + "middle");
var oRight = document.getElementById(divId + "right");
var oText = document.getElementById(divId + "text");
oLeft.src = imageFolder + "lg_button_l_green01.gif";
oMiddle.background = imageFolder + "lg_button_m_green01.gif";
oRight.src = imageFolder + "lg_button_r_green01.gif";
oText.className = "btnTextGold";
}
function doGreenBtnMouseOut(divId)
{
var oLeft = document.getElementById(divId + "left");
var oMiddle = document.getElementById(divId + "middle");
var oRight = document.getElementById(divId + "right");
var oText = document.getElementById(divId + "text");
oLeft.src = imageFolder + "lg_button_l_green.gif";
oMiddle.background = imageFolder + "lg_button_m_green.gif";
oRight.src = imageFolder + "lg_button_r_green.gif";
oText.className = "btnText";
}