
function Judge(applet,inputComponent,hc,oc,ocn,ho){
	this.applet = applet;
	this.hypothesisConstruction = hc;
	this.objectiveConstruction = oc;
	this.hiddenObj = ho;
	this.objectiveObjName = ocn;
	this.inputComponent = inputComponent;
}

function judge(){
	feedback = getFeedback();
	alert(feedback);
}

function ggbOninit(){

   for(i=0;i<hypothesisConstruction.length;i++){
			applet.evalCommand(hypothesisConstruction[i]);

   }

      for(l=0;l<objectiveConstruction.length;l++){
			applet.evalCommand(objectiveConstruction[l]);
   }


     for(j=0;j<hiddenObj.length;j++){
			applet.setVisible(hiddenObj[j],false);

   }
     for(k=0;k<objectiveObjName.length;k++){
			applet.setVisible(objectiveObjName[k],false);

   }



    setHypothesisFeel(applet);

	applet.registerAddListener("AddListenerFunction");



}

function getFeedback(){
	var answer = inputComponent.value;
	if(applet.exists(answer)){
		var result = answer + "==" + objectiveObjName[0];
		applet.evalCommand(result);
		if(applet.getValueString(applet.getObjectName(applet.getObjectNumber()-1)).indexOf("true")>=0){
			//alert(answer + ": Right");
			return "Congraduations! Your answer "+ answer + " is right.";
		}else{
			//alert(answer + ": Wrong");
			return "Your answer " + answer + " is wrong. Try again!";
		}
	}
}

function AddListenerFunction(){
setUserConstructionFeel(applet);
	
	
	
}