
bk = new Image();
bk.src ="/science/reproduction/images/top_arrow_chazara.gif";
bk2 = new Image();
bk2.src ="/science/reproduction/images/top_arrow_chazara_ro.gif";

//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
var def=null;
    
window.onfocus=onFocus;
    
function op(file,width,height)
  {
    if (def != null)
    def.close()
        
    leftPoint = (window.screen.availWidth-width)/2;
    topPoint  = (window.screen.availHeight-450);
    def = open(file, "PopUpWin", "width=" + width + ",height=" + height + ",scrollbars=1,status=0,top=" + topPoint + ",left=" + leftPoint);
  }
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function onFocus()
  {
    if (def != null)
    def.close()
  }
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function PopAnswer(file,width,height)
 {
   leftPoint = (window.screen.availWidth-width)/2;
   topPoint  = (window.screen.availHeight-450);
   open(file, "_blank",  "scrollbars=0,width=" + width + ",height=" + height + ",status=0,top=" + topPoint + ",left=" + leftPoint)
 }
 //-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 function GetResults()
 {
   RightAnswers = 0;
   CheckedAnswers = 0;
   for(i=0; i<4; i++)
   {
     currentChecked = false;
     for(j=0; j<3; j++)
     {
       if (document.getElementsByName("q" + (i+1)).item(j).checked && document.getElementsByName("Answerq").item(i).value == j)
       {
         RightAnswers++
         currentChecked = true;
         CheckedAnswers++;
         eval("document.all.picq"+(i+1)).src="/science/energy/images/right.gif";
       }
       else
         if (document.getElementsByName("q" + (i+1)).item(j).checked)
         {
           eval("document.all.picq"+(i+1)).src="/science/energy/images/wrong.gif";
           currentChecked = true;
           CheckedAnswers++;
         }
     }
     if (!currentChecked)
       eval("document.all.picq"+(i+1)).src="/science/energy/images/nothing.gif";
   }
   if (CheckedAnswers == 0)
     alert("!יש לסמן לפחות תשובה אחת ורק אז לשלוח לבדיקה");
   if (RightAnswers == 4)
     opAns("very_good.asp",250,200);
   else if (CheckedAnswers == 4)
    opAns("very_bad.asp",250,200);
}

function results()
{
	  var qArray
	  var qPic
	  var answer
	  
    bAnyAnswer = false;	    	 
	  for (var j=1 ; j<=5 ; j++)//j num of question (1-5)
	  {
	    qArray = "q" + j
	    qPic   = "picq" + j
	    rightAnwser = document.getElementsByName("Answerq").item(j-1).value
      
		  for (var i=0; i<document.getElementsByName(qArray).length;i++)
		  {
		    if (document.getElementsByName(qArray).item(i).checked)
        {
          bAnyAnswer = true;
  	      if (rightAnwser == i)
				    document.getElementsByName(qPic).item(i).src="../images/right.gif";
		        else if  (rightAnwser != i)
    		  		document.getElementsByName(qPic).item(i).src="../images/wrong.gif";
       }
		   else
				document.getElementsByName(qPic).item(i).src="../images/nothing.gif";
      }
	 }
   if (!bAnyAnswer)
    alert("!יש לסמן לפחות תשובה אחת ורק אז לשלוח לבדיקה");
     
 }
 //-----------------------------------------------------------------------------------------------------------------------------------------------
 function opAns(file,width,height)
  {
    if (def != null)
    def.close()
        
    leftPoint = (window.screen.availWidth-width)/2;
    topPoint  = (window.screen.availHeight-450);
    def = open(file, "PopUpWin", "width=" + width + ",height=" + height + ",scrollbars=1,status=0,top=" + topPoint + ",left=" + leftPoint);
  }
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------