(function($){
$(function(){
//var _scroller = $("#scroller ul").html();
//$("#scroller ul").append(_scroller,_scroller);

slideShow = new SlideShow({
        data:   "/js/slideData.xml"
    });

$('#scroller ul li').tooltip();

});


var isIE = navigator.userAgent.toLowerCase().match(/msie/i) != null;

function trace(arg) {
if(typeof console != 'undefined' && console.log) {
//console.log(arg);
}
}

var SlideShow = function( settings ) {
    this.currentIndex = 0;
this.naviIndex = 0;
    this.settings = settings;
this.total = 0;
this.naviTotal = 0;
this.data;
this.timer;
this.naviTimer;
this.list = [];
this.slidePosList = [];
    this.naviItems = [];
    this.naviPosList = [];
    this.naviSlideDirection;
    this.enterFrame;
    this.diff = 0;
    this.dx = 0;
    this.di = 0;
    this.initialize.apply(this, arguments);

this.naviLock = false;
}
SlideShow.prototype = {

    initialize: function( settings ) {
        this._init();
    },
    
    _init: function() {
//$('#slideArea')
//.html('<div id="centerRect"></div>');
this.enterFrame = new EnterFrame(18);
        this._jsonLoad();
    },
    
    _jsonLoad: function() {
    
        var self = this;
        
        $.ajax({
            type: "GET",
            url:this.settings.data,
            dataType:"xml",
            success: function(xml){
                self._parse(xml);
            }
        });
    },
    
    _parse: function(xml) {
        var self = this;
        self.data = {};
        self.data.slides = [];
        self.data.navi = [];
        $(xml).find("slides image").each(function() {
            self.data.slides.push($(this).text());
        })
        $(xml).find("navi item").each(function() {
           self.data.navi.push({
                "image": $("image",this).text(),
                "url": $("url",this).text(),
                "target": $("target",this).text(),
                "title": $("title",this).text(),
"width": $("width",this).text()
            });
        })
        if( self.data.slides.length < 4 ) self.data.slides = self.data.slides.concat(self.data.slides);
        self.total = self.data.slides.length;
        self.naviTotal = self.data.navi.length;
        self._imageLoad();
    },

_imageLoad: function() {

this.createSelectNavi();

var loaded = 0, loaded2 = 0, num, self = this;


            for (i in this.data.slides) {
                var path = this.data.slides[i];
num = parseInt(i) + 1;
self.list.push(num-1);
self.slidePosList.push((i*960)-480);
$('<a></a>')
.attr({
id:"slide-" + num,
className:"slide-item"
                    })
.css({
position: "absolute",
top: "0",
left: ((i*960)-480).toString() + "px",
cursor: "default"
})
.appendTo('#centerRect')

                $('<img />')
                    .attr({
src:path
})
.css({
display: "none",
opacity: "0"
})
                    .load(function(){
                        loaded += 1;
trace($(this).parent().attr("id"));
var slideId = $(this).parent().attr("id");
if( slideId == "slide-1") {
$(this)
.css({display:"block"})
.animate({opacity:"1.0"}, 2000); 
} else if( slideId == "slide-2" || slideId == "slide-3" ) {
$(this)
.css({display:"block"})
.animate({opacity:"0.3"}, 2000); 
} else {
$(this)
.css({opacity:"0.3", display:"block"})
}
                        if( loaded == self.total && loaded2 == self.naviTotal ) {
                            self._loaded();
                        }
                    })
.appendTo('#slide-' + num);
            }

for (i in this.data.navi) {
var nd = this.data.navi[i];
num = parseInt(i) + 1;
var _image = $('<img />')
                    .attr({
src:nd.image,
alt:nd.title,
width:nd.width,
height: "160"
})
                    .load(function(){
                        loaded2 += 1;
                        if( loaded == self.total && loaded2 == self.naviTotal ) {
                            self._loaded();
                        }
                    });

$('#slide-select-' + num + ' a').append(_image);
}
},

createSelectNavi: function() {

$('<ul></ul>').appendTo('#scroller');

var self = this;

var addWidth = 0;

for( i=0; i<this.naviTotal; i++ ) {
var _title = self.data.navi[i].title;
var  _width = parseInt(self.data.navi[i].width);
//_title = _title.length > 10 ? _title.substring(0, 10) + "..." : _title;

if(i==0){
var leftSize = 0;
}else{
var leftSize = addWidth;
}


$('<li><a></a></li>')
.attr({
id: "slide-select-" + (i+1).toString()  
})
.css({
left: (leftSize).toString() + "px",
top: (200).toString() + "px",
cursor: "pointer"
})
.appendTo('#scroller ul')
.click(function() {
//self.currentIndex = $('#slideSelectNavi ul li').index(this);
//self.setPosition(self.currentIndex);
})

addWidth = addWidth+_width+20;

var lo = $("#slide-select-" + (i+1).toString() + " a");
//$("#slide-select-" + (i+1).toString() + " .over").css({opacity:"0"})
$(lo)
.attr({
href: self.data.navi[i].url,
//title: self.data.navi[i].title,
target: self.data.navi[i].target
})
.hover(function() {
//var target = $(this).find(".over")
//$(target).stop();
//$(target).css({ opacity: 1.0 });
//$(target).animate({ opacity: 1.0 }, 100);
self.naviLock = false;
},
function() {
//var target = $(this).find(".over")
//$(target).stop();
//$(target).animate({ opacity: 0 }, 500);
self.naviLock = true;
self.naviTimer = setTimeout(function(){
            clearTimeout(self.naviTimer);
            self.naviLock = false;
        }, 700)
})
}

$('<p id="slideNaviLeftBtn" style="top:-200px;"><img src="img/snav_01.gif" width="50" height="18" alt="" /><img class="over" src="img/snav_01_on.gif" width="50" height="18" alt="" /></p>').insertAfter('#scroller')
$('<p id="slideNaviRightBtn" style="top:-200px;"><img src="img/snav_02.gif" width="50" height="18" alt="" /><img class="over" src="img/snav_02_on.gif" width="50" height="18" alt="" /></p>').insertAfter('#scroller')

$('#slideNaviLeftBtn').css({
cursor: "pointer"
});

$('#slideNaviRightBtn').css({
cursor: "pointer"
});

var lo = $('#slideNaviLeftBtn .over').get(0);
$('#slideNaviLeftBtn').hover(function() {
if( !self.naviLock ) {
$(lo).stop();
$(lo).css({display:"block", opacity:"0"});
$(lo).animate({
opacity: 1.0
}, 300);
}
},
function() {
$(lo).stop();
$(lo).animate({
opacity: 0
}, 300);
})
.click(function() {
if( !self.naviLock ) self.nextThumbnail(700);
})

var ro = $('#slideNaviRightBtn .over').get(0);
$('#slideNaviRightBtn').hover(function() {
if( !self.naviLock ) {
$(ro).stop();
$(ro).css({display:"block", opacity:"0"});
$(ro).animate({
opacity: 1.0
}, 300);
}
},
function() {
$(ro).stop();
$(ro).animate({
opacity: 0
}, 300);
})
.click(function() {
if( !self.naviLock ) self.prevThumbnail();
})

if(navigator.appVersion.indexOf("MSIE 6") != -1) { DD_belatedPNG.fix('#slideNaviLeftBtn img, #slideNaviRightBtn img') };
},
    
    _loaded: function() {

trace("load complete");

/*$('<div id="slideshow-cover-left"></div>')
.appendTo('#centerRect')
.css({opacity: "0.7"})
$('<div id="slideshow-cover-right"></div>')
.appendTo('#centerRect')
.css({opacity: "0.7"})*/

this._intro();
    },

_intro: function() {

var self = this;

var cnt = 0;


$('#scroller ul li').each(function() {
            self.naviItems.push(this);
            self.naviPosList.push(0);
if( cnt < 30 ) {
$(this).delay(cnt*100+1000).animate({
top: "20px"
}, 1000);
} else {
$(this).css({
top: "20px"
});
}
cnt += 1;

var _this = $(this);

});


var _totalSize = 0;
for (i=0; i<this.naviTotal; i++) {
_totalSize = _totalSize+parseInt(this.data.navi[i].width)+20;
}

        this.enterFrame.add(function(){
            self.render(_totalSize);
        })
        
        var t = setTimeout(function() {
            clearTimeout(t);
            self.enterFrame.start();
        }, 3000);

self.timer = setInterval( function() {
//$(self).trigger('slideStart');
self.currentIndex += 1;
if( self.currentIndex == self.total ) self.currentIndex = 0;
self.setPosition(self.currentIndex);
}, 5000 );
        
        
},

setPosition: function( index ) {

//trace("setPosition:" + index);
        
var self = this, num, currentPos, nextPos, half = self.getWidth()/2;

var beforeIndex = index-1;
if( beforeIndex < 0 ) beforeIndex = self.total-1;
self.fadeOutImage(beforeIndex+1);
        
for (i in this.data.slides) {
num = parseInt(i) + 1;
$("#slide-" + num).stop();

//currentPos = parseInt($("#slide-" + num).css("left"));
            currentPos = self.slidePosList[i];
if( currentPos < -2000 ) {
currentPos += this.total * 960;
$("#slide-" + num).css({ left: currentPos + "px" });
self.list.push(self.list.shift());
}
nextPos = currentPos - 960;
            
            if( nextPos <= half ) {
                //trace("move: slide-" +num); 
                if( parseInt($("#slide-" + num).css("left")) > currentPos ) $("#slide-" + num).css({left:currentPos.toString()+"px"})
                $("#slide-" + num).animate({
                    left: nextPos + "px"
                }, 2000, "easeInOutQuart", function() {
                    if( $(this).attr("id") == "slide-"+(index+1) ) self.fadeInImage(index+1);
                });
            }
            
            self.slidePosList[i] = nextPos;
}
},

fadeInImage: function(num) {
$("#slide-"+num + " img")
.animate({opacity:"1.0"}, 800); 
},

fadeOutImage: function(num) {
$("#slide-"+num + " img")
.animate({opacity:"0.3"}, 800); 
},
    
    render: function(_totalSize) {
    
        
        if( this.naviLock ) {
            var d1 = 0, d2 = 0;
            if( this.di != 0 ) d1 = this.dx * this.diff;
            this.dx = jQuery.easing.easeOutQuart(null, this.di, 0, 1, 14);
            d2 = Math.floor(this.dx * this.diff - d1);
var windowSize = $('body').width();
            if( this.di < 14 ) {

                for (i=0; i<this.naviTotal; i++) {
var wide = 140;
                    var target = this.naviItems[i], p;
                    p = parseInt($(target).css("left"));
                    if(this.naviSlideDirection ) {
                        if( p <= -parseInt(this.data.navi[i].width)-20 ) {
                           // p += this.naviTotal * 135;
   p += _totalSize;
                        }
                    } else {
                        if( p >= windowSize-20 ) {
                            //p -= this.naviTotal * 135;
p -= _totalSize;
                        }
                    }
                    $(target).css({left:(p+d2)+"px"});
                }
                this.di += 1;                
            }
            
        } else {
            for (i=0; i<this.naviTotal; i++) {
                var target = this.naviItems[i], p;
                p = parseInt($(target).css("left"));
                if( p <= -parseInt(this.data.navi[i].width)+20 ) {
                    //p += this.naviTotal * 135;
p += _totalSize;
                }
                $(target).css({left:(p-1)+"px"});
            }
        }
    },

nextThumbnail: function(time) {
this.naviIndex += 1;
if( this.naviIndex >= this.naviTotal ) this.naviIndex = 0;
this.setThumbnailPosition(true, time);
},
prevThumbnail: function() {
this.naviIndex -= 1;
if( this.naviIndex < 0 ) this.naviIndex = this.naviTotal;
this.setThumbnailPosition(false, 700);
},
setThumbnailPosition: function( direction, time ) {

var self = this;
        
        clearTimeout(self.naviTimer);
        
        self.di = 0;
        self.diff = direction ? -140 : 140;
self.naviSlideDirection = direction;
self.naviLock = true;
        
        self.naviTimer = setTimeout(function(){
            clearTimeout(self.naviTimer);
            self.naviLock = false;
        }, 700)
},

getWidth: function() {
var w = window.innerWidth;
if( isIE ) w = document.body.clientWidth;
return w > 960 ? w : 960;
}
}


 /*
 * EnterFrame.js
 * Copyright (c) Matsukaze. All Rights Reserved.
 * @version 1.0
 * @author mach3
 * @require jQuery
 */
var EnterFrame=function(a){this.config(a)};EnterFrame.prototype={option:{fps:30},active:true,funcs:[],tid:null,config:function(a){this.option=$.extend({},this.option,a);return this},start:function(){this.active=true;this._enterFrame();return this},_enterFrame:function(){if(this.active){$.each(this.funcs,function(a,b){b()});this.tid=setTimeout($.proxy(this._enterFrame,this),Math.floor(1000/this.option.fps))}},stop:function(){this.active=false;clearTimeout(this.tid);return this},add:function(a){this.funcs.push(a);return this},remove:function(a){this.funcs=$.grep(this.funcs,function(c,b){return(a!==c)});return this}};

/*
 * jQuery Easing v1.3 - http://gsgd.co.uk/sandbox/jquery/easing/
 *
 * Uses the built in easing capabilities added In jQuery 1.1
 * to offer multiple easing options
 *
 * TERMS OF USE - jQuery Easing
 * 
 * Open source under the BSD License. 
 * 
 * Copyright ﾂｩ 2008 George McGinley Smith
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
*/

// t: current time, b: begInnIng value, c: change In value, d: duration
jQuery.easing['jswing'] = jQuery.easing['swing'];

jQuery.extend( jQuery.easing,
{
def: 'easeOutQuad',
swing: function (x, t, b, c, d) {
//alert(jQuery.easing.default);
return jQuery.easing[jQuery.easing.def](x, t, b, c, d);
},
easeInQuad: function (x, t, b, c, d) {
return c*(t/=d)*t + b;
},
easeOutQuad: function (x, t, b, c, d) {
return -c *(t/=d)*(t-2) + b;
},
easeInOutQuad: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t + b;
return -c/2 * ((--t)*(t-2) - 1) + b;
},
easeInCubic: function (x, t, b, c, d) {
return c*(t/=d)*t*t + b;
},
easeOutCubic: function (x, t, b, c, d) {
return c*((t=t/d-1)*t*t + 1) + b;
},
easeInOutCubic: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t + b;
return c/2*((t-=2)*t*t + 2) + b;
},
easeInQuart: function (x, t, b, c, d) {
return c*(t/=d)*t*t*t + b;
},
easeOutQuart: function (x, t, b, c, d) {
return -c * ((t=t/d-1)*t*t*t - 1) + b;
},
easeInOutQuart: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
return -c/2 * ((t-=2)*t*t*t - 2) + b;
},
easeInQuint: function (x, t, b, c, d) {
return c*(t/=d)*t*t*t*t + b;
},
easeOutQuint: function (x, t, b, c, d) {
return c*((t=t/d-1)*t*t*t*t + 1) + b;
},
easeInOutQuint: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
return c/2*((t-=2)*t*t*t*t + 2) + b;
},
easeInSine: function (x, t, b, c, d) {
return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
},
easeOutSine: function (x, t, b, c, d) {
return c * Math.sin(t/d * (Math.PI/2)) + b;
},
easeInOutSine: function (x, t, b, c, d) {
return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
},
easeInExpo: function (x, t, b, c, d) {
return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
},
easeOutExpo: function (x, t, b, c, d) {
return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
},
easeInOutExpo: function (x, t, b, c, d) {
if (t==0) return b;
if (t==d) return b+c;
if ((t/=d/2) < 1) return c/2 * Math.pow(2, 10 * (t - 1)) + b;
return c/2 * (-Math.pow(2, -10 * --t) + 2) + b;
},
easeInCirc: function (x, t, b, c, d) {
return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
},
easeOutCirc: function (x, t, b, c, d) {
return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
},
easeInOutCirc: function (x, t, b, c, d) {
if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
},
easeInElastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
},
easeOutElastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
return a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b;
},
easeInOutElastic: function (x, t, b, c, d) {
var s=1.70158;var p=0;var a=c;
if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
if (a < Math.abs(c)) { a=c; var s=p/4; }
else var s = p/(2*Math.PI) * Math.asin (c/a);
if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
},
easeInBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
return c*(t/=d)*t*((s+1)*t - s) + b;
},
easeOutBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158;
return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
},
easeInOutBack: function (x, t, b, c, d, s) {
if (s == undefined) s = 1.70158; 
if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
},
easeInBounce: function (x, t, b, c, d) {
return c - jQuery.easing.easeOutBounce (x, d-t, 0, c, d) + b;
},
easeOutBounce: function (x, t, b, c, d) {
if ((t/=d) < (1/2.75)) {
return c*(7.5625*t*t) + b;
} else if (t < (2/2.75)) {
return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
} else if (t < (2.5/2.75)) {
return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
} else {
return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
}
},
easeInOutBounce: function (x, t, b, c, d) {
if (t < d/2) return jQuery.easing.easeInBounce (x, t*2, 0, c, d) * .5 + b;
return jQuery.easing.easeOutBounce (x, t*2-d, 0, c, d) * .5 + c*.5 + b;
}
});

/*
 *
 * TERMS OF USE - EASING EQUATIONS
 * 
 * Open source under the BSD License. 
 * 
 * Copyright ﾂｩ 2001 Robert Penner
 * All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without modification, 
 * are permitted provided that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of 
 * conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice, this list 
 * of conditions and the following disclaimer in the documentation and/or other materials 
 * provided with the distribution.
 * 
 * Neither the name of the author nor the names of contributors may be used to endorse 
 * or promote products derived from this software without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY 
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 *  COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 *  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 *  GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 *  NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 *
 */


$.fn.tooltip=function(){
this.live('mouseover',function(e){
e.preventDefault();

tipTitle = $(this).find('img').attr('alt'),
tipContent = tipTitle.split('｜').join('<br>').split('&lt;').join('<').split('&gt;').join('>').split('&#34;').join('"');

$(this).find('img').attr('alt','');
$('body').append('<div class="tooltip"><div class="toolInner">'+tipContent+'</div></div>');

var tipHeight = $('.tooltip').height(),
tipWidth = $('.tooltip').width();

$('.toolInner').css({
"-moz-border-radius":"5px",
"-webkit-border-radius":"5px",
"border-radius":"5px"
});

$('.tooltip').css({
'opacity':0.85,
"top":e.pageY-tipHeight-20,
"left":e.pageX-(tipWidth/2)
});
});

this.live('mousemove',function(e){
var tipHeight = $('.tooltip').height(),
tipWidth = $('.tooltip').width();

$('.tooltip').css({
'opacity':0.85,
"top":e.pageY-tipHeight-20,
"left":e.pageX-(tipWidth/2)
});
});

this.live('mouseout',function(){
$('.tooltip').remove();
$(this).find('img').attr('alt',tipContent);
});
};

})(jQuery);
