//////////////////////////////////////////////////////////////////
//  Global functions and objects for accentdecorativepainting.com

/*  This is an object that contains all the information to format a link
    and a target window launched from that link.
    All the features for the target window are defined in the object, with
    defaults and can be overidden by setting the properties after
    instantiating the object.
*/

//$Id: global.js 6 2008-04-01 17:48:31Z danielle $

//document.write("Now processing global.js<br>\n");
function lgwin() {
    //
    // properties
    //
    //  window call and anchor properties
    this.selfname              = "unknown";             // It seems there is no easy way for an object to know its name
    this.url                   = "notyet.html";         // A default page that can avoid 404 errors
    this.name                  = "Link";                // I guess you could do things to the target window after its launched
    this.linktitle             = "Title text not set";  // Default descriptive title (tooltip) text
    //  features
    this.features              = new Object();          // An object containing all the features of the target window
    this.features.height       = "860";                 // height of target window
    this.features.width        = "860";                 // width of target window
    this.features.left         = "20";                  // X coordinate of target window
    this.features.top          = "20";                  // Y coordinate of target window
    this.features.location     = "0";                   // Show the address bar
    this.features.menubar      = "0";                   // Show the menu bar
    this.features.resizeable   = "1";                   // Allow resizing
    this.features.scrollbars   = "1";                   // Allow scrollbars when necessary
    this.features.status       = "0";                   // Allow/set? the status bar
    this.features.toolbar      = "0";                   // Allow the tool bar
    // image
    this.image                 = new Object();          // An object containing all the attributes of the image (for the link)
    this.image.file            = "notyetsmpic.jpg";    // A default image to avoid broken image icons
    this.image.width           = "320";                 // width of the displayed image
    this.image.height          = "240";                 // height of the displayed image
    this.image.alt             = "Alt text not set";    // Default image alternate text
    // this.image.longdesc        = "notyetlongdesc.html"; // Default long description
    this.image.divClass        = "leftgalimg";          // Class of the image for CSS
    // deprecated image elements
    // this.image.hspace          = "0px";                 // Image horizontal spacing
    // this.image.vspace          = "0px";                 // Image vertical spacing
    // this.image.border          = "0px";                 // Image border width
    // this.image.align           = "bottom";              // Vertically align with the current baseline
    //
    // methods
    //
    this.Features       =   function() {  //This builds the features string
        return feat = "height=" + this.features.height + "," +
        "width="        + this.features.width + "," +
        "left="         + this.features.left + "," +
        "top="          + this.features.top + "," +
        "location="     + this.features.location + "," +
        "menubar="      + this.features.menubar + "," +
        "resizeable="   + this.features.resizable + "," +
        "scrollbars="   + this.features.scrollbars + "," +
        "status="       + this.features.status + "," +
        "toolbar="      + this.features.toolbar;
    }
    this.setTitleAndAlt =   function(titleAndAlt) {  // Will set both the image alternate text and the link title to the same value.
        this.image.alt      = titleAndAlt;           // These can be overridden by setting each property individually.
        this.image.longdesc = titleAndAlt;
        this.linktitle      = titleAndAlt;
    }
    this.WriteLink      =   function() { // This function writes a JavaScript enabled link at the location where it's called.
        var fulllink = "<a href=\"Javascript:" + this.selfname + ".NewWindow()\" title=\"" + this.linktitle + "\"><img class=\"" + this.image.divClass + "\" src=\"images/" + this.image.file + "\" width=\"" + this.image.width + "\" height=\"" + this.image.height + "\" alt=\"" + this.image.alt + "\"></a>\n";
        document.write(fulllink);   // From core client side JavaScript
    }
    this.NewWindow      =   function() { // This function formats and opens the target window when called.
        link = window.open(this.url,this.name,this.Features()); // From core client side JavaScript
    }
}

/*  Some wrappers for buttons to keep unobtrusive in HTML.
*/
function printButton() {
    document.write("<input class=\"jsbutton\" type=\"button\" value=\"Print\" onClick=\"window.print()\">");
}

function closeButton() {
    document.write("<input class=\"jsbutton\" type=\"button\" value=\"Close\" onClick=\"window.close()\">");
}
