﻿function refreshPage(){
	contentCount=0;
	for(var i=1;i<11;i++){
		var tmpDiv="AC"+i;
		var tester=parent.testID(tmpDiv);
		if(tester){
			var coord=parent.findPos(document.getElementById(tmpDiv));
			var leftPos=coord[0];
			var topPos=coord[1];
			self.addElement(i,leftPos,topPos);
			document.getElementById(tmpDiv).style.border="1px solid red";
			contentCount=contentCount+1;
		}
	}
	var loc=new String(window.location);
	var ids=loc.split("?id=");
	selectedID=ids[1];
	if(contentCount<2){
		parent.setACValues('AC1')
	}
}

function addElement(numi,elLeft,elTop) {
  var ni = document.getElementById('body');
  var newdiv = document.createElement('div');
  var divIdName = 'AC'+numi+'Div';
  var tmpDN='AC'+numi
  newdiv.setAttribute('id',divIdName);
  newdiv.innerHTML = "<a href=\"#\" style=\"height:10px;font-size:10px;color:white;text-decoration:none;display:block;\" onclick=\"parent.setACValues('"+tmpDN+"')\">E</a>";
  newdiv.style.width="10px";
  newdiv.style.height="10px";
  newdiv.style.backgroundColor="red";
  newdiv.style.border="1px solid black";
  newdiv.style.textAlign="center";
  newdiv.style.position="absolute";
  newdiv.style.left=elLeft+"px";
  newdiv.style.top=elTop+"px";
  ni.appendChild(newdiv);
}
