//==========================| 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="images/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(){
//==========================| ICO BLOCK |==========================//
	$("#ico_block a").mouseover(function(){
		$(this).stop().animate({opacity: 1}, {duration:500});
	});
	$("#ico_block a").mouseout(function(){
		$(this).stop().animate({opacity: 0}, {duration:300});
	});
	
	$('ul#menu_1 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_1 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_1 ul').index($(this)))).prev().removeClass('expanded').addClass('collapsed');
					});
				});
			}
		return false; // Prohibit the browser to follow the link address
		});
	});
	
	
	$('ul#menu_2 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_2 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_2 ul').index($(this)))).prev().removeClass('expanded').addClass('collapsed');
					});
				});
			}
		return false; // Prohibit the browser to follow the link address
		});
	});
	
	
	
	
	
});
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):
}




var jshover = function(){
  var nodes = document.getElementById("topMenu").getElementsByTagName("li");  
  for (var i=0; i<nodes.length; i++){
		nodes[i].onmouseover = function(){
		 this.className+=" jshover";
	}
	nodes[i].onmouseout = function(){

		  this.className=this.className.replace("jshover", "");
	}
  }
}
		if (window.attachEvent && navigator.userAgent.indexOf("Opera")==-1) {window.attachEvent("onload", jshover);} 
else {window.addEventListener("load", jshover, false); }

