﻿
var useerr;
function checktutorial(TID,THID,Ctype,Utype)
{
    setuser(Ctype);
    if(checkvaliduser(Ctype,Utype))
    {
        window.location.href="Tutorial.aspx?TID=" + TID + "&THid=" + THID;
    }
   else
   {
       showUpdate(useerr);
   }
}

function checkbasictest(BLTID,Ctype,Utype)
{
    setuser(Ctype);
    if(checkvaliduser(Ctype,Utype))
    {
        window.location.href="TestCentre/StartBasic.aspx?BLTID=" + BLTID;
    }
   else
   {
       showUpdate(useerr);
   }
}
function checkcat(CATID,Ctype,Utype)
{
//debugger;
    setuser(Ctype);
    if(checkvaliduser(Ctype,Utype))
    {
        window.location.href="TestCentre/StartCat.aspx?CLTID=" + CATID;
    }
   else
   {
       showUpdate(useerr);
   }
}
function setuser(Ctype)
{
  if (Ctype == "2")
    {
        useerr = "Registered";
    }
    else if (Ctype == "3")
    {
        useerr = "Paid";
    }  
}
function checkvaliduser(Ctype,Utype)
{
    var flag=0;
    if ((Utype == "0") && (Ctype == "1"))
    {
        flag = 1;
    }
    else if (((Utype == "1") || (Utype == "3")) && ((Ctype == "2") || (Ctype == "1")))
    {
        flag = 1;
    }
    else if ((Utype == "2") || (Utype == "4") || (Utype == "5") || (Utype == "6"))
    {
        flag = 1;
    }
    else
    {
        flag = 0;
    }
    return flag;
}
