

// add Easing
jQuery.easing.quart = function (x, t, b, c, d) {
	return -c * ((t=t/d-1)*t*t*t - 1) + b;
};



/* Event onLoad */
jQuery(document).ready(function(){
	
	// base
	rollOver();
	scrollInPage();
	iepngfix();
});




/*---------------------------------------------------------------*/

function rollOver(){
	var postfix = '_o';
	$('img.o,input.o').not('[src*="'+postfix+'."]').each(
		function(){
			this.src_org = jQuery(this).attr('src');
			this.src_ovr = this.src_org.substr(0,this.src_org.lastIndexOf('.')) + postfix + this.src_org.substr(this.src_org.lastIndexOf('.'));
			jQuery('<img>').attr('src', this.src_ovr);
				jQuery(this).bind('mouseover', hoverOver);
				jQuery(this).bind('mouseout', hoverOut);
		}
	);
}

function hoverOver(){
	jQuery(this).attr('src',this.src_ovr);
}

function hoverOut(){
	jQuery(this).attr('src',this.src_org);
}

/*---------------------------------------------------------------*/

function scrollInPage(){
	$('a[href*=#][class!=noscroll]').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 }, 500, 'quart');
				return false;
			}
		}
	});
}

/*---------------------------------------------------------------*/

function iepngfix(){
	if(jQuery.browser.msie&&(jQuery.browser.version == '6.0')){
		var el = $('.iepng');
		if(typeof el.fixPng !== 'function') return false;
		el.fixPng();
		// mouse over >>
		el.each(function(){
			if (this.vml && this.className.match(/[^0-9a-zA-Z\-_]*o[^0-9a-zA-Z\-_]*/)) {
				$(this.vml.image.shape).bind('mouseover',iepngfixMover);
				$(this.vml.image.shape).bind('mouseout',iepngfixMout);
			}
		});
	}
}
function iepngfixMover(e){
	iepngfixAttach(e.target.nextSibling,true);
}
function iepngfixMout(e){
	iepngfixAttach(e.target.nextSibling,false);
}
function iepngfixAttach(obj,bool){
	if(obj.vml){
		var image = obj.vml.image.fill;
		if(bool===true){
			image.setAttribute("src", image.getAttribute("src").replace('.png', '_o.png'));
		} else {
			image.setAttribute("src", image.getAttribute("src").replace('_o.png', '.png'));
		}
	}	
}

/*---------------------------------------------------------------*/

