// jQuery - Setting file

$(document).ready( function () {
	$('a[href^="http"]').click(function(){
		window.open(this.href, '');
		return false;
	});


	/**
	 * Analytics
	 */
	var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
	$.getScript(gaJsHost + "google-analytics.com/ga.js", function() {
		var pageTracker = _gat._getTracker("UA-5442189-41");
		pageTracker._trackPageview();
	});


	/**
	 * Rollover
	 */
	var image_cache = new Object();
	$('#gNavi a img, #movie img').not('[src*="_on."]').each(function(i) {
		var imgsrc = this.src;
		var dot = this.src.lastIndexOf('.');
		var imgsrc_on = this.src.substr(0, dot) + '_on' + this.src.substr(dot, 4);
		image_cache[this.src] = new Image();
		image_cache[this.src].src = imgsrc_on;
		$(this).hover(
			function() { this.src = imgsrc_on; },
			function() { this.src = imgsrc; }
		);
	});

	$.fn.movie = function(width, height) {
		$(this).click(function() {
			window.open(
				[this.href, width, height].join('/'),
				'movieWindow', [
					'width='+ width,
					'height='+ height,
					'center=no',
					'location=no',
					'toolbar=no',
					'status=no',
					'menubar=no',
					'scrollbars=no',
					'directories=no',
					'resizable=no',
					'maximize=no'
				].join(',')
			);
			return false;
		});
	}

	$('#movie a').movie(500, 375);

});
