
var TradeBase=new Class({kaisuu:0,daikin:0,initialize:function(tradeArray)
{if(isArray(tradeArray))
{var i=0;this.kaisuu=tradeArray[i++]-0;this.daikin=Math.round(tradeArray[i++]/1000);}}});var Trades=new Class({types:['kabu','saki','op','fx'],typeTexts:['株式','先物','ＯＰ','ＦＸ'],kabu:null,saki:null,op:null,fx:null,mainType:null,kaisuu:0,daikin:0,initialize:function(kaisuuArray,daikinArray)
{if(isArray(kaisuuArray)&&this.types.length==kaisuuArray.length&&isArray(daikinArray)&&this.types.length==daikinArray.length)
{var trade,maxDaikin=0;for(var i=0;i<this.types.length;i++)
{trade=this[this.types[i]]=new TradeBase([kaisuuArray[i],daikinArray[i]]);this.kaisuu+=trade.kaisuu;this.daikin+=trade.daikin;if(maxDaikin<trade.daikin)
{maxDaikin=trade.daikin;this.mainType=this.types[i];}}}}});var Profile=new Class({uid:null,name:null,comment:null,url:null,tiiki:null,seibetu:null,nenrei:null,initialize:function(profileArray)
{var i=0;this.uid=profileArray[i++];this.name=profileArray[i++];this.comment=profileArray[i++];this.url=profileArray[i++];this.tiiki=profileArray[i++];this.seibetu=profileArray[i++];this.nenrei=profileArray[i++];}});function isArray(obj)
{return typeof(obj)=='object'&&obj.constructor==Array;}
function showResponse(response)
{try
{if(!response)
return;$('main_contents').innerHTML=response;setTimeout(setDomReadyToTable,1);}
catch(e)
{endGetTable(false,e.description);}}
function completeGetTable()
{endGetTable(true);}
function setDomReadyToTable()
{var i=0,ele,main=$('main_contents');while(i++<1000&&!(ele=main.getElement('table')));if(ele)
ele.addEvent("domready",completeGetTable);else
completeGetTable();}
var sTT_ActiveColor=null,sTT_NotActiveColor=null;function selectTradeType(senderBtn,eleUpdate,activeColor,value)
{var ele,tmpColor;var allBtn=$(senderBtn.form).getElements('input[type=button]');senderBtn=$(senderBtn);eleUpdate=$(eleUpdate);if(senderBtn==null||senderBtn.disabled||!eleUpdate||!allBtn||allBtn.length==0)
{return;}
if(sTT_ActiveColor==null)
{tmpColor=senderBtn.getStyle('background-color');if(!senderBtn.setStyle('background-color',activeColor))
return;sTT_ActiveColor=senderBtn.getStyle('background-color');if(!senderBtn.setStyle('background-color',tmpColor))
throw new Exception('error: set tmpColor to senderBtn.style("background-color")');if(sTT_ActiveColor==null)
return;}
if(sTT_NotActiveColor==null)
{for(var i=0;i<allBtn.length;i++)
{ele=$(allBtn[i]);if(!ele||ele.disabled)
continue;if(sTT_NotActiveColor==null)
{sTT_NotActiveColor=ele.getStyle('background-color');if(sTT_NotActiveColor==sTT_ActiveColor)
{sTT_NotActiveColor=null;}}}
if(sTT_NotActiveColor==null)
return;}
for(var i=0;i<allBtn.length;i++)
{ele=allBtn[i];if(!ele||ele.disabled||ele.getStyle('background-color')==sTT_NotActiveColor)
continue;ele.setStyle('background-color',sTT_NotActiveColor);}
senderBtn.setStyle('background-color',sTT_ActiveColor);eleUpdate.setHTML(value);}
function ranking_format(data,name)
{var tmp,res=data+'';switch(name)
{case'rank_hendou':res=(res=='none'?'-':(res=='down'?'↓':'↑'));break;case'seibetu':res=(res=='otoko'?'男性':(res=='onnna'?'女性':''));break;case'ekiritu':var syousuu;if((tmp=res.indexOf('.'))==-1)
syousuu='0';else
{syousuu=res.substr(tmp+1);res=res.substr(0,tmp);}
while(res!=(tmp=res.replace(/^([+-]?\d+)(\d\d\d)/,"$1,$2")))
{res=tmp;}
res+='.'+syousuu;break;default:if(!isNaN(res))
{while(res!=(tmp=res.replace(/^([+-]?\d+)(\d\d\d)/,"$1,$2")))
{res=tmp;}}
break;}
return res;}

var hidableBar = false;
var defaultMarLeft;
function hideStatBar ()
{
	if (! hidableBar)
	{
		hidableBar = document.getElement('.statBar');
		defaultMarLeft = $('main_contents').getStyle('margin-left');
	}

	if (hidableBar.style.display == 'none')
	{
		hidableBar.style.display = 'block';
		$('main_contents').setStyle('margin-left', defaultMarLeft);
	}
	else
	{
		hidableBar.style.display = 'none';
		$('main_contents').setStyle('margin-left', 0);
	}
}
