// JavaScript Document

/*******FOR LEFT SCROLL*********/
$(function() {
	show_arrow();	   
	$('.nut_up').hide();
	$('.nut_down').click(function() {
	  go_down()
	});
	$('.nut_up').click(function() {
	  go_up()
	});
});

function go_down(){
	var txt = $('.scrolltext')	;
	var top = $('.scrolltext').position().top;
	var limit = $('.scrolltext').height() -  $('.scrollbox').height();

	if (-limit <0 && top >= (-limit)){
		txt.animate({top: '-=100px'},1500);
		$('.nut_up').fadeIn();
	}else{
		$('.nut_down').fadeOut();
	}
}
function go_up(){
	var txt = $('.scrolltext')	;
	var top = $('.scrolltext').position().top;
	if (top <0){
		txt.animate({top: '+=100px'},1500);
		$('.nut_down').fadeIn();
	}else{
		$('.nut_up').fadeOut();
	}
}

function show_arrow(){
	try{
		var top = $('.scrolltext').position().top;
		var limit = $('.scrolltext').height() -  $('.scrollbox').height();
		if (limit <0){
			$('.nut_down').fadeOut();
		}
	}catch(e){}
}

/*******RIGHT SCROLL**********/
$(function() {
	//show_arrow2();	   
	$('.nut_up2').hide();
	$('.nut_down2').click(function() {
	  go_down2()
	});
	$('.nut_up2').click(function() {
	  go_up2()
	});
});

function go_down2(){
	var txt = $('.scrolltext2')	;
	var top = $('.scrolltext2').position().top;
	var limit = $('.scrolltext2').height() -  $('.scrollbox2').height();

	if (-limit <0 && top >= (-limit)){
		txt.animate({top: '-=100px'},1500);
		$('.nut_up2').fadeIn();
	}else{
		$('.nut_down2').fadeOut();
	}
}
function go_up2(){
	var txt = $('.scrolltext2')	;
	var top = $('.scrolltext2').position().top;
	if (top <0){
		txt.animate({top: '+=100px'},1500);
		$('.nut_down2').fadeIn();
	}else{
		$('.nut_up2').fadeOut();
	}
}

function show_arrow2(){
	try{
		var top = $('.scrolltext2').position().top;
		var limit = $('.scrolltext2').height() -  $('.scrollbox2').height();
		if (limit <0){
			$('.nut_down2').fadeOut();
		}
	}catch(e){}
}
