﻿$(document).ready(function() {
$('.menuTop > ul > li:nth-child(2)').hover(
		function() {
		    $(this).addClass('Hover');
		    $('.detailOptions').find("select").blur();
		    $(this).find('.megaDropdown:first').parent().addClass('addRell');
		    $('.center').css('position', 'static');
		    $('.MagicZoomPlus').css("position", "static");
		    $(this).find('.megaDropdown:first').stop(true, true);
		    $(this).find('.megaDropdown:first').fadeIn(200);
		},
		function() {

		    $(this).find('.megaDropdown:first').fadeOut(0, function() { $(this).parent().removeClass('addRell'); });
		    $('.center').css('position', 'relative');
		    $(this).removeClass('Hover');
		    $('.MagicZoomPlus').css("position", "relative");
		}
	);

    ShoppingCartHover();

    /*Languages*/
    $('.rightBlock > ul > li').hover(
		function() {
		    $(this).addClass('Hover');
		    $(this).find('.languageSelect:first').parent().addClass('addRell');
		    $(this).find('.languageSelect:first').stop(true, true);
		    $(this).find('.languageSelect:first').fadeIn(200);
		},
		function() {

		    $(this).find('.languageSelect:first').fadeOut(0, function() { $(this).parent().removeClass('addRell'); });
		    $(this).removeClass('Hover');
		}
	);

    BtnHover();

    MagicZoomHover();

    ShippingCostHover();

    /* add scaling background to all browsers not supporting background-size (CSS3) */
    if ('MozBackgroundSize' in document.body.style == false && 'WebkitBackgroundSize' in document.body.style == false && 'BackgroundSize' in document.body.style == false) {
        if (screen.width > 1280 || screen.height > 1100) {
	        if(parseInt(jQuery.browser.version) == 6) {
	        	$('html, body').css({ 'height': '100%', 'overflow': 'auto' });
				$('#aspnetForm').wrap('<div class="ie6wrapper"></div>');
	        	$('body').prepend('<div id="bg_ie6"><img style="display: block;" src="/BackgroundImage.axd"/></div>');
	        }
	        else
	        	$('body').append('<div id="bg"><img style="display: block;" src="/BackgroundImage.axd"/></div>');
        }
    }
    
});


/*Buttons*/
function BtnHover() {
    $('.btn').hover(
	    function() {
            $(this).addClass('mouseHover');
	    },
	    function() {
	        $(this).removeClass('mouseHover');
	    }
	);
}

/*Detail page*/
function MagicZoomHover() {
    $('.MagicZoomPlus').hover(
	    function() {
	        $(this).addClass('Hover');
	        $('.detailOptions').find("select").blur();
	    },
	    function() {
	    }
    );
}


/*Shopping Cart*/
function ShoppingCartHover() {
    $('.greyBlock').hover(
	    function() {
	        $(this).addClass('Hover');
	        $(this).find('.shoppingCart:first').stop(true, true);
	        $(this).find('.shoppingCart:first').fadeIn(200);
	        $('.MagicZoomPlus').css("position", "static");
	    },
	    function() {
	        $(this).find('.shoppingCart:first').fadeOut(0);
	        $(this).removeClass('Hover');
	        $('.MagicZoomPlus').css("position", "relative");
	    }
    );
}

function ShippingCostHover() {
    $('.shippingQuestion').hover(
		function() {
		    $(this).addClass('mouseHover');
		},
		function() {
		    $(this).removeClass('mouseHover');
		}
	);
}