<!--
/*
// sysutils.js - Javascript utility functions for web(-it) sites
// Language    : Javascript 1.2
// Author      : Erwin Haantjes
// Project     : Web-It/General
// Copyright   : Erwin Haantjes/Interurbia (c) 2005-2007 - All rights reserved
// Licensed to : Interurbia/Meneer Web/Unit Redd Creators/Unit Redd - and it's customers
// Developed   : 2005
// Last updated: 25-05-2007
//
// IMPORTANT NOTES:
// ----------------
// o This software is provided 'as-is', without any expressed or implied warranty.                                                             //
// o In no event will the author be held liable for any damages arising from the use of this software.
// o VERY IMPORTANT: DO NOT EDIT/CHANGE THIS FILE!

// WARNING - COPYRIGHTED MATERIAL:
// -------------------------------
// This code is being released as PAYware. This means that the code is copyrighted and only intented to be used on this site.
// The owner of the site does not own this piece of software but using it as a part of a license. You may not redistibute it
// or copy (chunks of it) to use it in another services or website or redistribute it over the internet. You may not rename it,
// remove this copyright text, using this software as a part of your code or saying that you wrote this software.
*/


// General (property) functions

function isDefined(property)
{
  return (typeof property != 'undefined');
}

function isAssigned(v)
{
  return (v != undefined);
}

function isAlien(a) {
   return isObject(a) && typeof a.constructor != 'function';
}

function isArray(a) {
    return isObject(a) && a.constructor == Array;
}

function isBoolean(a) {
    return typeof a == 'boolean';
}

function isEmpty(o) {
    var i, v;
    if (isObject(o)) {
        for (i in o) {
            v = o[i];
            if (isVarUndefined(v) && isFunction(v)) {
                return false;
            }
        }
    }
    return true;
}

function isFunction(a) {
    return typeof a == 'function';
}

function isNull(a) {
    return a === null;
}

function isNumber(a) {
    return typeof a == 'number' && isFinite(a);
}

function isObject(a) {
    return (a && typeof a == 'object') || isFunction(a);
}

function isString(a) {
    return typeof a == 'string';
}

function isVarUndefined(a) {
    return typeof a == 'undefined';
}


// General string functions

function ltrim(argvalue)
{
  while( true )
  {
    if (argvalue.substring(0, 1) != " ")
      { break; }

    argvalue = argvalue.substring(1, argvalue.length);
  }

  return argvalue;
}

function rtrim(argvalue)
{
  while( true )
  {
    if( argvalue.substring( argvalue.length - 1, argvalue.length ) != " " )
      { break; }

    argvalue = argvalue.substring( 0, argvalue.length - 1 );
  }

  return argvalue;
}

function trim(argvalue)
{
  return ltrim(rtrim(argvalue));
}

function chr(iCode)
{ // Same as in php
  if( iCode =! VOID || isNumber( iCode ))
   { return String.fromCharCode(iCode); }
  else { return -1; }
}

function VersionStringToFloat( s )
{
  p = s.indexOf( "." );

  if( p )
   { var s2 = "";
     var L = s.length;

     for (var x=0; x < L; x++ )
     { if( x == p )
        { s2=s2+"."; }
       else { var ch = s.substring(x, x+1);
              if( ch != "." && ch != " " && ch != "_" )
               { s2=s2+ch; }
            }
     }
    return parseFloat( s2 );
   }

  return parseFloat( s );
}

function count( aValue )
 // Same as count in php
{
  if( isArray( aValue ) || isString( aValue ) )
   { return aValue.length; }
  else { return 0; }
}

function IndexOf( aValue, aS )
{ // Find position of a string in an array of strings or "single" string
  if( isArray( aS ) )
  { var c = count( aS );
    for( var i = 0; i < c; i++ )
     { if( aValue == aS[ i ] )
        { return i; }
     }
  }
  else { if( isString( aValue ) && isString( aS ))
         { return aS.indexOf( aValue ); }
       }

  return -1;
}

function strpos( s, sValue )
{
  if( isString( sValue ) && isString( s ))
  { return s.indexOf( sValue ); }
  else { return -1; }
}

function str_replace( s1, s2, s )
 // Same as str_replace in php
{
 if( !isString( s ))
  { return ""; }

 if( !isArray( s1 ))
  { s1 = new Array( s1 ); }

 if( !isArray( s2 ))
  { s2 = new Array( s2 ); }

 var c = s1.length;
 var c2 = s2.length;

 if( c == 0 || c2 == 0 )
  { return s; }
  
 if( c > c2 )
  { c = c2; }

 for( var i = 0; i < c; i++ )
  {
    if( s1[ i ] != s2[ i ] )
    {
      while( IndexOf( s1[ i ], s ) >= 0  )
       { s = s.replace( s1[ i ], s2[ i ] ); }
    }
  }

 return s;
}

function RemoveStr( s, sValue )
{
  var sReplace = "";

  if( isArray( sValue ))
   {
     var aReplace = sValue;
     var c = count( aReplace );

     for( var i = 0; i < c; i++ )
      {
        aReplace[ i ] = sReplace;
      }
   }
  else { var aReplace = sReplace; }

  return str_replace( sValue, aReplace, s );
}

function ReplaceStr( s, sValue, sReplace )
{
  if( isArray( sValue ))
   {
     var aReplace = sValue;
     var c = count( aReplace );

     for( var i = 0; i < c; i++ )
      {
        aReplace[ i ] = sReplace;
      }
   }
  else { var aReplace = sReplace; }

  return str_replace( sValue, aReplace, s );
}

function strtolower( s )
 // Same as in php
{ if( isString( s ))
   { return s.toLowerCase(); }
  else { return ""; }
}

function strtoupper( s )
 // Same as in php
{ if( isString( s ))
   { return s.toUpperCase(); }
  else { return ""; }
}

function strlen( s )
 // Same as in php
{ return count( s ); }

function substr( s, istart, ilength )
 // Same as in php
{ if( isString( s ))
   { if( isAssigned( ilength ))
      { return s.substring( istart, ilength ); }
     else { return s.substring( istart ); }
   }
  else { return ""; }
}

function explode( sSeperator, sValue )
 // Same as explode in php
 // Bug in javascript, split function doesn't return last record, workaround developed
{
 var Result = new Array();
 var i = IndexOf( sSeperator, sValue );
 var y = 0;
 var l = strlen( sSeperator );

 while( i >= 0 )
 {
   Result[ y ] = sValue.substring( 0, i );
   sValue = sValue.substring( i+l );
   y++;
   i = IndexOf( sSeperator, sValue );
 }

 if( sValue != "" )
  { Result[ y ] = sValue; }

 return Result;
}

function getqueryanchor( defaultvalue, sUrl )
{
  var defval    = (defaultvalue == undefined) ? ""  : defaultvalue;
  var url       = (sUrl == undefined) ? window.location.href : sUrl;

  var i = IndexOf( "#", url );

  if( i >= 0 )
   { return trim( url.substr( i+1 )); }
  else { return defval; }
}

function getqueryvalue( sName, defaultvalue, bUntouched, sUrl )
  // parses document queries and returns the value of query sName
{
  var defval    = (defaultvalue == undefined) ? ""  : defaultvalue;
  var bUntouch  = (bUntouched == undefined) ? false : bUntouched;
  var url       = (sUrl == undefined) ? window.location.href : sUrl;

  if( !isString( sName ))
   { return defval; }

  sName = trim( strtolower( sName ));
  url = str_replace( "&amp;", "&", url );

  var i = IndexOf( "#", url );
  if( i >= 0 )
   { url = rtrim( url.substr( 0, i )); }

  i = IndexOf( "?", url );
  if( i >= 0 )
   { url = ltrim( url.substr( i+1 )); }

  if( IndexOf( "&", url ) < 0 )
   { var urlqueries = [url]; }
  else { var urlqueries = explode('&', url ); }

  var len = count( urlqueries );

  for( i = 0; i < len; i++ )
   {
     var query = explode('=', urlqueries[ i ] );

     if( count( query ) == 2 )
      { query[ 0 ] = trim( strtolower( query[ 0 ] ));

        if( query[ 0 ] == sName )
         { if( bUntouch )
            { return query[ 1 ]; }
           else { return trim( str_replace( "%20", " ", query[ 1 ] )); }
         }
      }

   }
  return defaultvalue;
}

function MakeString( s, sSeperator )
// Function to convert an string array to a string
{
 if( sSeperator == undefined )
  { var sSeperator = ""; }
  
 if( isString( s ))
  {
    return s;
  }
 else {
        if( isArray( s ) )
         { var Count = count( s );

           var sResult = "";

           for( var i = 0; i < Count; i++ )
            { if( sSeperator != "" && sResult != "" )
               {
                 sResult = sResult+sSeperator+s[i];
               }
              else { sResult = sResult+s[i]; }
            }

           return sResult;
         }
        else return "";
      }
}

function MakeArray( ns, defsep )
 // Constructs an array with or without default values:
 // MakeArray( <count>, <defaultvalue> );
 // Also possible, convert string to array: MakeArray( <string>, <seperator> ); // default seperator is an enter chr(13)
{
  var Result = new Array();

  if( ns == VOID )
   { return Result; }

  if( isString( ns ))
   { return explode( ( defsep == VOID ) ? chr(13) : defsep, ns ); }

  if( isNumber( ns ))
   { Result.length = ns;

     if( defvalue != VOID )
     for( var i = 0; i < ns; i++ )
     { Result[i]=defsep; }
   }

  return Result;
}

function GetTextBetween( s, sBegin, sEnd, bCaseSensitive, bKeepOriginal, bKeepBeginEnd )
{
  s = MakeString( s );
  sOrg = "";

  if(( s == VOID || sBegin == VOID || sEnd == VOID ) || ( s == "" || sBegin == "" || sEnd == "" ))
  { return false; }

  if( bCaseSensitive == undefined )
   { var bCaseSensitive = true; }

  if( bKeepOriginal == undefined )
   { var bKeepOriginal = false; }

  if( bKeepBeginEnd == undefined )
   { var bKeepBeginEnd = false; }

  if( !bCaseSensitive )
  {
    if( bKeepOriginal )
     { sOrg = s; }

    s = strtolower( s );

    sBegin = strtolower( sBegin );
    sEnd   = strtolower( sEnd   );
  }

 var Result = new Array();
 var i = 0;
 var L1 = strlen( sBegin );
 var L2 = strlen( sEnd );

 while( true  )
  {
    var p = strpos( s, sBegin );

     if( p < 0 )
      { return Result; }

    s = substr( s, p+L1 );

    if( !bCaseSensitive && bKeepOriginal )
     {
       if( bKeepBeginEnd )
        { var sBeginOrg = substr( sOrg, p, L1 ); }

       sOrg = substr( sOrg, p+L1 );
     }

    p = strpos( s, sEnd );

     if( p < 0 )
      { return Result; }

    if( !bCaseSensitive && bKeepOriginal )
     {  if( bKeepBeginEnd )
         { var sEndOrg = substr( sOrg, p, L2 ); }

       var sSub = substr( sOrg, 0, p );
       var sOrg = substr( sOrg, p+L2+1 );
     }
    else { var sSub = substr( s, 0, p ); }

    s = substr( s, p+L2+1 );

    if( bKeepBeginEnd )
     {  if( !bCaseSensitive )
         { Result[i] = sBeginOrg+sSub+sEndOrg;
           alert( Result[i] );
         }
        else { Result[i] = sBegin+sSub+sEnd;
               alert( Result[i] ); }
     }
    else { Result[i] = sSub; }

   i++;
  }

 return Result;
}

function DeleteTextBetween( s, sBegin, sEnd, bCaseSensitive, bKeepOriginal )
{  // Not correctly implemented

 var Result = GetTextBetween( s, sBegin, sEnd, bCaseSensitive, true );

 if( !isArray( Result ))
  { return s; }

 var c = count( Result );

 if( c <= 0 )
  { return s; }

 for( var i = 0; i < c; i++ )
  { s = str_replace( sBegin+Result[ i ]+sEnd, MakeArray( c, "" ), s ); }

 return s;
}

function base64_encode(input)
{
   var output = "";
   var chr1, chr2, chr3;
   var enc1, enc2, enc3, enc4;
   var i = 0;

   do {
      chr1 = input.charCodeAt(i++);
      chr2 = input.charCodeAt(i++);
      chr3 = input.charCodeAt(i++);

      enc1 = chr1 >> 2;
      enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
      enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
      enc4 = chr3 & 63;

      if (isNaN(chr2)) {
         enc3 = enc4 = 64;
      } else if (isNaN(chr3)) {
         enc4 = 64;
      }

      output = output + BASE64_KEYS.charAt(enc1) + BASE64_KEYS.charAt(enc2) +
         BASE64_KEYS.charAt(enc3) + BASE64_KEYS.charAt(enc4);
   } while (i < input.length);

   return output;
}

function base64_decode(input)
{
   var output = "";
   var chr1, chr2, chr3;
   var enc1, enc2, enc3, enc4;
   var i = 0;

   // remove all characters that are not A-Z, a-z, 0-9, +, /, or =
   input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

   do {
      enc1 = BASE64_KEYS.indexOf(input.charAt(i++));
      enc2 = BASE64_KEYS.indexOf(input.charAt(i++));
      enc3 = BASE64_KEYS.indexOf(input.charAt(i++));
      enc4 = BASE64_KEYS.indexOf(input.charAt(i++));

      chr1 = (enc1 << 2) | (enc2 >> 4);
      chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
      chr3 = ((enc3 & 3) << 6) | enc4;

      output = output + String.fromCharCode(chr1);

      if (enc3 != 64) {
         output = output + String.fromCharCode(chr2);
      }
      if (enc4 != 64) {
         output = output + String.fromCharCode(chr3);
      }
   } while (i < input.length);

   return output;
}

// Image functions

function SU_preloadImages()
{
  var d=document;

  if(d.images)
  { if( !d.MM_p )
    d.MM_p=new Array();

    var i,j = d.MM_p.length,a = SU_preloadImages.arguments;

  for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0)
    { d.MM_p[j]=new Image;
      d.MM_p[j++].src=a[i];
    }
  }
}

function SU_swapImgRestore()
{
  var i,x,a=document.MM_sr;
  for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)
   x.src=x.oSrc;
}

function SU_swapImage()
{
  var i,j=0,x,a=SU_swapImage.arguments;

  document.MM_sr=new Array;

  for(i=0;i<(a.length-2);i+=3)
   if ((x=SU_findObj(a[i]))!=null)
    { document.MM_sr[j++]=x;
      if(!x.oSrc) x.oSrc=x.src;
       x.src=a[i+2];
    }
}

function SU_SetWatermark( doc, image, bgClr )
{
 if( doc == undefined )
  { var doc = document; }
 if( image == undefined )
  { var image = ""; }
 if( bgClr == undefined )
  { var bgClr = ""; }

 var Result = ( doc.all|| doc.getElementById );

 if( Result )
  { document.body.style.background="url('"+image+"') "+bgClr+" center no-repeat fixed"; }

 return Result;
}

 // Objects
function SU_findObj(n, d)
{
  var p,i,x;

  if(!d) d=document;
  if((p=n.indexOf("?"))>0&&parent.frames.length)
   { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}

  if(!(x=d[n])&&d.all)
   x=d.all[n];

  for (i=0;!x&&i<d.forms.length;i++)
   x=d.forms[i][n];

  for(i=0;!x&&d.layers&&i<d.layers.length;i++)
   x=MM_findObj(n,d.layers[i].document);

  if(!x && d.getElementById)
   x=d.getElementById(n);

  return x;
}

// (Multimedia) system detection functions

var flashVersion = -1;
function SU_getFlashVersion()
{
   if( SUFlashVersion != 0 )
    { return SUFlashVersion; }

   var latestFlashVersion = 25; // Fake version, needed for stupid checkloop
   var agent = navigator.userAgent.toLowerCase();

   // NS3 needs flashVersion to be a local variable
   if (agent.indexOf("mozilla/3") != -1 && agent.indexOf("msie") == -1)
   {
      flashVersion = 0;
   }

	// NS3+, Opera3+, IE5+ Mac (support plugin array):  check for Flash plugin in plugin array
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		var flashPlugin = navigator.plugins['Shockwave Flash'];
		if (typeof flashPlugin == 'object') {
			for (var i = latestFlashVersion; i >= 3; i--) {
            if (flashPlugin.description.indexOf(i + '.') != -1) {
               flashVersion = i;
               break;
            }
         }
		}
	}

	// IE4+ Win32:  attempt to create an ActiveX object using VBScript
	else if (agent.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4 && agent.indexOf("win")!=-1 && agent.indexOf("16bit")==-1) {
	   var doc = '<scr' + 'ipt language="VBScript"\> \n';
      doc += 'On Error Resume Next \n';
      doc += 'Dim obFlash \n';
      doc += 'For i = ' + latestFlashVersion + ' To 3 Step -1 \n';
      doc += '   Set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash." & i) \n';
      doc += '   If IsObject(obFlash) Then \n';
      doc += '      flashVersion = i \n';
      doc += '      Exit For \n';
      doc += '   End If \n';
      doc += 'Next \n';
      doc += '</scr' + 'ipt\> \n';
      document.write(doc);
   }

	// WebTV 2.5 supports flash 3
	else if (agent.indexOf("webtv/2.5") != -1) flashVersion = 3;

	// older WebTV supports flash 2
	else if (agent.indexOf("webtv") != -1) flashVersion = 2;

	// Can't detect in all other cases
	else { flashVersion = -1; }

  return flashVersion;
}

function SU_CheckFlashEnabled( reqVer, urlNotEnabled, urlEnabled )
{
  SUFlashVersion = SU_getFlashVersion();
  if( reqVer == undefined )
   { var ver = -1; }
  else { var ver = reqVer; }
  var urlEnable  = (urlEnabled == undefined) ? "" : urlEnabled;
  var urlDisable = (urlNotEnabled == undefined) ? "" : urlNotEnabled;
  var bEnabled = ( SUFlashVersion > 0 );

  if( bEnabled && ver > 0 )
   { bEnabled = ( SUFlashVersion >= ver ); }

  if( !bEnabled )
   {
     if( urlDisable != "" )
      { window.location.href = urlDisable; }
   }
  else { if( urlEnable != "" )
         { window.location.href = urlEnable; }
       }

  return bEnabled;
}

function SU_CheckJavaEnabled( reqVer, urlNotEnabled, urlEnabled )
{
  if( reqVer == undefined )
   { var ver = -1; }
  else { var ver = reqVer; }
  var urlEnable  = (urlEnabled == undefined) ? "" : urlEnabled;
  var urlDisable = (urlNotEnabled == undefined) ? "" : urlNotEnabled;
  var bEnabled = ( SUJavaEnabled && ver > 0 );

  if( bEnabled )
   { if( document.detectjvmapplet == undefined )
     {
       document.write( '<applet code="lib/support/DetectJVM.class" name="detectjvmapplet" width="0" height="0" style="visibility:hidden;">\n' );
       document.write( '<script>SUJavaEnabled = false;</script>\n' );
       document.write( '</applet>\n\n' );
     }

     bEnabled = ( SUJavaEnabled && document.detectjvmapplet != undefined );
     // alert( bEnabled );
   }
  
  if( bEnabled && document.detectjvmapplet != undefined )
   { SUJavaVersion = VersionStringToFloat( document.detectjvmapplet.getJavaVersion() );
     //SUJavaVendor  = document.detectjvmapplet.getJavaVendor();
     bEnabled = ( SUJavaVersion >= ver );
   }
  else { bEnabled = false;
         SUJavaVersion = 0;
         SUJavaVendor  = "Unknown";
       }

  if( !bEnabled )
   {
     if( urlDisable != "" )
      { window.location = urlDisable; }
   }
  else { if( urlEnable != "" )
         { window.location = urlEnable; }
       }

  return bEnabled;
}


function SU_CheckCookiesEnabled( urlNotEnabled, urlEnabled )
{
  var urlEnable  = (urlEnabled == undefined) ? "" : urlEnabled;
  var urlDisable = (urlNotEnabled == undefined) ? "" : urlNotEnabled;
  var bEnabled = ( SUBrowserCookies );

  if( !bEnabled )
   {
     if( urlDisable != "" )
      { window.location = urlDisable; }
   }
  else { if( urlEnable != "" )
         { window.location = urlEnable; }
       }

  return bEnabled;
}

function SU_CheckFramesEnabled( urlNotEnabled )
{
  var urlDisabled = trim( (urlNotEnabled == undefined) ? "" : urlNotEnabled );
  var bDoCheck = ( urlDisabled != ""  );

  if( bDoCheck )
   {
     document.write( '<noframes>\n' );
     document.write( ' <meta http-equiv="refresh" content="1; URL='+urlDisabled+'">\n' );
     document.write( '</noframes>\n\n' );
   }
}

function SU_CheckIFrameEnabled( urlNotEnabled )
{
  var urlDisabled = trim( (urlNotEnabled == undefined) ? "" : urlNotEnabled );
  var bDoCheck = ( urlDisabled != ""  );

  if( bDoCheck )
   {
     document.write( '<div style="visibility:hidden">' );
     document.write( '<iframe width="0" height="0" vspace="0" hspace="0" scrolling="No" frameborder="0" style="visibility:hidden;">\n' );
     document.write( ' <meta http-equiv="refresh" content="1; URL='+urlDisabled+'">\n' );
     document.write( '</iframe>\n\n' );
     document.write( '</div>' );
   }
}


function SU_GetBrowserInfo( iInfoSwitch )
{
 var InfoWanted = ( iInfoSwitch == undefined )  ? 0 : iInfoSwitch;
 var detect = navigator.userAgent.toLowerCase();
 var OS,browser,version,total,thestring;

 function checkIt(string)
 {
   place = detect.indexOf(string) + 1;
   thestring = string;
   return place;
 }


 if (checkIt('konqueror'))
 {
   browser = "Konqueror";
   OS = "Linux";
 }
 else if (checkIt('firefox')) browser = "Firefox"
 else if (checkIt('safari')) browser = "Safari"
 else if (checkIt('omniweb')) browser = "OmniWeb"
 else if (checkIt('opera')) browser = "Opera"
 else if (checkIt('webtv')) browser = "WebTV"
 else if (checkIt('icab')) browser = "iCab"
 else if (checkIt('msie')) browser = "Internet Explorer"
 else if (checkIt('mozilla')) browser = "Mozilla"
 else if (!checkIt('compatible'))
       {
	browser = "Netscape";
	version = detect.charAt(8);
       }
      else browser = "Unknown browser";

 if (!version)
  { var i = place + thestring.length;
    var L = detect.length;
    var ch = detect.charAt(i);
    i++;
    version = ch;
    ch = detect.charAt(i);

    while( i < L && ch != " " && ch != ";" )
     { version = version+ch;
       i++;
       ch = detect.charAt(i);
     }
    // alert( version );
  }

 if (!OS)
  {
	if (checkIt('linux')) OS = "Linux";
	else if (checkIt('x11')) OS = "Unix";
	else if (checkIt('mac')) OS = "Mac"
	else if (checkIt('win')) OS = "Windows"
	else OS = "Unknown operating system";
  }

 if( InfoWanted == 0 )
  { return browser; }
 else if( InfoWanted == 1 )
       { return version; }
      else if( InfoWanted == 2 )
            { return OS; }

 return false;
}

function SU_GetBrowserName()
{
  return SU_GetBrowserInfo(0);
}

function SU_GetBrowserVersion()
{
  return VersionStringToFloat( SU_GetBrowserInfo(1) );
}

function SU_GetBrowserOS()
{
  return SU_GetBrowserInfo(2);
}

// Window and document functions

function SU_OpenURL( bAutoResize, targetURL, targetObjectName, targetCaptionName, caption, sitename )
{  // Opens an URL in a target

   // Process open parameters
  var bAR           = (bAutoResize == undefined )  ? false : bAutoResize;
  var tarCaption    = (caption == undefined)  ? '' : caption;
  var tarName       = (sitename == undefined)  ? '' : sitename;
  var tarObject     = (targetObjectName == undefined)  ? 'self' : targetObjectName;
  var tarObjCaption = (targetCaptionName == undefined)  ? 'caption' : targetCaptionName;


  // set new content for iframe
  if( tarObject == "self" )
   { var o = window; }
  else { var o = window.frames[ tarObject ]; } //SU_findObj( tarObject );

  if( o != undefined )
   { // Works on IE
     if( SUBrowserIsIE )
      { o.document.location = targetURL; }
     // Works on Mozilla
     else { o.location.href = targetURL; }
   }

  // set new caption
  var c = SU_findObj( tarObjCaption );
  if( c != null )
   { c.value = tarCaption; }

  if( tarName != "" )
   { document.title = tarName+" - "+tarCaption; }
  else { if( tarCaption != "" )
          { document.title = tarCaption; }
       }

   // Autosize frame if needed
  if( bAR && tarObject != "self" )
  { SU_ResizeIFrame( tarObject ); }
}

function SU_OpenWedFile( num, caption, sitename, targetObjectName, targetCaptionName, bAutoResize )
{ // Opens an web-it CMS file
  return SU_OpenURL( bAutoResize, "wedfile.php?f="+num, targetObjectName, targetCaptionName, caption, sitename );
}

function SU_GetWindowHeight()
{ // Get the internal height of the browser window
 if( document && document.all )
  { return (document.documentElement.clientHeight) ? document.documentElement.clientHeight : document.body.clientHeight; }
 else { return window.innerHeight; }
}

function SU_GetWindowWidth()
{ // Get the internal width of the browser window
 if( document && document.all )
  { return (document.documentElement.clientWidth) ? document.documentElement.clientWidth : document.body.clientWidth; }
 else { return window.innerWidth-SU_GetScrollBarWidth(); }
}

function SU_GetContentHeight()
{
  if( document.body && document.body.scrollHeight )
   { return Math.max( document.body.scrollHeight, SU_GetWindowHeight() ); }
  else { return SU_GetWindowHeight(); }
}

function SU_GetContentWidth()
{
  if( document.body && document.body.scrollWidth )
   { return Math.max( document.body.scrollWidth, SU_GetWindowWidth() ); }
  else { return SU_GetWindowWidth(); }
}

function SU_GetWindowViewHeight()
// Get the (REAL) height that is visible to the user
{
 if( isDefined( window.screen.availHeight ))
  { return window.screen.availHeight; }
 else { return SU_GetWindowHeight(); }
}

function SU_GetWindowViewWidth()
// Get the (REAL) width that is visible to the user
{
 if( isDefined( window.screen.availWidth ))
  { return window.screen.availWidth; }
 else { return SU_GetWindowWidth(); }
}

function SU_WindowResizeToContent()
{
 var Result = ( window.sizeToContent );
 if( Result )
  { window.sizeToContent(); }
 return Result;
}

function SU_SetWindowEvent( sEventName, pListenerFunc, bEnable )
{
 // sEventName can be somthing like "onmousedown"
 // Beter use fixed names without the "on" specification:
 // for example mousedown instead of onmousedown

 //alert( sEventName );
 if( !window || sEventName == undefined || sEventName == "" ||
   pListenerFunc == undefined || !isFunction( pListenerFunc ) )
    return false;

 var bDoEnable = (bEnable == undefined)  ? true : bEnable;

 sEventName = strtolower( sEventName );
 var i = IndexOf( "on", sEventName );

 if( !SUBrowserIsIE )
 { if( i == 0 )
    { sEventName = substr( sEventName, 2 ); }
 }
 else { if( i != 0 )
         { sEventName = "on"+sEventName; }
      }

 var Result = (( bDoEnable && window.addEventListener ) || ( !bDoEnable && window.detachEvent ));

 if( Result )
  { // probably NOT IE
    if( bDoEnable )
     { window.addEventListener( sEventName, pListenerFunc, true ); }
    else { window.detachEvent( sEventName, pListenerFunc ); }
  }
 else { // probably IE
        Result = (( bDoEnable && window.attachEvent ) || ( !bDoEnable && window.removeEventListener ));

        if( Result )
         { if( bDoEnable )
            { window.attachEvent( sEventName, pListenerFunc ); }
           else { window.removeEventListener( sEventName, pListenerFunc ); }
         }
      }

 return Result;
}

function SU_RemoveWindowEvent( sEventName, pListnerFunc )
{
 // sEventName can be somthing like "onmousedown"
 // Beter use fixed names without the "on" specification:
 // for example mousedown instead of onmousedown
 return SU_SetWindowEvent( sEventName, pListnerFunc, false );
}

// Events
function SU_GetNameOfEvent()
{
  if( !Event || !Event.type )
   { return ""; }
  else { return Event.type; }
}

function SU_GetMouseX( e )
{
 if( !e )
  { e = window.event; }

 if( e.pageX )
   { return e.pageX; }
  else if( e.clientX )
        { return e.clientX + ( document.documentElement.scrollLeft ?  document.documentElement.scrollLeft : document.body.scrollLeft ); }

 return 0;
}

function SU_GetMouseY( e )
{
 if( !e )
  { e = window.event; }

 if( e.pageY )
  { return e.pageY; }
 else if( e.clientY )
       { return e.clientY + ( document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ); }

 return 0;
}

function SU_GetMousePos( e )
{
  return new Array( SU_GetMouseX( e ), SU_GetMouseY( e ) );
}

function SU_GetKeybState()
{
  if( Event )
   { var Result = ksNone;
     if( Event.altKey )
      { Result = Result + ksAltKey; }
     if( Event.ctrlKey )
      { Result = Result + ksCtrlKey; }
     if( Event.shiftKey )
      { Result = Result + ksShiftKey; }
     return Result;
   }
  else { return ksNone; }
}

function SU_GetKeyPressed()
{
 var Result = 0;
 var sResult = "";

 if( Event && sResult.fromCharCode )
  { if( Event.charCode )
     { Result = Event.charCode; }
    else { if( Event.keyCode )
            { Result = Event.keyCode; }
         }
    return sResult.fromCharCode( Result );
  }
 else { return sResult; }
}

// Browser
function __SU_InitIEBrowserBounds()
{ // This is a trick to find out what the size of the browser window is for IE.
  // IE doesn't support the window.outerHeight and window.outerWidth properties.
  // Method is to resize the window to the size of the current intern window and
  // calculate the difference between these sizes. Adding the difference between
  // these sizes to the original internal size reflects the actual size of
  // the browser window. This code is executed only once for each session that uses
  // the function SU_GetBrowserHeight() and/or the SU_GetBrowserWidth() function.
  if( SUBrowserIsIE && ( SUIEBorderHeight == 0 || SUIEBorderWidth == 0 ))
   {
     var OrgHeight = SU_GetWindowHeight();
     var OrgWidth  = SU_GetWindowWidth();

     window.resizeTo( OrgWidth, OrgHeight );

     var NewWidth  = SU_GetWindowWidth();
     var NewHeight = SU_GetWindowHeight();

     SUIEBorderHeight = OrgHeight - NewHeight;
     SUIEBorderWidth  = OrgWidth  - NewWidth;

     OrgHeight= OrgHeight + SUIEBorderHeight;
     OrgWidth = OrgWidth + SUIEBorderWidth;

     window.resizeTo( OrgWidth, OrgHeight );
   }

 return SUBrowserIsIE;
}

function SU_GetBrowserTop()
{
  if( isDefined( window.screenTop ))
   { return window.screenTop; }
  else { return window.screenY; }
}

function SU_GetBrowserLeft()
{
  if( isDefined( window.screenLeft ))
   { return window.screenLeft; }
  else { return window.screenX; }
}

function SU_GetBrowserHeight()
{
  if( !__SU_InitIEBrowserBounds() )
   { if( isDefined( window.outerHeight ))
      { return window.outerHeight; }
     else { return SU_GetWindowHeight(); /* hmmmmm..... */ }
   }
  else { return SU_GetWindowHeight()+SUIEBorderHeight; }
}

function SU_GetBrowserWidth()
{
  if( !__SU_InitIEBrowserBounds() )
   { if( isDefined( window.outerWidth ))
      { return window.outerWidth; }
     else { return SU_GetWindowWidth(); /* hmmmmm..... */ }
   }
  else { return SU_GetWindowWidth()+SUIEBorderWidth; }
}

function SU_SetBrowserBounds( aX, aY, aWidth, aHeight, bForce )
{
  var X  = (aX == undefined) ? window.left : aX;
  var Y  = (aY == undefined) ? window.top : aY;
  var W  = (aWidth == undefined) ? screen.width : aWidth;
  var H  = (aHeight == undefined) ? screen.height : aHeight;
  var b  = (bForce == undefined) ? true : bForce;

  var BrwLeft   = SU_GetBrowserLeft();
  var BrwTop    = SU_GetBrowserTop();
  var BrwHeight = SU_GetBrowserHeight();
  var BrwWidth  = SU_GetBrowserWidth();

  if( b || BrwLeft > X || BrwLeft < 0 || BrwTop > Y || BrwTop < 0 )
   window.moveTo( X,Y );

  if( b || BrwWidth < W || BrwHeight < H )
   { window.resizeTo( W,H ); }

  return true;
}

function SU_CenterBrowser( aWidth, aHeight )
{
  var W  = (aWidth == undefined) ? screen.width : aWidth;
  var H  = (aHeight == undefined) ? screen.height : aHeight;
  var X  = 0;
  var Y  = 0;

  if( W <= 0 || H <= 0 )
   { return false; }

 if( W > screen.width )
   { W = screen.width; }
  else { X = ( screen.width - W ) / 2 ; }

  if( H > screen.height )
   { H = screen.height; }
  else { Y = ( screen.Height - H ) / 2 ; }

  window.moveTo( X,Y );
  window.resizeTo( W,H );

  return true;
}

// IFrame

function SU_CreateIFrame( idName, bVisible, iLeft, iTop, iWidth, iHeight, sURL )
{
   if( !document || !document.createElement || !document.body || !document.body.appendChild )
    { return false; }

   var o = document.createElement( "iframe" );

   if( !o || !o.setAttribute )
    { return false; }

   o.setAttribute( "id", idName );
   o.setAttribute( "name", idName );

   if( o.style )
    {
      if( bVisible = undefined || bVisible )
       { o.style.visibility = "visible"; }
      else { o.style.visibility = "hidden"; }

      if( iLeft != undefined || iTop != undefined )
       {
         o.style.position = "absolute";

         if( iLeft != undefined )
          { o.style.left = iLeft; }

         if( iTop != undefined )
          { o.style.left = iTop; }
       }

      if( iWidth != undefined )
       { o.style.width = iWidth; }

      if( iHeight != undefined )
       { o.style.width = iHeight; }

      // o.style.background = "#00C";
      // o.style.border = "4px solid #000";
    }

   if( o.src && sURL != undefined )
    { o.src = sURL; }

   document.body.appendChild(o);

   return o;
}

function SU_ResizeIFrame( sIFrameName, minH, maxH, minW, maxW )
{ //return true;
  if( isAssigned( dyniframe ) && isAssigned( sIFrameName ))
   { var o = dyniframe;

     if( isAssigned( maxH ))
      { o.maxH = maxH; }
     else { o.maxH = 0; }

     if( isAssigned( minH ))
      { o.minH = minH; }
     else { o.minH = 0; }

     if( isAssigned( maxW ))
      { o.maxW = maxW; }
     else { o.maxW = 0; }

     if( isAssigned( minW ))
      { o.minW = minW; }
     else { o.minW = 0; }

     o.resize( sIFrameName );

     return true;
   }
 else { return false; }
}

function SU_ResizeIFrames( aIFrameNames )
{ if( isAssigned( dyniframe ) && isArray( aIFrameNames ))
   { for( var i = 0; i < aIFrameNames.length; i++ )
      dyniframe.resize( aIFrameNames[ 0 ] );
     return true;
   }
 else { return false; }
}

function SU_ResizeAllIFrames()
{ if( isAssigned( dyniframe ))
   { dyniframe.deferred_resize();
     return true;
   }
 else { return false; }
}

function SU_SetFrameSize( sFrameName, aWidth, aHeight )
{
  var W  = (aWidth == undefined) ? -1 : aWidth;
  var H  = (aHeight == undefined) ? -1 : aHeight;

  var o = document.getElementById( sFrameName );

  if( o != null )
  {

    if( aWidth >= 0 )
     { o.width = W; } //100px or 100%
    if( aWidth >= 0 )
     { o.height = H; } //100px or 100%
    //alert( "Yes" );
    return true;
  }
 else { return false; }
}



function SU_GetFrameScrollSize( FrameObj )
{ // FrameObj can be self or an iFrame object

   if( !isObject( FrameObj ) || !FrameObj.document )
    { return [0,0]; }
    
   var w=0, h=0, scr_h, off_h;
   var d = FrameObj.document;
   
   if( d.height )
    { return [d.width,d.height]; }

   with( d.body )
   {
     if( scrollHeight ) { h=scr_h=scrollHeight; w=scrollWidth; }
     if( offsetHeight ) { h=off_h=offsetHeight; w=offsetWidth; }
     if( scr_h && off_h ) h=Math.max(scr_h, off_h);
   }

   return [w,h];
}

function SU_GetFrameSize( sFrameName )
{
  var o = document.getElementById( sFrameName );
  var Result = [0,0];

  if( o != null && o.height )
  {
    if( o.width )
     { Result[ 0 ] = o.width; }
    if( o.height )
     { Result[ 1 ] = o.height; }
  }

 return Result;
}

function SU_GetIFrameContentSize( iFrameName )
{
  var o = document.getElementById( iFrameName );
  var Result = [-1,-1];

  if( !o )
   { return Result; }

  if( o.contentDocument ) // Firefox
   { Result[ 0 ] = parseInt( o.contentDocument.height );
     Result[ 1 ] = parseInt( o.contentDocument.width );
   }
  else if( o.scrollHeight ) // IE (and others?)
        { Result[ 0 ] = parseInt( o.scrollWidth );
          Result[ 0 ] = parseInt( o.scrollHeight );
        }

  return Result;
}

function SU_GetIFrameContentHeight( iFrameName )
{
  return SU_GetIFrameContentSize( iFrameName )[ 0 ];
}

function SU_GetIFrameContentWidth( iFrameName )
{
  return SU_GetIFrameContentSize( iFrameName )[ 1 ];
}

 // DIV's

function SU_GetDiv( idName )
{
 if( idName == undefined || !document )
  { return null; }

 var o = null;

 if( document.getElementById )
  { o = document.getElementById( idName ); }
 else { if( document.all )
         { o = document.all[ idName ]; }
      }

 if( o == null || !o.style )
  { return null; }
 else { return o; }
}

function SU_DivExists( idName )
{
  return ( SU_GetDiv( idName ) != null );
}

function SU_DivGetAllAbsolute()
{
  var arr = new Array();

  if( document.getElementById && document.getElementsByTagName )
   {
     var all_divs = document.body.getElementsByTagName("DIV");
     var j = 0;

     for (i = 0; i < all_divs.length; i++)
      if (all_divs.item(i).style.position=='absolute')
       {
         arr[j] = all_divs.item(i);
         j++;
       }
   }

   return arr;
}

function SU_DivBringToFront( id )
{
 if( !document || !document.getElementById || !document.getElementsByTagName)
  return;

 var obj = document.getElementById(id);
 var divs = SU_DivGetAllAbsolute();
 var max_index = 0;
 var cur_index;

 // Compute the maximal z-index of
 // other absolute-positioned divs
 for (i = 0; i < divs.length; i++)
  {
    var item = divs[i];
    if (item == obj || item.style.zIndex == '')
     continue;

    cur_index = parseInt(item.style.zIndex);
    if (max_index < cur_index)
    {
      max_index = cur_index;
    }
 }

 obj.style.zIndex = max_index + 1;
}

function SU_DivSendToBack( id )
{
 if (!document.getElementById || !document.getElementsByTagName)
  return;

 var obj = document.getElementById(id);
 var divs = SU_DivGetAllAbsolute;
 var min_index = 999999;
 var cur_index;

 if( divs.length < 2 )
  return;

 // Compute the minimal z-index of
 // other absolute-positioned divs
 for (i = 0; i < divs.length; i++)
  {
    var item = divs[i];
    if (item == obj)
     { continue; }

    if (item.style.zIndex == '')
     {
       min_index = 0;
       break;
     }

    cur_index = parseInt(item.style.zIndex);
    if (min_index > cur_index)
     { min_index = cur_index; }
  }

  if (min_index > parseInt(obj.style.zIndex))
    { return; }

    obj.style.zIndex = 1;

    if( min_index > 1 )
     { return; }

    var add = min_index == 0 ? 2 : 1;

    for (i = 0; i < divs.length; i++)
    {
      var item = divs[i];
      if( item == obj )
       { continue; }

      item.style.zIndex += add;
    }
}

function SU_GetDivBounds( idName )
{
 var o = SU_GetDiv( idName );

 if( o == null || !o.style )
  { return undefined; }

 //alert( o.style.width );
 var Result = new Array( parseInt( o.style.left ), parseInt( o.style.top ),
                         parseInt( o.style.width ), parseInt( o.style.height ));

 for( var i = 0; i < 4; i++ )
 {
   if( !Result[ i ] && Result[ i ] != 0 )
    { Result[ i ] = ""; }
 }
 
 return Result;
}

function SU_SetDivBounds( idName, aX, aY, aWidth, aHeight, bCentered, iCenterMode, bCenterInViewArea )
{
 var o = SU_GetDiv( idName );

 if( o == null || !o.style )
  { return false; }

  var bCenter    = ( bCentered == undefined ) ? false : bCentered;

  if( bCenter )
   {
     Cm = ( iCenterMode == undefined ) ? cmBoth : iCenterMode;
     var B  = SU_GetDivBounds( idName );
     if( B == undefined )
      { return false; }

     var X = ( aX == undefined ) ? 0 : parseInt(aX); // X margin
     var Y = ( aY == undefined ) ? 0 : parseInt(aY); // Y margin

     if( B[2] != "" && ( Cm == cmBoth || Cm == cmXaxis ))
      { o.style.left = ( Math.round( Math.abs( SU_GetContentWidth()-B[2]) / 2 )+X )+"px"; }

     if( B[3] != "" && ( Cm == cmBoth || Cm == cmYaxis ))
      { var bCenterInViewArea = true;
        if( bCenterInViewArea != undefined && bCenterInViewArea )
         { o.style.top = ( Math.round( Math.abs( SU_GetWindowHeight()+SU_GetScrollXY()[1]-B[3]) / 2 )+Y )+"px"; }
        else { o.style.top = ( Math.round( Math.abs( SU_GetContentHeight()-B[3]) / 2 )+Y )+"px"; }
      }
   }
  else {
         if( aWidth != undefined )
          { o.style.width = parseInt( aWidth )+"px"; }
         if( aHeight != undefined )
          { o.style.height = parseInt( aHeight )+"px"; }

         if( aX != undefined )
          { o.style.left = parseInt( aX )+"px"; }
         if( aY != undefined )
          { o.style.top = parseInt( aY )+"px"; }
       }
       
 return true;
}

function SU_GetDivPos( idName )
{
  var Result = SU_GetDivBounds( idName );
  if( Result != undefined )
   { return new Array( Result[ 0 ], Result[ 1 ] ); }
  else { return Result; }
}

function SU_SetDivPos( idName, aX, aY )
{
  return SU_SetDivBounds( idName, aX, aY );
}

function SU_SetDivTop( idName, aTop )
{
  return SU_SetDivBounds( idName, VOID, aTop );
}

function SU_SetDivLeft( idName, aLeft )
{
  return SU_SetDivBounds( idName, aLeft );
}

function SU_SetDivWidth( idName, aWidth )
{
  return SU_SetDivBounds( idName, VOID, VOID, aWidth );
}

function SU_SetDivHeight( idName, aHeight )
{
  return SU_SetDivBounds( idName, VOID, VOID, VOID, aHeight );
}

function SU_GetDivSize( idName )
{
  var Result = SU_GetDivBounds( idName );
  if( Result != undefined )
   { return new Array( Result[2], Result[3] ); }
  else { return Result; }
}

function SU_SetDivSize( idName, aWidth, aHeight )
{
  return SU_SetDivBounds( idName, VOID, VOID, aWidth, aHeight );
}

function SU_CenterDiv( idName, aXCorr, aYCorr, iCenterMode )
{
  return SU_SetDivBounds( idName, aXCorr, aYCorr, VOID, VOID, true, iCenterMode );
}

function SU_CenterXDiv( idName, aXCorr )
{
  return SU_SetDivBounds( idName, aXCorr, VOID, VOID, VOID, true, cmXaxis );
}

function SU_CenterYDiv( idName, aYCorr )
{
  return SU_SetDivBounds( idName, VOID, aYCorr, VOID, VOID, true, cmYaxis );
}

function SU_GetDivPlacement( idName )
{
 var o = SU_GetDiv( idName );

 if( o == null || !o.style || !o.style.position )
  { return false; }

 if( o.style.position == VOID )
  { return pmRelative; }

 return strtolower( trim( o.style.position )); // to be sure
}

function SU_SetDivPlacement( idName, pPos )
{
 var o = SU_GetDiv( idName );

 if( pPos == VOID || o == null || !o.style || !o.style.position )
  { return false; }

 pPos = strtolower( trim( pPos )); // to be sure; }

 if( o.style.position == VOID || strtolower( trim( o.style.position )) != pPos )
  { o.style.position = pPos; }

 return true;
}

function SU_IsFloatingDiv( idName )
{
  return ( SU_GetDivPlacement( idName ) == pmAbsolute );
}

function SU_SetDivFloating( idName )
{
  return ( SU_SetDivPlacement( idName, pmAbsolute ));
}

function SU_IsFloatingDiv( idName )
{
 var o = SU_GetDiv( idName );
 if( o == null || !o.style || !o.style.position || o.style.position == VOID )
  { return false; }

 return ( strtolower( trim( o.style.position )) == "absolute" );
}

function SU_GetDivVisible( idName )
{
 var o = SU_GetDiv( idName );
 if( o == null || !o.style )
  { return false; }
 else { return ( strtolower( o.style.visibility ) == "visible" ); }
}

function SU_SetDivVisible( idName, bValue )
{
 var o = SU_GetDiv( idName );

 if( o == null || !o.style || bValue == undefined || !isBoolean( bValue ) )
  { return false; }

 if( bValue )
  { o.style.visibility = "visible"; }
 else { o.style.visibility = "hidden"; }

 return true;
}

function SU_DivVisible( idName, bValue )
{
 if( bValue != undefined && isBoolean( bValue ))
  { return SU_SetDivVisible( idName, bValue ); }
 else { return SU_GetDivVisible( idName ); }
}

function SU_ShowDiv( idName )
{
  return SU_SetDivVisible( idName, true );
}

function SU_HideDiv( idName )
{
  return SU_SetDivVisible( idName, false );
}

function SU_GetDivColor( idName )
{
 var o = SU_GetDiv( idName );

 if( o == null || !o.style )
  { return false; }

 return o.style.backgroundColor;
}

function SU_SetDivColor( idName, Color )
{
 var o = SU_GetDiv( idName );

 if( o == null || !o.style )
  { return false; }

 o.style.backgroundColor = Color;
 return true;
}

function SU_DivColor( idName, Color )
{
 if( Color == undefined )
  { return SU_GetDivColor( idName ); }
 else { return SU_SetDivColor( idName, Color ); }
}

// Window

function SU_CenterWindowContent( bDoX, bDoY, iCorrX, iCorrY )
{
  var DoX  = (bDoX == undefined) ? true : bDoX;
  var DoY  = (bDoY == undefined) ? true : bDoY;

  var iCorrX  = (iCorrX == undefined) ? 0 : iCorrX;
  var iCorrY  = (iCorrY == undefined) ? 0 : iCorrY;

  var Size  = [];
  
  Size[ 0 ] = Math.abs( SU_GetWindowWidth() - SU_GetWindowViewWidth() );
  Size[ 1 ] = Math.abs( SU_GetWindowHeight() - SU_GetWindowViewHeight() );

  var W = 0;
  var H = 0;

  if( DoX && Size[ 0 ] > 0 )
   { W = Math.round( Size[ 0 ] / 2 )+iCorrX; }
  else { iCorrX = 0; }

  if( DoY && Size[ 1 ] > 0 )
   { H = Math.round( Size[ 1 ] / 2 )+iCorrY; }
  else { iCorrY = 0; }

  if( W > 0 || H > 0 )
  {
    window.scrollTo( W , H );
    return true;
  }
  else { return false; }
}

// Functions for the window scrollbar

function SU_SetScrollColor( frameName, cBaseColor, cTrackColor, cArrowColor,
                            cInnerShadowColor, cInnerHighlightColor,
                            cOuterShadowColor, cOuterHighlightColor )
{
  if( SUBrowserIsIE || strtolower( SUBrowserName ) == "opera" )
  { if( frameName == undefined )
     { var o = document.body.style; }
    else { var o = window.frames[ frameName ];
           if( o != undefined )
            { o = o.document.body.style; }
           else { return false; }
         }
  }
 else { return false; }

 // The object using different property names but is a littlebit confusing!
 // That's Microsoft ;-)

 if( isAssigned( cBaseColor ))
  { o.scrollbarBaseColor = cBaseColor; }

 if( isAssigned( cTrackColor ))
  { o.scrollbarTrackColor = cTrackColor; }

 if( isAssigned( cArrowColor ))
  { o.scrollbarArrowColor = cArrowColor; }

 if( isAssigned( cOuterShadowColor ))
  { o.scrollbarDarkShadowColor = cOuterShadowColor; }

 if( isAssigned( cInnerShadowColor ))
  { o.scrollbarShadowColor = cInnerShadowColor; }

 if( isAssigned( cInnerHighlightColor ))
  { o.scrollbarHighlightColor = cInnerHighlightColor; }

 if( isAssigned( cOuterHighlightColor ))
  { o.scrollbar3dLightColor = cOuterHighlightColor; }
}

function SU_GetScrollBarWidth()
{
  if( SUSCROLLBARWITDH == undefined )
  {
    var scr = null;
    var inn = null;
    var wNoScroll = 0;
    var wScroll = 0;

    // Outer scrolling div
    scr = document.createElement('div');
    scr.style.position = 'absolute';
    scr.style.top = '-1000px';
    scr.style.left = '-1000px';
    scr.style.width = '100px';
    scr.style.height = '50px';
    // Start with no scrollbar
    scr.style.overflow = 'hidden';

    // Inner content div
    inn = document.createElement('div');
    inn.style.width = '100%';
    inn.style.height = '200px';

    // Put the inner div in the scrolling div
    scr.appendChild(inn);
    // Append the scrolling div to the doc
    document.body.appendChild(scr);

    // Width of the inner div sans scrollbar
    wNoScroll = inn.offsetWidth;
    // Add the scrollbar
    scr.style.overflow = 'auto';
    // Width of the inner div width scrollbar
    wScroll = inn.offsetWidth;

    // Remove the scrolling div from the doc
    document.body.removeChild( document.body.lastChild );

    // Pixel width of the scroller
    SUSCROLLBARWITDH = (wNoScroll - wScroll);
   }

 return SUSCROLLBARWITDH;
}

function SU_GetScrollXY()
{
  var scrOfX = 0;
  var scrOfY = 0;

  if( isNumber( window.pageYOffset ) )
  {
    //Netscape compliant
    scrOfY = window.pageYOffset;
    scrOfX = window.pageXOffset;
  }
  else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) )
        {
           //DOM compliant
           scrOfY = document.body.scrollTop;
           scrOfX = document.body.scrollLeft;
        }
       else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) )
             {
                  //IE6 standards compliant mode
                  scrOfY = document.documentElement.scrollTop;
                  scrOfX = document.documentElement.scrollLeft;
             }

  return [ parseInt( scrOfX ), parseInt( scrOfY )];
}

function SU_ScrollWindowUp( ypos, steps, delay, xpos )
{
 if( !window.scroll )
  { return false; }
  
 if( ypos == undefined )
  { var ypos = 0; }

 var y = SU_GetScrollXY()[1];

 if( steps == undefined || steps <= 0 )
  { var steps = 0.5; }
 else { steps = ( ypos-y ) / steps / 1000; }

 if( delay == undefined )
  { var delay = 10; }

 if( xpos == undefined )
  { var xpos = SU_GetScrollXY()[0]; }

 //var y = steps + ( ypos - steps )*.1;
 y = y-steps;

 window.scroll(xpos,y);

 if((( ypos - y ) <= steps ) && ( (ypos - y) >= -steps) )
  { y = ypos; }
 else { setTimeout( "SU_ScrollWindowUp("+ypos+","+steps+","+delay+","+xpos+")", delay ); }

 return true;
}

function SU_ScrollWindowDown( ypos, steps, delay, xpos )
{
 if( !window.scroll )
  { return false; }

 var y = Math.max( SU_GetScrollXY()[1], 1 );

 if( ypos == undefined )
  { var ypos = SU_GetContentHeight(); }

 var distance = ( ypos-y );

 if( distance <= 0 )
  { return true; }
 
 if( steps == undefined || steps <= 0 )
  { var steps = 4; }
 else { steps = distance / steps; }

 if( xpos == undefined )
  { var xpos = SU_GetScrollXY()[0]; }

 if( delay == undefined || delay < 0 )
  { var delay = 250; }

 var delaysteps = 0;
 if( delay > 0 )
  { delaysteps = ( delay / steps ); }

 var i = 0;
 delay = 1;
 
 while( y <= ypos )
 {
   setTimeout( "window.scroll("+xpos+","+y+");", delay );
   delay = delay+delaysteps;
   y = y + steps;
 }

 if(y != ypos)
 {
   setTimeout( "window.scroll("+xpos+","+ypos+");", delay );
 }
}

 // (DIV) position modi
var pmUndefined = undefined;
var pmStatic    = "static"
var pmRelative  = "relative";
var pmAbsolute  = "absolute";
var pmFixed     = "fixed";
var pmInherit   = "inherit";

 // Center modes for SU_CenterDiv function
var cmBoth  = 2;
var cmXaxis = 1;
var cmYaxis = 0;
 
 // Keyboard state return values
var ksNone         = 0;
var ksAltKey       = 1;
var ksCtrlKey      = 2;
var ksShiftKey     = 4;
var ksAltAndCtrl   = 3;
var ksAltAndShift  = 5;
var ksCtrlAndShift = 6;
var ksCtrlAndAlt   = 3;
var ksShiftAndCtrl = 6;
var ksShiftAndAlt  = 5;
var ksShiftAltCtrl = 7;

var BASE64_KEYS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";

var SUSCROLLBARWITDH   = undefined;
var VOID               = undefined;
var SUIEBorderWidth    = 0;
var SUIEBorderHeight   = 0;
var SUBrowserName      = SU_GetBrowserName();
var SUBrowserIsIE      = ( SUBrowserName == "Internet Explorer" || SUBrowserName == "IE" );
var SUBrowserVersion   = SU_GetBrowserVersion();
var SUBrowserCodeName  = navigator.appCodeName;
var SUBrowserPlatform  = SU_GetBrowserOS();
var SUBrowserCookies   = navigator.cookieEnabled;
var SUBrowserUserAgent = navigator.userAgent;
var SUBrowserDHTML     = ( document.getElementById || document.all || document.layers );

var SUFlashVersion     = 0; // use the function SU_getFlashVersion() to get version!
var SUJavaEnabled      = navigator.javaEnabled();
var SUJavaVersion      = 0;
// var SUJavaVendor       = "Unknown";

 // Dynamic iFrame resize obj var
var dyniframe = {
        // Storage for known IFrames.
	iframes: {},
	// Here we save any previously installed onresize handler.
	oldresize: null,
	// Flag that tell us if we have already installed our onresize handler.
	ready: false,
	// The document dimensions last time onresize was executed.
	dim: [-1,-1],
        // Min and Max bounds
        maxH : 0,
        minH : 0,
        maxW : 0,
        minW : 0,
        // Timer ID used to defer the actual resize action.
	timerID: 0,
	// Obtain the dimensions (width,height) of the given document.
        interval: 300,
        // Interval of timer event
        getDim: function(d) {
		var w=200, h=200, scr_h, off_h;
		if( d.height ) { return [d.width,d.height]; }
                if( d.body )
                 { with( d.body )
                    {
			if( scrollHeight ) { h=scr_h=scrollHeight; w=scrollWidth; }
			if( offsetHeight ) { h=off_h=offsetHeight; w=offsetWidth; }
			if( scr_h && off_h ) h=Math.max(scr_h, off_h);
                    }
                 }

                return [w,h];
	},
	// This is our window.onresize handler.
	onresize: function() {
                // Invoke any previously installed onresize handler.
		if( typeof this.oldresize == 'function' ) { this.oldresize(); }
		// Check if the document dimensions really changed.
		var newdim = this.getDim(document);

		if( this.dim[0] == newdim[0] && this.dim[1] == newdim[1] )
                 return;

		// Defer the resize action to prevent endless loop in quirksmode.
		if( this.timerID ) return;
		this.timerID = setTimeout('dyniframe.deferred_resize();', this.interval );
	},
	// This is where the actual IFrame resize is invoked.
	deferred_resize: function() {
		// Walk the list of known IFrames to see if they need to be resized.
		for( var id in this.iframes ) this.resize(id);
		// Store resulting document dimensions.
		this.dim = this.getDim(document);
		// Clear the timer flag.
		this.timerID = 0;
	},
	// This is invoked when the IFrame is loaded or when the main window is resized.
	resize: function(id) {
		// Browser compatibility check.
		if( !window.frames || !window.frames[id] || !document.getElementById || !document.body )
			return;
		// Get references to the IFrame window and layer.
		var iframe = window.frames[id];
		var div = document.getElementById(id);
		if( !div ) return;
		// Save the IFrame id for later use in our onresize handler.
		if( !this.iframes[id] ) {
			this.iframes[id] = true;
		}
		// Should we inject our onresize event handler?
		if( !this.ready ) {
			this.ready = true;
			this.oldresize = window.onresize;
			window.onresize = new Function('dyniframe.onresize();');
		}
		// This appears to be necessary in MSIE to compute the height
		// when the IFrame'd document is in quirksmode.
		// OTOH, it doesn't seem to break anything in standards mode, so...
		if( document.all ) div.style.height = '0px';
		// Resize the IFrame container.

                var dim = this.getDim(iframe.document);

                dim[1]=dim[1]+20;

                if( this.maxW >= 0 && dim[0] > this.maxW )
                 { dim[0] = this.maxW; }
                if( this.minW >= 0 && dim[0] < this.minW )
                 { dim[0] = this.minW; }

                if( this.maxH > 0 && dim[1] > this.maxH )
                 { dim[1] = this.maxH; }
                if( this.minH > 0 && dim[1] < this.minH )
                 { dim[1] = this.minH; }

		//var dim = this.getDim(div.document);
		div.style.height = (dim[1]) + 'px';
	}
};

-->

