//Функция позволяет изменять сразу все объекты конкретного класса
//Create an array 
var allPageTags = new Array(); 

function doSomethingWithClasses(theClass, colorNew) {
	//Populate the array with all the page tags
	var allPageTags=document.getElementsByTagName("*");
	//Cycle through the tags using a for loop
	for (i=0; i<allPageTags.length; i++) {
		//Pick out the tags with our class name
		if (allPageTags[i].className==theClass) {
		//Manipulate this in whatever way you want
		allPageTags[i].style.color=colorNew;
		}
	}
} 



//Функция устанавливает звезду красного цвета по событию onFocus
function SetReq(type)
{

	theClass = "req-text-"+type;
	newColor = '#CC0000';
	doSomethingWithClasses(theClass, newColor);
}

//Функция устанавливает звезду красного или белого цвета по событию onBlur, в зависимости от значения в поле text
function ReqOff(val, type)
{
	theClass = "req-text-"+type;
	
	redColor = '#CC0000';
	whiteColor = '#FFFFFF';	
	if(val == ''){
		doSomethingWithClasses(theClass, whiteColor);
	}
	else{
		doSomethingWithClasses(theClass, redColor);
	}	
}


