

$(function() {
	$('a[href*=#]').click(function() {

		var loc_hostname = location.hostname;
		var this_hostname = this.hostname;

		var loc_path_hostname = location.pathname.replace(/^@\//,'');;
		var this_path_hostname ;
		
		if(!checkbrows()){
			
			this_path_hostname = "/"+this.pathname.replace(/^@\//,'');
		}else{
			this_path_hostname = this.pathname.replace(/^@\//,'');
		}

		//alert(loc_path_hostname+"::"+this_path_hostname);
		//alert(loc_path_hostname==this_path_hostname);

		if (loc_path_hostname == this_path_hostname && loc_hostname == this_hostname) {
			var target = $(this.hash);
			target = target.length && target;
			//alert(this.hash);
			if (target.length && this.hash !="" ) {
				var sclpos = 0;
				var scldurat = 1200;
				var targetOffset = target.offset().top - sclpos;
				$('html,body').stop();
				$('html,body')
					.animate({scrollTop: targetOffset}, {duration: scldurat, easing: "easeOutExpo"});
				return false;
			}
		}
	});
});

function checkbrows(){
	var userAgent = window.navigator.userAgent.toLowerCase();
	var appVersion = window.navigator.appVersion.toLowerCase();

	var result;

	if (userAgent.indexOf("msie") > -1) {
		if (appVersion.indexOf("msie 6.0") > -1) {
			//alert("IE6");
			result = false;
		}
		else if (appVersion.indexOf("msie 7.0") > -1) {
			//alert("IE7");
			result = false;
		}
		else if (appVersion.indexOf("msie 8.0") > -1) {
			//alert("IE8");
			result = true;
		}
		else {
			//alert("Unknown");
			result = true;
		}
	}else{
			result = true;
	}
	
	return result;
}
