

function findDivWithText(text) {


	var elements = document.querySelectorAll('.number_block');


	for (var element of elements) {

		if (element.innerText.trim() === text) {
			return element;
		}
	}

	return null; 
}

function unHighLightAllNumbers() {

	var classesToRemove = ['hilight-quad'
						,'hilight-split-upDown'
						,'hilight-split-across'
						,'hilight-street'
						,'hilight-double-street'
						,'hilight-pattern-break'
						,'hilight-straight'
						,'hilight-groups'
						,'hilight-unique'
						,'hilight-pattern-even-odd-high-low'
						,'hilight-pattern-rows'
						,'hilight-pattern-hilow'
						,'hilight-outside-defined'
						,'hilight-quad-defined'
						,'hilight-street-defined'
						,'hilight-split-down-defined'
						,'hilight-split-across-defined'
						,'hilight-line-defined'
						,'hilight-straight-defined'
						,'hilight-unique-defined' 
						,'hilight-group-defined'
						,'hilight-outside-pattern'
						,'hilight-quad2-defined'
						,'hilight-quad-defined'
						];


	for (let className of classesToRemove) {

		let elements = document.querySelectorAll(`.${className}`);
		
		for (let element of elements) {
			element.classList.remove(className);
		}
	}
}

 
function highlight_quad(item)
{

	if(item !== undefined && item !== null)
	{
		
		const selector = `[data-values="${item}"]`;
		const element = document.querySelector(selector);

		if (element) {
				var truth = element.classList.contains('hilight-quad-defined');
		
				if (!truth) {
					element.classList.add('hilight-quad-defined');
				}
			
		};
	
	}
	

}
function highlight_street(item)
{
	if(item !== undefined && item !== null)
	{
		
		const selector = `[data-values="${item}"]`;
		const element = document.querySelector(selector);

		if (element) {
				var truth = element.classList.contains('hilight-street-defined');
		
				if (!truth) {
					element.classList.add('hilight-street-defined');
					
				}
		};
	}
}

function highlight_double_street(item)
{ 

	if(item !== undefined && item !== null)
	{
	
		const selector = `[data-values="${item}"]`;
		const element = document.querySelector(selector);

		if (element) {
				var truth = element.classList.contains('hilight-line-defined');
		
				if (!truth) {
					element.classList.add('hilight-line-defined');
				}
		};
	}
}

function highlight_split_across(item)
{
	if(item !== undefined && item !== null)
	{
		const selector = `[data-values="${item}"]`;
		const element = document.querySelector(selector);
		if (element) {
		
				var truth = element.classList.contains('hilight-split-across-defined');

				if (!truth) {

					element.classList.add('hilight-split-across-defined');
				}
		};
	}

}
function highlight_split_down(item)
{

	if(item !== undefined && item !== null)
	{
		const selector = `[data-values="${item}"]`;
		const element = document.querySelector(selector);
	
		if (element) {
				var truth = element.classList.contains('hilight-split-down-defined');
		
				if (!truth) {
					element.classList.add('hilight-split-down-defined');
				}
		};
	}
	
}

function highlight_uniques(item)
{
	if(item !== undefined && item !== null)
	{
		const selector = `cellUnique_${item}`;
		const element = document.getElementById(selector);

		if (element) {
				var truth = element.classList.contains('hilight-unique-defined');
		
				if (!truth) {
					element.classList.add('hilight-unique-defined');
				}
		};
	}
}

function highlight_straight_numbers(item) {

	if(item !== undefined && item !== null)
	{
		const selector = `cellStraight_${item}`;
		const element = document.getElementById(selector);

		if (element) {
				var truth = element.classList.contains('hilight-straight-defined');
		
				if (!truth) {
					element.classList.add('hilight-dot', 'hilight-straight-defined');
				}
		};
	}
}

function highlight_number_groups(item) {
	
	if(item !== undefined && item !== null)
	{
		const selector = `cellUser_${item}`;
		const element = document.getElementById(selector);

		if (element) {
				var truth = element.classList.contains('hilight-group-defined');
		
				if (!truth) {
					element.classList.add('hilight-group-defined');
				}
		};
	}
	
}





function highlight_outside_defined(id){
	let item = document.getElementById(id);
    if (item) {
        var truth = item.classList.contains('hilight-outside-defined');

        if (!truth) {
            item.classList.add('hilight-outside-defined');
        }
    }
}
function highlight_low() {
	// 1 to 18
	highlight_outside_defined('cellStraight_Low');

}

function highlight_Even() {
	// Even
	highlight_outside_defined('cellStraight_Even');
}
function highlight_Red() {
	// Red
	highlight_outside_defined('cellStraight_Red');
}

function highlight_Black() {
	// Black
	highlight_outside_defined('cellStraight_Black');
}

function highlight_Odd() {
	// Odd
	highlight_outside_defined('cellStraight_Odd');
}

function highlight_high() {
	// 19 to 36
	highlight_outside_defined('cellStraight_High');
}




function highlight_dozen_1() {
	// dozen 1
	highlight_outside_defined('cellStraight_Dozen1');

}
function highlight_dozen_2() {

	// dozen 2
	highlight_outside_defined('cellStraight_Dozen2');
}
function highlight_dozen_3() {
	// dozen 3
	highlight_outside_defined('cellStraight_Dozen3');
}

function highlight_row_1() {
	// row 1
	highlight_outside_defined('cellStraight_Row1');
}
function highlight_row_2() {
	// row 2
	highlight_outside_defined('cellStraight_Row2');
}
function highlight_row_3() {
	// row 3
	highlight_outside_defined('cellStraight_Row3');
}


function highlight_outside_pattern(id){
	let item = document.getElementById(id);
    if (item) {
        var truth = item.classList.contains('hilight-outside-pattern');

        if (!truth) {
            item.classList.add('hilight-outside-pattern');
        }
    }
}

function highlight_pattern_low()
{
	highlight_outside_pattern('cellPattern_Low');
}
function highlight_pattern_even()
{
	highlight_outside_pattern('cellPattern_Even');
}
function highlight_pattern_red()
{
	highlight_outside_pattern('cellPattern_Red');
}
function highlight_pattern_black()
{
	highlight_outside_pattern('cellPattern_Black');
}
function highlight_pattern_odd()
{
	highlight_outside_pattern('cellPattern_Odd');
}
function highlight_pattern_high()
{
	highlight_outside_pattern('cellPattern_High');
}

function highlight_pattern_dozen_1() {
	highlight_outside_pattern('cellPattern_Dozen1');

}
function highlight_pattern_dozen_2() {
	highlight_outside_pattern('cellPattern_Dozen2');
}
function highlight_pattern_dozen_3() {
	highlight_outside_pattern('cellPattern_Dozen3');

}
function highlight_pattern_row_1() {

	highlight_outside_pattern('cellPattern_Row1');
}
function highlight_pattern_row_2() {
	highlight_outside_pattern('cellPattern_Row2');
}

function highlight_pattern_row_3() {
	highlight_outside_pattern('cellPattern_Row3');
}