var rtimer = true;
var df = 0;
var ty = 0;
var typa;

function reduce(ss,typ)
{
	rtimer = true;
	var docc = eval("document.xxx.v"+ss);
	df = docc.value;
	ty = ss;
	typa = typ;

	if(ty == 21)
		setTimeout('fonat()',30);
	else
		setTimeout('runner()',10);
}

function fonat()
{
	if(rtimer){
		if(typa == "up")
			df = parseInt(df)+1;
		else if(typa == "down")
			df = parseInt(df)-1;


		if(df < 25 && df > 0){
			var docc = eval("document.xxx.v"+ty);
			docc.value = df;
			setTimeout('fonat()',100);
		}
	}
	document.xxx.sd.style.fontSize = df;
}

function fontfa()
{
	var eds = document.xxx.r23.value;
	document.xxx.sd.style.fontFamily = eds;
		
}

function fonst()
{
	document.xxx.sd.style.fontWeight = "normal"; 
	document.xxx.sd.style.fontStyle = "normal"; 
	var eds = document.xxx.r22.value;
	if(eds == 2){
		document.xxx.sd.style.fontWeight = "bold"; }
	else if(eds == 3){
		document.xxx.sd.style.fontStyle = "italic"; }
	else if(eds == 4){
		document.xxx.sd.style.fontWeight = "bold";
		document.xxx.sd.style.fontStyle = "italic"; }
		
}

function runner()
{

	if(rtimer)
	{
		if(typa == "up")
			df = parseInt(df)+1;
		else if(typa == "down")
			df = parseInt(df)-1;

		if(df < 256 && df > 0)
		{
			var docc = eval("document.xxx.v"+ty);
			docc.value = df;
			setTimeout('runner()',20);
		}
	}
	
	if(ty == 11 || ty == 12 || ty == 13 ){
	var r = deciToHex(document.xxx.v11.value);
	var g = deciToHex(document.xxx.v12.value);
	var b = deciToHex(document.xxx.v13.value);
	var ssd = "#"+r+g+b;
	document.xxx.sd.style.color = ssd;
	document.xxx.v11.style.backgroundColor = "#"+r+"0000";
	document.xxx.v12.style.backgroundColor = "#00"+g+"00";
	document.xxx.v13.style.backgroundColor = "#0000"+b;
	document.xxx.v14.value = ssd;
	}
	else if(ty == 31 || ty == 32 || ty == 33 ){
	var r = deciToHex(document.xxx.v31.value);
	var g = deciToHex(document.xxx.v32.value);
	var b = deciToHex(document.xxx.v33.value);
	var ssd = "#"+r+g+b;
	var ssdd = document.getElementById("dum");
	//ssdd.setAttribute("bgcolor",ssd);
	ssdd.style.backgroundColor = ssd;
	document.xxx.v31.style.backgroundColor = "#"+r+"0000";
	document.xxx.v32.style.backgroundColor = "#00"+g+"00";
	document.xxx.v33.style.backgroundColor = "#0000"+b;
	document.xxx.v34.value = ssd;
	}
	else{
	var r = deciToHex(document.xxx.v1.value);
	var g = deciToHex(document.xxx.v2.value);
	var b = deciToHex(document.xxx.v3.value);
	var ssd = "#"+r+g+b;
	document.xxx.sd.style.backgroundColor = ssd;
	document.xxx.v1.style.backgroundColor = "#"+r+"0000";
	document.xxx.v2.style.backgroundColor = "#00"+g+"00";
	document.xxx.v3.style.backgroundColor = "#0000"+b;
	document.xxx.v4.value = ssd;
	}
}

function increase(df)
{
	if(df != 0)
	{
		df=df-1;
		document.xxx.sd.value = df;
		document.xxx.p1.onmousedown = reduce(df);
	}
}

function stop()
{
	rtimer=false;
}

function getHexNum(num)
{
	ar1 = new Array('0','1','2','3','4','5','6','7','8','9','10','11','12','13','14','15');
	ar2 = new Array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
	if(num > 15){
		return num;
	}else	{
		red = ar2[num];
		return red;
	}
}


function deciToHex(arg)
{
	res2 = 999;
	args = arg;
	while(args>15){
		arg1=parseInt(args/16);
		arg2=args%16;
		arg2=getHexNum(arg2);
		args=arg1;

		if(res2 == 999){
			res2=arg2.toString();}
		else{
			res2=arg2.toString()+res2.toString();}
	}
	if(args<16 && res2 != 999){
		def = getHexNum(args);
		res2=def+res2.toString();
	}
	 else if(res2 == 999){
		if(args < 16)
			res2= getHexNum(args);
		else
			res2= 1;
	}

	if(res2.length == 1)
		  res2 = "0"+res2;

	return res2;
}
