/*
 * common.js
 * 
 * Copyright (c) Takao Tagawa (dounokouno.com)
 * Licensed under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * Since:     2009-02-25
 * Modified:  2010-12-10
 *
 * jQuery 1.6.4
 * 
*/

(function($){
	$(function(){
		// enterキーで送信を停止
		$("form").submit(function(){
			return false;
		});
		
		// buttonをクリックしたときにGoogle Analytics
		$("button").click(function(){
			_gaq.push(["_trackEvent", document.title, $(this).text()]);
		});
	});
})(jQuery);

// escapeHTML関数
$(function(){
	$.escapeHTML=function escapeHTML(str) {
		str = str.replace(/&/g, '&amp;');
		str = str.replace(/\"/g, '&quot;');
		str = str.replace(/\'/g, '&#039;');
		str = str.replace(/</g, '&lt;');
		str = str.replace(/>/g, '&gt;');
		return str;
	}
	$.unescapeHTML=function unescapeHTML(str) {
		str = str.replace(/&amp;/g, '&');
		str = str.replace(/&quot;/g, '"');
		str = str.replace(/&#039;'/g, '\'');
		str = str.replace(/&lt;/g, '<');
		str = str.replace(/&gt;/g, '>');
		return str;
	}
});

