function drawchart(){$('#Mainframe').highcharts({chart:{type:'line',events:{load:function(){var ch=$('#Mainframe').highcharts(),ex=ch.yAxis[0].getExtremes();ch.renderer.label('ÃÖ°í:'+ex.dataMax+'¸í',8,40).attr({fill:'#FEFE93',zIndex:8,id:'ml'}).add()}}},title:{text:'¿¹¼öÂù¾ç¹æ¼Û ûÃëÀÚ ÇöȲ',style:{fontSize:'25px'},x:0},subtitle:{text:'3ÀÏ °£ÀÇ ÇöȲ'},credits:{text:'¿¹¼öÂù¾ç¹æ¼Û¼±±³È¸',href:'http://cafe.daum.net/godjesuslove3927'},data:{csv:document.getElementById('csv').innerHTML},xAxis:{reversed:true,tickInterval:20,tickWidth:1,gridLineWidth:1,labels:{formatter:function(){return this.value.substring(1)},align:'left',x:-18,y:42}},yAxis:{min:0,title:{text:'¼­¹öº° ûÃëÀÚ (¸í)'}},legend:{y:0,floating:true},tooltip:{formatter:function(){var s='½Ã°¢: '+this.points[0].key.substring(1)+'';$.each(this.points,function(i,point){s+='
\u25CF'+point.series.name+': '+point.y+' ¸í'});return s},shared:true,crosshairs:true,valueSuffix:'¸í'},series:[]})} function Fileload(m){ if(document.getElementById(m))Process(m); else{ var t=m=='frmFile0'?'':filedate(m), u='/HOSTING/SongHistory/Today'+t+'.htm'+(t?'':'?t='+new Date().getTime()), deferred=$.Deferred(), f=$("").attr({"id":m,"src":u}); f.load(deferred.resolve); f.appendTo("body"); deferred.done(function(){Process(m)}); return deferred.promise() } } function Process(m){ $("
").attr({'id': 'c'+m}).appendTo('body');
	var t=$('#'+m).contents().find("tbody").html();
	t=t.replace(/(|\/td>)\r?\n/ig,'$1');
	t=t.replace(/.*?(\d+:\d+):.*?(\d+) \((\d+)\+(\d+)\+(\d+).*?\/tr>/ig, m.slice(-1)+'$1,$2,$3,$4,$5');
	t=t.replace(/.*?\r?\n/ig, '');
	$('#c'+m).html(t);
}
function chartinit(){
	$("").appendTo('body');
	$.getScript('http://code.highcharts.com/highcharts.js', function(){
		$.getScript('http://code.highcharts.com/modules/data.js');
		if(v&&v<11){
			$.getScript("http://ccmsong.iptime.org/cj/chart1.php?d1="+filedate('d1')+"&d2="+filedate('d2'),function(){
				$('#csv').text($('#csv').text().replace(/\s/g,'\n'));
				setTimeout(function(){drawchart()},500)
			})
		}else{
			$('#csv').html('Time,ÇÕ°è,¸ÞÀμ­¹ö,º¸Á¶¼­¹ö,¼¼ÀÌ\n');
			$.when(Fileload('frmFile2'),Fileload('frmFile1'),Fileload('frmFile0'))
			.done(function(){
				for(i=0;i<3;i++)$('#csv').html($('#csv').html()+$('#cfrmFile'+i).html());
				$('#cfrmFile0,#cfrmFile1,#cfrmFile2').remove();
				setTimeout(function(){drawchart()},700)
			})
		}
	})
}
function filedate(frmFile) {
	var mydate=Number(frmFile.slice(-1)),yesterday=(function(d){ d.setDate(d.getDate()-mydate); return d})(new Date);
	return yesterday.getFullYear()+("0"+(yesterday.getMonth()+1)).slice(-2)+("0"+yesterday.getDate()).slice(-2);
}