/* ===========================================
 * NIKKOR
 * -------------------------------------------
 * UTF-8N
=========================================== */


/* Flash
=========================================== */

function drawSwf(id, url, w, h){
	var version = "8";
	var express = "";
	var flashvars = {};
	var attributes = {};
	var params = {
		quality: "high",
		menu: "false"
	};

	swfobject.embedSWF(url, id, w, h, version, express, flashvars, params, attributes);
}

function drawSwfTrs(id, url, w, h){
	var version = "8";
	var express = "";
	var flashvars = {};
	var attributes = {};
	var params = {
		quality: "high",
		menu: "false",
		wmode: "transparent"
	};

	swfobject.embedSWF(url, id, w, h, version, express, flashvars, params, attributes);
}


/* OpenGallery
=========================================== */

var opengallery = {
	setInit : function(){
		var p = "width=1070,height=690,menubar=no,toolbar=no,location=no,status=no,resizable=no,scrollbars=no";

		$("a.gallery").click(function(){
			var w = window.open(this.href, "gallery", p);
			w.focus();
			return false;
		});
	}
}


/* RollOver
=========================================== */

var rollover = {
	setInit : function(){
		rollover.p = new Object();
		$("img[src*='_n.'],input[src*='_n.']").each(function(){
			var n = this.src;
			var o = n.replace("_n.", "_o.");
			if(!rollover.p[n]){
				rollover.p[n] = new Image();
				rollover.p[n].src = n;
				rollover.p[o] = new Image();
				rollover.p[o].src = o;
			}
			$(this).hover( 
				function(){ this.src = rollover.p[o].src; },
				function(){ this.src = rollover.p[n].src; }
			);
		});
	}
}


/* AnimeScroll
=========================================== */

jQuery.easing.quart = function(x, t, b, c, d){
	return -c * ((t=t/d-1)*t*t*t - 1) + b;
};

var aniscroll = {
	setInit : function(){
		$('a[href*=#]').click(function(){
			if(location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname){
				var $target = $(this.hash);
				$target = $target.length && $target || $('[name='+this.hash.slice(1)+']');
				if($target.length){
					var targetOffset = $target.offset().top;
					var targetTag = navigator.appName.match(/Opera/)? "html" : "html,body";
					$(targetTag).animate({scrollTop: targetOffset}, 'quart');
					return false;
				}
			}
		});
	}
}


/* ===========================================
 * START
=========================================== */

$(document).ready(function(){

	// OpenGallery
	opengallery.setInit();

	// RollOver
	rollover.setInit();

	// AnimeScroll
	aniscroll.setInit();

});


