var currentpage = 1;
var startv = "A".charCodeAt(0);
var isquot = 0;

function showurl(src,msg,widthpx,heightpx)
{
  var x = document.clientWidth/2-150 ;
  var divBG = document.all.adddiv;
  var intLeft = 0; 
  var intTop  = 20; 
  intLeft = (document.body.offsetWidth - divBG.style.posWidth )/2 ;
  intTop  = (document.body.offsetHeight - divBG.style.posHeight )/2 ;

  if(intLeft>50)
  {
    divBG.style.posLeft = intLeft;
  }
  else 
  {
    divBG.style.posLeft = 50; 
  }

  if(intTop>50)
  {
    divBG.style.posTop = intTop;
  }
  else 
  {
    divBG.style.posTop = 40; 
  }
  document.body.scrollTop = 0;
  divBG.style.width = widthpx;
  divBG.style.height = heightpx;
  showmask();
  getContent("login.asp?nc="+new Date(),$("postbackdiv"));
  document.all.adddiv.style.display = '';
  return true;
}

//
function showmask()
{
  var divmask = $("maskdiv");
  divmask.style.display = "";
}

//
function hidemask()
{
  var divmask = $("maskdiv");
  divmask.style.display = "none";
}

//
function login()
{  
  var src = "login.asp";
  var widthpx = 250;
  var heightpx = 150;
  showmask();
  showurl(src,'ÓÃ»§µÇÂ¼',widthpx,heightpx);
}

//
function cloasewin()
{
  $("adddiv").style.display='none';
  hidemask();
}

//
function dosubmit()
{
  var pwd = $("password").value;
  var cardno = $("cardnum").value;
  var url = "login.asp?flag=login&cardnum="+cardno+"&password="+pwd;
  getScript(url);
}

//
function loadinfo()
{
   getContent("userinfo.asp",$("contentdiv"));
}

//
function loadcourse(page)
{
   var url = "getcourse.asp?flag=q";
   if(page) url+="&page="+page;
   //
   getContent(url,$("contentdiv"));
}

//
function loadfeed(page)
{
   var url = "getfeed.asp?flag=q";
   getContent(url,$("contentdiv"));
}

//
function loadquit(page)
{
   var url = "getquit.asp?flag=q";
   getContent(url,$("contentdiv"));
}

//
function loadcomplain()
{
   var url = "getcomplain.asp?flag=q";
   getContent(url,$("contentdiv"));
}
//
function setpassword()
{
   var url = "setpassword.asp?flag=q";
   getContent(url,$("contentdiv"));
}

//
function help()
{
   var url = "help.asp?nc="+new Date();
   getContent(url,$("contentdiv"));
}

//
function cancelcmp(id)
{
   var url = "getcomplain.asp?flag=cancle&id="+id;
   getScript(url,$("contentdiv"));
}

//
function showexit()
{
   $("passtd").style.display = "";
   $("exittd").style.display = "";
}

//
function loadreport()
{
   var url = "getconsultation.asp?flag=list";
   getContent(url,$("contentdiv"));
}

//
function loadpersoncourse()
{
   var url = "getpersoncourse.asp?flag=list";
   getContent(url,$("contentdiv"));
}

function viewcourse(id)
{
   var url = "viewpersoncourse.asp?flag=title&courseid="+id;
   getContent(url,$("contentdiv"));
}

function viewstata(id)
{
   var url = "viewpersoncourse.asp?flag=stata&courseid="+id;
   getContent(url,$("contentdiv"));
}

function viewuserflow(id,flowid)
{
   var url = "viewpersoncourse.asp?flag=view&courseid="+id+"&flowid="+flowid;
   getContent(url,$("contentdiv"));
}

//
function loadexam(page)
{
   var url = "getexam.asp?flag=list";
   if(page){url +="&page="+page;}
   getContent(url,$("contentdiv"));
}

//
function loadask(page)
{
   var url = "getask.asp?flag=list";
   if(page){url +="&page="+page;}
   getContent(url,$("contentdiv"));
}

//
function loadmyexam(page)
{
   var url = "getmyexam.asp?flag=list";
   if(page){url +="&page="+page;}
   getContent(url,$("contentdiv"));
}

//
function display(obj,dobj) {
  var str = obj.innerHTML;
  var outnode = obj;
  //outnode.appendChild(document.createTextNode(str));
  AMprocessNode(outnode);
  //AMprocessNode($(obj));
}

//
function checkmath(obj,dobj) {  
  if (isquot==2&&event.keyCode!=192)
  {
      var str = obj.innerHTML;
      var outnode = obj;
      AMprocessNode(outnode);
	  isquot = 0;
  }
  else if(event.keyCode==192){
      isquot = isquot + 1;
  };
}

//
function showmath(obj,dobj) {
  var str = obj.value;
  dobj.innerHTML = str;
  AMprocessNode(dobj);
}

//
function uppic(obj)
{
   window.open("uploadpic.asp?obj="+obj,"","width=300,height=240");
}
//
function showmathplayer(obj)
{
   window.open("mathplayer.asp?obj="+obj,"","width=640,height=480,scrollbar=1");
}


//
function addask()
{
   var url = "getask.asp?flag=add";
   getContent(url,$("contentdiv"));
}


function viewconsultation(id)
{
  var url = "showconsultation.asp?id="+id;
  window.open(url);
}