check = []; //this is an array that stores all the true/false values for each checkbox
check1 = []; //this is an array that stores all the true/false values for each checkbox


var x = readCookie('subscRemember');
var y = readCookie('advrtRemember');
if(x==1)
{
	check[1]=true;
}
if(y==1)
{
	check1[2]=true;
}
function checkBox(id)
	{

//alert(id);
	if(check[id] != true) //if a value is not true, use this rather than == false, 'cos the first time no value will be set and it will be undefined, not true or false
		{
		document.getElementById('imgCheck' + id).src = "images/true.png"; //change the image
		document.getElementById('inputCheck' + id).checked = "true"; //change the field value
		check[id] = true; //change the value for this checkbox in the array
		}
	else
		{
		document.getElementById('imgCheck' + id).src = "images/false.png";
		document.getElementById('inputCheck' + id).checked = "";
		check[id] = false;
		}
	}
	
function checkBox1(id)
	{

	if(check1[id] != true) //if a value is not true, use this rather than == false, 'cos the first time no value will be set and it will be undefined, not true or false
		{
		document.getElementById('imgCheck' + id).src = "images/true.png"; //change the image
		document.getElementById('inputCheck' + id).checked = "true"; //change the field value
		check1[id] = true; //change the value for this checkbox in the array
		}
	else
		{
		document.getElementById('imgCheck' + id).src = "images/false.png";
		document.getElementById('inputCheck' + id).checked = "";
		check1[id] = false;
		}
	}	
	
function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}
