
function switchFunction(modul,url)
{ if (url==null) 
  url=root;
  
   switch(modul){
      case "exam":
         SetCookie("soft_modul","exam",1);
         parent.main.location=url+"exam/enterexam.aspx";
         break;
      case "work":
         SetCookie("soft_modul","work",1);
         break;
      case "elearning":
         SetCookie("soft_modul","elearning",1);
         parent.main.location=url+"elearning/index.aspx";
         break;
   }

function CodeCookie(str)
{
var strRtn="";

for (var i=str.length-1;i>=0;i--)
{
strRtn+=str.charCodeAt(i);
if (i) strRtn+="a"; 
}
return strRtn;
}	

//SetCookie("cwq","1975",0)
//alert(GetCookie("cwq"))

function SetCookie(name,value,expires)
{


if (expires==1)
{var exp=new Date("December 31, 3666");;//长期有效的办法//;new Date()//
document.cookie=name+"="+encodeURIComponent(CodeCookie(value))+" ;  expires="+exp.toGMTString()+" ; path=/";
}
else
{var exp=new Date()//new Date("December 31, 3666");;//长期有效的办法//;
exp.setTime(exp.getTime()-exp.getTime());
document.cookie=name+"="+encodeURIComponent(CodeCookie(value))+" ;  expires="+exp.toGMTString()+" ; path=/";

}


}





}