/**
 * jQuery Cookie plugin
 *
 * Copyright (c) 2010 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */
jQuery.cookie = function (key, value, options) {

    // key and at least value given, set cookie...
    if (arguments.length > 1 && String(value) !== "[object Object]") {
        options = jQuery.extend({}, options);

        if (value === null || value === undefined) {
            options.expires = -1;
        }

        if (typeof options.expires === 'number') {
            var days = options.expires, t = options.expires = new Date();
            t.setDate(t.getDate() + days);
        }

        value = String(value);

        return (document.cookie = [
            encodeURIComponent(key), '=',
            options.raw ? value : encodeURIComponent(value),
            options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
            options.path ? '; path=' + options.path : '',
            options.domain ? '; domain=' + options.domain : '',
            options.secure ? '; secure' : ''
        ].join(''));
    }

    // key and possibly options given, get cookie...
    options = value || {};
    var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent;
    return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
};



/*
-------------------------------------------------------------------------------------------------
	[common.js] JavaScript
-------------------------------------------------------------------------------------------------
	copyright          : Lampros co.,Ltd.
	author             : Atsushi Umehara
	making day         : 2010-06-23
*/


/* ================================================

common

=================================================*/

jQuery(function($) {
	
	var ua =navigator.userAgent;
	if( ua.indexOf( 'iPhone' ) > -1  || ua.indexOf( 'iPod' ) > -1 || ( ua.indexOf( 'Android' ) > -1 && ua.indexOf( 'Mobile' ) > -1) ){
		$( 'body' ).prepend( '<p><a href="javascript:goToSpTop();"><img src="/sp/_img/pc/sp_bt.jpg" width="100%" /></a></p>' );
	}

	// add class
	$('html').css('overflow-y', 'scroll');
	$('body').addClass($.browser.className);

	// pngfix
	$('img').pngfix();
	$('.iepngfix').pngfix();

	// rolloveer
	var overImg = '_f2';
	$('.btn').each(function(){
		var classes = $(this).attr("class");
		var imgout = $(this).attr("src");
		var imgovr = imgout.replace('.gif', overImg + '.gif').replace('.jpg', overImg + '.jpg').replace('.png', overImg + '.png');
		$(this).hover(
			function(){ $(this).attr("src", imgovr); },
			function(){ $(this).attr("src", imgout); }
		);
	});

	//odd even
	$('ul').each(function(){
		$(this).find('li:first').addClass('first');
		$(this).find('li:odd').addClass('odd');
		$(this).find('li:even').addClass('even');
		$(this).find('li:last').addClass('last');
	});
	$('table').each(function(){
		$(this).find('tr:first').addClass('first');
		$(this).find('tr:odd').addClass('odd');
		$(this).find('tr:even').addClass('even');
		$(this).find('tr:last').addClass('last');
	});
	
	//accordion
	/*
	$(".acMenu a.tab").hover(function(){
		$(this).css("cursor","pointer"); 
	},function(){
		$(this).css("cursor","default"); 
		});
	$(".acMenu ul").css("display","none");
	$(".acMenu a.tab").click(function(){
		$(this).next().slideToggle("fast");
		return false;
	});
	*/
	
});

function goToSpTop(){
	$.cookie( 'sp_check', "0", { path: '/' } );
	document.location = "/sp/";
}

