﻿// JScript File






function CheckDownLoads(path)
{   
    //debugger;
    if(UserName=="")
    {
        if(confirm("You have to LOGIN for Downloading the files.Select OK to LOGIN."))
        {   
              var sPath = window.location.pathname;
              var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
              sPage=sPage.replace(".aspx","");
  
              window.location.href="http://www.ismbangalore.com/ISMLogin.aspx?page="+sPage;
        } 
    }
    else
    {
        //window.location.href="http://www.ismbangalore.com";
        window.location.href=path;
        
    }
}

function ScholershipLogin(path,from)
{    
    if(UserName=="")
    {
        if(confirm("You have to LOGIN for Taking up the Scholarship Test.Select OK to LOGIN."))
        {   
            UserLogin();                   
        } 
    }
    else
    {   
        /*if(from=="ScholershipTest")
            window.location.href="Instruction.aspx";
        else*/
            window.location.href=path;
        
    }
}


function OpenTest(path)
{
//debugger;
    /*if(UserName=="")
    {
        if(confirm("You have to LOGIN for Downloading the files.Select OK to LOGIN."))
        {   
            UserLogin();                   
        } 
    }
    else
    {*/
        //window.location.href="http://www.ismbangalore.com";
        //window.location.href=path;
        window.open(path,'mypage','fullscreen=yes,scrollbars=yes')
        
    //}
    

}


function  GetScreenY()
{
if (window.innerHeight && window.scrollMaxY) 
     {
        // Firefox         
        yWithScroll = window.innerHeight + window.scrollMaxY;         
        xWithScroll = window.innerWidth + window.scrollMaxX;     
     } 
     else if (document.body.scrollHeight > document.body.offsetHeight)
     { 
        // all but Explorer Mac         
        yWithScroll = document.body.scrollHeight;         
        xWithScroll = document.body.scrollWidth;     
     } 
     else 
     { 
        // works in Explorer 6 Strict, Mozilla (not FF) and Safari        
        yWithScroll = document.body.offsetHeight;
        xWithScroll = document.body.offsetWidth;       
     }     
     
     return yWithScroll;
}


function popUpRegister()
{   
    document.getElementById("ISMLogo").style.display="none";
    ClearFields();
    var reg=document.getElementById("ParentPopup");    
    var regchild=document.getElementById("divRegister");    
    var Login=document.getElementById("popUpLogin");     
    
    Login.style.display="none";
          
    var t;
    t="<table style='width:100%;height:" + GetScreenY() +"px;background-color:white' >";
    t=t+"<tr valign='middle' align='center'>";
    t=t+"<td>";    
    t=t+"</td>";
    t=t+"</tr>";
    t=t+"</table>";
    
    reg.innerHTML=t;

    reg.style.display="block";
    //reg.style.opacity = 50;
	reg.style.filter = 'alpha(opacity=95)';

    regchild.style.display="block";
    MaintainValidators("Register");
}


function ClosePopUp()
{   
    var reg=document.getElementById("ParentPopup");    
    var regchild=document.getElementById("divRegister"); 
    
    reg.style.display="none";
    regchild.style.display="none";
    document.getElementById("ISMLogo").style.display="block";
}   

function UserLogin()
{   
    if(document.getElementById("ISMLogo")!=null)
    document.getElementById("ISMLogo").style.display="none";
    
    ClearFields();
    var OpacityDIV=document.getElementById("ParentPopup");    
    var Login=document.getElementById("popUpLogin");    
          
    var t;
    t="<table style='width:100%;height:" + GetScreenY() +"px;background-color:white' >";
    t=t+"<tr valign='middle' align='center'>";
    t=t+"<td>";    
    t=t+"</td>";
    t=t+"</tr>";
    t=t+"</table>";
    
    OpacityDIV.innerHTML=t;

    OpacityDIV.style.display="block";    
	OpacityDIV.style.filter = 'alpha(opacity=95)';
    Login.style.display="block";
//    MaintainValidators("Login");        
}


function CloseLogin()
{
    var OpacityDIV=document.getElementById("ParentPopup");    
    var Login=document.getElementById("popUpLogin"); 
    
    OpacityDIV.style.display="none";    	
    Login.style.display="none";
    document.getElementById("ISMLogo").style.display="block";
}

function MaintainValidators(flag)
{
    if(flag=="Login")
    {
        
    }
    else
    {
        document.getElementById("txtLoginName").value="a";
        document.getElementById("txtLoginPass").value="a";
    } 
}




function ClearFields()
{
        document.getElementById("txtLoginName").value="";
        document.getElementById("txtLoginPass").value="";
}

function MaintainValidatorsForOtherPage()
{  

    document.getElementById("txtLoginName").value="a";
    document.getElementById("txtLoginPass").value="a";
}



//document.getElementById("divLoading").style.display="none";


