var cookieClass = {

	addSolution : function(){

		var page = document.title;
		var url  = location.href;
		var cks1 = $.cookie('ck_solution1');
		var cks2 = $.cookie('ck_solution2');
		var cksurl1 = $.cookie('ck_solution_url1');
		var cksurl2 = $.cookie('ck_solution_url2');
		var endNo = page.indexOf("|") -1;

		if( endNo != -1 ){
			page = page.slice(0, endNo);
		}

		if( page != cks1 ){
			if( page != cks2 ){

				$.cookie('ck_solution1', null);
				$.cookie('ck_solution2', null);
				$.cookie('ck_solution3', null);
				$.cookie('ck_solution1', page, { expires:30, path:'/' });
				$.cookie('ck_solution2', cks1, { expires:30, path:'/' });
				$.cookie('ck_solution3', cks2, { expires:30, path:'/' });

				$.cookie('ck_solution_url1', null);
				$.cookie('ck_solution_url2', null);
				$.cookie('ck_solution_url3', null);
				$.cookie('ck_solution_url1', url, { expires:30, path:'/' });
				$.cookie('ck_solution_url2', cksurl1, { expires:30, path:'/' });
				$.cookie('ck_solution_url3', cksurl2, { expires:30, path:'/' });

			}else{

				$.cookie('ck_solution1', null);
				$.cookie('ck_solution2', null);
				$.cookie('ck_solution1', page, { expires:30, path:'/' });
				$.cookie('ck_solution2', cks1, { expires:30, path:'/' });

				$.cookie('ck_solution_url1', null);
				$.cookie('ck_solution_url2', null);
				$.cookie('ck_solution_url1', url, { expires:30, path:'/' });
				$.cookie('ck_solution_url2', cksurl1, { expires:30, path:'/' });
			}
		}
	},

	addWorks : function(){
		var page = document.title;
		var url  = location.href;
		var ckw1 = $.cookie('ck_works1');
		var ckw2 = $.cookie('ck_works2');
		var ckwurl1 = $.cookie('ck_works_url1');
		var ckwurl2 = $.cookie('ck_works_url2');

		var endNo = page.indexOf("|") -1;
		if( endNo != -1 ){
			page = page.slice(0, endNo);
		}

		if( page != ckw1 ){
			if( page != ckw2 ){
				$.cookie('ck_works1', null);
				$.cookie('ck_works2', null);
				$.cookie('ck_works3', null);
				$.cookie('ck_works1', page, { expires:30, path:'/' });
				$.cookie('ck_works2', ckw1, { expires:30, path:'/' });
				$.cookie('ck_works3', ckw2, { expires:30, path:'/' });

				$.cookie('ck_works_url1', null);
				$.cookie('ck_works_url2', null);
				$.cookie('ck_works_url3', null);
				$.cookie('ck_works_url1', url, { expires:30, path:'/' });
				$.cookie('ck_works_url2', ckwurl1, { expires:30, path:'/' });
				$.cookie('ck_works_url3', ckwurl2, { expires:30, path:'/' });

			}else{
				$.cookie('ck_works1', null);
				$.cookie('ck_works2', null);
				$.cookie('ck_works1', page, { expires:30, path:'/' });
				$.cookie('ck_works2', ckw1, { expires:30, path:'/' });

				$.cookie('ck_works_url1', null);
				$.cookie('ck_works_url2', null);
				$.cookie('ck_works_url1', url, { expires:30, path:'/' });
				$.cookie('ck_works_url2', ckwurl1, { expires:30, path:'/' });
			}
		}
	},

	get : function(){

		var body = '';

		if( $.cookie('ck_solution1') != "" && $.cookie('ck_solution1') != null ){

			var body = body + '<li><img src="/common/images/tmp_info_txt_solution.gif" alt="ソリューション" width="178" height="18" /><ul class="solution">';

			if( $.cookie('ck_solution1') != null && $.cookie('ck_solution_url1') != null )
				body = body + '<li><a href="' + $.cookie('ck_solution_url1') + '">' + $.cookie('ck_solution1') + '</a></li>';

			if( $.cookie('ck_solution2') != null && $.cookie('ck_solution_url2') != null )
				body = body + '<li><a href="' + $.cookie('ck_solution_url2') + '">' + $.cookie('ck_solution2') + '</a></li>';

			if( $.cookie('ck_solution3') != null && $.cookie('ck_solution_url3') != null )
				body = body + '<li><a href="' + $.cookie('ck_solution_url3') + '">' + $.cookie('ck_solution3') + '</a></li>';

			body = body + '</ul></li>';
		}

		if( $.cookie('ck_works1') != "" && $.cookie('ck_works1') != null ){

			var body = body + '<li><img src="/common/images/tmp_info_txt_workstech.gif" alt="実績・技術情報" width="178" height="18" /><ul class="infotech">';

			if( $.cookie('ck_works1') != null && $.cookie('ck_works_url1') != null )
				body = body + '<li><a href="' + $.cookie('ck_works_url1') + '">' + $.cookie('ck_works1') + '</a></li>';

			if( $.cookie('ck_works2') != null && $.cookie('ck_works_url2') != null )
				body = body + '<li><a href="' + $.cookie('ck_works_url2') + '">' + $.cookie('ck_works2') + '</a></li>';

			if( $.cookie('ck_works3') != null && $.cookie('ck_works_url3') != null )
				body = body + '<li><a href="' + $.cookie('ck_works_url3') + '">' + $.cookie('ck_works3') + '</a></li>';

			body = body + '</ul></li>';

		}

		if( body != '' ){
			body = '<p class="label"><img src="/common/images/tmp_info_ttl_solution.gif" alt="最近見たソリューション" width="200" height="26" /></p><ul class="parent">' + body + '</ul>';
		}

		$("#historySolutionBox").html(body);

	}
}