<!--//--><![CDATA[//><!--

/*
 * _____________________________________________________________________________
 *
 *  RSZD library
 *   copyright (c) 2004-2005 Vincent Twigt (for RSZdesign)
 * _____________________________________________________________________________
 *
 *   Licensed under the terms of the GNU Lesser General Public License:
 *        http://www.opensource.org/licenses/lgpl-license.php
 *
 *   Creator website:
 *        http://www.rszdesign.com
 *
 *   File name: rszd_library.js
 *        JavaScript functions
 *
 *        This file must be included as the first JavaScript include on the page 
 *        so it can load all RSZD library JavaScript functions.
 *
 *   Version:  1.0 ($Rev: 13 $)
 *   Created:  2005-02-16 17:15:23
 *   Modified: $Date: 2005-10-10 01:05:09 +0200 (ma, 10 okt 2005) $
 *   Id:       $Id: rszd_library.js 13 2005-10-09 23:05:09Z Vincent $
 *
 *   File Authors:
 *        Vincent Twigt (vtwigt@rszdesign.com)
 *
 */


userAgent   = window.navigator.userAgent;
browserVers = parseInt(userAgent.charAt(userAgent.indexOf('/')+1),10);


// +-------------------------------------
// Event attacher
// +-------------------------------------
document.events = [];
document.attachEvent = function(type, reference) {
    var evt = this.events;
    if(!evt[type]) evt[type] = [];
    evt[type][evt[type].length] = reference;

    document[type] = function(e) { 
        document.executeEvents(type, e);        
    }
}    

document.executeEvents = function(type, e) {
    for(var i in this.events[type]) {
        this.events[type][i](e);
    }    
}

// +-------------------------------------
// Attach functions to window object methods
// +-------------------------------------
window.onload   = function() { document.executeEvents('onload'); }
window.onresize = function() { document.executeEvents('onresize'); }

// --------------------------------------


var preloadFlag = false;
function preloadImages( images )
{
    if (document.images) {
        if (images != null && images.length > 0) {
            var imgVars = new Array() ;
            for (i = 0; i < images.length; i++) {
                imgVars[i]     = new Image() ;
                imgVars[i].src = images[i];
            }
            preloadFlag = true;
        }
    }
}


function show( obj ) { if (obj != null) { if (obj.style.display != '')     { obj.style.display = ''; } } }
function hide( obj ) { if (obj != null) { if (obj.style.display != 'none') { obj.style.display = 'none'; } } }


function setRollOver(obj, path, path_over)
{
    if (obj != null) {
        obj.onmouseout  = function() { this.setAttribute('src', path); }
        obj.onmouseover = function() { this.setAttribute('src', path_over); }
    }
}


var win = 0;
function popup(page, name, w, h, scrollbars, pos)
{
    if (pos == 'random') {
        leftPos = (screen.width) ? Math.floor(Math.random() * (screen.width - w)) : 100;
        topPos = (screen.height) ? Math.floor(Math.random() * ((screen.height - h)-75)) : 100;
    } else if (pos == 'center') {
        leftPos = (screen.width) ? (screen.width - w) / 2 : 100;
        topPos = (screen.height) ? (screen.height -h) / 2 : 100;
    } else if ((pos != 'random' && pos != 'center') || pos == null) {
        leftPos = 0;
        topPos = 20;
    }
    settings = 'width='+w+',height='+h+',top='+topPos+',left='+leftPos+',scrollbars='+scrollbars+',location=no,status=no,menubar=no,toolbar=no,resizable=yes';
    win = window.open(page,name,settings);
    win.focus();

    return false;
}


function resizeWin(width, height)
{
    window.resizeTo(width, height);

    leftPos = (screen.width) ? (screen.width - width) / 2 : 100;
    topPos  = (screen.height) ? (screen.height - height) / 2 : 100;
    window.moveTo(leftPos, topPos);

    return true;
}


//--><!]]>
