$(function(){
	//helpmenu
	$('#helpmenuform select').bind('change', function(){
		if($(this).val() != '') window.location.href = $(this).val();
	});
	//cycle
	if (!($('body').hasClass('page-27080'))) {
	var start = false;
	var imageAreas = $('.contentImageArea').not('.variant-frontpage .contentImageArea');
	for(var i = 0; i < imageAreas.length; i++) {
		var images = $(imageAreas[i]).find('img');
		if(images.length > 1) {
			start = true;
			$(imageAreas[i]).before('<div class="cycle" id="cycle'+i+'"></div>');
			var h = 0;
			var w = 0;
			for (var j = 0; j < images.length; j++) {
				$('#cycle'+i).append($(images[j]));
				if(h < $(images[j]).height()) h = $(images[j]).height();
				if(w < $(images[j]).width()) w = $(images[j]).width();
			}
			$('#cycle'+i).css({'width' : w+'px', 'height' : h+'px'});
			$(imageAreas[i]).remove();
			var hw = 648 - w - 20;
			$('h1').css({'float' : 'left', 'width' : hw+'px'});
		}
		else if(images.length == 1) {
			$(imageAreas[i]).before($(imageAreas[i]).clone());
			var w = $(imageAreas[i]).width();
			var hw = 648 - w - 20;
			$(imageAreas[i]).remove();
			$('h1').css({'float' : 'left', 'width' : hw+'px'});
		}
	}
	if (start) {
		$(".cycle").cycle({
			fx: 'fade',
			timeout: 7500,
			speed: 3000
		});
	}
	}
});

