/*
 * 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. 
 *
 */
 

/* ================================================================== */
/*                                                                    */
/* ! Lazy Load - jQuery plugin for lazy loading images */
/*                                                                    */
/* ================================================================== */

/*
 * Lazy Load - jQuery plugin for lazy loading images
 *
 * Copyright (c) 2007-2009 Mika Tuupola
 *
 * Licensed under the MIT license:
 *   http://www.opensource.org/licenses/mit-license.php
 *
 * Project home:
 *   http://www.appelsiini.net/projects/lazyload
 *
 * Version:  1.5.0
 *
 */
(function($) {

    $.fn.lazyload = function(options) {
        var settings = {
            threshold    : 10,
            failurelimit : 0,
            event        : "scroll",
            effect       : "show",
            container    : window
        };
                
        if(options) {
            $.extend(settings, options);
        }

        /* Fire one scroll event per scroll. Not one scroll event per image. */
        var elements = this;
        if ("scroll" == settings.event) {
            $(settings.container).bind("scroll", function(event) {
                
                var counter = 0;
                elements.each(function() {
                    if ($.abovethetop(this, settings) ||
                        $.leftofbegin(this, settings)) {
                            /* Nothing. */
                    } else if (!$.belowthefold(this, settings) &&
                        !$.rightoffold(this, settings)) {
                            $(this).trigger("appear");
                    } else {
                        if (counter++ > settings.failurelimit) {
                            return false;
                        }
                    }
                });
                /* Remove image from array so it is not looped next time. */
                var temp = $.grep(elements, function(element) {
                    return !element.loaded;
                });
                elements = $(temp);
            });
        }
        
        this.each(function() {
            var self = this;
            
            /* Save original only if it is not defined in HTML. */
            if (undefined == $(self).attr("original")) {
                $(self).attr("original", $(self).attr("src"));     
            }

            if ("scroll" != settings.event || 
                    undefined == $(self).attr("src") || 
                    settings.placeholder == $(self).attr("src") || 
                    ($.abovethetop(self, settings) ||
                     $.leftofbegin(self, settings) || 
                     $.belowthefold(self, settings) || 
                     $.rightoffold(self, settings) )) {

                if (settings.placeholder) {
                    $(self).attr("src", settings.placeholder);
                    if (settings.backgroundImage) { $(self).css("background", "url(" + settings.backgroundImage + ") center center no-repeat") };
                } else {
                    $(self).removeAttr("src");
                }
                self.loaded = false;
            } else {
                self.loaded = true;
            }
            
            /* When appear is triggered load original image. */
            $(self).one("appear", function() {
                if (!this.loaded) {
                    $("<img />")
                        .bind("load", function() {
                            $(self)
                                .hide()
                                .attr("src", $(self).attr("original"))
                                [settings.effect](settings.effectspeed)
                                .css("background", "none");
                            self.loaded = true;
                        })
                        .attr("src", $(self).attr("original"));
                };
            });

            /* When wanted event is triggered load original image */
            /* by triggering appear.                              */
            if ("scroll" != settings.event) {
                $(self).bind(settings.event, function(event) {
                    if (!self.loaded) {
                        $(self).trigger("appear");
                    }
                });
            }
        });
        
        /* Force initial check if images should appear. */
        $(settings.container).trigger(settings.event);
        
        return this;

    };

    /* Convenience methods in jQuery namespace.           */
    /* Use as  $.belowthefold(element, {threshold : 100, container : window}) */

    $.belowthefold = function(element, settings) {
        if (settings.container === undefined || settings.container === window) {
            var fold = $(window).height() + $(window).scrollTop();
        } else {
            var fold = $(settings.container).offset().top + $(settings.container).height();
        }
        return fold <= $(element).offset().top - settings.threshold;
    };
    
    $.rightoffold = function(element, settings) {
        if (settings.container === undefined || settings.container === window) {
            var fold = $(window).width() + $(window).scrollLeft();
        } else {
            var fold = $(settings.container).offset().left + $(settings.container).width();
        }
        return fold <= $(element).offset().left - settings.threshold;
    };
        
    $.abovethetop = function(element, settings) {
        if (settings.container === undefined || settings.container === window) {
            var fold = $(window).scrollTop();
        } else {
            var fold = $(settings.container).offset().top;
        }
        return fold >= $(element).offset().top + settings.threshold  + $(element).height();
    };
    
    $.leftofbegin = function(element, settings) {
        if (settings.container === undefined || settings.container === window) {
            var fold = $(window).scrollLeft();
        } else {
            var fold = $(settings.container).offset().left;
        }
        return fold >= $(element).offset().left + settings.threshold + $(element).width();
    };
    /* Custom selectors for your convenience.   */
    /* Use as $("img:below-the-fold").something() */

    $.extend($.expr[':'], {
        "below-the-fold" : "$.belowthefold(a, {threshold : 0, container: window})",
        "above-the-fold" : "!$.belowthefold(a, {threshold : 0, container: window})",
        "right-of-fold"  : "$.rightoffold(a, {threshold : 0, container: window})",
        "left-of-fold"   : "!$.rightoffold(a, {threshold : 0, container: window})"
    });
    
})(jQuery);


/* ================================================================== */
/*                                                                    */
/* ! jQuery.BiggerLink */
/*                                                                    */
/* ================================================================== */

/*
 * jQuery.BiggerLink v2.0.1
 * http://www.ollicle.com/eg/jquery/biggerlink/
 *
 * Copyright (c) 2009 Oliver Boermans
 * http://creativecommons.org/licenses/MIT/
 *
 * 2009-11-22 (22 Nov 2009)
*/ 
(function(a){a.fn.biggerlink=function(b){var c={biggerclass:"bl-bigger",hoverclass:"bl-hover",hoverclass2:"bl-hover2",clickableclass:"bl-hot",otherstriggermaster:true,follow:"auto"};if(b){a.extend(c,b)}a(this).filter(function(){return a("a",this).length>0}).addClass(c.clickableclass).css("cursor","pointer").each(function(g){var d=a(this).data("biggerlink",{hovered:false,focused:false,hovered2:false,focused2:false});var e={all:a("a",this),big:a(this),master:a("a:first",this).data("biggerlink",{status:"master"}).addClass(c.biggerclass),other:a("a",this).not(a("a:first",this)).data("biggerlink",{status:"other"})};a("a",this).andSelf().each(function(){var i=a.extend(a(this).data("biggerlink"),e);a(this).data("biggerlink",i)});var h=d.attr("title");var f=d.data("biggerlink").master.attr("title");if(f&&!h){d.attr("title",f)}d.mouseover(function(i){window.status=a(this).data("biggerlink").master.get(0).href;a(this).addClass(c.hoverclass);a(this).data("biggerlink").hovered=true}).mouseout(function(i){window.status="";if(!a(this).data("biggerlink").focused){a(this).removeClass(c.hoverclass)}a(this).data("biggerlink").hovered=false}).bind("click",function(i){if(!a(i.target).closest("a").length){a(this).data("biggerlink").master.trigger({type:"click",source:"biggerlink"});i.stopPropagation()}});e.all.bind("focus",function(){a(this).data("biggerlink").big.addClass(c.hoverclass);a(this).data("biggerlink").big.data("biggerlink").focused=true}).bind("blur",function(){if(!a(this).data("biggerlink").big.data("biggerlink").hovered){a(this).data("biggerlink").big.removeClass(c.hoverclass)}a(this).data("biggerlink").big.data("biggerlink").focused=false});e.master.bind("click",function(i){if(i.source=="biggerlink"){if(c.follow===true||c.follow=="auto"&&i.result!==false){window.location=a(this).attr("href")}else{i.stopPropagation()}}});if(c.otherstriggermaster){e.other.addClass(c.biggerclass).bind("click",function(i){a(this).data("biggerlink").master.trigger({type:"click",source:"biggerlink"});i.preventDefault();i.stopPropagation()})}else{e.other.bind("focus",function(){a(this).data("biggerlink").big.addClass(c.hoverclass2);a(this).data("biggerlink").big.data("biggerlink").focused2=true}).bind("blur",function(){if(!a(this).data("biggerlink").big.data("biggerlink").hovered2){a(this).data("biggerlink").big.removeClass(c.hoverclass2)}a(this).data("biggerlink").big.data("biggerlink").focused2=false}).bind("mouseover",function(i){a(this).data("biggerlink").big.addClass(c.hoverclass2);a(this).data("biggerlink").big.data("biggerlink").hovered2=true;i.stopPropagation()}).bind("mouseout",function(i){if(!a(this).data("biggerlink").big.data("biggerlink").focused2){a(this).data("biggerlink").big.removeClass(c.hoverclass2)}a(this).data("biggerlink").big.data("biggerlink").hovered2=false;i.stopPropagation()});if(!e.other.attr("title")){e.other.attr("title","")}}});return this}})(jQuery);


/* ================================================================== */
/*                                                                    */
/* ! jquery.flatheights.js */
/*                                                                    */
/* ================================================================== */

/*
	jquery.flatheights.js
	Version: 2007-08-01
*/

/*
======================================================================
	$.changeLetterSize.addHandler(func)
	文字の大きさが変化した時に実行する処理を追加
======================================================================
*/

jQuery.changeLetterSize = {
	handlers : [],
	interval : 1000,
	currentSize: 0
};

(function($) {

	var self = $.changeLetterSize;

	/* 文字の大きさを確認するためのins要素 */
	var ins = $('<ins>M</ins>').css({
		display: 'block',
		visibility: 'hidden',
		position: 'absolute',
		padding: '0',
		top: '0'
	});

	/* 文字の大きさが変わったか */
	var isChanged = function() {
		ins.appendTo('body');
		var size = ins[0].offsetHeight;
		ins.remove();
		if (self.currentSize == size) return false;
		self.currentSize = size;
		return true;
	};

	/* 文書を読み込んだ時点で
	   文字の大きさを確認しておく */
	$(isChanged);

	/* 文字の大きさが変わっていたら、
	   handlers中の関数を順に実行 */
	var observer = function() {
		if (!isChanged()) return;
		$.each(self.handlers, function(i, handler) {
			handler();
		});
	};

	/* ハンドラを登録し、
	   最初の登録であれば、定期処理を開始 */
	self.addHandler = function(func) {
		self.handlers.push(func);
		if (self.handlers.length == 1) {
			setInterval(observer, self.interval);
		}
	};

})(jQuery);

/*
======================================================================
	$(expr).flatHeights()
	$(expr)で選択した複数の要素について、それぞれ高さを
	一番高いものに揃える
======================================================================
*/

(function($) {

	/* 対象となる要素群の集合 */
	var sets = [];

	/* 高さ揃えの処理本体 */
	var flatHeights = function(set) {
		var maxHeight = 0;
		set.each(function(){
			var height = this.offsetHeight;
			if (height > maxHeight) maxHeight = height;
		});
		set.css('height', maxHeight + 'px');
	};

	/* 要素群の高さを揃え、setsに追加 */
	jQuery.fn.flatHeights = function() {
		if (this.length > 1) {
			flatHeights(this);
			sets.push(this);
		}
		return this;
	};

	/* 文字の大きさが変わった時に、
	   setsに含まれる各要素群に対して高さ揃えを実行 */
	$.changeLetterSize.addHandler(function() {
		$.each(sets, function() {
			this.height('auto');
			flatHeights(this);
		});
	});

})(jQuery);

/*
Copyright (c) 2007, KITAMURA Akatsuki

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/


/* ================================================================== */
/*                                                                    */
/* ! jquery.cycle.lite.min.js */
/*                                                                    */
/* ================================================================== */

/* 
* 
* jquery.cycle.lite.min.js
* 
*/

(function(D){var A="Lite-1.0";D.fn.cycle=function(E){return this.each(function(){E=E||{};if(this.cycleTimeout){clearTimeout(this.cycleTimeout)}this.cycleTimeout=0;this.cyclePause=0;var I=D(this);var J=E.slideExpr?D(E.slideExpr,this):I.children();var G=J.get();if(G.length<2){if(window.console&&window.console.log){window.console.log("terminating; too few slides: "+G.length)}return }var H=D.extend({},D.fn.cycle.defaults,E||{},D.metadata?I.metadata():D.meta?I.data():{});H.before=H.before?[H.before]:[];H.after=H.after?[H.after]:[];H.after.unshift(function(){H.busy=0});var F=this.className;H.width=parseInt((F.match(/w:(¥d+)/)||[])[1])||H.width;H.height=parseInt((F.match(/h:(¥d+)/)||[])[1])||H.height;H.timeout=parseInt((F.match(/t:(¥d+)/)||[])[1])||H.timeout;if(I.css("position")=="static"){I.css("position","relative")}if(H.width){I.width(H.width)}if(H.height&&H.height!="auto"){I.height(H.height)}var K=0;J.css({position:"absolute",top:0,left:0}).hide().each(function(M){D(this).css("z-index",G.length-M)});D(G[K]).css("opacity",1).show();if(D.browser.msie){G[K].style.removeAttribute("filter")}if(H.fit&&H.width){J.width(H.width)}if(H.fit&&H.height&&H.height!="auto"){J.height(H.height)}if(H.pause){I.hover(function(){this.cyclePause=1},function(){this.cyclePause=0})}D.fn.cycle.transitions.fade(I,J,H);J.each(function(){var M=D(this);this.cycleH=(H.fit&&H.height)?H.height:M.height();this.cycleW=(H.fit&&H.width)?H.width:M.width()});J.not(":eq("+K+")").css({opacity:0});if(H.cssFirst){D(J[K]).css(H.cssFirst)}if(H.timeout){if(H.speed.constructor==String){H.speed={slow:600,fast:200}[H.speed]||400}if(!H.sync){H.speed=H.speed/2}while((H.timeout-H.speed)<250){H.timeout+=H.speed}}H.speedIn=H.speed;H.speedOut=H.speed;H.slideCount=G.length;H.currSlide=K;H.nextSlide=1;var L=J[K];if(H.before.length){H.before[0].apply(L,[L,L,H,true])}if(H.after.length>1){H.after[1].apply(L,[L,L,H,true])}if(H.click&&!H.next){H.next=H.click}if(H.next){D(H.next).bind("click",function(){return C(G,H,H.rev?-1:1)})}if(H.prev){D(H.prev).bind("click",function(){return C(G,H,H.rev?1:-1)})}if(H.timeout){this.cycleTimeout=setTimeout(function(){B(G,H,0,!H.rev)},H.timeout+(H.delay||0))}})};function B(J,E,I,K){if(E.busy){return }var H=J[0].parentNode,M=J[E.currSlide],L=J[E.nextSlide];if(H.cycleTimeout===0&&!I){return }if(I||!H.cyclePause){if(E.before.length){D.each(E.before,function(N,O){O.apply(L,[M,L,E,K])})}var F=function(){if(D.browser.msie){this.style.removeAttribute("filter")}D.each(E.after,function(N,O){O.apply(L,[M,L,E,K])})};if(E.nextSlide!=E.currSlide){E.busy=1;D.fn.cycle.custom(M,L,E,F)}var G=(E.nextSlide+1)==J.length;E.nextSlide=G?0:E.nextSlide+1;E.currSlide=G?J.length-1:E.nextSlide-1}if(E.timeout){H.cycleTimeout=setTimeout(function(){B(J,E,0,!E.rev)},E.timeout)}}function C(E,F,I){var H=E[0].parentNode,G=H.cycleTimeout;if(G){clearTimeout(G);H.cycleTimeout=0}F.nextSlide=F.currSlide+I;if(F.nextSlide<0){F.nextSlide=E.length-1}else{if(F.nextSlide>=E.length){F.nextSlide=0}}B(E,F,1,I>=0);return false}D.fn.cycle.custom=function(K,H,I,E){var J=D(K),G=D(H);G.css({opacity:0});var F=function(){G.animate({opacity:1},I.speedIn,I.easeIn,E)};J.animate({opacity:0},I.speedOut,I.easeOut,function(){J.css({display:"none"});if(!I.sync){F()}});if(I.sync){F()}};D.fn.cycle.transitions={fade:function(F,G,E){G.not(":eq(0)").css("opacity",0);E.before.push(function(){D(this).show()})}};D.fn.cycle.ver=function(){return A};D.fn.cycle.defaults={timeout:4000,speed:1000,next:null,prev:null,before:null,after:null,height:"auto",sync:1,fit:0,pause:0,delay:0,slideExpr:null}})(jQuery)


/* ================================================================== */
/*                                                                    */
/* ! jQuery 'onImagesLoaded' plugin */
/*                                                                    */
/* ================================================================== */

if(!window.jQuery){throw("jQuery must be referenced before using the 'onImagesLoad' plugin.");}
/* 
* jQuery 'onImagesLoaded' plugin 1.0.5
* Fires a callback function when all images have loaded within a particular selector.
*
* Copyright (c) Cirkuit Networks, Inc. (http://www.cirkuit.net), 2008.
* Dual licensed under the MIT and GPL licenses:
*   http://www.opensource.org/licenses/mit-license.php
*   http://www.gnu.org/licenses/gpl.html
*
* For documentation and usage, visit "http://includes.cirkuit.net/js/jquery/plugins/onImagesLoad/1.0/documentation/"
*/
(function($){
  $.fn.onImagesLoad = function(options){
    var opts = $.extend({}, $.fn.onImagesLoad.defaults, options);

    return this.each(function(){
      var container = this;
      var $imgs = $('img', container);
      if($imgs.length === 0 && opts.callbackIfNoImagesExist && opts.callback){
        opts.callback(container); //call callback immediately if no images were in selection
      }
      var loadedImages = [];
      $imgs.each(function(i, val){
        $(this).bind('load', function(){
          if(jQuery.inArray(i, loadedImages) == -1){ //don't double count images
            loadedImages.push(i); //keep a record of images we've seen
            if(loadedImages.length == $imgs.length){
              if(opts.callback){ opts.callback(container); }
            }
          }
        }).each(function(){
          if(this.complete || this.complete===undefined){ this.src = this.src; } //needed for potential cached images
        });
      });
    });
  };
  
  $.fn.onImagesLoad.defaults = {
    callback: null, //the function you want called when all images within $(yourSelector) have loaded
    callbackIfNoImagesExist: true //if no images exist within $(yourSelector), should the callback be called?
  };
  
})(jQuery);


/* ================================================================== */
/*                                                                    */
/* ! hoverFlow - A Solution to Animation Queue Buildup in jQuery */
/*                                                                    */
/* ================================================================== */

/* =====================================================================
*
* Version 1.00
*
* Copyright (c) 2009 Ralf Stoltze, http://www.2meter3.de/code/hoverFlow/
* Dual-licensed under the MIT and GPL licenses.
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*
* =================================================================== */

(function($){$.fn.hoverFlow=function(c,d,e,f,g){if($.inArray(c,['mouseover','mouseenter','mouseout','mouseleave'])==-1){return this}var h=typeof e==='object'?e:{complete:g||!g&&f||$.isFunction(e)&&e,duration:e,easing:g&&f||f&&!$.isFunction(f)&&f};h.queue=false;var i=h.complete;h.complete=function(){$(this).dequeue();if($.isFunction(i)){i.call(this)}};return this.each(function(){var b=$(this);if(c=='mouseover'||c=='mouseenter'){b.data('jQuery.hoverFlow',true)}else{b.removeData('jQuery.hoverFlow')}b.queue(function(){var a=(c=='mouseover'||c=='mouseenter')?b.data('jQuery.hoverFlow')!==undefined:b.data('jQuery.hoverFlow')===undefined;if(a){b.animate(d,h)}else{b.queue([])}})})}})(jQuery);


/* ================================================================== */
/*                                                                    */
/* ! Smooth scrolling */
/*                                                                    */
/* ================================================================== */

/* =====================================================================
*
*    Smooth scrolling
*    Changes links that link to other parts of this page to scroll
*    smoothly to those links rather than jump to them directly, which
*    can be a little disorienting.
*    
*    sil, http://www.kryogenix.org/
*    
*    v1.0 2003-11-11
*    v1.1 2005-06-16 wrap it up in an object
*
* =================================================================== */

var ss = {
  fixAllLinks: function() {
    // Get a list of all links in the page
    var allLinks = document.getElementsByTagName('a');
    // Walk through the list
    for (var i=0;i<allLinks.length;i++) {
      var lnk = allLinks[i];
      if ((lnk.href && lnk.href.indexOf('#') != -1) && 
          ( (lnk.pathname == location.pathname) ||
	    ('/'+lnk.pathname == location.pathname) ) && 
          (lnk.search == location.search)) {
        // If the link is internal to the page (begins in #)
        // then attach the smoothScroll function as an onclick
        // event handler
        if ( !(lnk.getAttribute("rel") == "noscroll") ) {
          ss.addEvent(lnk,'click',ss.smoothScroll);
        }
      }
    }
  },

  smoothScroll: function(e) {
    // This is an event handler; get the clicked on element,
    // in a cross-browser fashion
    if (window.event) {
      target = window.event.srcElement;
    } else if (e) {
      target = e.target;
    } else return;

    // Make sure that the target is an element, not a text node
    // within an element
    if (target.nodeName.toLowerCase() != 'a') {
      target = target.parentNode;
    }
  
    // Paranoia; check this is an A tag
    if (target.nodeName.toLowerCase() != 'a') return;
  
    // Find the <a name> tag corresponding to this href
    // First strip off the hash (first character)
    anchor = target.hash.substr(1);
    // Now loop all A tags until we find one with that name
    var allLinks = document.getElementsByTagName('a');
    var destinationLink = null;
    for (var i=0;i<allLinks.length;i++) {
      var lnk = allLinks[i];
      if (lnk.name && (lnk.name == anchor)) {
        destinationLink = lnk;
        break;
      }
    }
    if (!destinationLink) destinationLink = document.getElementById(anchor);

    // If we didn't find a destination, give up and let the browser do
    // its thing
    if (!destinationLink) return true;
  
    // Find the destination's position
    var destx = destinationLink.offsetLeft; 
    var desty = destinationLink.offsetTop;
    var thisNode = destinationLink;
    while (thisNode.offsetParent && 
          (thisNode.offsetParent != document.body)) {
      thisNode = thisNode.offsetParent;
      destx += thisNode.offsetLeft;
      desty += thisNode.offsetTop;
    }
  
    // Stop any current scrolling
    clearInterval(ss.INTERVAL);
  
    cypos = ss.getCurrentYPos();
  
    ss_stepsize = parseInt((desty-cypos)/ss.STEPS);
    ss.INTERVAL = setInterval('ss.scrollWindow('+ss_stepsize+','+desty+',"'+anchor+'")',10);
  
    // And stop the actual click happening
    if (window.event) {
      window.event.cancelBubble = true;
      window.event.returnValue = false;
    }
    if (e && e.preventDefault && e.stopPropagation) {
      e.preventDefault();
      e.stopPropagation();
    }
  },

  scrollWindow: function(scramount,dest,anchor) {
    wascypos = ss.getCurrentYPos();
    isAbove = (wascypos < dest);
    window.scrollTo(0,wascypos + scramount);
    iscypos = ss.getCurrentYPos();
    isAboveNow = (iscypos < dest);
    if ((isAbove != isAboveNow) || (wascypos == iscypos)) {
      // if we've just scrolled past the destination, or
      // we haven't moved from the last scroll (i.e., we're at the
      // bottom of the page) then scroll exactly to the link
      window.scrollTo(0,dest);
      // cancel the repeating timer
      clearInterval(ss.INTERVAL);
      // and jump to the link directly so the URL's right
      // location.hash = anchor;
    }
  },

  getCurrentYPos: function() {
    if (document.body && document.body.scrollTop)
      return document.body.scrollTop;
    if (document.documentElement && document.documentElement.scrollTop)
      return document.documentElement.scrollTop;
    if (window.pageYOffset)
      return window.pageYOffset;
    return 0;
  },

  addEvent: function(elm, evType, fn, useCapture) {
    // addEvent and removeEvent
    // cross-browser event handling for IE5+,  NS6 and Mozilla
    // By Scott Andrew
    if (elm.addEventListener){
      elm.addEventListener(evType, fn, useCapture);
      return true;
    } else if (elm.attachEvent){
      var r = elm.attachEvent("on"+evType, fn);
      return r;
    } else {
      alert("Handler could not be removed");
    }
  } 
}

ss.STEPS = 20;

ss.addEvent(window,"load",ss.fixAllLinks);


/* ================================================================== */
/*                                                                    */
/* ! jquery.scrollFollow.js with jQuery UI */
/*                                                                    */
/* ================================================================== */

/*!
 * jQuery UI 1.8rc3
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI
 */
/*
 * jQuery UI 1.8rc3
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI
 */
jQuery.ui||(function(b){var a=b.browser.mozilla&&(parseFloat(b.browser.version)<1.9);b.ui={version:"1.8rc3",plugin:{add:function(d,e,g){var f=b.ui[d].prototype;for(var c in g){f.plugins[c]=f.plugins[c]||[];f.plugins[c].push([e,g[c]])}},call:function(c,e,d){var g=c.plugins[e];if(!g||!c.element[0].parentNode){return}for(var f=0;f<g.length;f++){if(c.options[g[f][0]]){g[f][1].apply(c.element,d)}}}},contains:function(d,c){return document.compareDocumentPosition?d.compareDocumentPosition(c)&16:d!==c&&d.contains(c)},hasScroll:function(f,d){if(b(f).css("overflow")=="hidden"){return false}var c=(d&&d=="left")?"scrollLeft":"scrollTop",e=false;if(f[c]>0){return true}f[c]=1;e=(f[c]>0);f[c]=0;return e},isOverAxis:function(d,c,e){return(d>c)&&(d<(c+e))},isOver:function(h,d,g,f,c,e){return b.ui.isOverAxis(h,g,c)&&b.ui.isOverAxis(d,f,e)},keyCode:{BACKSPACE:8,CAPS_LOCK:20,COMMA:188,CONTROL:17,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,INSERT:45,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SHIFT:16,SPACE:32,TAB:9,UP:38}};b.fn.extend({_focus:b.fn.focus,focus:function(c,d){return typeof c==="number"?this.each(function(){var e=this;setTimeout(function(){b(e).focus();(d&&d.call(e))},c)}):this._focus.apply(this,arguments)},enableSelection:function(){return this.attr("unselectable","off").css("MozUserSelect","").unbind("selectstart.ui")},disableSelection:function(){return this.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})},scrollParent:function(){var c;if((b.browser.msie&&(/(static|relative)/).test(this.css("position")))||(/absolute/).test(this.css("position"))){c=this.parents().filter(function(){return(/(relative|absolute|fixed)/).test(b.curCSS(this,"position",1))&&(/(auto|scroll)/).test(b.curCSS(this,"overflow",1)+b.curCSS(this,"overflow-y",1)+b.curCSS(this,"overflow-x",1))}).eq(0)}else{c=this.parents().filter(function(){return(/(auto|scroll)/).test(b.curCSS(this,"overflow",1)+b.curCSS(this,"overflow-y",1)+b.curCSS(this,"overflow-x",1))}).eq(0)}return(/fixed/).test(this.css("position"))||!c.length?b(document):c},zIndex:function(f){if(f!==undefined){return this.css("zIndex",f)}if(this.length){var d=b(this[0]),c,e;while(d.length&&d[0]!==document){c=d.css("position");if(c=="absolute"||c=="relative"||c=="fixed"){e=parseInt(d.css("zIndex"));if(!isNaN(e)&&e!=0){return e}}d=d.parent()}}return 0}});b.extend(b.expr[":"],{data:function(e,d,c){return !!b.data(e,c[3])},focusable:function(d){var e=d.nodeName.toLowerCase(),c=b.attr(d,"tabindex");return(/input|select|textarea|button|object/.test(e)?!d.disabled:"a"==e||"area"==e?d.href||!isNaN(c):!isNaN(c))&&!b(d)["area"==e?"parents":"closest"](":hidden").length},tabbable:function(d){var c=b.attr(d,"tabindex");return(isNaN(c)||c>=0)&&b(d).is(":focusable")}})})(jQuery);;/*!
 * jQuery UI Widget 1.8rc3
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Widget
 */
/*
 * jQuery UI Widget 1.8rc3
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Widget
 */
(function(b){var a=b.fn.remove;b.fn.remove=function(c,d){return this.each(function(){if(!d){if(!c||b.filter(c,[this]).length){b("*",this).add(this).each(function(){b(this).triggerHandler("remove")})}}return a.call(b(this),c,d)})};b.widget=function(d,f,c){var e=d.split(".")[0],h;d=d.split(".")[1];h=e+"-"+d;if(!c){c=f;f=b.Widget}b.expr[":"][h]=function(i){return !!b.data(i,d)};b[e]=b[e]||{};b[e][d]=function(i,j){if(arguments.length){this._createWidget(i,j)}};var g=new f();g.options=b.extend({},g.options);b[e][d].prototype=b.extend(true,g,{namespace:e,widgetName:d,widgetEventPrefix:b[e][d].prototype.widgetEventPrefix||d,widgetBaseClass:h},c);b.widget.bridge(d,b[e][d])};b.widget.bridge=function(d,c){b.fn[d]=function(g){var e=typeof g==="string",f=Array.prototype.slice.call(arguments,1),h=this;g=!e&&f.length?b.extend.apply(null,[true,g].concat(f)):g;if(e&&g.substring(0,1)==="_"){return h}if(e){this.each(function(){var i=b.data(this,d),j=i&&b.isFunction(i[g])?i[g].apply(i,f):i;if(j!==i&&j!==undefined){h=j;return false}})}else{this.each(function(){var i=b.data(this,d);if(i){if(g){i.option(g)}i._init()}else{b.data(this,d,new c(g,this))}})}return h}};b.Widget=function(c,d){if(arguments.length){this._createWidget(c,d)}};b.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(d,e){this.element=b(e).data(this.widgetName,this);this.options=b.extend(true,{},this.options,b.metadata&&b.metadata.get(e)[this.widgetName],d);var c=this;this.element.bind("remove."+this.widgetName,function(){c.destroy()});this._create();this._init()},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled")},widget:function(){return this.element},option:function(e,f){var d=e,c=this;if(arguments.length===0){return b.extend({},c.options)}if(typeof e==="string"){if(f===undefined){return this.options[e]}d={};d[e]=f}b.each(d,function(g,h){c._setOption(g,h)});return c},_setOption:function(c,d){this.options[c]=d;if(c==="disabled"){this.widget()[d?"addClass":"removeClass"](this.widgetBaseClass+"-disabled "+this.namespace+"-state-disabled").attr("aria-disabled",d)}return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(d,e,f){var h=this.options[d];e=b.Event(e);e.type=(d===this.widgetEventPrefix?d:this.widgetEventPrefix+d).toLowerCase();f=f||{};if(e.originalEvent){for(var c=b.event.props.length,g;c;){g=b.event.props[--c];e[g]=e.originalEvent[g]}}this.element.trigger(e,f);return !(b.isFunction(h)&&h.call(this.element[0],e,f)===false||e.isDefaultPrevented())}}})(jQuery);;/*!
 * jQuery UI Mouse 1.8rc3
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Mouse
 *
 * Depends:
 *	jquery.ui.widget.js
 */
/*
 * jQuery UI Mouse 1.8rc3
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Mouse
 *
 * Depends:
 *	jquery.ui.widget.js
 */
(function(a){a.widget("ui.mouse",{options:{cancel:":input,option",distance:1,delay:0},_mouseInit:function(){var b=this;this.element.bind("mousedown."+this.widgetName,function(c){return b._mouseDown(c)}).bind("click."+this.widgetName,function(c){if(b._preventClickEvent){b._preventClickEvent=false;c.stopImmediatePropagation();return false}});this.started=false},_mouseDestroy:function(){this.element.unbind("."+this.widgetName)},_mouseDown:function(d){d.originalEvent=d.originalEvent||{};if(d.originalEvent.mouseHandled){return}(this._mouseStarted&&this._mouseUp(d));this._mouseDownEvent=d;var c=this,e=(d.which==1),b=(typeof this.options.cancel=="string"?a(d.target).parents().add(d.target).filter(this.options.cancel).length:false);if(!e||b||!this._mouseCapture(d)){return true}this.mouseDelayMet=!this.options.delay;if(!this.mouseDelayMet){this._mouseDelayTimer=setTimeout(function(){c.mouseDelayMet=true},this.options.delay)}if(this._mouseDistanceMet(d)&&this._mouseDelayMet(d)){this._mouseStarted=(this._mouseStart(d)!==false);if(!this._mouseStarted){d.preventDefault();return true}}this._mouseMoveDelegate=function(f){return c._mouseMove(f)};this._mouseUpDelegate=function(f){return c._mouseUp(f)};a(document).bind("mousemove."+this.widgetName,this._mouseMoveDelegate).bind("mouseup."+this.widgetName,this._mouseUpDelegate);(a.browser.safari||d.preventDefault());d.originalEvent.mouseHandled=true;return true},_mouseMove:function(b){if(a.browser.msie&&!b.button){return this._mouseUp(b)}if(this._mouseStarted){this._mouseDrag(b);return b.preventDefault()}if(this._mouseDistanceMet(b)&&this._mouseDelayMet(b)){this._mouseStarted=(this._mouseStart(this._mouseDownEvent,b)!==false);(this._mouseStarted?this._mouseDrag(b):this._mouseUp(b))}return !this._mouseStarted},_mouseUp:function(b){a(document).unbind("mousemove."+this.widgetName,this._mouseMoveDelegate).unbind("mouseup."+this.widgetName,this._mouseUpDelegate);if(this._mouseStarted){this._mouseStarted=false;this._preventClickEvent=(b.target==this._mouseDownEvent.target);this._mouseStop(b)}return false},_mouseDistanceMet:function(b){return(Math.max(Math.abs(this._mouseDownEvent.pageX-b.pageX),Math.abs(this._mouseDownEvent.pageY-b.pageY))>=this.options.distance)},_mouseDelayMet:function(b){return this.mouseDelayMet},_mouseStart:function(b){},_mouseDrag:function(b){},_mouseStop:function(b){},_mouseCapture:function(b){return true}})})(jQuery);;/*
 * jQuery UI Position 1.8rc3
 *
 * Copyright (c) 2010 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Position
 */
(function(f){f.ui=f.ui||{};var c=/left|center|right/,e="center",d=/top|center|bottom/,g="center",a=f.fn.position;f.fn.position=function(i){if(!i||!i.of){return a.apply(this,arguments)}i=f.extend({},i);var l=f(i.of),n=(i.collision||"flip").split(" "),m=i.offset?i.offset.split(" "):[0,0],k,h,j;if(i.of.nodeType===9){k=l.width();h=l.height();j={top:0,left:0}}else{if(i.of.scrollTo&&i.of.document){k=l.width();h=l.height();j={top:l.scrollTop(),left:l.scrollLeft()}}else{if(i.of.preventDefault){i.at="left top";k=h=0;j={top:i.of.pageY,left:i.of.pageX}}else{k=l.outerWidth();h=l.outerHeight();j=l.offset()}}}f.each(["my","at"],function(){var o=(i[this]||"").split(" ");if(o.length===1){o=c.test(o[0])?o.concat([g]):d.test(o[0])?[e].concat(o):[e,g]}o[0]=c.test(o[0])?o[0]:e;o[1]=d.test(o[1])?o[1]:g;i[this]=o});if(n.length===1){n[1]=n[0]}m[0]=parseInt(m[0],10)||0;if(m.length===1){m[1]=m[0]}m[1]=parseInt(m[1],10)||0;if(i.at[0]==="right"){j.left+=k}else{if(i.at[0]===e){j.left+=k/2}}if(i.at[1]==="bottom"){j.top+=h}else{if(i.at[1]===g){j.top+=h/2}}j.left+=m[0];j.top+=m[1];return this.each(function(){var t=f(this),s=t.outerWidth(),r=t.outerHeight(),p=f.extend({},j),u,o,q;if(i.my[0]==="right"){p.left-=s}else{if(i.my[0]===e){p.left-=s/2}}if(i.my[1]==="bottom"){p.top-=r}else{if(i.my[1]===g){p.top-=r/2}}f.each(["left","top"],function(w,v){if(f.ui.position[n[w]]){f.ui.position[n[w]][v](p,{targetWidth:k,targetHeight:h,elemWidth:s,elemHeight:r,offset:m,my:i.my,at:i.at})}});if(f.fn.bgiframe){t.bgiframe()}t.offset(f.extend(p,{using:i.using}))})};f.ui.position={fit:{left:function(h,i){var k=f(window),j=h.left+i.elemWidth-k.width()-k.scrollLeft();h.left=j>0?h.left-j:Math.max(0,h.left)},top:function(h,i){var k=f(window),j=h.top+i.elemHeight-k.height()-k.scrollTop();h.top=j>0?h.top-j:Math.max(0,h.top)}},flip:{left:function(i,j){if(j.at[0]==="center"){return}var l=f(window),k=i.left+j.elemWidth-l.width()-l.scrollLeft(),h=j.my[0]==="left"?-j.elemWidth:j.my[0]==="right"?j.elemWidth:0,m=-2*j.offset[0];i.left+=i.left<0?h+j.targetWidth+m:k>0?h-j.targetWidth+m:0},top:function(i,k){if(k.at[1]==="center"){return}var m=f(window),l=i.top+k.elemHeight-m.height()-m.scrollTop(),h=k.my[1]==="top"?-k.elemHeight:k.my[1]==="bottom"?k.elemHeight:0,j=k.at[1]==="top"?k.targetHeight:-k.targetHeight,n=-2*k.offset[1];i.top+=i.top<0?h+k.targetHeight+n:l>0?h+j+n:0}}};if(!f.offset.setOffset){f.offset.setOffset=function(l,i){if(/static/.test(jQuery.curCSS(l,"position"))){l.style.position="relative"}var k=jQuery(l),n=k.offset(),h=parseInt(jQuery.curCSS(l,"top",true),10)||0,m=parseInt(jQuery.curCSS(l,"left",true),10)||0,j={top:(i.top-n.top)+h,left:(i.left-n.left)+m};if("using" in i){i.using.call(l,j)}else{k.css(j)}};var b=f.fn.offset;f.fn.offset=function(h){var i=this[0];if(!i||!i.ownerDocument){return null}if(h){return this.each(function(){f.offset.setOffset(this,h)})}return b.call(this)}}})(jQuery);;

/**
 * jquery.scrollFollow.js
 * Copyright (c) 2008 Net Perspective (http://kitchen.net-perspective.com/)
 * Licensed under the MIT License (http://www.opensource.org/licenses/mit-license.php)
 * 
 * @author R.A. Ray
 *
 * @projectDescription	jQuery plugin for allowing an element to animate down as the user scrolls the page.
 * 
 * @version 0.4.0
 * 
 * @requires jquery.js (tested with 1.2.6)
 * @requires ui.core.js (tested with 1.5.2)
 * 
 * @optional jquery.cookie.js (http://www.stilbuero.de/2006/09/17/cookie-plugin-for-jquery/)
 * @optional jquery.easing.js (http://gsgd.co.uk/sandbox/jquery/easing/ - tested with 1.3)
 * 
 * @param speed		int - Duration of animation (in milliseconds)
 * 								default: 500
 * @param offset			int - Number of pixels box should remain from top of viewport
 * 								default: 0
 * @param easing		string - Any one of the easing options from the easing plugin - Requires jQuery Easing Plugin < http://gsgd.co.uk/sandbox/jquery/easing/ >
 * 								default: 'linear'
 * @param container	string - ID of the containing div
 * 								default: box's immediate parent
 * @param killSwitch	string - ID of the On/Off toggle element
 * 								default: 'killSwitch'
 * @param onText		string - killSwitch text to be displayed if sliding is enabled
 * 								default: 'Turn Slide Off'
 * @param offText		string - killSwitch text to be displayed if sliding is disabled
 * 								default: 'Turn Slide On'
 * @param relativeTo	string - Scroll animation can be relative to either the 'top' or 'bottom' of the viewport
 * 								default: 'top'
 * @param delay			int - Time between the end of the scroll and the beginning of the animation in milliseconds
 * 								default: 0
 */

( function( $ ) {
	
	$.scrollFollow = function ( box, options )
	{ 
		// Convert box into a jQuery object
		box = $( box );
		
		// 'box' is the object to be animated
		var position = box.css( 'position' );
		var targetHeight = box.height();
		var originalTop = box.css("top");		
		
		function ani()
		{		
			// The script runs on every scroll which really means many times during a scroll.
			// We don't want multiple slides to queue up.
			box.queue( [ ] );
		
			// A bunch of values we need to determine where to animate to
			var viewportHeight = parseInt( $( window ).height() );	
			var pageScroll =  parseInt( $( document ).scrollTop() );
			var parentTop =  parseInt( box.cont.offset().top );
			var parentHeight = parseInt( box.cont.attr( 'offsetHeight' ) );
			var boxHeight = parseInt( box.attr( 'offsetHeight' ) + ( parseInt( box.css( 'marginTop' ) ) || 0 ) + ( parseInt( box.css( 'marginBottom' ) ) || 0 ) );
			var aniTop;
			
			// Make sure the user wants the animation to happen
			if ( isActive )
			{
				// If the box should animate relative to the top of the window
				if ( options.relativeTo == 'top' )
				{
					// Don't animate until the top of the window is close enough to the top of the box
					if ( box.initialOffsetTop >= ( pageScroll + options.offset ) )
					{
						aniTop = box.initialTop;
					}
					else
					{
						aniTop = Math.min( ( Math.max( ( -parentTop ), ( pageScroll - box.initialOffsetTop + box.initialTop ) ) + options.offset ), ( parentHeight - boxHeight - box.paddingAdjustment ) );
					}
				}
				// If the box should animate relative to the bottom of the window
				else if ( options.relativeTo == 'bottom' )
				{
					// Don't animate until the bottom of the window is close enough to the bottom of the box
					if ( ( box.initialOffsetTop + boxHeight ) >= ( pageScroll + options.offset + viewportHeight ) )
					{
						aniTop = box.initialTop;
					}
					else
					{
						aniTop = Math.min( ( pageScroll + viewportHeight - boxHeight - options.offset ), ( parentHeight - boxHeight ) );
					}
				}
				
				// Checks to see if the relevant scroll was the last one
				// "-20" is to account for inaccuracy in the timeout
				if ( ( new Date().getTime() - box.lastScroll ) >= ( options.delay - 20 ) )
				{
					var containerViewHeight = box.cont.offset().top + box.cont.height() - $(window).scrollTop();
					var delta = $("body").height() - $(window).scrollTop() - containerViewHeight;

						if (targetHeight < viewportHeight) {
								box.animate(
								    {
								    	top: aniTop
								    }, options.speed, options.easing
								);
						}
						else {
							box.css({ top: originalTop })					
						}
				}
			}
		};
		
		// For user-initiated stopping of the slide
		var isActive = true;
		
		if ( $.cookie != undefined )
		{
			if( $.cookie( 'scrollFollowSetting' + box.attr( 'id' ) ) == 'false' )
			{
				var isActive = false;
				
				$( '#' + options.killSwitch ).text( options.offText )
					.toggle( 
						function ()
						{
							isActive = true;
							
							$( this ).text( options.onText );
							
							$.cookie( 'scrollFollowSetting' + box.attr( 'id' ), true, { expires: 365, path: '/'} );
							
							ani();
						},
						function ()
						{
							isActive = false;
							
							$( this ).text( options.offText );
							
							box.animate(
								{
									top: box.initialTop
								}, options.speed, options.easing
							);	
							
							$.cookie( 'scrollFollowSetting' + box.attr( 'id' ), false, { expires: 365, path: '/'} );
						}
					);
			}
			else
			{
				$( '#' + options.killSwitch ).text( options.onText )
					.toggle( 
						function ()
						{
							isActive = false;
							
							$( this ).text( options.offText );
							
							box.animate(
								{
									top: box.initialTop
								}, 0
							);	
							
							$.cookie( 'scrollFollowSetting' + box.attr( 'id' ), false, { expires: 365, path: '/'} );
						},
						function ()
						{
							isActive = true;
							
							$( this ).text( options.onText );
							
							$.cookie( 'scrollFollowSetting' + box.attr( 'id' ), true, { expires: 365, path: '/'} );
							
							ani();
						}
					);
			}
		}
		
		// If no parent ID was specified, and the immediate parent does not have an ID
		// options.container will be undefined. So we need to figure out the parent element.
		if ( options.container == '')
		{
			box.cont = box.parent();
		}
		else
		{
			box.cont = $( '#' + options.container );
		}
		
		// Finds the default positioning of the box.
		box.initialOffsetTop =  parseInt( box.offset().top );
		box.initialTop = parseInt( box.css( 'top' ) ) || 0;
		
		// Hack to fix different treatment of boxes positioned 'absolute' and 'relative'
		if ( box.css( 'position' ) == 'relative' )
		{
			box.paddingAdjustment = parseInt( box.cont.css( 'paddingTop' ) ) + parseInt( box.cont.css( 'paddingBottom' ) );
		}
		else
		{
			box.paddingAdjustment = 0;
		}
		
		// Animate the box when the page is scrolled
		$( window ).scroll( function ()
			{
				// Sets up the delay of the animation
				$.fn.scrollFollow.interval = setTimeout( function(){ ani();} , options.delay );
				
				// To check against right before setting the animation
				box.lastScroll = new Date().getTime();
			}
		);
		
		// Animate the box when the page is resized
		$( window ).resize( function ()
			{			
				// Sets up the delay of the animation
				$.fn.scrollFollow.interval = setTimeout( function(){ ani(); } , options.delay );
				
				// To check against right before setting the animation
				box.lastScroll = new Date().getTime();
			}
		);

		// Run an initial animation on page load
		box.lastScroll = 0;
		
		ani();
	};
	
	$.fn.scrollFollow = function ( options )
	{
		options = options || {};
		options.relativeTo = options.relativeTo || 'top';
		options.speed = options.speed || 500;
		options.offset = options.offset || 0;
		options.easing = options.easing || 'swing';
		options.container = options.container || this.parent().attr( 'id' );
		options.killSwitch = options.killSwitch || 'killSwitch';
		options.onText = options.onText || 'Turn Slide Off';
		options.offText = options.offText || 'Turn Slide On';
		options.delay = options.delay || 0;
		
		this.each( function() 
			{
				new $.scrollFollow( this, options );
			}
		);
		
		return this;
	};
})( jQuery );


/* ================================================================== */
/*                                                                    */
/* ! jQuery RollOver */
/*                                                                    */
/* ================================================================== */

/**
 * jQuery.rollover
 *
 * @version  1.0.2
 * @author   rew <rewish.org@gmail.com>
 * @link     http://rewish.org/javascript/jquery_rollover_plugin
 * @license  http://rewish.org/license/mit The MIT License
 *
 * Inspired by:
 * Telepath Labs (http://dev.telepath.co.jp/labs/article.php?id=15)
 *
 * Usage:
 * jQuery(document).ready(function($) {
 *   // <img>
 *   $('#nav a img').rollover();
 *
 *   // <input type="image">
 *   $('form input:image').rollover();
 *
 *   // set suffix
 *   $('#nav a img').rollover('_over');
 * });
 */
jQuery.fn.rollover = function(suffix) {
	suffix = suffix || '_h';
	return this.not('[src*="'+ suffix +'."]').each(function() {
		var img = jQuery(this);
		var src = img.attr('src');
		var _on = [
			src.substr(0, src.lastIndexOf('.')),
			src.substring(src.lastIndexOf('.'))
		].join(suffix);
		jQuery('<img>').attr('src', _on);
		img.hover(
			function() { img.attr('src', _on); },
			function() { img.attr('src', src); }
		);
	});
};

$(document).ready(function($) {
	$('body img.ro, body form input:image.ro').rollover();
});


/* ================================================================== */
/*                                                                    */
/* ! Window Open */
/*                                                                    */
/* ================================================================== */

function openLinkPopup(wUrl,_wWidth,_wHeight){
	var wObj;
	
	if (_wWidth) {
		wWidth = _wWidth;
	} else {
		wWidth = 650;
	}
	
	if (_wHeight) {
		wHeight = _wHeight;
	} else {
		wHeight = 600;
	}
	
	scWidthCenter = screen.availWidth / 2;
	scHeightCenter = screen.availHeight / 2;
	wOption =
	"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,width="
	+ wWidth + ",height=" + wHeight + ",left=" + (scWidthCenter - (wWidth /
	2)) + ",top=" + (scHeightCenter - (wHeight / 2));
	wObj = window.open(wUrl,'link',wOption);
	wObj.focus();
}


/* ================================================================== */
/*                                                                    */
/* ! OS and Modern Browser Check */
/*                                                                    */
/*   for Mac OS X, iPhone OS and Windows                              */
/*       Safari, Chrome, Firefox, Opera and Internet Explorer         */
/*                                                                    */
/* ------------------------------------------------------------------
*
*    How to get OS Name:
*       alert(_ua.os.name);
*
*    How to get OS Version (except "Opera" in Mac):
*       alert(_ua.os.name);
*
*    How to get Browser Name:
*       alert(_ua.browser.name);
*
*    How to get Browser Version:
*       alert(_ua.browser.ver);
*
* =================================================================== */

var _ua = new Object();

_ua.str = navigator.userAgent.toUpperCase();
_ua.os = {};
_ua.browser = {};

if (_ua.str.indexOf("MACINTOSH") >= 0) {
	_ua.os.name = "Mac";
	if (_ua.str.indexOf("MAC OS X ") >=0 ) {
		_ua.os.ver = _ua.str.match(/MAC OS X [0-9_.]*/).toString().substr(9, 4).replace(/_/g, ".");
	}
}
else if (_ua.str.indexOf("IPAD") >= 0) {
	_ua.os.name = "iPad";
	if (_ua.str.indexOf("IPHONE OS ") >=0 ) {
		_ua.os.ver = _ua.str.match(/IPHONE OS [0-9_.]*/).toString().substr(10, 3).replace(/_/g, ".");
	}
}
else if (_ua.str.indexOf("IPHONE") >= 0) {
	_ua.os.name = "iPhone";
	if (_ua.str.indexOf("IPHONE OS ") >=0 ) {
		_ua.os.ver = _ua.str.match(/IPHONE OS [0-9_.]*/).toString().substr(10, 3).replace(/_/g, ".");
	}
}
else if (_ua.str.indexOf("IPOD") >= 0) {
	_ua.os.name = "iPod touch";
	if (_ua.str.indexOf("IPHONE OS ") >=0 ) {
		_ua.os.ver = _ua.str.match(/IPHONE OS [0-9_.]*/).toString().substr(10, 3).replace(/_/g, ".");
	}
}
else if (_ua.str.indexOf("WINDOWS") >= 0) {
	_ua.os.name = "Windows";
	if (_ua.str.indexOf("WINDOWS NT 5.1") >= 0) _ua.os.ver = "XP";
	if (_ua.str.indexOf("WINDOWS NT 6.0") >= 0) _ua.os.ver = "Vista";
	if (_ua.str.indexOf("WINDOWS NT 6.1") >= 0) _ua.os.ver = "7";
}


if (_ua.str.indexOf("CHROME") >= 0) {
	_ua.browser.name = "Chrome";
	_ua.browser.ver = _ua.str.match(/CHROME\/[0-9_.]*/).toString().substr(7,3) - 0;
}
else if (_ua.str.indexOf("IPAD") >= 0 && _ua.str.indexOf("SAFARI") >= 0) {
	_ua.browser.name = "Mobile Safari";
	_ua.browser.ver = _ua.str.match(/VERSION\/[0-9_.]*/).toString().substr(8) - 0;
} 
else if (_ua.str.indexOf("IPHONE") >= 0 && _ua.str.indexOf("SAFARI") >= 0) {
	_ua.browser.name = "Mobile Safari";
	_ua.browser.ver = _ua.str.match(/VERSION\/[0-9_.]*/).toString().substr(8) - 0;
} 
else if (_ua.str.indexOf("IPOD") >= 0 && _ua.str.indexOf("SAFARI") >= 0) {
	_ua.browser.name = "Mobile Safari";
	_ua.browser.ver = _ua.str.match(/VERSION\/[0-9_.]*/).toString().substr(8) - 0;
} 
else if (_ua.str.indexOf("SAFARI") >= 0) {
	_ua.browser.name = "Safari";
	_ua.browser.ver = _ua.str.match(/VERSION\/[0-9_.]*/).toString().substr(8);
} 
else if (_ua.str.indexOf("FIREFOX") >= 0) {
	_ua.browser.name = "Firefox";
	_ua.browser.ver = _ua.str.match(/FIREFOX\/[0-9_.]*/).toString().substr(8, 3) - 0;
}
else if (_ua.str.indexOf("OPERA") >= 0) {
	_ua.browser.name = "Opera";
	_ua.browser.ver = _ua.str.match(/VERSION\/[0-9_.]*/).toString().substr(8) - 0;
}
else if (_ua.str.indexOf("MSIE") >= 0) {
	_ua.browser.name = "IE";
	if (_ua.str.indexOf("MSIE 5.0") >= 0) _ua.browser.ver = 5.0;
	if (_ua.str.indexOf("MSIE 5.5") >= 0) _ua.browser.ver = 5.5;
	if (_ua.str.indexOf("MSIE 6.0") >= 0) _ua.browser.ver = 6.0;
	if (_ua.str.indexOf("MSIE 7.0") >= 0) _ua.browser.ver = 7.0;
	if (_ua.str.indexOf("MSIE 8.0") >= 0) _ua.browser.ver = 8.0;
	if (_ua.str.indexOf("MSIE 9.0") >= 0) _ua.browser.ver = 9.0;
}


/* ================================================================== */
/*                                                                    */
/* ! Browser Check */
/*                                                                    */
/* ================================================================== */

var os;
var uAgent = navigator.userAgent.toUpperCase();
if (uAgent.indexOf("MAC") >= 0) { os = "Mac"; }
if (uAgent.indexOf("WIN") >= 0) { os = "Win"; }
if (uAgent.indexOf("X11") >= 0) { os = "UNIX"; }
if (uAgent.indexOf("WINDOWS NT 6") >= 0) { os = "Vista"; }

var browser;
var ieflag;

var aName = navigator.appName.toUpperCase();
var uName = navigator.userAgent.toUpperCase();

if (uName.indexOf("SAFARI") >= 0) { browser = "Safari"; }
if (uName.indexOf("OPERA") >= 0) { browser = "Opera"; }
if (uName.indexOf("FIREFOX") >= 0) { browser = "Firefox"; }
if (uName.indexOf("FIREFOX/3") >= 0) { browser = "Firefox3"; }
if (uName.indexOf("NETSCAPE") >= 0) { browser = "Netscape"; }

if (aName.indexOf("MICROSOFT") >= 0) { ieflag = true; }

if (ieflag) {
	if (uName.indexOf("MSIE 6.0") >= 0) {
		browser = "IE6";
	}
	if (uName.indexOf("MSIE 7.0") >= 0) {
		browser = "IE7";
	}
	if (uName.indexOf("MSIE 8.0") >= 0) {
		browser = "IE8";
	}
}


/* ================================================================== */
/*                                                                    */
/* ! Global Navigation and Dropdown Menu */
/*                                                                    */
/* ================================================================== */

var homeFlag = false;   // トップページか
var maOpened = false;   // メイクアップメニューが開いているか
var skOpened = false;   // スキンケアメニューが開いているか
var effectFlag = false; // エフェクトの処理中か

var gnLeftPos; // グローバルナビゲーション画像のX方向の位置


/* ------------------------------------------------------------------ */
/* ドロップダウンメニューの展開処理 */
/* ------------------------------------------------------------------ */

function ddmenu(_id, _mode) {
	var ddId;        // ターゲットメニュー
	var trigId;      // トリガー


	/* ---------------------------------
	*    ターゲットを設定    */

	if (_id == "gnMa") {
		ddId = "#dd-ma";
		oppositeId = "#dd-sk";
		trigId = "#trig-ma";
	}
	else if (_id == "gnSk") {
		ddId = "#dd-sk";
		oppositeId = "#dd-ma";
		trigId = "#trig-sk";
	}


	/* ---------------------------------
	*    メニューを開く    */

	if (_mode == "on") {
	
		// エフェクトを適用し、メニューを開く
		if (effectFlag == false) {
			effectFlag = true;
			
			if (_ua.browser.name == "IE" && _ua.browser.ver >= 7.0) {
				$(ddId).show(0, function() { effectFlag = false; });
			}
			else {
				$(ddId).fadeIn("fast", function() { effectFlag = false; });
			}
		}


		/* ---------------------------------
		*    メイクアップメニューのとき    */

		if (_id == "gnMa") {
			maOpened = true;
			$(ddId).css("z-index", "500");
			$(oppositeId).css("z-index", "400");
		}


		/* ---------------------------------
		*    スキンケアメニューのとき    */

		else if (_id == "gnSk") {
			skOpened = true;
			$(ddId).css("z-index", "500");
			$(oppositeId).css("z-index", "400");
		}
		
	}


	/* ---------------------------------
	*    メニューを閉じる    */

	else if (_mode == "off") {
		if (effectFlag == false) {

			effectFlag = true;

			if (_ua.browser.name == "IE" && _ua.browser.ver >= 7.0) {
				$(ddId).hide(0, function() {
					if (_id == "gnMa") {
						maOpened = false;
					}
					else if (_id == "gnSk") {
						skOpened = false;
					}
					effectFlag = false;
				});
			}
			else {
				$(ddId).fadeOut("fast", function() {
					if (_id == "gnMa") {
						maOpened = false;
					}
					else if (_id == "gnSk") {
						skOpened = false;
					}
					effectFlag = false;
				});
			}

			$(trigId).css("background-position", gnLeftPos + " -31px");

		}
	}
}


/* ------------------------------------------------------------------ */
/* 各メニューごとのメニュー画像の背景位置（x方向）を返す関数 */
/* ------------------------------------------------------------------ */

function getXpos(_id) {
	switch (_id) {
	    case "gnAb": return "0";      break;
	    case "gnMa": return "-261px"; break;
	    case "gnSk": return "-389px"; break;
	    case "gnSa": return "-510px"; break;
	    case "gnCa": return "-601px"; break;
	    case "gnQa": return "-736px"; break;
	    case "hnAb": return "0";      break;
	    case "hnMa": return "-174px"; break;
	    case "hnSk": return "-348px"; break;
	    case "hnSa": return "-522px"; break;
	    case "hnCa": return "-696px"; break;
	    case "hnQa": return "-870px"; break;
	}
}


$(document).ready(function() {

	/* ------------------------------------------------------------------ */
	/*                                                                    */
	/* ドロップダウンメニューの配置処理 */
	/*                                                                    */
	/* ------------------------------------------------------------------ */

	/* ---------------------------------
	*    メイクアップメニュー    */
	var ddMaSrc = '<div id="dd-ma">'
				+ '<div class="ddConTop"></div>'
				+ '<div class="ddConMid">'
				+ '<div class="container"><ul class="clearfix">'
				+ '<li><div class="cont newIcon"><a href="/makeup/base_and_concealer/"><img class="thumb" src="/common/images/dd/dd_ma_base.jpg" alt="ベース / コンシーラー" width="118" height="118" /></a></div><img class="openBtn" src="/common/images/dd/dd_openbtn.gif" alt="" title="この製品ラインの詳細を見る" width="24" height="24" /></li>'
				+ '<li><div class="cont newIcon"><a href="/makeup/foundation/#powder"><img class="thumb" src="/common/images/dd/dd_ma_powder.jpg" alt="パウダー ファンデーション" width="118" height="118" /></a></div><img class="openBtn" src="/common/images/dd/dd_openbtn.gif" alt="" title="この製品ラインの詳細を見る" width="24" height="24" /></li>'
				+ '<li><div class="cont"><a href="/makeup/foundation/#liquid"><img class="thumb" src="/common/images/dd/dd_ma_liquid.jpg" alt="リキッド ファンデーション" width="118" height="118" /></a></div><img class="openBtn" src="/common/images/dd/dd_openbtn.gif" alt="" title="この製品ラインの詳細を見る" width="24" height="24" /></li>'
				+ '<li><div class="cont"><a href="/makeup/foundation/#cream"><img class="thumb" src="/common/images/dd/dd_ma_cream.jpg" alt="クリーム ファンデーション" width="118" height="118" /></a></div><img class="openBtn" src="/common/images/dd/dd_openbtn.gif" alt="" title="この製品ラインの詳細を見る" width="24" height="24" /></li>'
				+ '<li><div class="cont"><a href="/makeup/foundation/#face"><img class="thumb" src="/common/images/dd/dd_ma_face.jpg" alt="フェイス パウダー" width="118" height="118" /></a></div><img class="openBtn" src="/common/images/dd/dd_openbtn.gif" alt="" title="この製品ラインの詳細を見る" width="24" height="24" /></li>'
				+ '<li><div class="cont"><a href="/makeup/eyebrow/"><img class="thumb" src="/common/images/dd/dd_ma_eyebrow.jpg" alt="アイブロー" width="118" height="118" /></a></div><img class="openBtn" src="/common/images/dd/dd_openbtn.gif" alt="" title="この製品ラインの詳細を見る" width="24" height="24" /></li>'
				+ '<li><div class="cont"><a href="/makeup/eyeliner/"><img class="thumb" src="/common/images/dd/dd_ma_eyeliner.jpg" alt="アイライナー" width="118" height="118" /></a></div><img class="openBtn" src="/common/images/dd/dd_openbtn.gif" alt="" title="この製品ラインの詳細を見る" width="24" height="24" /></li>'
				+ '<li class="last"><div class="cont"><a href="/makeup/eyelash/"><img class="thumb" src="/common/images/dd/dd_ma_eyelash.jpg" alt="アイラッシュ" width="118" height="118" /></a></div><img class="openBtn" src="/common/images/dd/dd_openbtn.gif" alt="" title="この製品ラインの詳細を見る" width="24" height="24" /></li>'
				+ '<li><div class="cont"><a href="/makeup/mascara/"><img class="thumb" src="/common/images/dd/dd_ma_mascara.jpg" alt="マスカラ" width="118" height="118" /></a></div><img class="openBtn" src="/common/images/dd/dd_openbtn.gif" alt="" title="この製品ラインの詳細を見る" width="24" height="24" /></li>'
				+ '<li><div class="cont"><a href="/makeup/eyecolor/"><img class="thumb" src="/common/images/dd/dd_ma_eyecolor.jpg" alt="アイ カラー" width="118" height="118" /></a></div><img class="openBtn" src="/common/images/dd/dd_openbtn.gif" alt="" title="この製品ラインの詳細を見る" width="24" height="24" /></li>'
				+ '<li><div class="cont"><a href="/makeup/cheekcolor/"><img class="thumb" src="/common/images/dd/dd_ma_cheek.jpg" alt="チーク カラー" width="118" height="118" /></a></div><img class="openBtn" src="/common/images/dd/dd_openbtn.gif" alt="" title="この製品ラインの詳細を見る" width="24" height="24" /></li>'
				+ '<li><div class="cont"><a href="/makeup/lip/"><img class="thumb" src="/common/images/dd/dd_ma_lip.jpg" alt="リップ" width="118" height="118" /></a></div><img class="openBtn" src="/common/images/dd/dd_openbtn.gif" alt="" title="この製品ラインの詳細を見る" width="24" height="24" /></li>'
				+ '<li><div class="cont"><a href="/makeup/tool/#brush"><img class="thumb" src="/common/images/dd/dd_ma_brush.jpg" alt="ブラシ" width="118" height="118" /></a></div><img class="openBtn" src="/common/images/dd/dd_openbtn.gif" alt="" title="この製品ラインの詳細を見る" width="24" height="24" /></li>'
				+ '<li><div class="cont"><a href="/makeup/tool/#tool"><img class="thumb" src="/common/images/dd/dd_ma_tool.jpg" alt="ツール" width="118" height="118" /></a></div><img class="openBtn" src="/common/images/dd/dd_openbtn.gif" alt="" title="この製品ラインの詳細を見る" width="24" height="24" /></li>'
				+ '<li><div class="cont"><a href="/makeup/tool/#case"><img class="thumb" src="/common/images/dd/dd_ma_case.jpg" alt="レフィル ケース" width="118" height="118" /></a></div><img class="openBtn" src="/common/images/dd/dd_openbtn.gif" alt="" title="この製品ラインの詳細を見る" width="24" height="24" /></li>'
				+ '<li class="last"><div class="cont"><a href="/makeup/tool/#box"><img class="thumb" src="/common/images/dd/dd_ma_box.jpg" alt="メイクアップ ボックス / ブラシケース" width="118" height="118" /></a></div><img class="openBtn" src="/common/images/dd/dd_openbtn.gif" alt="" title="この製品ラインの詳細を見る" width="24" height="24" /></li>'
				+ '</ul></div>'
				+ '</div>'
				+ '<div class="ddConBtm"></div>'
				+ '</div>';
	
	/* ---------------------------------
	*    スキンケアメニュー    */
	var ddSkSrc = '<div id="dd-sk">'
				+ '<div class="ddConTop"></div>'
				+ '<div class="ddConMid">'
				+ '<div class="container"><ul class="clearfix">'
				+ '<li><div class="cont newIcon"><a href="/skincare/cleansingoil/"><img class="thumb" src="/common/images/dd/dd_sk_clean.jpg" alt="クレンジング オイル" width="118" height="118" /></a></div><img class="openBtn" src="/common/images/dd/dd_openbtn.gif" alt="" title="この製品ラインの詳細を見る" width="24" height="24" /></li>'
				+ '<li><div class="cont"><a href="/skincare/hydrability/"><img class="thumb" src="/common/images/dd/dd_sk_hydro.jpg" alt="ハイドラビリティ [保湿]" width="118" height="118" /></a></div><img class="openBtn" src="/common/images/dd/dd_openbtn.gif" alt="" title="この製品ラインの詳細を見る" width="24" height="24" /></li>'
				+ '<li><div class="cont newIcon"><a href="/skincare/whitefficient/"><img class="thumb" src="/common/images/dd/dd_sk_white.jpg" alt="ホワイトレメディ [美白]" width="118" height="118" /></a></div><img class="openBtn" src="/common/images/dd/dd_openbtn.gif" alt="" title="この製品ラインの詳細を見る" width="24" height="24" /></li>'
				+ '<li><div class="cont"><a href="/skincare/photoprotector/"><img class="thumb" src="/common/images/dd/dd_sk_photo.jpg" alt="フォトプロテクター UV MX [日焼け止め]" width="118" height="118" /></a></div><img class="openBtn" src="/common/images/dd/dd_openbtn.gif" alt="" title="この製品ラインの詳細を見る" width="24" height="24" /></li>'
				+ '<li><div class="cont"><a href="/skincare/eternalremedy/"><img class="thumb" src="/common/images/dd/dd_sk_eternal.jpg" alt="エターナルレメディ [エイジングケア]" width="118" height="118" /></a></div><img class="openBtn" src="/common/images/dd/dd_openbtn.gif" alt="" title="この製品ラインの詳細を見る" width="24" height="24" /></li>'
				+ '<li><div class="cont"><a href="/skincare/depsea_water/"><img class="thumb" src="/common/images/dd/dd_sk_depsea.jpg" alt="ディプシー ウォーター" width="118" height="118" /></a></div><img class="openBtn" src="/common/images/dd/dd_openbtn.gif" alt="" title="この製品ラインの詳細を見る" width="24" height="24" /></li>'
				+ '<li><div class="cont"></div></li>'
				+ '<li class="last"><div class="cont last"></div></li>'
				+ '</ul></div>'
				+ '</div>'
				+ '<div class="ddConBtm"></div>'
				+ '</div>';


	/* ---------------------------------
	*    ナビゲーションに追加    */
	var j_nav;
	
	if ($("body").is(":has('#homeNavi')")) {
		homeFlag = true;
	}

	$("#globalBtn").wrap('<div class="btnCont"></div>');
	j_nav = $("#globalNavi .btnCont");
		
	gnLeftPos = "-866px";
	
	j_nav.append(ddMaSrc).append(ddSkSrc);


	// NEWアイコンの追加
	$("#dd-ma li, #dd-sk li").find(".newIcon").each(function() {
		if (browser == "IE6") {
			$(this).prepend('<div class="new"><img src="/common/images/icon_new.gif" alt="NEW" width="33" height="33" /></div>')
		} else {
			$(this).prepend('<div class="new"><img src="/common/images/icon_new.png" alt="NEW" width="33" height="33" /></div>')
		}
	});


	// IE6に対しpngFixを実行
	if (browser == "IE6") {
		$("#dd-ma, #dd-sk").pngFix({ blankgif: '/common/images/blank.gif' });
	}


	/* ---------------------------------
	*    パネル ホバー時の処理    */
    $("#dd-ma li, #dd-sk li").each(function(i) {
    	$(this).hover(
    		function() {
    			$(this).find(".cont").css("opacity", 0.85);
    			$(this).find("img.openBtn").animate({ left: "95px", top: "94px" }, 150);
    		},
    		function() {
    			$(this).find(".cont").css("opacity", 1);
    			$(this).find("img.openBtn").animate({ left: "119px", top: "119px" }, 200);
    		}
    	);
    });


	/* ---------------------------------
	*    トリガーにIDを付与   */
	$("#gnMa span").attr("id", "trig-ma");
	$("#gnSk span").attr("id", "trig-sk");



	/* ------------------------------------------------------------------ */
	/*    ナビゲーションからマウスアウトした時の処理 */
	/* ------------------------------------------------------------------ */

    /* ---------------------------------
    *     フラグ    */
    var outMaFlag = false; // マウスアウトしているか
    var outSkFlag = false; // マウスアウトしているか
	
	$("#dd-ma, #gnMa").hover(
	    function() {
	    	outMaFlag = false;
	    },
	    function() {
	    	if (maOpened) {
	    		outMaFlag = true;
	    		$("#gnMa").delay(500).show(0, function() {
	    			if (outMaFlag) {
						if (_ua.browser.name == "IE" && _ua.browser.ver >= 7.0) {
		    				$("#dd-ma").hide(0, function(){ maOpened = false; });
						}
						else {
		    				$("#dd-ma").fadeOut("fast", function(){ maOpened = false; });
						}
						$("#trig-ma").css("background-position", gnLeftPos + " -62px");
	    			}
	    		});
	    	}
	    }	
	);

	$("#dd-sk, #gnSk").hover(
	    function() {
	    	outSkFlag = false;
	    },
	    function() {
	    	if (skOpened) {
	    		outSkFlag = true;
	    		
	    		$("#gnSk").delay(500).show(0, function() {
	    			if (outSkFlag) {
						if (_ua.browser.name == "IE" && _ua.browser.ver >= 7.0) {
		    				$("#dd-sk").hide(0, function(){ skOpened = false; });
						}
						else {
		    				$("#dd-sk").fadeOut("fast", function(){ skOpened = false; });
						}
						$("#trig-sk").css("background-position", gnLeftPos + " -62px");
	    			}
	    		});
	    	}
	    }	
	);


	/* ------------------------------------------------------------------ */
	/*                                                                    */
	/*    グローバルナビゲーションのボタン制御 */
	/*                                                                    */
	/* ------------------------------------------------------------------ */

	// ホームページ（トップ）の際の処理
	$("#globalBtn li").each(function() {
	    /* ------------------------------------------------------------------ */
	    /*    ドロップダウンメニューのトリガーの挙動を設定 */
	    /* ------------------------------------------------------------------ */
	
	    $(this).find("span")
	    .hover(
	    	// ホバー時の処理
	    
	    	function() {
	    		var targetId = $(this).closest("li").attr("id");
	
	    		if (targetId == "gnMa") {
	    			if (maOpened == false) {
	    				$(this).css({ "backgroundPosition" : gnLeftPos + " -31px" });
	    			}
	    		}
	    		else if (targetId == "gnSk") {
	    			if (skOpened == false) {
	    				$(this).css({ "backgroundPosition" : gnLeftPos + " -31px" });
	    			}
	    		}
	    	},
	    	function() {
	    		var targetId = $(this).closest("li").attr("id");
	
	    		if (targetId == "gnMa") {
	    			if (maOpened == false) {
	    				$(this).css({ "backgroundPosition" : gnLeftPos + " -62px" });
	    			}
	    		}
	    		else if (targetId == "gnSk") {
	    			if (skOpened == false) {
	    				$(this).css({ "backgroundPosition" : gnLeftPos + " -62px" });
	    			}
	    		}
	    	}
	    )
	    .click(function() {
	    	// クリック時の処理
	
	    	var targetId = $(this).closest("li").attr("id");
	
	    	if (targetId == "gnMa") {
	    		if (maOpened == false) {
	    			$(this).css({ "backgroundPosition" : gnLeftPos + " 0" });
	    			ddmenu("gnMa", "on");
	    		} else {
	    			ddmenu("gnMa", "off");
	    		}
	    	}
	    	else if (targetId == "gnSk") {
	    		if (skOpened == false) {
	    			$(this).css({ "backgroundPosition" : gnLeftPos + " 0" });
	    			ddmenu("gnSk", "on");
	    		} else {
	    			ddmenu("gnSk", "off");
	    		}
	    	}
	
	
	    	/* ---------------------------------
	    	*    他のクリックイベントを解除    */
	    	return false;
	    });

	});
});

$(document).ready(function($) {
	$("#mainHeader a").hover(
		function() {
			$(this).css({ "opacity": 0.65 });
		},
		function() {
			$(this).css({ "opacity": 1 });
		}
	);
});

