/*
 * common.js
 *
 */
 


// onload event set
//
window.onload = function () { 
	if(typeof fontSize == "object"){
		fontSize.init();
	}
	if(typeof swapImage == "object"){
		swapImage.init();
	}
}


// popup
//
function fWinClosed(winVar) {
var ua = navigator.userAgent
	if( !!winVar )
		if( ( ua.indexOf('Gecko')!=-1 || ua.indexOf('MSIE 4')!=-1 ) && ua.indexOf('Win')!=-1 ) 
				return winVar.closed
			else return typeof winVar.document  != 'object'
	else return true
}
function fOpenWin(theURL,targetName,theW,theH) {
	if(fWinClosed(tWin)){
		var tWin = window;
		tWin = open(theURL,targetName,'scrollbars=yes,resizable=yes,toolbar=no,location=yes,directories=no,status=yes,menubar=no,width='+theW+',height='+theH+'');
		tWin.focus();
	}
}
// easing
//
jQuery.easing.quart = function (x, t, b, c, d) {
    return -c * ((t=t/d-1)*t*t*t - 1) + b;
};

// page scroll
//
jQuery(document).ready(function(){
	$('a[id^=move]:empty, a[name^=move]:empty').css('display', 'block');
	jQuery('a[href*=#move]').click(function() {
			if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
					var $target = jQuery(this.hash);
					$target = $target.length && $target || jQuery('[name=' + this.hash.slice(1) +']');
					if ($target.length) {
							var targetOffset = $target.offset().top;
							jQuery('html,body').animate({ scrollTop: targetOffset }, 1200, 'quart');
							return false;
					}
			}
	});
	jQuery('area[href*=#move]').click(function() {
			if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
					var $target = jQuery(this.hash);
					$target = $target.length && $target || jQuery('[name=' + this.hash.slice(1) +']');
					if ($target.length) {
							var targetOffset = $target.offset().top;
							jQuery('html,body').animate({ scrollTop: targetOffset }, 1200, 'quart');
							return false;
					}
			}
	});
	
});
