/**
 * fineDine JS
 * @require jquery(1.4.3)
 * 
 */

/* --------------------------------------------------
	Page Scroll Top 
-------------------------------------------------- */

var fineDine = {
	pagetop: function(){
		$('.pagetop a').click(function() {
			$(this).blur();
			$('html ,body').animate({ scrollTop: 0 }, 'slow');
			return false;
		});
	},
	init: function(){
		fineDine.pagetop();
	}
};

$(function(){
	fineDine.init();
});

/* --------------------------------------------------
	Photo Switch
-------------------------------------------------- */
/*
$(function(){
	var _photoImage = $('#photo img');
	var _defImage = _photoImage.attr('src');
	var _thumbs = $('#thamb a');
	_thumbs.mouseover(function(e){
		_thumbs.filter('.active').removeClass('active');
		$(this).addClass('active');
		_photoImage.attr('src', this.getAttribute('href'));
		e.preventDefault();
	});

_thumbs.click(function(){
		this.blur();
		return false;
	});
});
*/

/* --------------------------------------------------
	ALIGN BOXES HEIGHT
-------------------------------------------------- */
/*
jQuery.changeLetterSize = {
	handlers : [],
	interval : 1000,
	currentSize: 0
};

(function($) {
	var self = $.changeLetterSize;
	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);
	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);

(function($) {
	var sets = [];
	var alignbox = function(set) {
		var maxHeight = 0;
		set.each(function(){
			var height = this.offsetHeight;
			if (height > maxHeight) maxHeight = height;
		});
		set.css('height', maxHeight + 'px');
	};
	jQuery.fn.alignbox = function() {
		if (this.length > 1) {
			alignbox(this);
			sets.push(this);
		}
		return this;
	};
	var reflatting = function() {
		$.each(sets, function() {
			this.height('auto');
			alignbox(this);
		});
	};
	$.changeLetterSize.addHandler(reflatting);
	$(window).resize(reflatting);
})(jQuery);

$(function(){
    var sets = [], temp = [];
    $('#item_area p.ab_text').each(function(i) {
        temp.push(this);
        if (i % 3 == 2) {
            sets.push(temp);
            temp = [];
        }
    });
    if (temp.length) sets.push(temp);

    $.each(sets, function() {
        $(this).alignbox();
    });
});
$(function(){
    var sets = [], temp = [];
    $('#item_area p.price').each(function(i) {
        temp.push(this);
        if (i % 3 == 2) {
            sets.push(temp);
            temp = [];
        }
    });
    if (temp.length) sets.push(temp);

    $.each(sets, function() {
        $(this).alignbox();
    });
});

$(function(){
    var sets = [], temp = [];
    $('#item_area ul > li.alignbox').each(function(i) {
        temp.push(this);
        if (i % 3 == 2) {
            sets.push(temp);
            temp = [];
        }
    });
    if (temp.length) sets.push(temp);

    $.each(sets, function() {
        $(this).alignbox();
    });
});

$(function(){
    var sets = [], temp = [];
    $('#order_item_area p.ab_text').each(function(i) {
        temp.push(this);
        if (i % 5 == 4) {
            sets.push(temp);
            temp = [];
        }
    });
    if (temp.length) sets.push(temp);

    $.each(sets, function() {
        $(this).alignbox();
    });
});

$(function(){
    var sets = [], temp = [];
    $('#order_item_area p.price').each(function(i) {
        temp.push(this);
        if (i % 5 == 4) {
            sets.push(temp);
            temp = [];
        }
    });
    if (temp.length) sets.push(temp);

    $.each(sets, function() {
        $(this).alignbox();
    });
});

$(function(){
    var sets = [], temp = [];
    $('#order_item_area ul > li.alignbox').each(function(i) {
        temp.push(this);
        if (i % 5 == 4) {
            sets.push(temp);
            temp = [];
        }
    });
    if (temp.length) sets.push(temp);

    $.each(sets, function() {
        $(this).alignbox();
    });
});
*/

/* --------------------------------------------------
	ACCORDION SWITCH
-------------------------------------------------- */

$(function(){
	$(".option_link").live('click', function(){
	$(this).toggleClass("open");
	$(this).parent().parent().next().slideToggle('sllow');
	return false;
	});
});




