 $(function () {	
	
	$("#topnav li").each(function () 
	{	
	    if (!$(this).hasClass("div"))
	    {   
	        $(this).hover(function () {	  
				if (!$(this).hasClass("active"))
				{
					_img = $(this).find("img");
					_img.attr("src",_img.attr("src").replace("_off","_on"));
				}
	        },
	        function () {
				if (!$(this).hasClass("active"))
				{
					_img = $(this).find("img");
					_img.attr("src",_img.attr("src").replace("_on","_off"));
				}
	        });
    	    
	        $(this).click(function () {
				_this = $(this);
				$("#topnav li img").each(function () 
				{					
					$(this).attr("src",$(this).attr("src").replace("_on","_off"));					
				});
				
				$("#topnav li").each(function () 
				{
					$(this).removeClass("active");
				});
				
				$(this).addClass("active");
				$(this).find("img").attr("src",$(this).find("img").attr("src").replace("_off","_on"));	
	        });
	    }
	    
	});
	
	$("#botnav li").each(function () 
	{	
	    if (!$(this).hasClass("div"))
	    {   
	        $(this).hover(function () {	  
				if (!$(this).hasClass("active"))
				{
					_img = $(this).find("img");
					_img.attr("src",_img.attr("src").replace("_off","_on"));
				}
	        },
	        function () {
				if (!$(this).hasClass("active"))
				{
					_img = $(this).find("img");
					_img.attr("src",_img.attr("src").replace("_on","_off"));
				}
	        });
    	    
	        $(this).click(function () {
				_this = $(this);
				$("#botnav li img").each(function () 
				{					
					$(this).attr("src",$(this).attr("src").replace("_on","_off"));					
				});
				
				$("#botnav li").each(function () 
				{
					$(this).removeClass("active");
				});
				
				$(this).addClass("active");
				$(this).find("img").attr("src",$(this).find("img").attr("src").replace("_off","_on"));	
	        });
	    }
		
	
	    
	});
	
	$("input#textsearch").focus(function () 
	{		
		if ($(this).attr("value") == $(this).attr("title")) $(this).attr("value","");		
	});
	
	$("input#textsearch").blur(function ()	
	{
		if ($(this).attr("value") == "") $(this).attr("value",$(this).attr("title"));
	});
});


function botHeight()
{
    var val = $(window).height() - 63;
	val = Math.floor(val);
    if (val < 706) { val = 706; }	
    return val;
}

function setTopNav(id)
{
	
	_$this = $("#"+id);
	
	//if (!_$this.hasClass("active"))
	//{
		
		$("#topnav li img").each(function () 
		{					
			$(this).attr("src",$(this).attr("src").replace("_on","_off"));					
		});
		
		$("#topnav li").each(function () 
		{
			$(this).removeClass("active");
		});
		
		_$this.addClass("active");
		_$this.find("img").attr("src",_$this.find("img").attr("src").replace("_off","_on"));	
	//}
}

