function initChange(){
	$('#navholder .borderbox .selected a.change').click(function(){
		var ___this = $(this);
		$(this).parents('.borderbox').find('.inactive').slideDown(400,function(){
			___this.parents('.selected').removeClass('selected');
		});
		return false;
	});
}
$(function(){
	initChange();
});

function initMoreLogos(){
	var _holder = $('#content-holder');
	if(_holder.length){
		var _opener = _holder.find('a.close');
		_opener.click(function(){
			if($(this).hasClass('more')){
				$(this).removeClass('more').text('Close');
				$(this).parents('.logopart').find('.logocont').addClass('logocont-opened');
			}else{
				$(this).addClass('more').text('More');
				$(this).parents('.logopart').find('.logocont').removeClass('logocont-opened');
			}
			return false;
		});
	}
}
$(document).ready(function(){
	initMoreLogos();
});
var _focusFlag = false;
var _langFlag;

function loadWin(){
	imgGall(); // gallery
}
function imgGall(){
	var _box = $('.product-hero-box');
	$('ul.gal-list').each(function(){
		var _list = $(this).children();
		var _a = _list.index(_list.filter('.active:eq(0)'));
		if(_a == -1) _a = 0;
		_list.eq(_a).addClass('active');
		$('.loading').show();
		_box.empty();
		$.ajax({
			type: "GET",
			url: _list.eq(_a).children('a[rel="gal-img"]').attr('href'),
			success: function(msg){
				$('.loading').hide();
				_box.html(msg);
			}
		});
		_list.click(function(){
			if(_list.index(this) != _a && $(this).children('a[rel="gal-img"]').length){
				_list.eq(_a).removeClass('active');
				_a = _list.index(this);
				_list.eq(_a).addClass('active');
				$('.loading').show();
				$.ajax({
					type: "GET",
					url: _list.eq(_a).children('a[rel="gal-img"]').attr('href'),
					success: function(msg){
						$('.loading').hide();
						_box.empty().html(msg);
					}
				});
			}
			return false;
		});
	});
}

if(window.addEventListener)
	window.addEventListener("load", loadWin, false);
else if (window.attachEvent && !window.opera)
	window.attachEvent("onload", loadWin);


