/* [INDEX]======================================
jQuery / jQuery.noConflict();

mac用
boxHeight
last element addClass "last"
anchorScroll
rollOver
tabel odd cahnge color
outside link blank
============================================== */


/* --------------------------------------------------
test用
-------------------------------------------------- */
$(".text1").css("background","#ffdddd");



/* --------------------------------------------------
mac用
-------------------------------------------------- */
$(function(){
	if (navigator.platform.indexOf("Mac") != -1) {
		$("body").addClass("mac");
	}
});

/* --------------------------------------------------
boxHeight
-------------------------------------------------- */
$(function(){
	boxHeight("div.columnWrap", "div.column");
});

boxHeight = function(wrap, box){$(function(){
	$(wrap).each(function(){
		var wrapHeight = 0;
		var alignBox = $(this).find(box);
		if($.browser.msie && Number($.browser.version) < 7) {
			alignBox.height("auto");
		} else {
			alignBox.css("min-height", 0);
		}

		for(var i=0; i<alignBox.length; i++){
			wrapHeight = Math.max(wrapHeight, alignBox.eq(i).height());	
		}
		if($.browser.msie && Number($.browser.version) < 7) {
			alignBox.height(wrapHeight);
		} else {
			alignBox.css("min-height", wrapHeight);
		}
	});
})};

/* --------------------------------------------------
last element addClass "last"
-------------------------------------------------- */
$(function(){
	lastElement("body", ".section");
	lastElement("ul", "li");
	lastElement(".columnWrap", ".column");
});

lastElement = function(parentElem, lastElem){$(function(){
	$(parentElem).each(function(index, elem) {
		$(lastElem+":last", $(elem)).addClass("last");
	});
})};


/* --------------------------------------------------
pageScroll
-------------------------------------------------- */
$(function () {
        // PageTop
        $('a[href^=#], area[href^=#]').not('a[href=#], area[href=#]').each(function () {
                // jquery.easing
                jQuery.easing.quart = function (x, t, b, c, d) {
                        return -c * ((t = t / d - 1) * t * t * t - 1) + b;
                };
                if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname && this.hash.replace(/#/, '')) {
                        var $targetId = $(this.hash),
                                $targetAnchor = $('[name=' + this.hash.slice(1) + ']');
                        var $target = $targetId.length ? $targetId : $targetAnchor.length ? $targetAnchor : false;
                        if ($target) {
                                var targetOffset = $target.offset().top;
                                $(this).click(function () {
                                        $('html, body').animate({
                                                scrollTop: targetOffset
                                        }, 700, 'quart');
                                        return false;
                                });
                        }
                }
        });
                if (location.hash) {
                        var hash = location.hash;
                        window.scroll(0, 0)
                        $('a[href=' + hash + ']').click();
                }
});

/* --------------------------------------------------
rollOver
-------------------------------------------------- */
$(function () {
	var postfix = '_on';
	$('a img.hover').not('[src*="'+ postfix +'."]').each(function() {
		var img = $(this);
		var src = img.attr('src');
		var src_on = src.substr(0, src.lastIndexOf('.'))
		           + postfix
		           + src.substring(src.lastIndexOf('.'));
		$('<img>').attr('src', src_on);
		img.hover(function() {
			img.attr('src', src_on);
		}, function() {
			img.attr('src', src);
		});
	});
});

/* --------------------------------------------------
tabel odd cahnge color
-------------------------------------------------- */
$(function(){
	$("tr:nth-child(odd)").addClass("odd");
	$("tr:nth-child(even)").addClass("even");
});

/* --------------------------------------------------
outside link blank
-------------------------------------------------- */
$(function(){
	//$("a[href^='http']").attr("target","_blank");
	$("a.blank").attr("target","_blank");
});

/* --------------------------------------------------
xxxx
-------------------------------------------------- */


/* --------------------------------------------------
xxxx
-------------------------------------------------- */


/* --------------------------------------------------
xxxx
-------------------------------------------------- */


/* --------------------------------------------------
xxxx
-------------------------------------------------- */


/* --------------------------------------------------
xxxx
-------------------------------------------------- */


/* --------------------------------------------------
xxxx
-------------------------------------------------- */


/* --------------------------------------------------
xxxx
-------------------------------------------------- */



