﻿// JScript File

    //var Value="";
    var hh=0;
    var inter;
    var strWrongImg="";
    var strRightImg="";
function GetPoint_CallBack(response) 
{   

    var responseText = response.value;
	//alert(responseText);
	 Hide("divQ");
	if(responseText>0)
	{
	//document.getElementById("ImgAnswer").src=strRightImg;
	
	loadPopupRight();
	document.getElementById("RightDiv").style.visibility='visible';
	centerPopup("RightDiv");
	}
	else
	{
	loadPopupWrong();
	document.getElementById("WrongDiv").style.visibility='visible';
	centerPopup("WrongDiv");
	}
 }

function GetPoint1_CallBack(response) 
{   

    var responseText = response.value;	
    window.location=ResultStage1URL;


}
 function Hide(obj)
  {
            //document.getElementById(obj).className="csHide";           
            document.getElementById(obj).style.visibility='hidden';          
  } 
  
function Show(obj)
  {
         document.getElementById(obj).style.visibility='visible';
  } 
  

//SETTING UP OUR POPUP
//0 means disabled; 1 means enabled;
var popupStatus = 0;

//loading popup with jQuery magic!
    function loadPopup()
    {
    //loads popup only if it is disabled
            if(popupStatus==0)
            {
           
               $("#divQ").fadeIn(2000);
                popupStatus = 1;
            }
    }

 function loadPopupRight()
    {
    //loads popup only if it is disabled
            if(popupStatus==0)
            {
           
          // alert($("#RightDiv"));
                $("#RightDiv").fadeIn(2000);
                popupStatus = 1;
            }
    } 
    function loadPopupWrong()
    {
    //loads popup only if it is disabled
            if(popupStatus==0)
            {
           
               $("#WrongDiv").fadeIn(2000);
                popupStatus = 1;
            }
    }


function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

//centering popup
function centerPopup(obj)
{
    //request data for centering
    var windowtop =getposOffset(document.getElementById("divQ"),"top");
   var windowWidth = document.documentElement.clientWidth;   
   var windowHeight = document.documentElement.clientHeight;  
   var windowleft = getposOffset(document.getElementById("divQ"),"left");


//alert(windowWidth);
//alert(windowleft);
//alert(windowHeight);
//alert(windowtop);
    var popupHeight = $(obj).height();
    var popupWidth = $(obj).width();
    //centering
 //$(obj).css({"position": "absolute","top": windowHeight/2-windowtop/2+100,"left": windowWidth/8-windowleft/3+2});
 //$(obj).css({"position": "absolute","top": windowtop,"left": windowleft});
   //$(obj).css({"position": "absolute");
  // document.getElementById(obj);
     document.getElementById(obj).style.left=windowleft+'px';
    document.getElementById(obj).style.top=windowtop+'px';
    //alert(document.getElementById(obj).style.top);
    //only need force for IE6


}





