function tick(){
	$('.shortNews p:first').slideUp(
	function () {
		$(this).appendTo($('.shortNews')).slideDown();
	});
} setInterval(function(){ tick () }, 5000);

dojo.addOnLoad(function(){
	var nodes = dojo.query('.bottomHalf .front>div');
	dojo.require('dojo.fx');
	nodes.connect('onmouseenter', function(e){
		var slide = dojo.query('.slide', this);
		dojo.fx.slideTo({
			node: slide[0],
			top: '-150'
		}).play();
	});
	nodes.connect('onmouseleave', function(e){
		var slide = dojo.query('.slide', this);
		dojo.fx.slideTo({
			node: slide[0],
			top: '-45'
		}).play();
	});

	var search = dojo.query('.functionButtons .search input')[0];
	dojo.connect(search, 'onkeydown', function(e){
		var key = e.keyCode;
		if(key == dojo.keys.ENTER) {
			document.location = '/search?q='+encodeURIComponent(this.value);
		}
	})
	dojo.connect(search, 'onfocus', function(){
		if(this.value == 'Search') this.value = '';
	//		dojo.disconnect(focus);
	})
	dojo.connect(search, 'onblur', function(){
		if(this.value == '') this.value = 'Search';
	//		dojo.disconnect(focus);
	})

	if($('#slideshow').length >0 ) {
	$('#slideshow').crossSlide({
		fade: 2
	}, [
	{
		src:  '/images/keyVisual/05.jpg',
		alt:  'Delarange Headquarters',
		from: '100% 30% 1x',
		to:   '10% 30% 1x',
		time: 4
	}, {
		src:  '/images/keyVisual/01.jpg',
		alt:  'New products',
		from: '100% 80% 1x',
		to:   '100% 0% 1x',
		time: 2
	}, {
		src:  '/images/keyVisual/02.jpg',
		alt:  'Product discussion',
		from: 'top left',
		to:   'bottom right 1x',
		time: 2
	}, {
		src:  '/images/keyVisual/03.jpg',
		alt:  'A new cosmetic is created',
		from: '100% 0% 1x',
		to:   '100% 80% 1x',
		time: 2
	}, {
		src:  '/images/keyVisual/04.jpg',
		alt:  'We produce new cosmetics',
		from: '100% 50% 1x',
		to:   '30% 50% 1x',
		time: 2
	}
	], function(idx, img, idxOut, imgOut) {
		if (idxOut == undefined)
		{
			// starting single image phase, put up caption
			$('div.caption').text(img.alt).animate({
				opacity: .7
			})
		}
		else
		{
			// starting cross-fade phase, take out caption
			$('div.caption').fadeOut()
		}
	});
}
});


