$(window).bind('load', function() {
    var ipre_a = new Array();
	$("#navtab .navn, .prginmarg_p, .prgmarg_p").each(function(){
      ipre_a.push('/i/nav/' + $(this).find('img').attr('name') + '_a.gif');
	});
    var ipre_i = document.createElement('img');
    $(ipre_i).bind('load', function() {
        if(ipre_a[0]) {
            this.src = ipre_a.shift();
        }
    }).trigger('load');
});

$(function(){
	$("#navtab .navn").each(function(){
		$(this).mouseover(function(){
			$(this).find('img').attr('src', '/i/nav/' + $(this).find('img').attr('name') + '_a.gif');
			/*$(this).css('backgroundColor', '#91002C');*/
		});
		$(this).mouseout(function(){
			$(this).find('img').attr('src', '/i/nav/' + $(this).find('img').attr('name') + '.gif');
			/*$(this).css('backgroundColor', '#fff');*/
		});
	});
   /*
	$(".prgmarg_p, .prginmarg_p").each(function(){
		$(this).mouseover(function(){
			$(this).find('img').attr('src', '/i/text/' + $(this).find('img').attr('name') + '_a.gif');
		});
		$(this).mouseout(function(){
			$(this).find('img').attr('src', '/i/text/' + $(this).find('img').attr('name') + '.gif');
		});
	});*/
   $("#q").focus(function(){
      if( $(this).val() == "поиск" ){
         $(this).val("");
      }
   });
   $("#q").blur(function(){
      if( $(this).val() == "" ){
         $(this).val("поиск");
      }
   });
   $("#q_btn").click(function(){
      if( $("#q").val() != "поиск" &&  $("#q").val() != "" ){
         document.forms["q_frm"].submit();
      }
   });
});