
function pageScrollTo(tar, speed, pos, delay){
	var target = $(tar);
	if(target){
		setTimeout(function(){
			var targetOffset = target.offset().top - pos;
			$("html,body").queue([]).stop();
			$('html,body').animate({scrollTop:targetOffset}, {duration:speed, easing:"easeOutExpo"});
		}, delay);
	}
}

$.fn.pageScroll = function(option){
	$(this).each(function(){
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
			var target = this.hash;
			$(this).click(function(){
				pageScrollTo(target, 1200, 0, 0);
				return false;
			});
		}
	}); 
}

$(document).ready(function(){
	 $('a[href*=#].scroll').pageScroll();
});

function initSwapImages() {
	var image_cache = new Object();
	$("img.swap").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; });
	});
}
function initFadeImages() {
	$("img.fade").each(function() {
		$(this).hover(
			function() {
				$(this).queue([]).stop();
				$(this).fadeTo(100, 0.5);
			},
			function() {
				$(this).queue([]).stop();
				$(this).fadeTo(200, 1);
			});
		}
	);
	$("input.fade").each(function() {
		$(this).hover(
			function() {
				$(this).queue([]).stop();
				$(this).fadeTo(100, 0.5);
			},
			function() {
				$(this).queue([]).stop();
				$(this).fadeTo(200, 1);
			});
		}
	);
}

  $(function(){
    $(".center_top #alert").fadeIn("slow");
    $(".center_top #alert_wrap #alert").click(function () {
      $(".center_top #alert_wrap").fadeOut("slow");
    });

  });



$(document).ready(initSwapImages);
$(document).ready(initFadeImages);

// Popup(/release/)

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}
