var vT;var vS;var vFT;var vCt;var vRt;var vLp;var vIsIE;var vBPM;var vBPMBias;var vHEI;var vMES;var vSongHei;var vTopM;var vBtmM;var vScrollEnd;var vTopGap;var vBtmGap;var vOfs;var vACtr;var vCurPtr;var vYPosA;var vMeasA;var vBPMsA;var vMHeiA;var vPHeiA;function pCode1_Initialize(){vIsIE=true;if(document.all){if(document.body){if(("1"+document.body.offsetTop)&&"1"+document.body.clientHeight){vIsIE=true;}else{vIsIE=false;}}else{vIsIE=false;}}else{vIsIE=false;}if(vIsIE){vOfs=document.all.ScoreTable.offsetTop-2;}else{vOfs=0;}}function pIE(){var v0=new Date;var v1=document.body.clientHeight-vOfs;if(v1<0)v1=0;clearTimeout(vT);vS=vCt-((v0.getTime()-vFT)*vRt);if(vS<=vYPosA[vCurPtr-1]){vCurPtr--;vHEI=vMHeiA[vCurPtr];vBPM=vBPMsA[vCurPtr]*vBPMBias;vCt=vYPosA[vCurPtr];vFT=v0.getTime()-((vCt-vS)/vRt);vRt=(vHEI/(60/vBPM*4000));vS=vCt-((v0.getTime()-vFT)*vRt);}if((vS>vScrollEnd)&&vLp){window.scrollTo(0,vS-v1);vT=setTimeout("pIE()",1);}else{if(vScrollEnd==0){vLp=false;}else{vT=setTimeout("pStartScroll()",500);}}}function pNN(){var v0=new Date;var v1=window.innerHeight-3-vOfs;if(v1<0)v1=0;clearTimeout(vT);vS=vCt-((v0.getTime()-vFT)*vRt);if(vS<=vYPosA[vCurPtr-1]){vCurPtr--;vHEI=vMHeiA[vCurPtr];vBPM=vBPMsA[vCurPtr]*vBPMBias;vCt=vYPosA[vCurPtr];vFT=v0.getTime()-((vCt-vS)/vRt);vRt=(vHEI/(60/vBPM*4000));vS=vCt-((v0.getTime()-vFT)*vRt);}if((vS>vScrollEnd)&&vLp){window.scrollTo(0,vS-v1);vT=setTimeout("pNN()",1);}else{if(vScrollEnd==0){vLp=false;}else{vT=setTimeout("pStartScroll()",500);}}}function pStartScroll(){if(vBtmM<=0){vCurPtr=vACtr-1;vHEI=vMHeiA[vCurPtr];vBPM=vBPMsA[vCurPtr]*vBPMBias;vCt=vTopGap+vSongHei+vBtmGap;}else{vCurPtr=pFindMeasure(vBtmM);vHEI=vMHeiA[vCurPtr];vBPM=vBPMsA[vCurPtr]*vBPMBias;vCt=pCalcMeasureYPos(vBtmM)+25;}if(vTopM==0){vScrollEnd=0;}else{vScrollEnd=pCalcMeasureYPos(vTopM);if(vScrollEnd<0)vScrollEnd=1;}vRt=(vHEI/(60/vBPM*4000));vFT=(new Date).getTime();clearTimeout(vT);vLp=true;if(vIsIE){vT=setTimeout("pIE()",1);}else{vT=setTimeout("pNN()",1);}}function pFindMeasure(xMeasure){var v0;for(v0=0;v0<vACtr;v0++){if(vMeasA[v0]<=xMeasure){break;}}return(v0);}function pCalcMeasureYPos(xMeasure){var v0;v0=pFindMeasure(xMeasure);return(vYPosA[v0]-(vPHeiA[v0]*(xMeasure-vMeasA[v0])));}function pSetBPMBias(xBPMBias){if(isNaN(xBPMBias)||(xBPMBias=="")){vBPMBias=1;}else{vBPMBias=xBPMBias;}}function pSetBound(xBoundBtmM,xBoundTopM){var v0;if(isNaN(parseInt(xBoundBtmM))){vBtmM=0;}else{vBtmM=parseInt(xBoundBtmM);}if(isNaN(parseInt(xBoundTopM))){vTopM=0;}else{vTopM=parseInt(xBoundTopM);if(vTopM>0){vTopM=vTopM+1;}}if(vTopM<vBtmM){v0=vTopM;vTopM=vBtmM+1;vBtmM=v0-1;}}function pConstantBPMInitialize(xBPM,xHeight,xTopGap,xBtmGap){pVariableBPMInitialize(xTopGap,xBtmGap);vMES=vSongHei/xHeight;pVariableBPMDefine(vMES,xBPM,xHeight);pVariableBPMDefine(1,xBPM,xHeight);pVariableBPMFinish();}function pVariableBPMInitialize(xTopGap,xBtmGap){var v0;vTopGap=xTopGap;vBtmGap=xBtmGap;vSongHei=0;for(v0=0;v0<document.images.length;v0++){vSongHei=vSongHei+document.images[v0].height;}vSongHei=vSongHei-vTopGap;vSongHei=vSongHei-vBtmGap;vACtr=0;vCurPtr=0;vYPosA=new Array();vMeasA=new Array();vBPMsA=new Array();vMHeiA=new Array();vPHeiA=new Array();}function pVariableBPMDefine(xMeasure,xBPM,xMeasureHeight,xPhysicalHeight){if(!(xPhysicalHeight)){xPhysicalHeight=xMeasureHeight;}vYPosA[vACtr]=0;vMeasA[vACtr]=xMeasure;vBPMsA[vACtr]=xBPM;vMHeiA[vACtr]=xMeasureHeight;vPHeiA[vACtr]=xPhysicalHeight;vACtr++;}function pVariableBPMFinish(){var v0;var v1;var v2;vMES=vMeasA[0];v1=vMES+1;v2=vTopGap;for(v0=0;v0<vACtr;v0++){v2=v2+((v1-vMeasA[v0])*vPHeiA[v0]);vYPosA[v0]=v2;v1=vMeasA[v0];}}function pMouseDown(nEvent){clearTimeout(vT);vLp=false;}function pTimeShift(xCount){if(vLp){vFT+=xCount;}}