//

// Copyright (c) 2003 Advanced Computer Graphics, Inc. All rights reserved.

//

// The information in this file is protected by copyright law and international

// treaty provisions. Unauthorized reproduction, distribution or reverse

// engineering of this file, or any portion of it, is strictly prohibited.

//

// For information on licensing this software, please email requests to

// <licensing@acgmultimedia.com> or visit our website at <www.acgmultimedia.com>.

//

 

function ACG_ImageIBM( sName, sFile, iWidth, iHeight, sAttributes )

{

document.write( ACG_ImageIBMGetMarkup( sName, sFile, iWidth, iHeight, sAttributes ) );

}

function ACG_ImageIBMGetMarkup( sName, sFile, iWidth, iHeight, sAttributes )

{

var sMarkup = "<img";

sMarkup += " name='" + sName + "'";

sMarkup += " id='" + sName + "'";

sMarkup += " src='" + sFile + "'";

sMarkup += " width='" + iWidth + "'"

sMarkup += " height='" + iHeight + "'"

sMarkup += " border='0'"

if ( sAttributes )

{

sMarkup += " " + sAttributes;

}

sMarkup += ">";

return sMarkup;

}

function ACG_ImageMapIBM( sName, sCoords, sScript )

{

document.write( ACG_ImageMapIBMGetMarkup( sName, sCoords, sScript ) );

}

function ACG_ImageMapIBMGetMarkup( sName, sCoords, sScript )

{

var sMarkup = "<map";

sMarkup += " name=\"" + sName + "\">";

sMarkup += "<area";

sMarkup += " shape=\"rect\"";

sMarkup += " coords=\"" + sCoords + "\"";

if ( sScript )

{

sMarkup += " href=\"javascript:" + sScript + "\">";

}

sMarkup += "</map>";

return sMarkup;

}



function ACG_Timer( _sExpression, _iPeriodMilliseconds, _bPersistent )

{

this._sExpression = _sExpression;

this._bPersistent = _bPersistent;

if( _bPersistent )	

this._iTimerID = setInterval( _sExpression, _iPeriodMilliseconds );

else

this._iTimerID = setTimeout( _sExpression, _iPeriodMilliseconds );

}

ACG_Timer.prototype.Kill = function()

{

if( this._iTimerID )

{

if( this._bPersistent )

{

clearInterval( this._iTimerID );

}

else

{

clearTimeout( this._iTimerID );

}

}

}

function ACG_TimerFn( _pFunction, _iPeriodMilliseconds, _bPersistent, _pData )

{

var i;

var _sExpression;

for ( i = 0; i < ACG_TimerFn._aTimerList.length; i++ )

{

if ( ACG_TimerFn._aTimerList[ i ] == null )

{

break;

}

}

ACG_TimerFn._aTimerList[ i ] = new Array;

this._iId = ACG_TimerFn._iId++; 

this._bPersistent = _bPersistent;

ACG_TimerFn._aTimerList[ i ][ 0 ] = this._iId;

ACG_TimerFn._aTimerList[ i ][ 1 ] = _pFunction;

ACG_TimerFn._aTimerList[ i ][ 2 ] = _pData;

_sExpression = "ACG_TimerFn._TimerEvent( " + this._iId + ");";

if ( this._bPersistent )	

this._iTimerID = setInterval( _sExpression, _iPeriodMilliseconds );

else

this._iTimerID = setTimeout( _sExpression, _iPeriodMilliseconds );

}

ACG_TimerFn._aTimerList = new Array;

ACG_TimerFn._iId = 0;

ACG_TimerFn._TimerEvent = function( _iId )

{

var i;

for ( i = 0; i < ACG_TimerFn._aTimerList.length; i++ )

{

if ( ACG_TimerFn._aTimerList[ i ] != null )

{

if ( ACG_TimerFn._aTimerList[ i ][ 0 ] == _iId )

{

ACG_TimerFn._aTimerList[ i ][ 1 ]( ACG_TimerFn._aTimerList[ i ][ 2 ] );

return;

}

}

}

}

ACG_TimerFn.prototype.Kill = function()

{

var i;

for ( i = 0; i < ACG_TimerFn._aTimerList.length; i++ )

{

if ( ACG_TimerFn._aTimerList[ i ] != null )

{

if ( ACG_TimerFn._aTimerList[ i ][ 0 ] == this._iId )

{

if ( this._bPersistent )

clearInterval( this._iTimerID );

else

clearTimeout( this._iTimerID );

ACG_TimerFn._aTimerList[ i ] = null;

return;

}

}

}

}



function ACG_Cookie( _sName, _ExpirationDate, _sPath, _sDomain, _bSecure )

{

this.__sName = _sName;

if ( _ExpirationDate ) this.__sExpiration = _ExpirationDate.toUTCString(); 

if ( _sPath ) this.__sPath = _sPath;

if ( _sDomain ) this.__sDomain = _sDomain;

if ( _bSecure )

this.__bSecure = true;

else

this.__bSecure = false;

}

ACG_Cookie.prototype.Load = function()

{

var _cookies = document.cookie;

if ( _cookies == "" )

{

return false;

}

_cookies = unescape( _cookies );

var _iStart = _cookies.indexOf( this.__sName + '=' );

if ( _iStart == -1 ) return false;

_iStart += this.__sName.length + 1;

var _iEnd = _cookies.indexOf( ';', _iStart );

if ( _iEnd == -1 )

_iEnd = _cookies.length;

var _cookieval = _cookies.substring( _iStart, _iEnd );

var _aProp = _cookieval.split( '&' );

for ( var _i = 0; _i < _aProp.length; _i++ )

_aProp[ _i ] = _aProp[ _i ].split( ':' );

for ( var _i = 0; _i < _aProp.length; _i++ )

{

this[ _aProp[ _i ][ 0 ] ] = eval( unescape( _aProp[ _i ][ 1 ] ) );

}

return true;

}

ACG_Cookie.prototype.Save = function()

{

var _cookieval = "";

for ( var _prop in this )

{

if ( ( _prop.charAt( 0 ) != '_' ) && ( ( typeof this[ _prop ] ) != 'function' ) )

{

if ( _cookieval != "" )

_cookieval += '&';

_cookieval += _prop + ':';

if ( typeof( this[ _prop ] ) == 'string' )

_cookieval += "\"";

_cookieval += escape( this[ _prop ] );

if ( typeof( this[ _prop ] ) == 'string' )

_cookieval += "\"";

}

}

var _cookie = this.__sName + '=' + _cookieval;

if ( this.__sExpiration ) _cookie += '; expires=' + this.__sExpiration;

if ( this.__sPath ) _cookie += '; path=' + this.__sPath;

if ( this.__sDomain ) _cookie += '; domain=' + this.__sDomain;

if ( this.__bSecure ) _cookie += '; secure';

document.cookie = _cookie;

}

ACG_Cookie.prototype.Delete = function()

{

var _cookie;

_cookie = this.__sName + '=null';

if ( this.__sPath ) _cookie += '; path=' + this.__sPath;

if ( this.__sDomain ) _cookie += '; domain=' + this.__sDomain;

_cookie += '; expires=Fri, 02-Jan-1970 00:00:00 GMT';

document.cookie = _cookie;

}

function ACG_FlashIBM( sName, sFile, iWidth, iHeight )

{

var sMarkup = ACG_FlashIBMGetMarkup( sName, sFile, iWidth, iHeight );

document.write( sMarkup );

}

function ACG_FlashIBMGetMarkup( sName, sFile, iWidth, iHeight )

{

var oParameters = [];

oParameters.quality = "high";

oParameters.wmode = "opaque";

oParameters.swliveconnect = "true";

oParameters.loop = "false";

var sMarkup = "<object";

sMarkup = "<object ";

sMarkup += "name=\"" + sName + "\" ";

sMarkup += "id=\"" + sName + "\" ";

sMarkup += "classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" ";

sMarkup += "codebase=\"//active.macromedia.com/flash2/cabs/swflash.cab#version=6,0,0,0\" ";

sMarkup += "width=\"" + iWidth + "\" ";	 

sMarkup += "height=\"" + iHeight + "\" ";

sMarkup += ">";

sMarkup += "<param name=\"movie\" value=\"" + sFile + "\">";

for ( var name in oParameters )

sMarkup += "<param name=\""+name+"\" value=\""+ oParameters[name] + "\">";

sMarkup += "<embed ";

sMarkup += "name=\"" + sName + "\" ";

sMarkup += "src=\"" + sFile + "\" ";

sMarkup += "type=\"application/x-shockwave-flash\" ";

sMarkup += "pluginspage=\"//www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" ";

sMarkup += "width=\"" + iWidth + "\" ";

sMarkup += "height=\"" + iHeight + "\" ";

sMarkup += "movie=\""+ sFile + "\" ";

for ( var name in oParameters )

sMarkup += name+"=\""+ oParameters[name] + "\" ";

sMarkup += "></embed>";

var agt		= navigator.userAgent.toLowerCase();

var is_ie	= ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));

if ( is_ie )

{

aFileName = sFile.split( "." );

sMarkup += ACG_ImageIBMGetMarkup( sName, "images/" + aFileName[0] + "_noreplay.jpg", iWidth, iHeight, null );

}

sMarkup += "</object>";

if ( is_ie )

{

sMarkup += "<SCRIPT FOR=\""+sName+"\" EVENT=\"FSCommand\">";

sMarkup += "" + sName + "_" + "DoFSCommand( arguments[0], arguments[1] );";

sMarkup += "</SCRIPT>";

}

return sMarkup;

}

