﻿(function(jQuery) {
	jQuery.fn.customFadeIn = function(speed, callback) {
		jQuery(this).fadeIn(speed, function() {
			if(jQuery.browser.msie)
				jQuery(this).get(0).style.removeAttribute('filter');
			if(callback != undefined)
				callback();
		});
	};
	jQuery.fn.customFadeOut = function(speed, callback) {
		jQuery(this).fadeOut(speed, function() {
			if(jQuery.browser.msie)
				jQuery(this).get(0).style.removeAttribute('filter');
			if(callback != undefined)
				callback();
		});
	};
})(jQuery);

jQuery(document).ready(function(){	
	jQuery("div#home_gallery li img").fadeTo("normal", 0.6);
	jQuery("div#home_gallery li img").hover(function(){
		jQuery(this).fadeTo("fast", 1.0);},function(){
		jQuery(this).fadeTo("fast", 0.6);
		return false;
	});
	
	//Smooth Scroll
	jQuery('a[href*=#]:not([href=#])').click(function() {
		if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
			&& location.hostname == this.hostname) {
			var jQuerytarget = jQuery(this.hash);
			jQuerytarget = jQuerytarget.length && jQuerytarget
			|| jQuery('[name=' + this.hash.slice(1) +']');
			if (jQuerytarget.length) {
				var targetOffset = jQuerytarget.offset().top;
				jQuery('html,body')
				.animate({scrollTop: targetOffset}, 1000);
				return false;
			}
		}
	});
	
	//Input Focus
	jQuery('.InputFocus').each(function() {	
		jQuery(this).focus(function() {
			jQuery(this).addClass("focusField");
		});
		jQuery(this).blur(function() {
			jQuery(this).removeClass("focusField");
		});
	});
	
	jQuery('.back_button').click(function(e) {
		e.preventDefault();
	});

});