﻿	$(window).load(function(){
		var postfix = '_r';
		$('img.ir').not('[src*="'+ postfix +'."]').each(function() {
			var img = $(this);
			var src = img.attr('src');
			var src_on = src.substr(0, src.lastIndexOf('.'))
			           + postfix
			           + src.substring(src.lastIndexOf('.'));
			$('<img>').attr('src', src_on);
			img.hover(
				function() {
					img.attr('src', src_on);
				},
				function() {
					img.attr('src', src);
				}
			);
		});
		$('img.ia').hover(function(){
			$(this).stop().fadeTo(100,0.6);
		}, function(){  
			$(this).stop().fadeTo(300,1);
		});

		$("a[rel='blank']").click(function(){
			window.open($(this).get(0).href);
			return false;
		});

		$("a[rel='in']").click(function(){
			var URI = $(this).get(0).href;
			var targetID = (URI.match(/#(.+)/)||[])[1];
			var targetOffset = $("#" + targetID).offset().top;
			$('html,body').animate({scrollTop: targetOffset}, 600);
			return false;
		});
		if (typeof document.documentElement.style.maxHeight == "undefined"){
			$(document).pngFix();
		}
	});

	$(window).scroll(function(){
		var scrl = $(document).scrollTop();
		if(scrl > 460){
			$("#submenu").css({"position":"fixed","top":"0%"});
		}else{
			$("#submenu").css({"position":"absolute"});
		}
	});

