$(document).ready(function() {
						   
	$("body").addClass("Active");
			
	/* List in columns */
	$('.FeatureMenu .Enhance2MenuWrap .Enhance2MenuLevel').makeacolumnlists({cols:2,colWidth:0,equalHeight:false});
	
	/* Pop-ups Setup */
	$(".Info .Enhance2ContentElement1").addClass('ControlStrip');
	$(".Info .ControlStrip").siblings().wrapAll('<div class="ExpandContent"></div>').wrapAll('<div class="ExpandContentInside"></div>');
	
	$(".Info2 .Enhance2ContentElement1").addClass('ControlStrip');
	$(".Info2 .ControlStrip").siblings().wrapAll('<div class="ExpandContent"></div>').wrapAll('<div class="ExpandContentInside"></div>');
	
	$(".ExtraContent h3:first").addClass('ControlStrip');
	$(".ExtraContent .ControlStrip").siblings().wrapAll('<div class="ExpandContent"></div>').wrapAll('<div class="ExpandContentInside"></div>');
	
	/* Pop-up [.Info] */
	$(".Info .ControlStrip, .Info .ControlStrip *").click(function(){
		if($(".Info .ExpandContent").height() == 0){
        	$(".Info .ExpandContent").animate({ height: "250px" }, 1500 );
			collapse($(".Info2 .ExpandContent"));
			collapse($(".ExtraContent .ExpandContent"));
	  	}
	  	if($(".Info .ExpandContent").height() == 250){
        	$(".Info .ExpandContent").animate({ height: "0px" }, 1500 );
	  	}
	});
	
	/* Pop-up [.Info2] */
	$(".Info2 .ControlStrip, .Info2 .ControlStrip *").click(function(){
		if($(".Info2 .ExpandContent").height() == 0){
        	$(".Info2 .ExpandContent").animate({ height: "400px" }, 1500 );
			collapse($(".Info .ExpandContent"));
			collapse($(".ExtraContent .ExpandContent"));
	  	}
	  	if($(".Info2 .ExpandContent").height() == 400){
        	$(".Info2 .ExpandContent").animate({ height: "0px" }, 1500 );
	  	}
	});
	
	/* Pop-up [.ExtraContent] */
	$(".ExtraContent .ControlStrip, .ExtraContent .ControlStrip *").click(function(){
		if($(".ExtraContent .ExpandContent").height() == 0){
        	$(".ExtraContent .ExpandContent").animate({ height: "400px" }, 1500 );
			collapse($(".Info .ExpandContent"));
			collapse($(".Info2 .ExpandContent"));
	  	}
	  	if($(".ExtraContent .ExpandContent").height() == 400){
        	$(".ExtraContent .ExpandContent").animate({ height: "0px" }, 1500 );
	  	}
	});
	
	$(".Info .ControlStrip a, .Info2 .ControlStrip a, .ExtraContent .ControlStrip a").click(function(){return false;});
						   
    ReadJCList();
	$('.FeatureStrip ul').jcarousel({
        scroll: 1,
		visible: 3,
		auto: 2,
        initCallback: mycarousel_initCallback,
        wrap: 'circular',
        itemVisibleInCallback: {onBeforeAnimation: mycarousel_itemVisibleInCallback},
        itemVisibleOutCallback: {onAfterAnimation: mycarousel_itemVisibleOutCallback}
    });
	
		$(window).resize(function() {
        $('.FeatureStrip ul').css({'left': '0px'});
    });	
	
});

function collapse(element){
	if(element.height() > 10){
		element.animate({ height: "0px" }, 1500 );
	}
}

var mycarousel_itemList = new Array();
ReadJCList = function() {
var JCList;
if ($('.FeatureStrip ul li')!=null){
    JCList=$('.FeatureStrip ul li');
    for (var i = 0; i < JCList.length; i++) {
        mycarousel_itemList[i]=JCList[i].innerHTML;
    }
}
}

function mycarousel_itemVisibleInCallback(carousel, item, i, state, evt)
{
    // The index() method calculates the index from a
    // given index who is out of the actual item range.
    var idx = carousel.index(i, mycarousel_itemList.length);
    carousel.add(i, mycarousel_itemList[idx - 1]);

	if(typeof pngFix == 'function') {
		pngFix();
	}
};

function mycarousel_itemVisibleOutCallback(carousel, item, i, state, evt)
{
    carousel.remove(i);
    carousel.startAuto();
};

function mycarousel_initCallback(carousel)
{
    carousel.clip.hover(function() {
        carousel.stopAuto();
    }, function() {
        carousel.startAuto();
    });
};
