var count_up = 0;

function comparePosition()
{count_up++;
 count_down = number_of_chips
 for (chip_number=1; chip_number<=number_of_chips; chip_number++){
  objectID = "guide" + chip_number;
  guide_left = document.getElementById(objectID).offsetLeft;
	guide_top  = document.getElementById(objectID).offsetTop;
	
	objectID = "chip" + chip_number;
	chip_left = document.getElementById(objectID).offsetLeft;
	chip_top  = document.getElementById(objectID).offsetTop;
	
  difference_left = guide_left - chip_left;
	difference_left = difference_left * difference_left;
	difference_left = Math.sqrt(difference_left);
	difference_top = guide_top - chip_top;
	difference_top = difference_top * difference_top;
	difference_top = Math.sqrt(difference_top);
	
	if ((difference_left<=10) && (difference_top<=10))
	{  document.getElementById(objectID).style.left = guide_left;
	   document.getElementById(objectID).style.top = guide_top;
		 document.getElementById(objectID).style.backgroundColor = '#f90';
		 count_down--;
  }//end of if
 }//end of for
 
 if (count_down == 0)
   document.getElementById('ans').style.visibility = 'visible';
 else
   {document.getElementById('wrong').style.visibility = 'visible';
    if (count_up > 3)
    document.getElementById('next').style.display = 'block';
	 }//end of if count_down == 0
}//end of function comparePosition

function hint () {
  document.getElementById('chip1').style.left = 180;
  document.getElementById('chip2').style.left = 180;
  document.getElementById('chip1').style.top = 125;
  document.getElementById('chip2').style.top = 165;
	document.getElementById('chip1').style.backgroundColor = 'f33';
	document.getElementById('chip2').style.backgroundColor = 'f33';
}
