function clockstarttimer ()
{	
	clocktimer = setTimeout('hs.htmlExpand(document.getElementById("graphclock"), { contentId: "expandedgraphclock" } )', 1000);
}

function clockstoptimer ()
{
	clearTimeout(clocktimer);
}

var pollarrInput = new Array(0);
var pollarrInputValue = new Array(0);

function polladdInput() 
{
	if (pollarrInput.length < 25)
	{
		document.getElementById("counter").value++;
		pollarrInput.push(pollarrInput.length);
		pollarrInputValue.push("");
		polldisplay();
	}
}

function polldisplay() 
{
	document.getElementById('polloptionfield').innerHTML="";
	for (intI=0;intI<pollarrInput.length;intI++) 
	{
		document.getElementById('polloptionfield').innerHTML+=pollcreateInput(pollarrInput[intI], pollarrInputValue[intI]);
	}
}

function pollsaveValue(intId,strValue) 
{
	pollarrInputValue[intId]=strValue;
}  

function pollcreateInput(id,value) 
{
	num = id + 1;
	return "<b>Antwoord "+ num +":</b>&nbsp;&nbsp;<input type='text' name='option"+ id +"' id='option"+ id +"' onChange='javascript:pollsaveValue("+ id +",this.value)' value='"+ value +"' maxlength='75' style='width:200px;' /><br />";
}

function polldeleteInput() 
{
	if (pollarrInput.length > 2) 
	{ 
		document.getElementById("counter").value--;
		pollarrInput.pop(); 
		pollarrInputValue.pop();
	}
	polldisplay(); 
}


function addbbcode(text, id)
{
	var txtarea = document.getElementById(id);
	text = ' ' + text + ' ';
	txtarea.value  += text;
	txtarea.focus();
}

check = [];
function checkBox(id)
{
    if (check[id] != true)
    {
        document.getElementById('imgCheck' + id).src = "img/checktrue.png";
        document.getElementById('post' + id).style.color = "grey";
        check[id] = true;
    }
    else
    {
        document.getElementById('imgCheck' + id).src = "img/checkfalse.png";
        document.getElementById('post' + id).style.color = null;
        check[id] = false;
    }
}

function masscheckBox(id)
{
    document.getElementById('imgCheck' + id).src = "img/checktrue.png";
    document.getElementById('post' + id).style.color = "grey";
    check[id] = true;		
}

function massuncheckBox(id)
{
    document.getElementById('imgCheck' + id).src = "img/checkfalse.png";
    document.getElementById('post' + id).style.color = null;
    check[id] = false;
}

function gatherCheckedDelete()
{
 	var url = "postact.php?action=massdelete";
	var number = 0;
	for (x = 0; x < check.length; x++)
	{
	 	if (check[x] == true)
	 	{
			url = url + "&" + number + "=" + x;
			number = number + 1;
		}
	}
	window.location.href = url;
}

function gatherCheckedMove()
{
 	var url = "postact.php?action=massmove";
	var number = 0;
	for (x = 0; x < check.length; x++)
	{
	 	if (check[x] == true)
	 	{
			url = url + "&" + number + "=" + x;
			number = number + 1;
		}
	}
	window.location.href = url;
}

var arrInput = new Array(0);
var arrInputValue = new Array(0);

function addInput(options)
{
 	document.getElementById("counter").value++;
	arrInput.push(arrInput.length);
	arrInputValue.push("");
	display(options);
}

function display(options) 
{
	document.getElementById('addusersarea').innerHTML="";
	for (intI=0;intI<arrInput.length;intI++) 
	{
		document.getElementById('addusersarea').innerHTML += createInput(arrInput[intI], arrInputValue[intI], options);
	}
}

function saveValue(intId,strValue) 
{
	arrInputValue[intId]=strValue;
} 

function createInput(id, value, options)
{
	return "<select id='uindex"+ id +"' name='uindex"+ id +"' onChange='javascript:saveValue("+ id +",document.getElementById('uindex"+ id +"'))'><option value='' readonly>Selecteer...</option>"+ options +"</select><br />";
}
