/**
 * jQuery - Plugin and Function
 */

/**
 * Google Analytics
 *
 * @param string ga_code
 */
function MyGoogleAnalytics(ga_code)
{
	var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
	jQuery.getScript(gaJsHost + "google-analytics.com/ga.js", function()
	{
		var pageTracker = _gat._getTracker(ga_code);
		pageTracker._trackPageview();
	});
}

/**
 * NewWinOpen v1.0
 *
 * Copyright (c) 2009 Rewish (http://rewish.org/)
 * Dual licensed under the MIT and GPL licenses.
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.opensource.org/licenses/gpl-license.php
 *
 * Date: 2009-02-09 13:00
 *
 */
(function() {
	jQuery.fn.NewWinOpen = function(option)
	{
		$(this).click(function()
		{
			if (option != null) {
				window.open(this.href, null, option);
			} else {
				window.open(this.href, null);
			}
			return false;
		});
	}
})(jQuery);

/**
 * jQueryRollover v1.0
 * http://rewish.org/javascript/jquery_rollover_plugin
 *
 * Copyright (c) 2009 Rewish (http://rewish.org/)
 *
 * Licensed under the MIT:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * Inspired by:
 * Telepath Labs (http://dev.telepath.co.jp/labs/article.php?id=15)
 *
 * Usage:
 * jQuery(document).ready(function($) {
 *     // <img>
 *     $('div#nav a img').rollover();
 *
 *     // <input type="image">
 *     $('form input:image').rollover();
 *
 *     // set postfix
 *     $('div#nav a img').rollover('_over');
 * });
 *
 **/
(function($) {
    $.fn.rollover = function(postfix) {
        postfix = postfix || '_on';
        return this.not('[src*="'+ postfix +'."]').each(function() {
            var img = $(this);
            var src = img.attr('src');
            var src_on = [
                src.substr(0, src.lastIndexOf('.')),
                src.substring(src.lastIndexOf('.'))
            ].join(postfix);
            $('<img>').attr('src', src_on);
            img.hover(
                function() {
                    img.attr('src', src_on);
                },
                function() {
                    img.attr('src', src);
                }
            );
        });
    };
})(jQuery);

