jQuery.preloadImages = function()
{
  for(var i = 0; i<arguments.length; i++)
  {
    jQuery("<img>").attr("src", arguments[i]);
  }
}

$j(document).ready(
	function() {
		$j.preloadImages($pagePath + "img/herbal/menu/on_topics.jpg",
                         $pagePath + "img/herbal/menu/on_contest.jpg",
                         $pagePath + "img/herbal/menu/on_vconsultations.jpg",
                         $pagePath + "img/herbal/menu/on_members.jpg",
                         $pagePath + "img/herbal/menu/on_articles.jpg",
                         $pagePath + "img/herbal/menu/on_faq.jpg",
                         $pagePath + "img/herbal/submenu/on_image.jpg",
                         $pagePath + "img/herbal/submenu/on_haircare.jpg",
                         $pagePath + "img/herbal/submenu/on_health.jpg",
                         $pagePath + "img/herbal/submenu/on_love.jpg");
		/*
		$j("#menu img.menu_item").mouseover(
			function() { 
				var img= $j(this).attr('id');
				$j(this).attr({src : $pagePath + "img/herbal/menu/on_"+img+".jpg"});
			}
		);
		
		$j("#menu img.menu_item").mouseout(
			function() { 
				var img= $j(this).attr('id');
				$j(this).attr({src : $pagePath + "img/herbal/menu/"+img+".jpg"});
			}
		);
		*/
		
		$j("a#login_lnk").click(
				function() { 
					openLoginForm();
					return false;
				}
			);		
		
		
		$j("#searcher_inp").autocomplete($pagePath+"/webpr_tags/autocomplete/"+$j("#searcher_inp").val(), { 
                                minChars:1, 
								selectFirst: true,
								scrollHeight: 230,
								width: 108,
                                formatItem:formatItem
        });

		
		$j("#login_form_submit").click(
			function() { 
				$j.ajax({
				   type: "POST",
				   url: "/usr_users/login_ajax",
				   data: $j("#login_form").serialize()
				   
				 });
				 $j("#login_form").submit();
				return false;
			}
		);
		$j("#login_form_submit_btn").click(
			function() { 
				$j("#login_form").submit();
				return false;
			}
		);
				
	}
);


function formatItem(row) {
	return row[0] + "<br>";
}

				  

function noActiveLinks() {
	$j("a").click(
			function() { 
				openLoginForm();
				return false;
			}
		);
}
