function fade(sElemId, sRule, bBackward){if (!document.getElementById(sElemId)) return;var aRuleList = sRule.split(/\s*,\s*/);for (var j	= 0; j < aRuleList.length; j++){sRule = aRuleList[j];if (!fade.aRules[sRule]) continue;var i=0;if (!fade.aProc[sElemId]){fade.aProc[sElemId] = {};}	else if (fade.aProc[sElemId][sRule]){i = fade.aProc[sElemId][sRule].i;clearInterval(fade.aProc[sElemId][sRule].tId);}if ((i==0 && bBackward) || (i==fade.aRules[sRule][3] && !bBackward)) continue;fade.aProc[sElemId][sRule] = {'i':i, 'tId':setInterval('fade.run("'+sElemId+'","'+sRule+'")', fade.aRules[sRule][4]),'bBackward':Boolean(bBackward)};}}
fade.aProc = {};
fade.aRules = {};
fade.run = function(sElemId, sRule)
{
    fade.aProc[sElemId][sRule].i += fade.aProc[sElemId][sRule].bBackward?-1:1;
 	var finishPercent = fade.aProc[sElemId][sRule].i/fade.aRules[sRule][3]; 
	var startPercent = 1 - finishPercent; 
	var aRGBStart = fade.aRules[sRule][0];
	var aRGBFinish = fade.aRules[sRule][1];
    document.getElementById(sElemId).style[fade.aRules[sRule][2]] = 'rgb('+ 
	Math.floor( aRGBStart['r'] * startPercent + aRGBFinish['r'] * finishPercent ) + ','+
	Math.floor( aRGBStart['g'] * startPercent + aRGBFinish['g'] * finishPercent ) + ','+
	Math.floor( aRGBStart['b'] * startPercent + aRGBFinish['b'] * finishPercent ) +')';
	if ( fade.aProc[sElemId][sRule].i == fade.aRules[sRule][3] || fade.aProc[sElemId][sRule].i ==0) clearInterval(fade.aProc[sElemId][sRule].tId); 
}
fade.back = function (sElemId, sRule){fade(sElemId, sRule, true);};
fade.addRule = function (sRuleName, sFadeStartColor, sFadeFinishColor, sCSSProp, nMiddleColors, nDelay)
{fade.aRules[sRuleName] = [fade.splitRGB(sFadeStartColor), fade.splitRGB(sFadeFinishColor), fade.ccs2js(sCSSProp), nMiddleColors || 50, nDelay || 1];};
fade.splitRGB = function (color){var rgb = color.replace(/[# ]/g,"").replace(/^(.)(.)(.)$/,'$1$1$2$2$3$3').match(/.{2}/g); for (var i=0;  i<3; i++) rgb[i] = parseInt(rgb[i], 16); return {'r':rgb[0],'g':rgb[1],'b':rgb[2]};};
fade.ccs2js = function (prop){var i; while ((i=prop.indexOf("-"))!=-1) prop = prop.substr(0, i) + prop.substr(i+1,1).toUpperCase() + prop.substr(i+2); return prop;};

fade.addRule('fr4','#FC6','#000246', 'color', 50, 1);
fade.addRule('fr3','#FC6','#000246', 'color', 50, 1);
fade.addRule('fr6',"#FF9900","#fff", "border-color", 100, 1);
fade.addRule('fr5','#FFF','#f95656', 'background-color', 100, 1);
fade.addRule('fr1','#FFF','#f95656', 'background-color', 100, 1);
function more(evt,oi)
{
	var evd=document.getElementById(evt);
	if(oi==1)
	{
		evd.className="morebut";
	}else
	{
		evd.className="morebut1";
	}
}
wrr=0;
seek=10;
//exr=-200;
posex=-200;
int=0;
abse=10;

function moving(x)
{
	int+=abse;
	exr=(document.getElementById("begun").offsetLeft);
	if (exr!=x)
	{
		exr=x;fade("begun", 'fr1');
		document.getElementById("begun").style.left=exr;
	}
	else 
	{
		fade.back("begun","fr1");
	}
}

function me(evt,oi)
{
	fade.back("begun","fr1");
	seel=parseInt(evt.parentNode.offsetTop);
	if(oi==1)
	{
		seek=posex;fade.back("begun","fr1");
	}else
	{
		if (oi==2)posex=parseInt(evt.parentNode.offsetLeft);
		seek=parseInt(evt.parentNode.offsetLeft);
	}
	document.getElementById("begun").style.top=(200+parseInt(seel))+"px";
	if(parseInt(document.getElementById("begun").offsetLeft)!=parseInt(seek)){moving(parseInt(seek));}

}