$(document).ready(function() {
    if($('#rooms').length) {
        // The image map is present, so continue.
        
        var elems = $('area[title]').removeAttr('title');
        
        // Create the tooltips
        $('#rm1').qtip(
        {
           content: $('#rm1div'),
           position: {
               my: 'top left',
               at: 'bottom right',
               target: 'mouse',
               adjust: {
                   mouse: false
               },
               effect: false
           }
        });
        $('#rm2').qtip(
        {
           content: $('#rm2div'),
           position: {
               my: 'top left',
               at: 'bottom right',
               target: 'mouse',
               adjust: {
                   mouse: false
               },
               effect: false
           }
        });
        $('#rm3').qtip(
        {
           content: $('#rm3div'),
           position: {
               my: 'top left',
               at: 'bottom right',
               target: 'mouse',
               adjust: {
                   mouse: false
               },
               effect: false
           }
        });
        $('#rm4').qtip(
        {
           content: $('#rm4div'),
           position: {
               my: 'top left',
               at: 'bottom right',
               target: 'mouse',
               adjust: {
                   mouse: false
               },
               effect: false
           }
        });
        $('#rm5').qtip(
        {
           content: $('#rm5div'),
           position: {
               my: 'top left',
               at: 'bottom right',
               target: 'mouse',
               adjust: {
                   mouse: false
               },
               effect: false
           }
        });
        $('#rm6').qtip(
        {
           content: $('#rm6div'),
           position: {
               my: 'top left',
               at: 'bottom right',
               target: 'mouse',
               adjust: {
                   mouse: false
               },
               effect: false
           }
        });
        $('#rm7').qtip(
        {
           content: $('#rm7div'),
           position: {
               my: 'top left',
               at: 'bottom right',
               target: 'mouse',
               adjust: {
                   mouse: false
               },
               effect: false
           }
        });
        $('#rm8').qtip(
        {
           content: $('#rm8div'),
           position: {
               my: 'top left',
               at: 'bottom right',
               target: 'mouse',
               adjust: {
                   mouse: false
               },
               effect: false
           }
        });
        $('#rm9').qtip(
        {
           content: $('#rm9div'),
           position: {
               my: 'top left',
               at: 'bottom right',
               target: 'mouse',
               adjust: {
                   mouse: false
               },
               effect: false
           }
        });
        $('#rm10').qtip(
        {
           content: $('#rm10div'),
           position: {
               my: 'top left',
               at: 'bottom right',
               target: 'mouse',
               adjust: {
                   mouse: false
               },
               effect: false
           }
        });
        $('#rm11').qtip(
        {
           content: $('#rm11div'),
           position: {
               my: 'top left',
               at: 'bottom right',
               target: 'mouse',
               adjust: {
                   mouse: false
               },
               effect: false
           }
        });
        $('#rm12').qtip(
        {
           content: $('#rm12div'),
           position: {
               my: 'top left',
               at: 'bottom right',
               target: 'mouse',
               adjust: {
                   mouse: false
               },
               effect: false
           }
        });
        $('#rm13').qtip(
        {
           content: $('#rm13div'),
           position: {
               my: 'top left',
               at: 'bottom right',
               target: 'mouse',
               adjust: {
                   mouse: false
               },
               effect: false
           }
        });
        $('#rm14').qtip(
        {
           content: $('#rm14div'),
           position: {
               my: 'top left',
               at: 'bottom right',
               target: 'mouse',
               adjust: {
                   mouse: false
               },
               effect: false
           }
        });
        $('#rm15').qtip(
        {
           content: $('#rm15div'),
           position: {
               my: 'top left',
               at: 'bottom right',
               target: 'mouse',
               adjust: {
                   mouse: false
               },
               effect: false
           }
        });
        $('#rm16').qtip(
        {
           content: $('#rm16div'),
           position: {
               my: 'top left',
               at: 'bottom right',
               target: 'mouse',
               adjust: {
                   mouse: false
               },
               effect: false
           }
        });
        $('#rm17').qtip(
        {
           content: $('#rm17div'),
           position: {
               my: 'top left',
               at: 'bottom right',
               target: 'mouse',
               adjust: {
                   mouse: false
               },
               effect: false
           }
        });
        $('#rm18').qtip(
        {
           content: $('#rm18div'),
           position: {
               my: 'top left',
               at: 'bottom right',
               target: 'mouse',
               adjust: {
                   mouse: false
               },
               effect: false
           }
        });
        $('#rm19').qtip(
        {
           content: $('#rm19div'),
           position: {
               my: 'top left',
               at: 'bottom right',
               target: 'mouse',
               adjust: {
                   mouse: false
               },
               effect: false
           }
        });
        $('#rm20').qtip(
        {
           content: $('#rm20div'),
           position: {
               my: 'top left',
               at: 'bottom right',
               target: 'mouse',
               adjust: {
                   mouse: false
               },
               effect: false
           }
        });
        $('#rm21').qtip(
        {
           content: $('#rm21div'),
           position: {
               my: 'top left',
               at: 'bottom right',
               target: 'mouse',
               adjust: {
                   mouse: false
               },
               effect: false
           }
        });
        $('#rm22').qtip(
        {
           content: $('#rm22div'),
           position: {
               my: 'top left',
               at: 'bottom right',
               target: 'mouse',
               adjust: {
                   mouse: false
               },
               effect: false
           }
        });
        $('#rm23').qtip(
        {
           content: $('#rm23div'),
           position: {
               my: 'top left',
               at: 'bottom right',
               target: 'mouse',
               adjust: {
                   mouse: false
               },
               effect: false
           }
        });
        $('#rm24').qtip(
        {
           content: $('#rm24div'),
           position: {
               my: 'top left',
               at: 'bottom right',
               target: 'mouse',
               adjust: {
                   mouse: false
               },
               effect: false
           }
        });
        $('#rm25').qtip(
        {
           content: $('#rm25div'),
           position: {
               my: 'top left',
               at: 'bottom right',
               target: 'mouse',
               adjust: {
                   mouse: false
               },
               effect: false
           }
        });
        $('#rm26').qtip(
        {
           content: $('#rm26div'),
           position: {
               my: 'top left',
               at: 'bottom right',
               target: 'mouse',
               adjust: {
                   mouse: false
               },
               effect: false
           }
        });
        $('#rm27').qtip(
        {
           content: $('#rm27div'),
           position: {
               my: 'top left',
               at: 'bottom right',
               target: 'mouse',
               adjust: {
                   mouse: false
               },
               effect: false
           }
        });
        $('#rm28').qtip(
        {
           content: $('#rm28div'),
           position: {
               my: 'top left',
               at: 'bottom right',
               target: 'mouse',
               adjust: {
                   mouse: false
               },
               effect: false
           }
        });
        $('#rm29').qtip(
        {
           content: $('#rm29div'),
           position: {
               my: 'top left',
               at: 'bottom right',
               target: 'mouse',
               adjust: {
                   mouse: false
               },
               effect: false
           }
        });
        $('#rm30').qtip(
        {
           content: $('#rm30div'),
           position: {
               my: 'top left',
               at: 'bottom right',
               target: 'mouse',
               adjust: {
                   mouse: false
               },
               effect: false
           }
        });
        $('#rm31').qtip(
        {
           content: $('#rm31div'),
           position: {
               my: 'top left',
               at: 'bottom right',
               target: 'mouse',
               adjust: {
                   mouse: false
               },
               effect: false
           }
        });
        $('#rm32').qtip(
        {
           content: $('#rm32div'),
           position: {
               my: 'top left',
               at: 'bottom right',
               target: 'mouse',
               adjust: {
                   mouse: false
               },
               effect: false
           }
        });
        $('#rm33').qtip(
        {
           content: $('#rm33div'),
           position: {
               my: 'top left',
               at: 'bottom right',
               target: 'mouse',
               adjust: {
                   mouse: false
               },
               effect: false
           }
        });
        $('#rm34').qtip(
        {
           content: $('#rm34div'),
           position: {
               my: 'top left',
               at: 'bottom right',
               target: 'mouse',
               adjust: {
                   mouse: false
               },
               effect: false
           }
        });
        $('#rm35').qtip(
        {
           content: $('#rm35div'),
           position: {
               my: 'top left',
               at: 'bottom right',
               target: 'mouse',
               adjust: {
                   mouse: false
               },
               effect: false
           }
        });
        /* Zami's Old Code
        // Select all elements that are to share the same tooltip
        var elems = $('area[title]').removeAttr('title');
 
        // Store our title attribute and remove it so we don't get browser tooltips showing up
 
        // Create the tooltip on a dummy div since we're sharing it between targets
        $('<div />').qtip(
        {
            content: 'qtip', // Can use any content here :)
            position: {
                my: 'top left',
                at: 'bottom right',
                target: 'mouse',
                adjust: {
                    mouse: false // Use the triggering element as the positioning target
                },
                effect: false   // Disable default 'slide' positioning animation
            },
            show: {
                target: elems
            },
            hide: {
                target: elems
            },
            events: {
                show: function(event, api) {
                    // Update the content of the tooltip on each show
                    var contentdivid = $(event.originalEvent.target).attr('id') + 'div';
                   //alert(contentdivid);
 
                    if($('#' + contentdivid).length) {
                        api.set('content.text', $('#' + contentdivid));
                    }
                },
                hide: function(event, api) {
                    api.set('content.text', '');
                }
            }
        });*/
    }
});

// Old Code
/*/If the browser is W3 DOM compliant, execute setImageSwaps function
if (document.getElementsByTagName && document.getElementById) {
if (window.addEventListener) window.addEventListener('load', setImageSwaps, false);
else if (window.attachEvent) window.attachEvent('onload', setImageSwaps);
}

function setImageSwaps() {
prepareImageSwap(document.body);
prepareImageSwap(document.rooms);
}

function prepareImageSwap(elem,mouseOver,mouseOutRestore,mouseDown,mouseUpRestore,mouseOut,mouseUp) {
//Do not delete these comments.
//Non-Obtrusive Image Swap Script V1.1 by Hesido.com
//Attribution required on all accounts
    if (typeof(elem) == 'string') elem = document.getElementById(elem);
    if (elem == null) return;
    var regg = /(.*)(_nm\.)([^\.]{3,4})$/
    var prel = new Array(), img, imgList, imgsrc, mtchd;
    imgList = elem.getElementsByTagName('img');
    for (var i=0; img = imgList[i]; i++) {
        if (!img.rolloverSet && img.src.match(regg)) {
            mtchd = img.src.match(regg);
            img.hoverSRC = mtchd[1]+'_hv.'+ mtchd[3];
            img.outSRC = img.src;
            if (typeof(mouseOver) != 'undefined') {
                img.hoverSRC = (mouseOver) ? mtchd[1]+'_hv.'+ mtchd[3] : false;
                img.outSRC = (mouseOut) ? mtchd[1]+'_ou.'+ mtchd[3] : (mouseOver && mouseOutRestore) ? img.src : false;
                img.mdownSRC = (mouseDown) ? mtchd[1]+'_md.' + mtchd[3] : false;
                img.mupSRC = (mouseUp) ? mtchd[1]+'_mu.' + mtchd[3] : (mouseOver && mouseDown && mouseUpRestore) ? img.hoverSRC : (mouseDown && mouseUpRestore) ? img.src : false;
                }
            if (img.hoverSRC) {preLoadImg(img.hoverSRC); img.onmouseover = imgHoverSwap;}
            if (img.outSRC) {preLoadImg(img.outSRC); img.onmouseout = imgOutSwap;}
            if (img.mdownSRC) {preLoadImg(img.mdownSRC); img.onmousedown = imgMouseDownSwap;}
            if (img.mupSRC) {preLoadImg(img.mupSRC); img.onmouseup = imgMouseUpSwap;}
            img.rolloverSet = true;
        }
    }
    function preLoadImg(imgSrc) {
        prel[prel.length] = new Image(); prel[prel.length-1].src = imgSrc;
    }
}
function imgHoverSwap() {this.src = this.hoverSRC;}
function imgOutSwap() {this.src = this.outSRC;}
function imgMouseDownSwap() {this.src = this.mdownSRC;}
function imgMouseUpSwap() {this.src = this.mupSRC;}

*/
