$(document).ready(function() {
	var screenHeight	=	$(window).height() - 600;
	screenHeight		=	screenHeight / 2;
	if(screenHeight < 0) {
		screenHeight 	= 	0;
	}
	$('#container').css({
		marginTop	:	screenHeight + 'px'
	});
	$('.background').cycle({ 
		fx:     'fade', 
		speed:   1000, 
		timeout: 7000, 
		next:   '.background', 
		pause:   7 
	});
	var content_h = parseInt($('#content .text_c .text').height());
	var content_v = 345;
	var content_s = content_h - content_v;
	var content_p = $('#content .text_c .text').position();
	var content_t =  parseInt(content_p.top);
	var speed	  = 20;
	if(content_h > content_v) {
		$('.down').mouseover(function() {
			content_scroll = String(Math.round(content_p.top * 1) / 1);
			content_scroll = parseInt(content_scroll.replace('-', ''));
			content_scroll = content_s - content_scroll;
			$('#content .text_c .text').animate({top: '-' + content_s + 'px'}, (content_scroll * speed), 'linear');
		}).mouseout(function() {
			content_p = $('#content .text_c .text').position();
			$('#content .text_c .text').stop();
		});
		$('.up').mouseover(function() {
			content_scroll = String(Math.round(content_p.top * 1) / 1);
			content_scroll = parseInt(content_scroll.replace('-', ''));
			content_scroll = content_scroll;
			$('#content .text_c .text').animate({top: '0px'}, (content_scroll * speed), 'linear');
		}).mouseout(function() {
			content_p = $('#content .text_c .text').position();
			$('#content .text_c .text').stop();
		});
	}
	else {
		$('.up').hide();
		$('.down').hide();
	}
});

$(window).resize(function() {
	var screenHeight	=	$(window).height() - 600;
	screenHeight		=	screenHeight / 2;
	if(screenHeight < 0) {
		screenHeight 	= 	0;
	}
	$('#container').css({
		marginTop	:	screenHeight + 'px'
	});
});


