﻿/* Image w/ description tooltip v2.0
* Created: April 23rd, 2010. This notice must stay intact for usage 
* Author: Dynamic Drive at http://www.dynamicdrive.com/
* Visit http://www.dynamicdrive.com/ for full source code
*/


var ddimgtooltip = {

    tiparray: function() {
        var tooltips = []
        //define each tooltip below: tooltip[inc]=['path_to_image', 'optional desc', optional_CSS_object]
        //For desc parameter, backslash any special characters inside your text such as apotrophes ('). Example: "I\'m the king of the world"
        //For CSS object, follow the syntax: {property1:"cssvalue1", property2:"cssvalue2", etc}

        //tooltips[0] = ["red_balloon.gif", "Here is a red balloon<br /> on a white background", { background: "#FFFFFF", color: "black", border: "5px ridge darkblue"}]
        //tooltips[1] = ["duck2.gif", "Here is a duck on a light blue background.", { background: "#98c559", width: "200px"}]
        //tooltips[2] = ["../dynamicindex14/winter.jpg"]
        //tooltips[3] = ["../dynamicindex17/bridge.gif", "Bridge to somewhere.", { background: "white", font: "bold 12px Arial"}]

        tooltips[0] = ["Images/Tarantino_200.jpg", "Michalyn (Mikkey) Tarantino", { background: "#87c531", width: "200px", font: "bold 12px Arial"}]
        tooltips[1] = ["Images/DougKinnett_200.jpg", "Commune with organic and geometric forms. See compositions with great harmonies and contrasts. Enjoy the balance of Form and Function, the mix of patterns and the ample use of color. Visit the recently finished rooms of the Manna Machine Studio where Doug Kinnett divides his time between painting, ceramics and furniture making.",  { background: "#518c00", width: "200px", font: "bold 12px Arial"}]
        tooltips[2] = ["Images/SheilaBrannan_200.jpg", "Working in her newly expanded studio, Sheila Brannan&rsquo;s stained glass creations range from the traditional to free form designs incorporating WestVirginia hand-blown glass, copper wire, and found objects. She is available to create custom designs for entryways, bathroom windows for privacy, and kitchen cupboards. Her extensive portfolio is available.",  { background: "#AFB872", width: "200px", font: "bold 12px Arial"}]
        tooltips[3] = ["Images/CarrieSinger_200.jpg", "Carrie Singer designs and creates one-of-a-kind art jewelry from sterling silver, 24K gold, semi-precious stones using traditional metal-smithing techniques. She draws inspriation from the natural world to craft her handmade wearable art.",  { background: "#724f1d", width: "200px", font: "bold 12px Arial"}]
        tooltips[4] = ["Images/Thomas_D_Onofrio_200.jpg", "Concentrating on Windsor style chairs, Tom D&rsquo;Onofrio has re-created several examples of settees, side chairs, armchairs and stools. He also makes country-style tables and benches. All are hand finished, some with the mellow look representing years of use.",  { background: "#cc8d33", width: "200px", font: "bold 12px Arial"}]
        tooltips[5] = ["Images/TaraBell_200.jpg", "Using colored pencils, Tara Bell creates playful animals, insects and landscapes within meditative circles. Find originals &amp; prints, bookmarks, greeting cards, pins, and butterfly ornaments... all enhanced with Tara&rsquo;s luminous art.",  { background: "#48691a", width: "200px", font: "bold 12px Arial"}]
        tooltips[6] = ["Images/SteveAdams_200.jpg", "Using a hand adz, scorp and wood chisel, Steve Adams makes bowls the old fashioned way from a block of wood, out of a hardwood tree that he has cut down. His newest bowls are made from burls that grow around a wound in a living tree and create fascinating structures. He chops and chisels away the bark to reveal the tree&rsquo;s hidden potential.",  { background: "#724f1d", width: "200px", font: "bold 12px Arial"}]
        tooltips[7] = ["Images/EricJohnson_200.jpg", "Ruggedness, character, utility, grace and symmetry are Eric Johnson&rsquo;s favorite descriptions of hand-wrought (forged) iron and steel. This age-old tradition, combining beauty and utility, is the way of life at Southwood Farm Forge.",  { background: "#A078A6", width: "200px", font: "bold 12px Arial"}]
        tooltips[8] = ["Images/NancyStreeter_200.jpg", "Nancy Streeter&rsquo;s interest in nature is revealed by re-creating wildlife in wood. Her animal creations, caught in motion, sometimes whimsical, sometimes realistic, provide a peek into nature. Her creations are unique and require many hours of work. During the holidays she turns to creating unique Santas and other holiday works.",  { background: "#cc8d33", width: "200px", font: "bold 12px Arial"}]
        tooltips[9] = ["Images/RenParziale_200.jpg", "Ren &amp; Pam Parziale create colorful additions to their line of stoneware and redware pottery. Bright majolica reds and oranges highlight the familiar blues and greens. These handmade pots make cooking and serving a pleasure.",  { background: "#87c531", width: "200px", font: "bold 12px Arial"}]
        tooltips[10] = ["Images/MargotOurs_200.jpg", "Margot Ours crochets, knits, sews and tats an astonishing collection of personal and home interior decor pieces. Her winter specialties are 'Kool Socks' and Icelandic sweaters. Come and see for yourself. Your request for a custom design is always welcome.<br>",  { background: "#2c70b1", width: "200px", font: "bold 12px Arial"}]
        tooltips[11] = ["Images/FrancesBrolle_200.jpg", "Fran Brolle collaborates with her husband creating sterling settings for Steve&rsquo;s hot glass cabochons, producing pendants and bracelets. Fran also works with Swarovski crystal beads to make unusual, one-of-a-kind earrings and bracelets.",  { background: "#812db2", width: "200px", font: "bold 12px Arial"}]
        tooltips[12] = ["Images/AnneBowers_200.jpg", "Functional art is how we describe the woven baskets and creations that you will see at Anne Bowers&rsquo; studio in the quaint village of Middleway. Her creative mind is always thinking of new and different ways to expand her range of basketry skills. Come see what is new and enjoy our hospitality.",  { background: "#518c00", width: "200px", font: "bold 12px Arial"}]
        tooltips[13] = ["Images/TrevaBlackford_200.jpg", "Bears, bunnies and foxes are made of mohair with moveable joints. Treva Blackford designs and creates each to have a distinctive look, with sparkling eyes and hand stitched faces.",  { background: "#48691a", width: "200px", font: "bold 12px Arial"}]
        tooltips[14] = ["Images/Mosel_200.jpg", "Elaine is a fabric artisan who creates original, one-of-a-kind works including soft sculptured snow people, quilted pillows, wall hangings and quilted note cards. Some of the quilted items are enhanced with hand embroidery and beading and are designed to be functional as well as decorative.", { background: "#99ba00", width: "200px", font: "bold 12px Arial"}]
        tooltips[15] = ["Images/ThomasMcGarry_200.jpg", "Tom McGarry brings to furniture making the same eye for detail he used in the study of Colonial and Federal period artifacts as an archeologist. Each table, bed or case piece made at The Birnam Wood Joinery is authentic in design, yet expertly adapted to modern living.",  { background: "#8e50b2", width: "200px", font: "bold 12px Arial"}]
        tooltips[16] = ["Images/BlickenstaffKitts_200.jpg", "“From a Feline&rsquo;s Perspective” is a collaboration project of imaging making between Dusseldorf, a long hair red tabby feline and his best friend photographer Teressa Blickenstaff-Kitts.",  { background: "#5081b1", width: "200px", font: "bold 12px Arial"}]
        tooltips[17] = ["Images/Jones_200.jpg", "Rebecca Grace Jones creates mixed media wall pieces and paintings on canvas, paper and wood.",  { background: "#cc9e5c", width: "200px", font: "bold 12px Arial"}]
        tooltips[18] = ["Images/JoyBridy_200.jpg", "Whether it&rsquo;s a set of mugs, plates, or bowls you&rsquo;re looking for, or a bottle and vase for special occasions, Joy Bridy&rsquo;s wood fired pottery will certainly pique your interest. Each piece is made by hand, starting on the potter&rsquo;s wheel, and fired in a wood kiln around-the-clock for 2-7 days. The resulting complex surfaces of ash and flame call out to be touched and used. Stop in to see what it&rsquo;s all about!",  { background: "#8e50b2", width: "200px", font: "bold 12px Arial"}]
        tooltips[19] = ["Images/Langerhans_200.jpg", "From her originally designed patterns Pat Langerhans makes her figures out of fabric, she then applies many layers of paint. She completes her whimsical creations by sealing and antiquing them. From swans, cows, and pigs with pears, to santas and snowmen with reindeer, you never know what you will find her working on.",  { background: "#518c00", width: "200px", font: "bold 12px Arial"}]
        tooltips[20] = ["Images/Shildmyer_200.jpg", "Susan Shildmyer creates knitted items with a focus on color and structure. Her pieces take a multi directional form that explores the many relationships that can occur with shape, space, texture and color. Whether you choose a classic Aran or a more conceptual item, each piece is exquisitely finished and completely unique, no two are ever alike.", { background: "#633b00", width: "200px", font: "bold 12px Arial"}]
        tooltips[21] = ["Images/LindaWright_200.jpg", "Linda Wright<br />Decorative Paintings &amp; Murals", { background: "#2c70b1", width: "200px", font: "bold 12px Arial"}]
        tooltips[22] = ["Images/Fransen_200.jpg", "Bruce Fransen produces carved wood vessels and abstract sculpture. His process is reduction carving (starting with a piece of wood and 'chipping' away at it). He generally starts with a log and a chainsaw, and then uses grinders and sanders and other hand tools. His pieces are highly polished to highlight grain and smoothness to the touch.", { background: "#cc8d33", width: "200px", font: "bold 12px Arial"}]
        tooltips[23] = ["Images/Miller_200.jpg", "Thomas Miller works with the printmaking medias of silkscreen, woodblock and collograph prints as well as painting in oils. His subjects are landscapes and vernacular buildings of Jefferson County.", { background: "#cc8d33", width: "200px", font: "bold 12px Arial"}]
        return tooltips //do not remove/change this line
    } (),

    tooltipoffsets: [20, -30], //additional x and y offset from mouse cursor for tooltips

    //***** NO NEED TO EDIT BEYOND HERE

    tipprefix: 'imgtip', //tooltip ID prefixes

    createtip: function($, tipid, tipinfo) {
        if ($('#' + tipid).length == 0) { //if this tooltip doesn't exist yet
            return $('<div id="' + tipid + '" class="ddimgtooltip" />').html(
				'<div style="text-align:center"><img src="' + tipinfo[0] + '" /></div>'
				+ ((tipinfo[1]) ? '<div style="text-align:left; margin-top:5px">' + tipinfo[1] + '</div>' : '')
				)
			.css(tipinfo[2] || {})
			.appendTo(document.body)
        }
        return null
    },

    positiontooltip: function($, $tooltip, e) {
        var x = e.pageX + this.tooltipoffsets[0], y = e.pageY + this.tooltipoffsets[1]
        var tipw = $tooltip.outerWidth(), tiph = $tooltip.outerHeight(),
		x = (x + tipw > $(document).scrollLeft() + $(window).width()) ? x - tipw - (ddimgtooltip.tooltipoffsets[0] * 2) : x
        y = (y + tiph > $(document).scrollTop() + $(window).height()) ? $(document).scrollTop() + $(window).height() - tiph - 10 : y
        $tooltip.css({ left: x, top: y })
    },

    showbox: function($, $tooltip, e) {
        $tooltip.show()
        this.positiontooltip($, $tooltip, e)
    },

    hidebox: function($, $tooltip) {
        $tooltip.hide()
    },


    init: function(targetselector) {
        jQuery(document).ready(function($) {
            var tiparray = ddimgtooltip.tiparray
            var $targets = $(targetselector)
            if ($targets.length == 0)
                return
            var tipids = []
            $targets.each(function() {
                var $target = $(this)
                $target.attr('rel').match(/\[(\d+)\]/) //match d of attribute rel="imgtip[d]"
                var tipsuffix = parseInt(RegExp.$1) //get d as integer
                var tipid = this._tipid = ddimgtooltip.tipprefix + tipsuffix //construct this tip's ID value and remember it
                var $tooltip = ddimgtooltip.createtip($, tipid, tiparray[tipsuffix])
                $target.mouseenter(function(e) {
                    var $tooltip = $("#" + this._tipid)
                    ddimgtooltip.showbox($, $tooltip, e)
                })
                $target.mouseleave(function(e) {
                    var $tooltip = $("#" + this._tipid)
                    ddimgtooltip.hidebox($, $tooltip)
                })
                $target.mousemove(function(e) {
                    var $tooltip = $("#" + this._tipid)
                    ddimgtooltip.positiontooltip($, $tooltip, e)
                })
                if ($tooltip) { //add mouseenter to this tooltip (only if event hasn't already been added)
                    $tooltip.mouseenter(function() {
                        ddimgtooltip.hidebox($, $(this))
                    })
                }
            })

        }) //end dom ready
    }
}

//ddimgtooltip.init("targetElementSelector")
ddimgtooltip.init("*[rel^=imgtip]")
