$(function($) {
	var flHandler = function() {
		var allcookies = document.cookie;
		var name = 'snyun_service_dialog';
		var pos = allcookies.indexOf(name + '=');
		var value = '';
		if (pos != -1) {
			var start = pos + name.length + 1;
			var end = allcookies.indexOf(';', start);
			if (end == -1) end = allcookies.length;
			value = allcookies.substring(start, end);
		}

		if (value != 'hidden') {
			var cs = $.getClientSize();
			var lw = cs.width - 138;
			var lh = 155;
			$('.f-fixed-layer').css({ top:lh + 'px', left:lw + 'px' });
			$('.f-fixed-layer').fadeIn('normal');
		}
	};
	$(window).resize(flHandler);
	flHandler();

	/* close handler */
	$('.f-fixed-layer h2 a').click(function() {
		var host = $('.f-fixed-layer');
		document.cookie = "snyun_service_dialog=hidden";
		host.fadeOut('fast');
		return false;
	});

	$('.logo').click(function() {
		location.href = "http://www.snyun.com";
	});
	$('.logo').css({ cursor:'pointer' });

	/* cart animation */
	var aniHanlder = function() {
		var pos = $('.f-nav .flow').position();
		$('body').append('<div class="cart-ani"><img src="common/image/cart.gif" border="0" /></div>');
		$('.cart-ani').css({ left:pos.left, top:pos.top - 18 });
	};
	$(window).resize(aniHanlder);
	aniHanlder();
});
