﻿if (document.location.hostname.indexOf('tanny') == -1) window.open('about:blank', '_self');
var MaxColorR=0,MaxColorG=0,MaxColorB=0,AEvent=0;
var MaxColorVal=255,ColorDivide=4;
var S_CrossHatch="#",S_Zero="0";
var R_Value="RValue",G_Value="GValue",B_Value="BValue",Start="ALink(RValue,GValue,BValue);";

function ALinkColor(RValue,GValue,BValue){MaxColorR=RValue;MaxColorG=GValue;MaxColorB=BValue;AEvent=0;}
function ALink(RValue,GValue,BValue){
MaxColorR+=RValue;MaxColorR=Math.round(MaxColorR);
MaxColorG+=GValue;MaxColorG=Math.round(MaxColorG);
MaxColorB+=BValue;MaxColorB=Math.round(MaxColorB);
var fCR=MaxColorR.toString(16),fCG=MaxColorG.toString(16),fCB=MaxColorB.toString(16);
var bCR=(MaxColorVal-Math.round(MaxColorR/ColorDivide)).toString(16),bCG=(MaxColorVal-Math.round(MaxColorG/ColorDivide)).toString(16),bCB=(MaxColorVal-Math.round(MaxColorB/ColorDivide)).toString(16);
if(fCR.length==1)fCR=S_Zero+fCR;
if(fCG.length==1)fCG=S_Zero+fCG;
if(fCB.length==1)fCB=S_Zero+fCB;
var fColor=S_CrossHatch+fCR+fCG+fCB;
var bColor=S_CrossHatch+bCR+bCG+bCB;

try{
document.styleSheets[0].rules[2].style.color=fColor;
document.styleSheets[0].rules[3].style.backgroundColor=bColor;
}catch(e){
}

if (MaxColorR<=0&&RValue!=0)RValue=1;
else if(MaxColorR>=255&&RValue!=0)RValue=-1;
if (MaxColorG<=0&&GValue!=0)GValue=1;
else if(MaxColorG>=255&&GValue!=0)GValue=-1;
if (MaxColorB<=0&&BValue!=0)BValue=1;
else if(MaxColorB>=255&&BValue!=0)BValue=-1;
if(AEvent==1)setTimeout(Start.replace(R_Value,RValue).replace(G_Value,GValue).replace(B_Value,BValue),100);
}
function LoadStyle(){
ALinkColor(0,0,255);
AEvent=1;
setTimeout(Start.replace(R_Value,"1").replace(G_Value,"0").replace(B_Value,"0"));
}
setTimeout("LoadStyle();");