//
// Common Construction Element Declarations
//

//
// Directory tree shorthand...

// Graphics Directories
var Gfx_d   = '/Common/Graphics/';
var Books_d = Gfx_d + 'Books/';
var Logo_d  = Gfx_d + 'Logos/';

// Content Directories
var Links_d = '/Resources/';

//
// Per Browser content helpers...

// Browser checks...
var isIE    = document.all;             // IE vAny
var isNN    = !document.all &&
               document.getElementById; // NS v6.x ->
var isN4    = document.layers;          // NS <- v4.x

// Visibility style attribute values (by browser)...
var Style_Hide = ( isN4 )? "hide" : "hidden";
var Style_Show = ( isN4 )? "show" : "visible";

//
//Site Specific Shorthand...
var Contact  = 
    {
        addr:   {
                    title:  'AnimalTell/Karla McCoy',
                    pobox:  'P.O. Box 95',
                    where:  'Washington, IL  61571'
                },
        email:  'KarlaMcCoy@AnimalTell.com',
        phone:  '1-309-444-1514'
    }

//
// Contact Display Functions

function Contact_MailTo()
{
    document.write('<a href="mailto:', Contact.email, '">', Contact.email, '</a>');
}

function Contact_Phone()
{
    document.write(Contact.phone);
}

function Contact_Address()
{
    document.write(Contact.addr.title, '<br>', Contact.addr.pobox, '<br>', Contact.addr.where);
}


//
// External Site Credits (Left side of Footer)
//
// Site definition is comprised of the following:
//
// alt:     ALT text displayed if there is trouble with the logo image
// image:   _local_ path to the logo image
// url:     URL to which the anchor will point
//
// Credits - Array defining the order the credits will appear...

var Credits =
    new Array(
                {
                    alt:    'W3C HTML4.01',
                    image:  Logo_d + 'vHTML401T.gif',
                    url:    'http://validator.w3.org/check/referer'
                }
             );

// Auto Generate the HTML code for the Credits
function Credits_Create(top)
{
    for ( var idx=0; idx < Credits.length; idx++ )
    {
        document.write('<a href="', Credits[idx].url, '">');
        document.write('<img alt="', Credits[idx].alt, '" border=0',
                           ' class=xCredits src="', top,
                           Credits[idx].image, '">');
        document.writeln('</a>');
    }
}

//
// Disclaimer()

function Disclaimer()
{
    // Layout control box: Begin
    document.writeln('<div align=center class=Disclaimer>');
    
    document.writeln('<span class=DisclaimerBullets> &#149;&#149; </span>');
    document.writeln('<em class=Disclaimer>');
    document.writeln('These services are ',
                     '<strong style="font-size: 9pt;">not</strong> ',
                     'an alternative or substitute for good veterinary care.');
    document.writeln('</em>');
    document.writeln('<span class=DisclaimerBullets> &#149;&#149; </span>');
    
    // Additional info & Disclosure...
    if ( Page_ID == 'Consultations' )
    {
        document.writeln('<br>');
        document.writeln('<A href="/Resources/IAAOR.html">');
        document.writeln('<em class=Disclaimer>');
        document.writeln('More Information');
        document.writeln('</em>');
        document.writeln('</a>');
        document.writeln('<br>');
    }

    // Layout control box: End
    document.writeln('</div>');
}

//
// Tool Functions...

//
// _SidesObjFrom(unknown)
//
// Convert unknown variable into an appropriate sides object, suitable
// for use with 'style' attribute and/or CSS properties.
//
// (border-*-width, padding-*, margin-*, etc.)

function _SidesObjFrom(unknown, justify)
{
    var _obj = new Object();

    // Default to no margins...
    if ( unknown == null ) unknown = 0;
    switch ( typeof(unknown) )
    {
        case 'number':      // all padding is the same...
            _obj.t  = _obj.l  = _obj.b = _obj.r = unknown;  // CSS
            _obj.hs = _obj.vs = unknown;                    // <img>
            break;

        case 'object':      // Should have come through as an Array, but...
        case 'array':
            switch ( unknown.length )                       // CSS
            {
                case 2:     // tp/bt, lt/rt
                    _obj.b = _obj.t = unknown[0];
                    _obj.l = _obj.r = unknown[1];
                    break;
                case 3:     // tp, lt/rt, bt
                    _obj.b = unknown[2];
                    _obj.t = unknown[0];
                    _obj.l = _obj.r = unknown[1];
                    break;
                case 4:     // tp, rt, bt, lt
                    _obj.b = unknown[2];
                    _obj.l = unknown[3];
                    _obj.r = unknown[1];
                    _obj.t = unknown[0];
                    break;
            }
            // <img> tag allows only h/v spacing... make the best of the data
            // that has been supplied.
            _obj.hs = Math.floor((_obj.l + _obj.r) / 2);    // <img>
            _obj.vs = Math.floor((_obj.b + _obj.t) / 2);
            break;

        default:        // Something is wrong... quit while ahead...
            return(null);
    }

    // Adjust sizes for justification... unless all 4 sides were given...
    if ( unknown.length != 4 )
    {
        switch ( justify )
        {
            case 'left':    _obj.l = 0; break;  // Remove left size...
            case 'right':   _obj.r = 0; break;  // Remove right size...
            default:                    break;  // Untouched
        }
    }

    return(_obj);
}


