//==========================| FIX PNG |==========================//
function fixPNG(element){if(/MSIE (5\.5|6).+Win/.test(navigator.userAgent)){var src;if(element.tagName=='IMG'){if(/\.png$/.test(element.src)){src=element.src;element.src="blank.gif"}}else{src=element.currentStyle.backgroundImage.match(/url\("(.+\.png)"\)/i);if(src){src=src[1];element.runtimeStyle.backgroundImage="none"}}if(src)element.runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+src+"',sizingMethod='scale')"}}
//==========================| END FIX PNG |==========================//
$(document).ready(function(){



//==========================| TOP MENU |==========================//
	$("#ico_block a").mouseover(function(){
		$(this).stop().animate({opacity: 1}, {duration:400});
	});
	$("#ico_block a").mouseout(function(){
		$(this).stop().animate({opacity: 0}, {duration:300});
	});
//==========================| END ICO BLOCK |==========================//
	$('ul#menu ul').each(function(i) { // Check each submenu:
		if ($.cookie('submenuMark-' + i)) {  // If index of submenu is marked in cookies:
			$(this).show().prev().removeClass('collapsed').addClass('expanded'); // Show it (add apropriate classes)
		}else {
			$(this).hide().prev().removeClass('expanded').addClass('collapsed'); // Hide it
		}
		$(this).prev().addClass('collapsible').click(function() { // Attach an event listener
			var this_i = $('ul#menu ul').index($(this).next()); // The index of the submenu of the clicked link
			if ($(this).next().css('display') == 'none') {
				$(this).next().slideDown(200, function () { // Show submenu:
					$(this).prev().removeClass('collapsed').addClass('expanded');
					cookieSet(this_i);
				});
			} else {
				$(this).next().slideUp(200, function () { // Hide submenu:
					$(this).prev().removeClass('expanded').addClass('collapsed');
					cookieDel(this_i);
					$(this).find('ul').each(function() {
						$(this).hide(0, cookieDel($('ul#menu ul').index($(this)))).prev().removeClass('expanded').addClass('collapsed');
					});
				});
			}
		return false; // Prohibit the browser to follow the link address
		});
	});
//==========================| END RIGHT MENU |==========================//
	$("a.zoom").fancybox();
	
	$('#disklaimer_yes').click(function() {
		$.cookie('disklaimer', 'ok', {expires: null, path: '/'});
		window.location.replace("/ir.html");
	});
	$('#disklaimer_no').click(function() {
		window.location.replace("/");
	});	
	
	
});

function cookieSet(index) {
	$.cookie('submenuMark-' + index, 'opened', {expires: null, path: '/'}); // Set mark to cookie (submenu is shown):
}
function cookieDel(index) {
	$.cookie('submenuMark-' + index, null, {expires: null, path: '/'}); // Delete mark from cookie (submenu is hidden):
}
