﻿function showAlert()
{
    alert("Please click \"Add to my study desk\" to purchase this lesson first. The courseware is Can$"+ cprice +". \nIf you haven't registered an account with us, please register first.");
}

function AddToStudydesk(string, cid, username){    
  ScreenConvert(); 
  var ShowDiv="<div style=\"padding:0px;\">"
    + "<table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">"
    +  "  <tr>"
    +  "      <td style=\"width:100%; height:20px; background-color:Green;\"></td>"
    +  "  </tr>"
    +  "  <tr>"
    +  "      <td align=\"center\" style=\"padding:15px 5px 15px 5px;height:60px;\"><span id=\"spContent\">Adding this courseware to your study desk will deduct Canadian $ " + string + " from your account.</span></td>"
    +  "  </tr>"
    +  "  <tr>"
    +  "      <td align=\"right\" style=\"padding-right:15px;\"><input type=\"checkbox\" id=\"isNextShow\" />Skip this message next time.</td>"
    +  "  </tr>"
    +  "  <tr>"
    +  "      <td align=\"right\" style=\"padding-right:15px;\">"
    +  "      <input type=\"button\" value=\"OK\" onclick=\"CommonPayment('/ajaxHandle/HandleAddtostudydesk.aspx?cid=" + cid +"&cPrice=" + string + "&username=" + username + "');\" />"
    +  "      <input type=\"button\" value=\"Cancel\" onclick=\"handleIsShow('lesson.aspx -- addtomystudydeskButton');DialogHide();\" />"
    +  "      </td>"
    +  "  </tr>"
    + "</table>  "
    + "</div>";  
  DialogShow(ShowDiv,250,120,340,150);
  return false;
}   

function JudgeBalance(string, cid, username)
{
  ScreenConvert(); 
  var ShowDiv="<div style=\"padding:0px;\">"
    + "<table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">"
    +  "  <tr>"
    +  "      <td style=\"width:100%; height:20px; background-color:Green;\"></td>"
    +  "  </tr>"
    +  "  <tr>"
    +  "      <td align=\"center\" style=\"padding:15px 5px 15px 5px;height:60px;\">Your account balance is not enough to cover the item. We'll bring you to the add fund page where you can add more fund. After that, the amount for this item will be automatically deducted. </td>"
    +  "  </tr>"
    +  "  <tr>"
    +  "      <td align=\"right\" style=\"padding-right:15px;\">&nbsp;</td>"
    +  "  </tr>"
    +  "  <tr>"
    +  "      <td align=\"right\" style=\"padding-right:15px;\" valign=\"bottom\">"
    +  "      <input type=\"button\" value=\"OK\" onclick=\"return AddToStudydesk('" + string + "','" + cid + "','" + username + "');\" />"
    +  "      <input type=\"button\" value=\"Cancel\" onclick=\"handleIsShow('lesson.aspx -- addtomystudydeskButton');DialogHide();\" />"
    +  "      </td>"
    +  "  </tr>"
    + "</table>  "
    + "</div>";  
  DialogShow(ShowDiv,250,120,340,150);
  
  return false;
}   
