/**
 * W tej sekcji tylko wywołanie funkcji
 */
$(document).ready(function() {
						   
    //rafał
    languageSelection();
    dropDownMenu();
    smallSlider();
    uniqueAttributesProductsPicturCenter();
    homeSlider();
    comparisonList();
    showSearchBox();	
	printDoc();
	
	$(".brandBox .brandBoxSpacer ul").find("a.active").css("opacity",1); // nie wiem czemu zawarcie tego w funkcji nie działało :(
	$("#homeContent").next().css("top","-115px");	
	
	$(".logoSlogan:contains('гармонии')").css({
		"font-size":"10px",
		"position":"relative",
		"left":"-2px",
		"width":"120px",
		"text-align":"center",
		"line-height":"1em"
	}).parent().css("top","6px");
	
	if ($.browser.webkit) {
		$("#flashBg").css("left","1px");
	}
	
	
    //szałek
    hideItemeOnFirsPage();
	
});
	
/**
 * @author Szałek
 */
function showItemeOnFirsPage(){
	  
		//$('#top').animate({opacity: 1}, 500, function() {});
		//$('#homeContentIn').animate({opacity: 1}, 500, function() {});
		//$('#footer').animate({opacity: 1}, 500, function() {});
	   
		$('#flashBg').animate({
			height: '672px'
		}, 500, function() {
			/*$("#wrapper, body, html").css({
				"height": $("#wrapper").height() - 215 + "px"
			});*/		
		});
		
}

/**
 * @author Szałek
 */
function hideItemeOnFirsPage(){
    //$("#top").css({ opacity: 0 });
    //$("#homeContentIn").css({ opacity: 0 });
    //$("#footer").css({ opacity: 0 });    
}
/**
 * @author Rafał
 */
function languageSelection(){
    $("#langSelect").click(function() {	
    	$(".selectBox").css("display","block");
    }).mouseleave(function() {
    	$(".selectBox").css("display","none");
    });  
}
/**
 * @author Rafał
 */

function setToDrop() {
	if ($(".dropDown").hasClass("toDrop")) {
		$(".dropDown").css("display","block");
	}
}

function dropDownMenu(){
    $(".bottomMenu ul li").hover(function() {	
		$(".pngTransp").css("display","block");
        $(this).find(".dropDown").addClass("toDrop");
        $(this).children("a").first().not(".greenSign").addClass("mmActiveProd");
        setTimeout(setToDrop, 100);
    }, function() {
		$(".pngTransp").delay(200).css("display","none");
        $(".dropDown").removeClass("toDrop");
        if ($.browser.msie) {
                $(this).find(".dropDown").delay(100).css("display","none");
        } else {
                $(this).find(".dropDown").delay(100).fadeOut(100);
        }
        $(this).children("a").first().not(".greenSign").removeClass("mmActiveProd");
        
    });
  
       
}

/**
 * @author Rafał
 */
function smallSlider(){
    $(".smallSliderDots li:first-child").css("paddingLeft","0px");
    $(".smallSliderDots li:last-child").css("paddingRight","0px");
}

function printDoc() {
	$('.pageActions a.printDoc').click(function() {
		window.print();
	});	
}

/**
 * @author Rafał
 */
function uniqueAttributesProductsPicturCenter(){
    
    if ($.browser.msie) { } else {
		
		$(".brandBox .brandBoxSpacer ul li a.noactive").css("opacity", .6).hover(function() {
			$(this).fadeTo(150, 1);
		}, function() {	
			$(this).fadeTo(150, .6);
		});
		
		$(".brandBox .brandBoxSpacer ul li a.active").css("opacity", 1).hover(function() {
			$(this).fadeTo(150, 1);
		}, function() {
			$(this).fadeTo(150, 1);
		});
	
	}
    
    $(".uniqueAttrs .prodAttrPic").css({
            "width": $(".uniqueAttrs .prodAttrPic").children().width() + "px",
            "height": $(".uniqueAttrs .prodAttrPic").children().height() + "px",									   
            "top": 175 - $(".uniqueAttrs .prodAttrPic").height() / 2 + "px",
            "left": 234 - $(".uniqueAttrs .prodAttrPic").width() / 2 + "px"
    });
}

/**
 * @author Rafał
 */
function homeSlider(){
    $(".smallSliderDots li a").click(function(e) {
		e.preventDefault();
		$(".smallSliderDots").find(".selected").removeClass("selected");
		$(this).addClass("selected");

		$(".whiteSlide").css("display","block").fadeOut(700);
		
		$(".dlink").attr("href", $(".smallSliderDots").find(".selected").attr("rev")).text($(".smallSliderDots").find(".selected").attr("title"));

    });
}

/**
 * @author Rafał
 */
function comparisonList(){
	$(".compareGrid table tr.tableHead td:last .setString").css("display","none");
}

/**
 * @author Rafał
 */
function showSearchBox() {
	$(".showSearchBox").parent().hover(function() {
		$(".searchBoxTop").css("display", "block");
	}, function() {
		if ($.browser.msie) {
			$(".searchBoxTop").css("display", "none");
		}
		else {
			$(".searchBoxTop").fadeOut(150);
		}
	});
}

/**
 * @author Rafał
 */
function footerUp() {
	$("#homeContent").next().css("top","-115px");	 
}
