$(document).ready(function(){
	$('#separator_' + $('#main-menu-list').children('.active').attr('id')).css('display', 'none');
	$('#separator_' + (parseInt($('#main-menu-list').children('.active').attr('id')) + 1)).css('display', 'none');
});

$(function() {
    $("div#controller").jFlow({
        slides: "#slides",
        width: "475px",
        height: "244px"
    });
    setTimeout("changeSlide()", 8000);

    $('#image-carousel').jcarousel({
        visible: 3,
        scroll: 1,
        initCallback:image_carousel,
        buttonNextHTML: null,
        buttonPrevHTML: null
    });
    
    $('.parameters-title').click(function(){
    	if ($('.parameters-content').css('display') == 'block') {
    		$('.parameters-content').slideUp();
		}
    	else {
			if($.browser.msie && $.browser.version == '8.0') {
				$('.parameters-content').show();
			} else
	    		$('.parameters-content').slideDown();
    	}

    });
    
});

function changeSlide() {
	$(".jFlowNext").click();
	setTimeout("changeSlide()", 8000);
}

function image_carousel(carousel) {
	jQuery('.image-slider-next').bind('click', function() {
			carousel.next();
			return false;
	});    
	
	jQuery('.image-slider-prev').bind('click', function() {
		carousel.prev();
		return false;    
	});
}

function changeMainImage(type, imgcache1, imgcache2) {
	
	var data = '';
	
	if (type == 'image') {
		data = '<a class="thickbox" rel="product_images" href="' + imgcache1 + '"><img src="' + imgcache2 + '" alt="" title="" class="imagecache imagecache-store_product_detail" width="638" height="359">	</a>';
	}
	else if (type == 'video') {
		data = '<object width="500" height="359"><param name="movie" value="http://www.youtube.com/v/' + imgcache1 + '"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/' + imgcache1 + '" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="500" height="359"></embed></object>';
	}
	
	$('#main-image-container').html(data);
	tb_init('a.thickbox');
	
}
