// JavaScript Document

$(document).ready(function() {
   var badBrowser = (/MSIE ((5\.5)|6)/.test(navigator.userAgent) && navigator.platform == "Win32");
   if (badBrowser) {     
     $('.nav-top ul li:first').addClass('first');
	 $('.b-f-links .b-f-col:first').addClass('first');
	 $('.nav-block li:first').addClass('first');
	 $('.nav-order li').hover(function(){
		$(this).toggleClass('over');
	 });
   }
    $('.b-product-tabs-01 ins').hide();
	$('.b-product-tabs-01 ins:first').show();
	$('.b-product-tabs-01 ul li:first').addClass('active');
	$('.b-product-tabs-01 ul li a').click(function(){ 
		$('.b-product-tabs-01 ul li').removeClass('active');
		$(this).parent().parent().addClass('active'); 
		var currentTab = $(this).attr('href'); 
		$('.b-product-tabs-01 ins').hide();
		$(currentTab).show();
	return false;
	});
	$('.b-product-tabs-02 ins').hide();
	$('.b-product-tabs-02 ins:first').show();
	$('.b-product-tabs-02 ul li:first').addClass('active');
	$('.b-product-tabs-02 ul li a').click(function(){ 
		$('.b-product-tabs-02 ul li').removeClass('active');
		$(this).parent().parent().addClass('active'); 
		var currentTab = $(this).attr('href'); 
		$('.b-product-tabs-02 ins').hide();
		$(currentTab).show();
	return false;
	});
	//Table Rows
	$('.tbl-params tr:even').addClass("even");
	$('.tbl-params tr:odd').addClass("odd");
	// Combobox
	$("body select.dd").msDropDown();
	// Cart Corners For IE
	$('.tbl-cart thead td:first').addClass('first');
	
});

function showPopupReview()
{
	$('.b-popup-review').modal({
	  overlayCss: {
			backgroundColor:'#000'
	  },
	  containerCss: {
			backgroundColor: 'transparent',
			width: '530px'
	  }
	});	
}

function closePopup()
{
    $.modal.close();
}

function showPopupImg()
{
	$('.b-popup-img').modal({
	  overlayCss: {
			backgroundColor:'#000'
	  },
	  containerCss: {
			backgroundColor: 'transparent',
			width: '730px'
	  }
	});	
}

function showPopupVideo()
{
	$('.b-popup-video').modal({
	  overlayCss: {
			backgroundColor:'#000'
	  },
	  containerCss: {
			backgroundColor: 'transparent',
			width: '730px'
	  }
	});	
}

function showPopup360()
{
	$('.b-popup-360').modal({
	  overlayCss: {
			backgroundColor:'#000'
	  },
	  containerCss: {
			backgroundColor: 'transparent',
			width: '770px'
	  }
	});	
}

function slideSwitch(direct) {
    var $active = $('#slideshow IMG.active');
    if ( $active.length == 0 ) {
        if(direct == 1) $active = $('#slideshow IMG:last');
        else $active = $('#slideshow IMG:first');
    }
    var $next = null;
    if(direct == 1){
        $next =  $active.next().length ? $active.next() : $('#slideshow IMG:first');
    } else {
        $next =  $active.prev().length ? $active.prev() : $('#slideshow IMG:last');
    }
    $active.addClass('last-active');
    $next.css({opacity: 0.0})
        .addClass('active')
        .animate({opacity: 1.0}, 700, function() {
            $active.removeClass('active last-active');
            $('#banner-more-btn').attr('href',$('#slideshow IMG.active').attr('alt'));
        });
}
