
Function.prototype.bind = fnBind;
function fnBind(_this)
{
var ptr = this;
return function(args) { ptr.call(_this, args) };
}
function Sys_Objectware()
{
this.onMouseMove = new Array();
this.onMouseDown = new Array();
this.onMouseUp = new Array();
this.onResize = new Array();
this.onScroll = new Array();
this.bDebugShowing = false;
this.EnableDebugging = false;
this.BodyLoaded = false;
this.debugHTML = '';
this.arActivateElems = new Array();
this.arPopupElems = new Array();
this.ModalCancel = null;
this._bodyOnLoads = new Array();
this.Init();
}
Sys_Objectware.prototype.AddWindowOnload = fnAddWindowOnload;
Sys_Objectware.prototype.FireOnClick = fnFireOnClick;
Sys_Objectware.prototype.CopyValue = fnCopyValue;
Sys_Objectware.prototype.ShowElementById = fnShowElementById;
Sys_Objectware.prototype.HideElementById = fnHideElementById;
Sys_Objectware.prototype.ShowElement = fnShowElement;
Sys_Objectware.prototype.HideElement = fnHideElement;
Sys_Objectware.prototype.AddOnMouseMove = fnAddOnMouseMove;
Sys_Objectware.prototype.AddOnMouseDown = fnAddOnMouseDown;
Sys_Objectware.prototype.AddOnMouseUp = fnAddOnMouseUp;
Sys_Objectware.prototype.AddOnResize = fnAddOnResize;
Sys_Objectware.prototype.AddOnScroll = fnAddOnScroll;
Sys_Objectware.prototype.RemoveOnMouseMove = fnRemoveOnMouseMove;
Sys_Objectware.prototype.RemoveOnMouseDown = fnRemoveOnMouseDown;
Sys_Objectware.prototype.RemoveOnMouseUp = fnRemoveOnMouseUp;
Sys_Objectware.prototype.RemoveOnResize = fnRemoveOnResize;
Sys_Objectware.prototype.RemoveOnScroll = fnRemoveOnScroll;
Sys_Objectware.prototype.MakeElementDraggable = fnMakeElementDraggable;
Sys_Objectware.prototype.Debug = fnDebug;
Sys_Objectware.prototype.GetAbsoluteLeft = fnGetAbsoluteLeft;
Sys_Objectware.prototype.GetAbsoluteTop = fnGetAbsoluteTop;
Sys_Objectware.prototype.GetAbsolutePos = fnGetAbsolutePos;
Sys_Objectware.prototype.CloneObject = fnCloneObject;
Sys_Objectware.prototype.CopyValues = fnCopyValues;
Sys_Objectware.prototype.SetCookie = fnSetCookie;
Sys_Objectware.prototype.DeleteCookie = fnDeleteCookie;
Sys_Objectware.prototype.GetCookie = fnGetCookie;
Sys_Objectware.prototype.EnableDebug = fnEnableDebug;
Sys_Objectware.prototype.DisableDebug = fnDisableDebug;
Sys_Objectware.prototype.InitDebug = fnInitDebug;
Sys_Objectware.prototype.DisplayObject = fnDisplayObject;
Sys_Objectware.prototype.WindowTop = fnWindowTop;
Sys_Objectware.prototype.WindowLeft = fnWindowLeft;
Sys_Objectware.prototype.WindowRight = fnWindowRight;
Sys_Objectware.prototype.WindowBottom = fnWindowBottom;
Sys_Objectware.prototype.DocumentRight = fnDocumentRight;
Sys_Objectware.prototype.DocumentBottom = fnDocumentBottom;
Sys_Objectware.prototype.ScreenTop = fnScreenTop;
Sys_Objectware.prototype.ScreenLeft = fnScreenLeft;
Sys_Objectware.prototype.ScreenBottom = fnScreenBottom;
Sys_Objectware.prototype.CenterObject = fnCenterObject;
Sys_Objectware.prototype.MaximizeObject = fnMaximizeObject;
Sys_Objectware.prototype.SetObjectTransparency = fnSetObjectTransparency;
Sys_Objectware.prototype.MoveObject = fnMoveObject;
Sys_Objectware.prototype.ObjectVisible = fnObjectVisible;
Sys_Objectware.prototype.ObjectHit = fnObjectHit;
Sys_Objectware.prototype.AddPopup = fnAddPopup;
Sys_Objectware.prototype.RemovePopup = fnRemovePopup;
Sys_Objectware.prototype.ShowPopup = fnShowPopup;
Sys_Objectware.prototype.CopyObject = fnCopyObject;
Sys_Objectware.prototype.NumberToString = fnNumberToString;
Sys_Objectware.prototype.Round = fnRound;
Sys_Objectware.prototype.ValidObject = fnValidObject;
Sys_Objectware.prototype.DoModal = doModal;
Sys_Objectware.prototype.GrayScreen = fnGrayScreen;
Sys_Objectware.prototype.SetModalBackgroundColor = fnSetModalBackgroundColor;
Sys_Objectware.prototype.UnGrayScreen = fnUnGrayScreen;
Sys_Objectware.prototype.RightAlignAndCenterToElement = fnRightAlignAndCenterToElement;
Sys_Objectware.prototype.ScrollToTop = fnScrollToTop;
Sys_Objectware.prototype.CreateFloatingIFrame = fnCreateFloatingIFrame;
Sys_Objectware.prototype.DestroyFloatingIFrame = fnDestroyFloatingIFrame;
Sys_Objectware.prototype.AddPopupClick = fnAddPopupClick;
Sys_Objectware.prototype.Init = fnInit;
Sys_Objectware.prototype.HandleTabKeyDown = fnHandleTabKeyDown;
Sys_Objectware.prototype.RunBodyOnloads = fnRunBodyOnLoads;
Sys_Objectware.prototype.AddBodyOnLoad = fnAddBodyOnLoad;
Sys_Objectware.prototype.GetDimensions = fnGetDimensions;
Sys_Objectware.prototype.AddOnClickScript = fnAddOnClickScript;
Sys_Objectware.prototype.MouseInElement = fnMouseInElement;
Sys_Objectware.prototype.GetWindowScrollY = fnGetWindowScrollY;
Sys_Objectware.prototype.DoModalOutOfStock = doModalOutOfStock;
function fnInit()
{
var ptr = this;
this.AddWindowOnload(function(){ ptr.BodyLoaded = true; ptr.RunBodyOnloads(); });
document.onmousemove = _handleMouseMove.bind(this);
document.onmousedown = _handleMouseDown.bind(this);
document.onmouseup = _handleMouseUp.bind(this);
document.onresize = _handleResize.bind(this);
window.onscroll = _handleScroll.bind(this);
this.Debug('Sys_Objectware Initialized...');
}
var bPopUpVisible = false;
var bUseIfrm = false;
var ifrmPopup = null;
var loadIFRAME = function()
{
//if ( /FIREFOX/.test(navigator.userAgent.toUpperCase()) ) 
//return;
ifrmPopup = document.createElement('iframe');
if ( typeof ifrmPopup != 'undefined' && ifrmPopup != null )
{
ifrmPopup.style.backgroundColor = '#FFFFFF';
ifrmPopup.style.position = 'absolute';
ifrmPopup.frameBorder = 0;
ifrmPopup.border = 0;
ifrmPopup.style.border = 0;
ifrmPopup.style.visibility = 'hidden';
ifrmPopup.style.display = 'none';
ifrmPopup.src = 'javascript:false';
ifrmPopup.id = 'currentModalIframe';
document.body.appendChild(ifrmPopup);
bUseIfrm = true;
}
}
fnAddWindowOnload(loadIFRAME);
function _handleMouseMove(e)
{
var x = 0;
var y = 0;
if ( !e )
{
e = window.event;
x = e.clientX + document.body.scrollLeft;
y = e.clientY + document.body.scrollTop;
}
else
{
x = e.pageX;
y = e.pageY;       
}
this.CurrentMouseX = x;
this.CurrentMouseY = y;
for( var n=0; n < this.onMouseMove.length; n++ )
{
if ( this.onMouseMove[n](x,y) )
{
if ( e && typeof e.preventDefault != 'undefined' )
e.preventDefault();
if ( event )
{
if ( typeof event.stopPropagation != 'undefined' )
event.stopPropagation();
event.returnValue = false;
event.cancelBubble = true;
}
return false;
}
}
for( var i=0; i < this.arActivateElems.length; i++ )
{
var activate = document.getElementById(this.arActivateElems[i]);
var popup = document.getElementById(this.arPopupElems[i]);
if ( Sys_Objectware.ValidObject(activate) )
{
if ( Sys_Objectware.ObjectHit(activate, x, y) )
{
if ( !bPopUpVisible )
{
Sys_Objectware.ShowPopup(popup, x, y);
if ( bUseIfrm && ifrmPopup != null )
{
ifrmPopup.style.zIndex = popup.style.zIndex - 1;
ifrmPopup.style.left = popup.style.left;
ifrmPopup.style.top = popup.style.top;
ifrmPopup.style.width = popup.offsetWidth + 'px';
ifrmPopup.style.height = popup.offsetHeight + 'px';
if ( !Sys_Objectware.ObjectVisible(ifrmPopup) )
Sys_Objectware.ShowElement(ifrmPopup);
}
bPopUpVisible = true;
}
}
else
{
if ( Sys_Objectware.ObjectVisible(popup) && !Sys_Objectware.ObjectHit(popup, x,y) )
{
Sys_Objectware.HideElement(popup);
if ( ifrmPopup != null )
Sys_Objectware.HideElement(ifrmPopup);
bPopUpVisible = false;
}
}
}
}
}
var bList = 0;
function _handleMouseDown( e )
{
for( var n=0; n < this.onMouseDown.length; n++ )
{
if ( this.onMouseDown[n](this.CurrentMouseX,this.CurrentMouseY) )
{
if ( e && typeof e.preventDefault != 'undefined' )
e.preventDefault();
if ( event )
{
event.returnValue = false;
event.cancelBubble = true;
}
return false;
}
}
}
function _handleScroll( e )
{
for( var n=0; n < this.onScroll.length; n++ )
{
if ( this.onScroll[n]() )
{
if ( e && typeof e.preventDefault != 'undefined' )
e.preventDefault();
if ( event )
{
event.returnValue = false;
event.cancelBubble = true;
}
return false;
}
}
}
function _handleResize( e )
{
for( var n=0; n < this.onResize.length; n++ )
{
if ( this.onResize[n]() )
{
if ( e && typeof e.preventDefault != 'undefined' )
e.preventDefault();
if ( event )
{
event.returnValue = false;
event.cancelBubble = true;
}
return false;
}
}
}
function _handleMouseUp( e )
{
for( var n=0; n < this.onMouseUp.length; n++ )
{
if ( this.onMouseUp[n](this.CurrentMouseX,this.CurrentMouseY) )
{
if ( e && typeof e.preventDefault != 'undefined' )
e.preventDefault();
if ( event )
{
event.returnValue = false;
event.cancelBubble = true;
}
return false;
}
}
}
function fnAddPopup(activateElem, popupElem )
{
this.arActivateElems.push(activateElem);
this.arPopupElems.push(popupElem);
}
function fnRemovePopup(activateElem, popupElem)
{
var array1 = new Array();
var array2 = new Array();
for( var n=0; n < this.arActivateElems.length; n++ )
{
if ( this.arActivateElems[n] != activateElem )
{
array1.push(this.arActivateElems[n]);
array2.push(this.arPopupElems[n]);
}
}
this.arActivateElems = array1;
this.arPopupElems = array2;
}
function fnInitDebug()
{
if ( !this.EnableDebugging )
return;
if ( !this.bDebugShowing )
{ 
var divHeader = document.createElement('div');
divHeader.style.backgroundColor = '#8080ff';
divHeader.innerHTML = 'Debug Window';
divHeader.style.width = '200px';
divHeader.style.height = '20px';
divHeader.style.position = 'relative';
this.divDebug = document.createElement('textarea');

this.divDebug.style.overflow = 'auto';
this.divDebug.style.backgroundColor = '#ffffff';
this.divDebug.style.width = '200px';
this.divDebug.style.height = '400px';
this.divDebug.style.position = 'relative';
var divDebugWindow = document.createElement('div');
divDebugWindow.appendChild(divHeader);
divDebugWindow.appendChild(this.divDebug);
divDebugWindow.style.zIndex = 10000;
divDebugWindow.style.position = 'absolute';
divDebugWindow.style.height = '420px';
divDebugWindow.style.width = divHeader.style.width;
if ( this.GetCookie('DebugLocation') != null )
{
var cookie = this.GetCookie('DebugLocation');
try
{
divDebugWindow.style.left = cookie.split(',')[0];
divDebugWindow.style.top = cookie.split(',')[1];
if ( divDebugWindow.style.left < 0 )
divDebugWindow.style.left = 0;
if ( divDebugWindow.style.top < 0 )
divDebugWindow.style.top = 0;
}
catch(e)
{
divDebugWindow.style.left = 0;
divDebugWindow.style.top = 0;
}
}
else
{
divDebugWindow.style.left = 0;
divDebugWindow.style.top = 0;
}
document.body.appendChild(divDebugWindow);
var ptr = this;
var funcMouseUp = function(elem, args) 
{
if ( elem.MoveParent )
{
args.x = elem.parentNode.style.left;
args.y = elem.parentNode.style.top;


}
else
{
args.x = elem.style.left;
args.y = elem.style.top;
}
var sLocation = args.x + ',' + args.y;
ptr.SetCookie('DebugLocation', sLocation);
}
this.MakeElementDraggable(divHeader, true, null, funcMouseUp,null);
this.divDebug.innerHTML += this.debugHTML;
this.bDebugShowing = true;
}
}
function fnDebug(sDebug)
{
if ( !this.divDebug )
{
this.debugHTML += sDebug + '\r\n';
return;
}
this.divDebug.value += sDebug + '\r\n';
}
function fnEnableDebug()
{
this.EnableDebugging = true;
this.AddWindowOnload(this.InitDebug.bind(this));
this.Debug('Debugging Enabled');
}
function fnDisableDebug()
{
this.EnableDebugging = false;
}
function fnMakeElementDraggable(elem, bMoveParent, fBeginDragging, fEndDragging, fDragging)
{
elem.style.cursor = 'move';
elem.IsDragging = false;    
elem.BeginDragging = fBeginDragging;
elem.EndDragging = fEndDragging;
elem.Dragging = fDragging;
elem.MoveParent = bMoveParent;
var ptr = this;
var funcMouseMove = function(x,y) 
{ 
if ( elem.IsDragging )
{
var dragElem = elem;
if ( elem.MoveParent )
dragElem = elem.parentNode;
var newX = x - elem.HitOffsetX;
var newY = y - elem.HitOffsetY;
if ( newX < 0 )
newX = 0;
if ( newY < 0 )
newY = 0;
dragElem.style.left = newX + 'px';
dragElem.style.top = newY + 'px';
if ( elem.Dragging )
{
var args = new Object();
args.x = x;
args.y = y;
elem.Dragging(elem, args);
}
return true;    
}
return false;
};
var funcMouseDown = function(x,y)
{
var elemLeft = Sys_Objectware.GetAbsoluteLeft(elem);
var elemTop = Sys_Objectware.GetAbsoluteTop(elem);
var elemWidth = elem.offsetWidth;
var elemHeight = elem.offsetHeight;
if ( x >= elemLeft && x <= elemLeft + elemWidth )
{
if ( y >= elemTop && y <= elemTop + elemHeight )
{
elem.IsDragging = true;
elem.HitOffsetX = x - elemLeft;
elem.HitOffsetY = y - elemTop;   
if ( elem.BeginDragging )
{
var args = new Object();
args.x = x;
args.y = y;
elem.BeginDragging(elem, args);
}
var dragElem = elem;
if ( elem.MoveParent )
dragElem = elem.parentNode;
if ( dragElem.style.position != 'absolute' )
{
var elemX = Sys_Objectware.GetAbsoluteLeft(dragElem);
var elemY = Sys_Objectware.GetAbsoluteTop(dragElem);
dragElem.style.position = 'absolute';
dragElem.style.left = elemX;
dragElem.style.top = elemY;
dragElem.style.zIndex = 10000;
}
return true;
}
}
return false;
};
var funcMouseUp = function(x, y)
{
if ( elem.IsDragging )
{
if ( elem.EndDragging != null )
{
var args = new Object();
args.x = x;
args.y = y;
elem.EndDragging(elem, args);
}
elem.IsDragging = false;
}
};
elem.OnMouseMove = funcMouseMove;
elem.OnMouseDown = funcMouseDown;
elem.OnMouseUp = funcMouseUp;
this.AddOnMouseMove(funcMouseMove);
this.AddOnMouseDown(funcMouseDown);
this.AddOnMouseUp(funcMouseUp);
}
function fnAddWindowOnload(func) 
{
if (window.addEventListener) 
window.addEventListener("load",func,false);
else if (window.attachEvent) 
window.attachEvent("onload",func);
else
{
var oldFunc = window.onload ? window.onload : new Function;
var newFunc = function()
{
if ( oldFunc )
oldFunc();
func(); 
}
window.onload = newFunc;        
}
}
function fnAddOnMouseMove(func)
{
this.onMouseMove.push(func);
}
function fnRemoveOnMouseMove(func)
{
var arNewMoves = new Array();
for( var n=0; n < this.onMouseMove.length; n++ )
{
if ( this.onMouseMove[n] != func )
arNewMoves.push(this.onMouseMove[n]);
}    
this.onMouseMove = arNewMoves;
}
function fnAddOnMouseDown(func)
{
this.onMouseDown.push(func);
}
function fnRemoveOnMouseDown(func)
{
var arNewDowns = new Array();
for( var n=0; n < this.onMouseDown.length; n++ )
{
if ( this.onMouseDown[n] != func )
arNewDowns.push(this.onMouseDown[n]);
}    
this.onMouseDown = arNewDowns;
}
function fnAddOnMouseUp(func)
{
this.onMouseUp.push(func);
}
function fnRemoveOnMouseUp(func)
{
var arNewUps = new Array();
for( var n=0; n < this.onMouseUp.length; n++ )
{
if ( this.onMouseUp[n] != func )
arNewUps.push(this.onMouseUp[n]);
}   
this.onMouseUp = arNewUps;
}
function fnFireOnClick(elem)
{
 
if ( !Sys_Objectware.ObjectVisible(elem) )
{
Sys_Objectware.ShowElement(elem);
elem.style.position = 'absolute';
elem.style.left = Sys_Objectware.WindowLeft() - elem.style.offsetWidth + 'px';
}
if ( document.createEvent )
{
var evObj = document.createEvent('MouseEvents');
evObj.initMouseEvent('click', true, true, document.defaultView, 1, 0, 0, 0, 0, false, false, false, false, 0, elem);
elem.dispatchEvent(evObj);
}
else if ( elem.click )
{
elem.click();
}    
else if ( elem.onclick )
{
elem.onclick();
}
}
function fnCopyValue(elem1, elem2)
{
document.getElementById(elem2).value = document.getElementById(elem1).value;
}
function fnHideElementById(elem)
{
document.getElementById(elem).style.visibility = 'hidden';
document.getElementById(elem).style.display = 'none';
}
function fnHideElement(elem)
{
if ( Sys_Objectware.ValidObject(elem) )
{
elem.style.visibility = 'hidden';
elem.style.display = 'none';
}
}
function fnShowElementById(elem)
{
document.getElementById(elem).style.visibility = 'visible';
document.getElementById(elem).style.display = 'block';
}
function fnShowElement(elem)
{
elem.style.visibility = 'visible';
elem.style.display = 'block';
}
function fnGetAbsolutePos(elem)
{
var left = 0;
var top = 0;
do
{
left += elem.offsetLeft;
top += elem.offsetTop;
elem = elem.offsetParent;
} while ( elem != null );
return [left,top];
}
function fnGetAbsoluteLeft(elem)
{
return Sys_Objectware.GetAbsolutePos(elem)[0];
}
function fnGetAbsoluteTop(elem)
{
return Sys_Objectware.GetAbsolutePos(elem)[1];
}
function fnCloneObject(object)
{
return new _fnCloneObject(object);
}
function _fnCloneObject(object)
{
for (i in object) 
{
if (typeof object[i] == 'object') 
this[i] = new _fnCloneObject(object[i]);
else
this[i] = object[i];    
}
}
function fnCopyValues(objectSrc, objectDest)
{
for( i in objectSrc)
{
if ( typeof objectSrc[i] == 'object' )
{

Sys_Objectware.CopyValues(objectSrc[i], objectDest[i]);
}
else
{
try
{
objectDest[i] = objectSrc[i];
}
catch(e)
{
Sys_Objectware.Debug(e);
}
}
}
}
function _getCookieVal (offset) 
{
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function fnGetCookie (name) 
{
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) 
{
var c = ca[i];
while (c.charAt(0)==' ') 
c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) 
return c.substring(nameEQ.length,c.length);
}
return null;
}
function fnSetCookie (name, value,days) 
{
if (days) 
{
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
}
else 
var expires = "";
document.cookie = name+"="+value+expires+"; path=/";
}
function fnDeleteCookie (name) 
{
Sys_Objectware.SetCookie(name,"",-1);
}
function fnDisplayObject(object, prefix, arRecursedObjects)
{
if ( arRecursedObjects == null )
{
arRecursedObjects = new Array();
arRecursedObjects.push(object);
}
if ( prefix == null )
prefix = '';
var iCounter = 0;
var names = new Array();
for( p in object )
{
iCounter++;
if ( iCounter > 1000 )
return;









try
{
names.push(prefix + '.' + p + ' = ' + object[p]);
}
catch( e )
{
names.push('Error on key: ' + p + ' --> ' + e);
}
}    
function sort(a,b)
{
var maxLength = a.length;
if ( b.length < maxLength )
maxLength = b.length;
for( var n=0; n < maxLength; n++ )
{
var A=a.charAt(n);
var B=b.charAt(n);
if ( A != B )
{
return A>B ? 1: A < B ? -1 : 0;    
}
}
return 1;
}
names.sort(sort);
for( var n=0; n < names.length; n++ )
{
this.Debug(names[n]);
}
}
function fnWindowLeft()
{
if ( typeof document.body.scrollLeft != 'undefined' )
{
return document.body.scrollLeft;
}
else
{
return  window.pageXOffset;
}	
}
function fnWindowRight()
{
if ( typeof document.body.scrollLeft != 'undefined' )
{
return document.body.scrollLeft + document.body.clientWidth;
}
else
{
return window.pageXOffset + window.innerWidth;
}
}
function fnWindowTop()
{
if ( typeof document.body.scrollLeft != 'undefined' )
{
return document.body.scrollTop;
}
else
{
return window.pageYOffset;
}
}
function fnWindowBottom()
{
if ( typeof document.body.scrollLeft != 'undefined' )
{
return document.body.scrollTop + document.body.clientHeight;
}
else
{
return window.pageYOffset + window.innerHeight;
}
}
function fnDocumentRight()
{
if ( document.body.scrollHeight )
return document.body.scrollWidth;
else
return document.scrollWidth;
}
function fnDocumentBottom()
{
if ( document.body.scrollHeight )
return document.body.scrollHeight;
else
return document.scrollHeight;
}
function fnScreenTop()
{
return window.screenTop;
}
function fnScreenLeft()
{
return window.screenLeft;
}
function fnScreenBottom()
{
return window.screen.availHeight;
}
function fnCenterObject(elem)
{
elem.style.position = 'absolute';
var bVisible = Sys_Objectware.ObjectVisible(elem);
Sys_Objectware.ShowElement(elem);	
var iWidth = elem.offsetWidth;
var iHeight = elem.offsetHeight;
if ( !bVisible )
Sys_Objectware.HideElement(elem);
var left = Sys_Objectware.WindowLeft() + (  Sys_Objectware.WindowRight() - Sys_Objectware.WindowLeft() ) / 2 - iWidth / 2;
if( left < 0 )
elem.style.left = '5px';
else
elem.style.left = left + 'px'
var top, screenY, rightvar;
if (navigator.appName == "Microsoft Internet Explorer")
{
screenY = document.body.offsetHeight;
rightvar = (screenY - iHeight) / 2;
top = rightvar;
}
else
{
screenY = window.outerHeight;
rightvar = (screenY - iHeight) / 2;
top = (rightvar - pageYOffset);
}


if( top < 0 )
elem.style.top = '5px';
else
elem.style.top = top + 'px';


}
function fnSetObjectTransparency(elem, opacity)
{
if ( typeof elem.style.filter != 'undefined' )
elem.style.filter = 'alpha(opacity = ' + ( opacity ) + ');';
else if (typeof elem.style.mozOpacity != 'undefined')
elem.style.mozOpacity = opacity / 100;
else
elem.style.opacity = opacity / 100;
}
function fnMaximizeObject(elem)
{
elem.style.position = 'absolute';
elem.style.top = 0
elem.style.left = 0
elem.style.width = Sys_Objectware.DocumentRight() + 'px';
elem.style.height = Sys_Objectware.DocumentBottom() + 'px';
}
function fnMoveObject(elem, x, y)
{
if ( elem.style.position != 'absolute' )
elem.style.position = 'absolute';
elem.style.left = x + 'px';
elem.style.top = y + 'px';
}
function fnObjectVisible( elem )
{
return elem.style.visibility != 'hidden';
}
function fnObjectHit(elem, x, y )
{
if ( !Sys_Objectware.ObjectVisible(elem) )
return false;
var iLeft = Sys_Objectware.GetAbsoluteLeft(elem);
var iTop = Sys_Objectware.GetAbsoluteTop(elem);
var iWidth = elem.offsetWidth;
var iHeight = elem.offsetHeight;
if ( x <= iLeft + iWidth && x >= iLeft && y <= iTop + iHeight && y >= iTop )
return true;
else
return false;
}
function fnMouseInElement(elem)
{
return this.ObjectHit(elem, this.CurrentMouseX, this.CurrentMouseY);
}
function fnCreateFloatingIFrame(zIndex, left, top, width, height)
{
var frm = document.createElement('iframe');
frm.style.zIndex = zIndex;
frm.src = 'javascript:false;';
frm.style.position = 'absolute';
frm.frameBorder = 0;
frm.border = 0;
frm.style.border = 0;
frm.style.visibility = 'visible';
frm.style.display = '';
document.body.appendChild(frm);
Sys_Objectware.SetObjectTransparency(frm, 0);
if ( left && top && width && height )
{
frm.style.left = left + 'px';
frm.style.top = top + 'px';
frm.style.width = width + 'px';
frm.style.height = height + 'px';
}
else
Sys_Objectware.MaximizeObject(frm);
return frm;
}
function fnDestroyFloatingIFrame(iFrame)
{
document.body.removeChild(iFrame);
}
var _currentPopups = 0;
var _currentPopupZ = 1;
function fnAddPopupClick(clickElem, clickTargetElem)
{
clickElem = document.getElementById(clickElem);
clickTargetElem = document.getElementById(clickTargetElem);
var f = function(event)
{
if ( !Sys_Objectware.ObjectVisible(clickTargetElem) )
{
Sys_Objectware.ShowPopup(clickTargetElem);
clickTargetElem.IFRAME = Sys_Objectware.CreateFloatingIFrame(_currentPopupZ - 1, Sys_Objectware.GetAbsoluteLeft(clickTargetElem), Sys_Objectware.GetAbsoluteTop(clickTargetElem), clickTargetElem.offsetWidth, clickTargetElem.offsetHeight );
_currentPopups++;
}
clickTargetElem.style.zIndex = _currentPopupZ++;
if ( event )
event.returnValue = false;
return false;	
}
clickElem.onclick = f;		
fnAddPopupClickFunction(clickTargetElem, 'Close', function() { Sys_Objectware.HideElement(clickTargetElem); _currentPopups--; if ( _currentPopups == 0 ) _currentPopupZ = 1;  Sys_Objectware.DestroyFloatingIFrame(clickTargetElem.IFRAME);});
}
function fnAddPopupClickFunction(elem, value, func)
{
if ( Sys_Objectware.ValidObject(elem.childNodes) )
{
for( var n=0; n < elem.childNodes.length; n++ )
{
if ( typeof elem.childNodes[n].getAttribute != 'undefined' && elem.childNodes[n].getAttribute('PopupFunction') && elem.childNodes[n].getAttribute('PopupFunction') == value )
{
elem.childNodes[n].onclick = func;
elem.style.cursor = 'pointer';
}		   
fnAddPopupClickFunction(elem.childNodes[n], value, func);
}
}
}
function fnShowPopup(popupElem, mouseX, mouseY)
{
if ( !mouseX )
mouseX = this.CurrentMouseX;
if ( !mouseY )
mouseY = this.CurrentMouseY;
Sys_Objectware.ShowElement(popupElem);
var iWidth = popupElem.offsetWidth;
var iHeight = popupElem.offsetHeight;
var iScreenRight = Sys_Objectware.WindowRight();
var iScreenLeft = Sys_Objectware.WindowLeft();
var iScreenTop = Sys_Objectware.WindowTop();
var iScreenBottom = Sys_Objectware.WindowBottom();
var x = Sys_Objectware.GetAbsoluteLeft(popupElem);
var y = Sys_Objectware.GetAbsoluteTop(popupElem);




var iPopDirection = 0;
if ( iScreenRight - mouseX - 1 > iWidth  ) 
{
if ( iScreenBottom - mouseY - 1 > iHeight ) 
{
iPopDirection = 0;
}
else if ( mouseY - iScreenTop - 1 > iHeight ) 
{
iPopDirection = 1;
}
else 
{
iPopDirection = 2;
}
}
else if ( mouseX - iScreenLeft - 1 > iWidth ) 
{
if ( mouseY - iScreenTop - 1 > iHeight ) 
{
iPopDirection = 3;
}
else if ( iScreenBottom - mouseY - 1 > iHeight )  
{
iPopDirection = 4;
}
else 
{
iPopDirection = 5;
}
}
else
{
if ( iScreenBottom - mouseY - 1 > iHeight )  
{
iPopDirection = 6;
}
else if ( mouseY - iScreenTop - 1 > iHeight ) 
{
iPopDirection = 7;
}
else 
{
iPopDirection = 8;
}
}
if ( iPopDirection == 0 )
{
x = mouseX + 1;
y = mouseY + 1;
}
else if ( iPopDirection == 1 )
{
x = mouseX + 1;
y = mouseY - 1 - iHeight;
}
else if ( iPopDirection == 2 )
{
x = mouseX + 1;
y = iScreenTop + ( iScreenBottom - mouseY ) / 2;
}
else if ( iPopDirection == 3 )
{
x = mouseX - 1 - iWidth;
y = mouseY - 1 - iHeight;
}
else if ( iPopDirection == 4 )
{
x = mouseX - 1 - iWidth;
y = mouseY + 1;
}
else if ( iPopDirection == 5 )
{
x = mouseX - 1 - iWidth;
y = iScreenTop + ( iScreenBottom - mouseY ) / 2;
}
else if ( iPopDirection == 6 )
{
x = iScreenLeft + ( iScreenRight - iWidth ) / 2;
y = mouseY - 1 - iHeight;
}
else if ( iPopDirection == 7 )
{
x = iScreenLeft + ( iScreenRight - iWidth ) / 2;
y = mouseY + 1 
}
else if ( iPopDirection == 8 )
{
x = iScreenLeft + ( iScreenRight - iScreenLeft - iWidth ) / 2;
y = iScreenTop + ( iScreenBottom - iScreenTop - iHeight ) / 2;
}
Sys_Objectware.MoveObject(popupElem, x,y);
}
function fnCopyObject(obj)
{
return obj;
}
function fnNumberToString(num, arg)
{
if ( typeof arg == 'undefined' )
return '' + num;
else if ( arg.toLowerCase() == 'c' )
{
num = parseFloat(num);
var strCurrency = num.toString();
if ( strCurrency.lastIndexOf('.') == -1 )
strCurrency = strCurrency + '.00';
if ( strCurrency.lastIndexOf('.') == strCurrency.length - 2 )
strCurrency += '0';
return '$' + strCurrency;
}
else
{
throw 'Unknown formatting for float: ' + arg;
}
}
function fnRound(num, arg)
{
if ( isNaN(num) )
throw num + ' is not a number.';
var resolution = 2;
if ( typeof arg != 'undefined' || arg != null && !isNaN(arg) )
resolution = arg;
var precision = 1;
for( var n=0; n < resolution; n++ )
{
precision = precision * 10;
}
num = Math.round(num * precision) / precision;
return num;
}
function fnValidObject(obj)
{
if ( typeof obj != 'undefined' && obj != null )
return true;
return false;
}
var global_currentModalResize = null;
function doModalOutOfStock(modalDiv, onok, oncancel, bLockScreen, posLeft, posTop, transparencyLevel)
{
	if ( Sys_Objectware.ModalCancel != null )
	{
		Sys_Objectware.ModalCancel();
		Sys_Objectware.ModalCancel = null;
	}
	
	if ( bLockScreen )
		Sys_Objectware.GrayScreen(transparencyLevel);

 	var oldCancelFunc = oncancel ? oncancel : Function;
 	
    if(parent.document)
    {
	    parent.document.getElementById('activeModalHidden').value = modalDiv.id;
	}
 	
	onresize = function()
    {
        var div = document.getElementById(grayDivID);
        if( Sys_Objectware.ValidObject(div ))
        {
            Sys_Objectware.MaximizeObject(div);
        
	        if( Sys_Objectware.ValidObject(posTop) && !Sys_Objectware.ValidObject(posLeft) )
	        {
	            Sys_Objectware.CenterObject(modalDiv);
	            Sys_Objectware.CenterObject(ifrmPopup);
	            
	            Sys_Objectware.MoveObject(modalDiv, parseInt(modalDiv.style.left), posTop);
	            Sys_Objectware.MoveObject(ifrmPopup, parseInt(modalDiv.style.left), posTop);
	        }
	        else if ( !Sys_Objectware.ValidObject(posLeft ) )
	        {
		        Sys_Objectware.CenterObject(modalDiv);
		        Sys_Objectware.CenterObject(ifrmPopup);
	        }
	
		}    
    }
    
    onscroll = function()
    {
        var div = document.getElementById(grayDivID);
        if( Sys_Objectware.ValidObject(div ))
        {
            Sys_Objectware.MaximizeObject(div);
            if ( !Sys_Objectware.ValidObject(posLeft) )
            {
		        Sys_Objectware.CenterObject(ifrmPopup);
		        Sys_Objectware.CenterObject(modalDiv);
		    }
		}    
    }
    	
    oncancel = function()
	{
		if ( bUseIfrm )
			Sys_Objectware.HideElement(ifrmPopup);
		
		Sys_Objectware.HideElement(modalDiv); 
		
		if ( bLockScreen )
			Sys_Objectware.UnGrayScreen();
		
		oldCancelFunc();
		
	    Sys_Objectware.RemoveOnResize(onresize);
	    Sys_Objectware.RemoveOnScroll(onscroll);
		Sys_Objectware.ModalCancel = null;
		
	}
	
    oldOkFunc = onok ? onok : Function;
    
    onok = function()
    {
		if ( bUseIfrm && ifrmPopup != null  )
			Sys_Objectware.HideElement(ifrmPopup);
		
		Sys_Objectware.HideElement(modalDiv); 
		Sys_Objectware.UnGrayScreen();
		
		oldOkFunc();
		
		Sys_Objectware.RemoveOnResize(onresize);
	    Sys_Objectware.RemoveOnScroll(onscroll);
	    
		Sys_Objectware.ModalCancel = null;
    }
   
	modalDiv.style.zIndex = 501;
	
	if( Sys_Objectware.ValidObject(posTop) && !Sys_Objectware.ValidObject(posLeft) )
	{
	    Sys_Objectware.CenterObject(modalDiv);
	    modalDiv.style.top = posTop + 'px';
	}
	else if ( !Sys_Objectware.ValidObject(posLeft ) )
	{
		Sys_Objectware.CenterObject(modalDiv);
	}
	else
	{
		Sys_Objectware.MoveObject(modalDiv, posLeft, posTop);
    }
    
	Sys_Objectware.ShowElement(modalDiv);
		
//	if ( bUseIfrm && ifrmPopup != null  )
//	{
//		Sys_Objectware.ShowElement(ifrmPopup);
//		
//		Sys_Objectware.MoveObject(ifrmPopup, modalDiv.offsetLeft, modalDiv.offsetTop);
//		ifrmPopup.style.zIndex = 500;
//		ifrmPopup.style.width = modalDiv.offsetWidth + 'px';
//		ifrmPopup.style.height = modalDiv.offsetHeight + 'px';
//	}
		
	fnModalAddOnOk(modalDiv, onok);
	fnModalAddOnCancel(modalDiv,oncancel);
	
	Sys_Objectware.ModalCancel = oncancel;
    
    onresize();
	
	this.AddOnResize(onresize);
	this.AddOnScroll(onscroll);
}

function doModal(modalDiv, onok, oncancel, bLockScreen, posLeft, posTop, transparencyLevel)
{
if ( Sys_Objectware.ModalCancel != null )
{
Sys_Objectware.ModalCancel();
Sys_Objectware.ModalCancel = null;
}

if ( bLockScreen )
Sys_Objectware.GrayScreen(transparencyLevel);
var oldCancelFunc = oncancel ? oncancel : Function;
if(parent.document)
{
parent.document.getElementById('activeModalHidden').value = modalDiv.id;
}
onresize = function()
{
var div = document.getElementById(grayDivID);
if( Sys_Objectware.ValidObject(div ))
{
Sys_Objectware.MaximizeObject(div);
if( Sys_Objectware.ValidObject(posTop) && !Sys_Objectware.ValidObject(posLeft) )
{
Sys_Objectware.CenterObject(modalDiv);
Sys_Objectware.CenterObject(ifrmPopup);
Sys_Objectware.MoveObject(modalDiv, parseInt(modalDiv.style.left), posTop);
Sys_Objectware.MoveObject(ifrmPopup, parseInt(modalDiv.style.left), posTop);
}
else if ( !Sys_Objectware.ValidObject(posLeft ) )
{
Sys_Objectware.CenterObject(modalDiv);
Sys_Objectware.CenterObject(ifrmPopup);
}
}    
}
onscroll = function()
{
var div = document.getElementById(grayDivID);
if( Sys_Objectware.ValidObject(div ))
{
Sys_Objectware.MaximizeObject(div);
if ( !Sys_Objectware.ValidObject(posLeft) )
{
Sys_Objectware.CenterObject(ifrmPopup);
Sys_Objectware.CenterObject(modalDiv);
}
}    
}
oncancel = function()
{
if ( bUseIfrm )
Sys_Objectware.HideElement(ifrmPopup);
Sys_Objectware.HideElement(modalDiv); 
if ( bLockScreen )
Sys_Objectware.UnGrayScreen();
oldCancelFunc();
Sys_Objectware.RemoveOnResize(onresize);
Sys_Objectware.RemoveOnScroll(onscroll);
Sys_Objectware.ModalCancel = null;
}
oldOkFunc = onok ? onok : Function;
onok = function()
{
if ( bUseIfrm && ifrmPopup != null  )
Sys_Objectware.HideElement(ifrmPopup);
Sys_Objectware.HideElement(modalDiv); 
Sys_Objectware.UnGrayScreen();
oldOkFunc();
Sys_Objectware.RemoveOnResize(onresize);
Sys_Objectware.RemoveOnScroll(onscroll);
Sys_Objectware.ModalCancel = null;
}
modalDiv.style.zIndex = 501;
if( Sys_Objectware.ValidObject(posTop) && !Sys_Objectware.ValidObject(posLeft) )
{
Sys_Objectware.CenterObject(modalDiv);
modalDiv.style.top = posTop + 'px';
}
else if ( !Sys_Objectware.ValidObject(posLeft ) )
{
Sys_Objectware.CenterObject(modalDiv);
}
else
{
Sys_Objectware.MoveObject(modalDiv, posLeft, posTop);
}
Sys_Objectware.ShowElement(modalDiv);
if ( bUseIfrm && ifrmPopup != null  )
{
Sys_Objectware.ShowElement(ifrmPopup);
Sys_Objectware.MoveObject(ifrmPopup, modalDiv.offsetLeft, modalDiv.offsetTop);
ifrmPopup.style.zIndex = 500;
ifrmPopup.style.width = modalDiv.offsetWidth + 'px';
ifrmPopup.style.height = modalDiv.offsetHeight + 'px';
}
fnModalAddOnOk(modalDiv, onok);
fnModalAddOnCancel(modalDiv,oncancel);
Sys_Objectware.ModalCancel = oncancel;
onresize();
this.AddOnResize(onresize);
this.AddOnScroll(onscroll);
return false;
}
var grayDivID = null;
var grayDivBackgroundColor = '#999999';
function fnSetModalBackgroundColor(sColor)
{
grayDivBackgroundColor = sColor;
}
function fnGrayScreen(transparencyLevel)
{
if ( !transparencyLevel )
transparencyLevel = 50;
var div = document.getElementById(grayDivID);
if ( Sys_Objectware.ValidObject(div) )
document.body.removeChild(div);
div = document.createElement('div');
div.id = 'graydiv';
grayDivID = div.id;
document.body.appendChild(div);
div.style.zIndex = 500;
div.style.backgroundColor = grayDivBackgroundColor;
if ( bUseIfrm && ifrmPopup != null )
{
Sys_Objectware.ShowElement(ifrmPopup);
ifrmPopup.style.zIndex = 499;
Sys_Objectware.MaximizeObject(ifrmPopup);
Sys_Objectware.SetObjectTransparency(div, 0);		
}
Sys_Objectware.MaximizeObject(div);
Sys_Objectware.SetObjectTransparency(div, transparencyLevel);		
Sys_Objectware.ShowElement(div);
}
function fnUnGrayScreen()
{
if ( grayDivID != null )
{
var div = document.getElementById(grayDivID);
if ( Sys_Objectware.ValidObject(div) )
document.body.removeChild(div); 
}
if ( bUseIfrm && ifrmPopup != null )
Sys_Objectware.HideElement(ifrmPopup);
}
function fnModalAddOnCancel(elem, oncancel)
{
if ( Sys_Objectware.ValidObject(elem.childNodes) )
{
for( var n=0; n < elem.childNodes.length; n++ )
{
if ( elem.childNodes[n].id == 'tdCancel' )
{
elem.childNodes[n].onclick = oncancel;
elem.style.cursor = 'pointer';
}		   
fnModalAddOnCancel(elem.childNodes[n], oncancel);
}
}
}
function fnModalAddOnOk(elem, onok)
{
if ( Sys_Objectware.ValidObject(elem.childNodes) )
{
for( var n=0; n < elem.childNodes.length; n++ )
{
if ( elem.childNodes[n].id == 'tdOk' )
{
elem.childNodes[n].onclick = onok;
elem.style.cursor = 'pointer';
}
fnModalAddOnOk(elem.childNodes[n], onok);
}
}
}
function fnHandleTabKeyDown(txt)
{
var tabKeyCode = 9;
if (event.keyCode == tabKeyCode && event.srcElement == txt) 
{
txt.selection = document.selection.createRange();
txt.selection.text = String.fromCharCode(tabKeyCode);
event.returnValue = false;
return false;
}
}
function Redirect(url)
{
window.location = url; 
}
function fnRightAlignAndCenterToElement(elemAnchor, elemToCenter, iPadding)
{
if ( iPadding == null )
iPadding = 0;
var iLeft = Sys_Objectware.GetAbsoluteLeft(elemAnchor);
var iTop = Sys_Objectware.GetAbsoluteTop(elemAnchor);
var iWidth = elemAnchor.offsetWidth;
var iHeight = elemAnchor.offsetHeight;
var x = iLeft + iWidth + iPadding;
var y = iTop + iHeight / 2 - elemToCenter.offsetHeight / 2;
Sys_Objectware.MoveObject(elemToCenter, x, y );		
} 
function fnScrollToTop()
{
window.scroll(0,0);
}
function fnRunBodyOnLoads()
{
for( var n = 0 ; n < this._bodyOnLoads.length; n++ )
this._bodyOnLoads[n]();
}
function fnAddBodyOnLoad(func)
{
this._bodyOnLoads.push(func);   
}
function fnGetDimensions(elem)
{
var x = 0;
var y = 0;
var width = elem.offsetWidth;
var height = elem.offsetHeight;
do
{
x += elem.offsetLeft;
y += elem.offsetTop;
elem = elem.offsetParent;
} while ( elem != null )
var dimensions = new Object();
dimensions.X = x;
dimensions.Y = y;
dimensions.Width = width;
dimensions.Height = height;
return dimensions;
}
function fnAddOnResize(func)
{
this.onResize.push(func);
}
function fnRemoveOnResize(func)
{
var arNewResize = new Array();
for( var n=0; n < this.onResize.length; n++ )
{
if ( this.onResize[n] != func )
arNewResize.push(this.onResize[n]);
}    
this.onresize = arNewResize;
}
function fnAddOnScroll(func)
{
this.onScroll.push(func);
}
function fnRemoveOnScroll(func)
{
var arNewScroll = new Array();
for( var n=0; n < this.onScroll.length; n++ )
{
if ( this.onScroll[n] != func )
arNewScroll.push(this.onScroll[n]);
}    
this.onscroll = arNewScroll;
}
function fnAddOnClickScript(clientID, script, append)
{
if (append == null || typeof append == 'undefined' )
append = false;
var element = document.getElementById(clientID);
var oldFunc = element.onclick || Function;
var newFunc = function() 
{ 
var bReturn = oldFunc();
if ( typeof bReturn == 'undefined' || bReturn )
{   
eval('var returnFunc = function() { ' + script + ' }');
bReturn = returnFunc();
}
return bReturn;
}
element.onclick = newFunc;
}
function fnGetWindowScrollY()
{
var scrOfY = 0;
var currentDocument;
if(parent.document)
{
currentDocument = parent.document;
}
else
{
currentDocument = document;
}
if(currentDocument.body && currentDocument.body.scrollTop) 
{
scrOfY = currentDocument.body.scrollTop;
} 
else if( currentDocument.documentElement && currentDocument.documentElement.scrollTop ) 
{
scrOfY = currentDocument.documentElement.scrollTop;
}
return scrOfY;
}
String.prototype.LeftTrim = function leftTrim() 
{
var sString = this;
while (sString.substring(0,1) == ' ')
{
sString = sString.substring(1, sString.length);
}
return sString;
}
String.prototype.RightTrim = function rightTrim() 
{
var sString = this;
while (sString.substring(sString.length-1, sString.length) == ' ')
{
sString = sString.substring(0,sString.length-1);
}
return sString;
}
String.prototype.Trim = function trimAll() 
{
var sString = this;
sString = sString.LeftTrim();
sString = sString.RightTrim();
return sString;
}
var Sys_Objectware = new Sys_Objectware();
function Timer(interval,callback,autoReset)
{
if( typeof interval == 'undefined')
alert('interval not defined');
if( typeof callback == 'undefined')
alert('callback not defined');
this._timerID = -1;
this._interval = interval;
this._callback = callback;
this._autoReset = autoReset;
}
Timer.prototype.Start = Timer_fnStart;
Timer.prototype.Stop = Timer_fnStop;
Timer.prototype.IsRunning = Timer_fnIsRunning;
Timer.prototype._onTick = Timer_fn_onTick;
function Timer_fn_onTick()
{
if( this._callback != null)
this._callback();
if( this.IsRunning() && this._autoReset)
{
this.Start();
}
}
function Timer_fnStart()
{
if( this.IsRunning())
this.Stop();
var _ptr = this;
this._timerID = setTimeout(this._onTick.bind(_ptr),this._interval);
}
function Timer_fnStop()
{
if( this.IsRunning())
{
clearTimeout(this._timerID);
this._timerID = -1;    
}
}
function Timer_fnIsRunning()
{
return this._timerID != -1;
}
