
var bwIE60 = (navigator.appVersion.indexOf("MSIE 6.0") != -1) ? "True" : "False";
var bwIE70 = (navigator.appVersion.indexOf("MSIE 7.0") != -1) ? "True" : "False";

$(document).ready(function ()
{
	// top menu
	$(".hlbMenuMain li").each(function ()
	{
		// menu SHOW
		$(this).mouseenter(function ()
		{
			$("a:first", this).toggleClass("hlbMenuMainSelected");
			var offset = $("a:first", this)[0].offsetLeft;
			if (bwIE60 == "True" || bwIE70 == "True")
			{
				offset = this.offsetLeft;
			}
			$("div:first", this).css("left", offset + "px");
			$("div:first", this).show();
		});
		// menu HIDE
		$(this).mouseleave(function ()
		{
			$("div:first", this).hide();
			$("a:first", this).toggleClass("hlbMenuMainSelected");
		});
	});

	// model menu
	$(".mmMenuMain li", this).each(function ()
	{
		// menu SHOW
		$(this).mouseenter(function ()
		{
			$("a:first", this).toggleClass("mmMenuMainSelected");
			$("div:first", this).show();
			var offset = $("a:first", this)[0].offsetLeft;
			var width = $("div:first", this)[0].offsetWidth;
			if (bwIE60 == "True" || bwIE70 == "True")
			{
				offset = this.offsetLeft;
			}
			if (offset + width > 920)
			{
				var diff = 920 - (offset + width);
				offset = offset + diff;
			}
			$("div:first", this).css("left", offset + "px");
		});
		// menu HIDE
		$(this).mouseleave(function ()
		{
			$("div:first", this).hide();
			$("a:first", this).toggleClass("mmMenuMainSelected");
		});
	});

	$("ul.tabs").each(function(){
		$(this).children("li:first").addClass("active").show();
	});
	
	$("ul.tabs li").click(function() {
		$(this).parent().children("li").removeClass("active");
		$(this).addClass("active"); 
		$(this).parent().next('.tabs_container').children(".tab_content").hide();
		var activeTab = $(this).find("a").attr("href"); 
		$(activeTab).fadeIn(); 
		return false;
	});

	if($(".hlbSearch #searching_field").attr("value").length < 1) {
		$(".hlbSearch #searching_field").attr("value", "Szukaj");
	}

	$(".hlbSearch #searching_field").focus(function(){  $(this).attr("value") != "Szukaj" ? '' : $(this).attr("value", '')});
	$(".hlbSearch #searching_field").blur(function(){ $(this).attr("value").length < 1  ? $(this).attr("value", 'Szukaj') : ''});
});

