<?php 
//======================================================================================================================
//
//  Compress output and set caching headers
//
// ---------------------------------------------------------------------------------------------------------------------

/*     ob_start( 'ob_gzhandler' ) ; */
/*     header( 'Content-type: text/javascript' ) ; */
/*     header ( 'Cache-Control: must-revalidate' ) ; */
/*     $offset = 60 * 60 ; */
/*     $ExpStr = 'Expires: ' .  */
/*     gmdate ( 'D, d M Y H:i:s', */
/*     time() + $offset) . ' GMT' ; */
/*     header( $ExpStr ) ; */

?>
//======================================================================================================================
//
//  Copyright (c) 2004, Creed New Media except where noted otherwise. All rights reserved.
//
// ---------------------------------------------------------------------------------------------------------------------
//
//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO 
//  THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 
//  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 
//  THE SOFTWARE. 
//
//======================================================================================================================

//======================================================================================================================
//
//  Function to add background stripes to tables.
//  Original code http://www.alistapart.com/articles/zebratables/
//
//----------------------------------------------------------------------------------------------------------------------

    // this function is needed to work around 
    // a bug in IE related to element attributes
    
    function hasClass(obj) 
    {
        var result = false;
     
        if ( obj.getAttributeNode( "class" ) != null ) {
            result = obj.getAttributeNode( "class" ).value ;
        }
     
        return result ;
    }   
    
    
    function stripeTables() 
    {
        // if arguments are provided to specify the colours
        // of the even & odd rows, then use the them;
        // otherwise use the following defaults:
        var evenColor = arguments[0] ? arguments[0] : "#eee";
        var oddColor = arguments[1] ? arguments[1] : "#fff";
        
        // obtain a reference to the desired table
        // if no such table exists, abort
        if ( arguments[2] ) 
        {
            var table = document.getElementById(id);
        
            if ( ! table ) { return; }
        }
        else
        {
            var tables = document.getElementsByTagName("table") ;
        }
        
        for ( var t = 0; t < tables.length; t++ ) 
        {
            // the flag we'll use to keep track of 
            // whether the current row is odd or even
            var even = false;
            
            // by definition, tables can have more than one tbody
            // element, so we'll have to get the list of child
            // &lt;tbody&gt;s 
            var tbodies = tables[t].getElementsByTagName("tbody");
        
            // and iterate through them...
            for (var h = 0; h < tbodies.length; h++) 
            {
                // find all the &lt;tr&gt; elements... 
                var trs = tbodies[h].getElementsByTagName("tr");
              
                // ... and iterate through them
                for (var i = 0; i < trs.length; i++)
                {
                    // avoid rows that have a class attribute or backgroundColor style
                    if ( ! hasClass(trs[i]) && ! trs[i].style.backgroundColor ) 
                    {
                        var mytr = trs[i];

                        // set this row's class in case we want to overide it later...
                        mytr.className = even ? 'dark' : 'light' ;
                        
                        // get all the cells in this row...
                        var tds = trs[i].getElementsByTagName("td");
                        
                        // and iterate through them...
                        for (var j = 0; j < tds.length; j++) 
                        {
                            var mytd = tds[j];
                
                            // avoid cells that have a class attribute
                            // or backgroundColor style
                            if ( ! hasClass(mytd) && ! mytd.style.backgroundColor ) {
                                mytd.style.backgroundColor = even ? evenColor : oddColor ;
                            }
                        }
                    }
                    
                    // flip from odd to even, or vice-versa
                    even =  ! even;
                }
            }
        }
    }
    
    function stripeIntranetTables() 
	{
		stripeTables('#EFDAEB', '#FFFFFF');
	}
	
	if (isIntranet)
	{
		safeAddOnload( stripeIntranetTables ) ;
	}
	else
	{
		safeAddOnload( stripeTables ) ;
	}
  

//======================================================================================================================
//
//  Used for reveal/hide elements, etc.
//
//----------------------------------------------------------------------------------------------------------------------

    function changeClass( id, newclass ) 
    {
        if ( ! document.getElementById ) return ;

        element = document.getElementById( id ) ;
        
        if ( element ) element.className = newclass ;
    } 


//======================================================================================================================
//
//  Standards-compliant image rollovers.
//
//  Original JavaScript code by Daniel Nolan
//  http://www.bleedingego.co.uk/webdev.php
//
//----------------------------------------------------------------------------------------------------------------------

    function initRollovers ( ) 
    {
        if ( ! document.getElementById ) return ;
        
        var trimString = '_active' ;
        var overString = '_hilite' ;
        var inactiveString = '_inactive' ;
        
        var aPreLoad = new Array() ;
        var sTempSrc ;
        var aImages = document.getElementsByTagName('img') ;
    
        for ( var i = 0; i < aImages.length; i++ ) 
        {       
            if ( aImages[i].className.match( 'rollover' ) ) 
            {
                var src = aImages[i].getAttribute( 'src' ) ;
                
                var ftype = src.substring( src.lastIndexOf( '.' ), src.length) ;
                
                var hsrc = src.replace( trimString + ftype, overString + ftype ) ;
    
                aImages[i].setAttribute( 'hsrc', hsrc ) ;
                
                aPreLoad[i] = new Image() ;
                
                aPreLoad[i].src = hsrc ;
                
                aImages[i].onmouseover = function() 
                {
                    sTempSrc = this.getAttribute( 'src' ) ;
                    this.setAttribute( 'src', this.getAttribute( 'hsrc' ) ) ;
                }   
                
                aImages[i].onmouseout = function() 
                {
                    if ( ! sTempSrc ) sTempSrc = this.getAttribute( 'src' ).replace( overString + ftype, trimString + ftype ) ;
                    this.setAttribute( 'src', sTempSrc ) ;
                }
            }
        }
    }
    
    safeAddOnload( initRollovers ) ;


//======================================================================================================================
//
//  Preload images function.
//
//  Call using <body onload="preloadImages( 'image1.gif','image2.gif' )" > or by SafeAddOnload(preloadImages) .
//
//----------------------------------------------------------------------------------------------------------------------

    var gPreloadedImages = new Array() ;
    
    function preloadImages() 
    {
        if ( ! document.images ) return ;

        var temp = preloadImages.arguments ; 

        for ( x=0; x < temp.length; x++ ) 
        {
            gPreloadedImages[x] = new Image() ;
            
            gPreloadedImages[x].src = preloadImages.arguments[x] ;
        }
    }



//======================================================================================================================
// EOF

