function setPeriod_ll(interval){
	$('.ll_graph_date').each(function(){
		//$(this).css('text-decoration', 'underline');
		$(this).removeClass('button-active');
	});
	$('#ll_graph_date_' + interval).addClass('button-active');

	var type = "both";
	$('#ll-group').children().each(function(){
		var tmp = $(this);
		if (tmp.find('.checked').attr('id')){
			type = tmp.find('.checked').attr('id');
		}
	});

	var send = $.ajax
	({	
		type: "post",
		url: '/ajax/',
		data: {action:'graph_ll',period:interval,type:type},
		dataType: "json",
		success: onPreSetPeriod_ll
	});
}

function onPreSetPeriod_ll(oReq){
	var json = oReq;
	if (json.status=='ok'){
		var send = $.ajax
		({	
			type: "post",
			url: '/ajax/',
			data: {action:'reload_ll_graph'},
			dataType: "json",
			success: onSetPeriod_ll
		});
		$('#ll_positive').css('width', json.pos+"px");
		$('#ll_negative').css('width', json.neg+"px");

        }
}
			
function onSetPeriod_ll(oReq){
	var json = oReq;
	var data = json.data;
	var settings = json.settings;
	flashMovie = document.getElementById("amline_ll");
	flashMovie.setData(data, false);
	flashMovie.setSettings(settings, false);
	flashMovie.rebuild();
}			


function setType_ll(type){
	$('#ll-group .form-style').each(function(){
//	$('#ll-group').children('.l-radio').each(function(){
		//$(this).css('text-decoration', 'underline');
		//$(this).removeClass('button-active');
		$(this).removeClass('checked');
	});
	//$('#' + type).css('text-decoration', 'none');
	//$('#' + type).addClass('button-active');
	$('#' + type).addClass('checked');
	var interval = 7;
	$('.ll_graph_date').each(function(){
		//if ($(this).css('text-decoration')=='none'){
		if ($(this).hasClass('button-active')){
			interval = $(this).attr("name");
		}
       	});

	var send = $.ajax
	({	
		type: "post",
		url: '/ajax/',
		data: {action:'graph_ll',period:interval,type:type},
		dataType: "json",
		success: onPreSetPeriod_ll
	});
}

/*
function onOnSetPeriod(oReq){
	var json = oReq;
	var str = json.str
	$('#bond_graph_nav').html(str);
	
	
}

function checkBenchmark(_id){
	var pos = _id.indexOf("_")+1;
	var id = _id.substr(pos);

	var sections = $('#benchmark_count').val();
	var str = '#benchmark_' + id;
	var element = $(str).val();
	if (element>=0){
		var el = document.getElementById(_id);
		var benchmark_el = document.getElementById("benchmark");
		if (el.checked){
			if (benchmark_el.checked){
				showGraph2(element);
			}
		}else{
			var flag = false;
			for (var i=1; i<=sections;i++){
				var tmp_name = '#benchmark_' + i;
				var tmp_el = document.getElementById('segments_' + i);
				if (tmp_el.checked){
					if ($(tmp_name).val()==element){
						flag = true;
						break;
					}
				}
			}
			if (flag == false){
               			hideGraph2(element);
			}
		}
	}
}

function onoffBenchmark(){

	var benchmark_el = document.getElementById("benchmark");
	var sections = $('#benchmark_count').val();
	//alert(sections);
	if (benchmark_el.checked){
		for (var i=1; i<=sections;i++){
			var tmp_el = document.getElementById('segments_' + i);
			if (tmp_el.checked){
				var tmp_name = '#benchmark_' + i;
				showGraph2($(tmp_name).val());
				//alert($(tmp_name).val());
			}
		}
	}else{
		for (var i=1; i<=sections;i++){
			var tmp_el = document.getElementById('segments_' + i);
			if (tmp_el.checked){
				var tmp_name = '#benchmark_' + i;
				hideGraph2($(tmp_name).val());
				//alert($(tmp_name).val());
				//???
			}
		}
	}
}
*/