$(document).ready(function()
{
  $("#search").focus(function()
  {
    $(this).removeClass("search-input").addClass("search-input-focus");
    if ($(this).val() == "искать на сайте...") $(this).val("");    
  }).blur(function()
  {
    $(this).removeClass("search-input-focus").addClass("search-input");
    if ($.trim($(this).val()) == "") $(this).val("искать на сайте...");
  });
  $("#search-form").submit(function()
  {  
    if ($.trim($("#search", this).val()) == "") return false;
    else return true;
  });
	
	$(".menu-link").mouseover(function() {
		$(this).find("img").toggle();
	}).mouseout(function() {
		$(this).find("img").toggle();
	});
	
	//console.log($('#fdb'), "test");
	$('#fdb1').mouseover(function() {
		$(this).find("img:eq(0)").hide().next().show();
	})
	.mouseleave(function() {
		$(this).find("img:eq(1)").hide().prev().show();
	});
});
function mark(g,c,e,f){for(var b=false,a=g.firstChild;a!=null;a=a.nextSibling)if(a.nodeType==3)for(var d=-1;(d=a.nodeValue.toLowerCase().indexOf(c.toLowerCase(),d+1))!=-1;){if(d>0){b=a.nodeValue.substr(0,d);a.parentNode.insertBefore(document.createTextNode(b),a)}b=document.createElement("span");b.setAttribute("class","found");b.setAttribute("className","found");b.appendChild(document.createTextNode(a.nodeValue.substr(d,c.length)));d=document.createTextNode(a.nodeValue.substr(d+c.length));a.parentNode.insertBefore(b, a);a.parentNode.insertBefore(d,a);a.parentNode.removeChild(a);a=b;b=true;break}if(!e&&!b&&c.match(/[\s!@#$%^&*()_\-+={}\[\];:\"\'\`~\.\,\/]/gi)){c=c.replace(/[\s!@#$%^&*()_\-+={}\[\];:\"\'\`~\.\,\/]/gi," ").split(" ");for(e=0;e<c.length;e++)if(f?c[e].length>=f:c[e]!="")b|=mark(g,c[e],true,f)}return b};
