﻿/*
<SCRIPT src="http://www.ouhk.edu.hk/LIPACE/JS/frontpage/enrolNow.js" type=text/javascript></SCRIPT>                                       
<SCRIPT type=text/javascript> enrolNow('33520',true) </SCRIPT>   
*/


var hrefText="<a style=\"text-decoration:none \"  target=\"_top\" href='"

//var enroll="https://vis89prd.ouhk.edu.hk/psc/s89prdp/EMPLOYEE/HRMS/c/OL_APPL.OU_APP_BA.GBL?&prgcode="
//var enroll="http://www.ouhk.edu.hk/WCM/?FUELAP_TEMPLATENAME=tcSingPage&ITEMID=CCLIPACECONTENT_58094617&lang=eng&FUELAP_SITEDBID=SITE_-65"
var enroll="http://www.ouhk.edu.hk/~lcewww/notice/OnlineEnrol.htm#"                    


var onlineI="http://www.ouhk.edu.hk/LIPACE/images/web_icon/online50.gif"
var onlineIc="http://www.ouhk.edu.hk/LIPACE/images/web_icon/online50c.gif"
var online15="http://www.ouhk.edu.hk/LIPACE/images/web_icon/online_15.gif"
var online15C="http://www.ouhk.edu.hk/LIPACE/images/web_icon/online_15c.gif"



sas = Array();


sas[0]="SH004"
sas[1]="SH002"
sas[2]="SH002"
sas[3]="SB014"
sas[4]="SB013"
sas[5]="SB011"
sas[6]="SB010"
sas[7]="SB007"
sas[8]="SB006"
sas[9]="SB003"
sas[10]="SB001"
sas[11]="SA001"
sas[12]="DH009"
sas[13]="DH006"
sas[14]="DH003"
sas[15]="DH002"
sas[16]="DH001"
sas[17]="CA001"
sas[18]="DB007"
sas[19]="DB002"
sas[20]="DB002"
sas[21]="DA009"
sas[22]="DA008"
sas[23]="DA007"
sas[24]="DA006"
sas[25]="DA005"
sas[26]="DA004"
sas[27]="DA003"
sas[28]="DA002"
sas[29]="DA001"
sas[30]="DA001"
sas[31]="CH019"
sas[32]="CH018"
sas[33]="CH013"
sas[34]="CH012"
sas[35]="CH011"
sas[36]="CH008"
sas[37]="CH006"
sas[38]="CH005"
sas[39]="CH004"
sas[40]="CH003"
sas[41]="CH002"
sas[42]="CH001"
sas[43]="CB014"
sas[44]="CB011"
sas[45]="CB009"
sas[46]="CB008"
sas[47]="CB006"
sas[48]="CB004"
sas[49]="CB003"
sas[50]="CB001"
sas[51]="CA033"
sas[52]="CA029"
sas[53]="CA027"
sas[54]="CA026"
sas[55]="CA025"
sas[56]="CA024"
sas[57]="CA023"
sas[58]="CA022"
sas[59]="CA021"
sas[60]="CA020"
sas[61]="CA019"
sas[62]="CA018"
sas[63]="CA017"
sas[64]="CA016"
sas[65]="CA016"
sas[66]="CA015"
sas[67]="CA014"
sas[68]="CA013"
sas[69]="CA012"
sas[70]="CA011"
sas[71]="CA010"
sas[72]="CA009"
sas[73]="CA009"
sas[74]="CA008"
sas[75]="CA007"
sas[76]="CA006"
sas[77]="CA005"
sas[78]="CA004"
sas[79]="CA004"
sas[80]="CA003"
sas[81]="CA002"
sas[82]="SB015"
sas[83]="CA036"
sas[84]="SA002"
sas[85]="DA014"
sas[86]="DA015"
sas[87]="DH017"
sas[89]="CA054"
sas[90]="CA037"
sas[91]="SA005"
sas[92]="SA005"
sas[93]="SA006"
sas[94]="SA010"
sas[95]="SA004"
sas[96]="SA009"
sas[97]="SA007"
sas[98]="SH006"
sas[99]="SB016"
sas[100]="SB016"
//sas[100]="DB021"
//sas[101]="SB017"
sas[101]="CA058"
//sas[102]="DB018"
sas[102]="SA011"
sas[103]="CA028"
//sas[104]="SH008"
sas[105]="CA061"
sas[106]="CA065"
  



//SB017
//sb021
//DB018




function enrolNow(x,y){

urlVal=location.search;
//document.write(urlVal);
//if ((urlVal.indexOf("&SASTEST=TRUE") >=0)||(urlVal.indexOf("&sastest=true") >=0)){
      foundU=false;
      foundD=false;
      for (i=0; i<sas.length; i++)
                    if (sas[i]==x) {
                             
                           if (!foundU){ 

                               if(y==true){
                                       document.write(hrefText)
                                       document.write(enroll,sas[i])
                                       document.write("'>") 
                                       document.write("Enrol Now</a>")                                       

//                                      document.write("<img border=\"0\" src=\"",onlineI,"\" alt=\"Online Enrol:",x,"\"></a>")
                                       foundU=true;
                               }
                               else{

                                       document.write(hrefText)
                                       document.write(enroll,sas[i])
                                       document.write("'>")

                                        document.write("即時網上報名</a>")                                       
//                                       document.write("<img border=\"0\" src=\"",onlineIc,"\" alt=\"網上報名:",x,"\"></a>")
                                       foundU=true;
                            }//end if y==ture

                            i=sas.length;
                          }//if !foundU

                     }//if sas==x

        if (!foundU) {
              if(y==true)
                      document.write("<font color=\"#FF0000\">Online Enrol is not applicable</font>")
              else
                      document.write("<font color=\"#FF0000\">本課程不提供網上報名</font>")
       }

//}//if (location.search.indexOf("&sastest=true") >=0
}


function findEnrol(x){

      foundU=false;
      for (i=0; i<sas.length; i++)
                    if (sas[i]==x) {
                             
                           if (!foundU){ 

                                       foundU=true;
                                       return foundU;
                         
                          }//if !foundU

                     }//if sas==x

return foundU;
}








function TestNow(x,y){

urlVal=location.search;
//document.write(urlVal);
if ((urlVal.indexOf("&SASTEST=TRUE") >=0)||(urlVal.indexOf("&sastest=true") >=0)){
      foundU=false;
      foundD=false;
      for (i=0; i<sas.length; i++)
                    if (sas[i]==x) {
                             
                           if (!foundU){ 

                               if(y==true){
                                       document.write(hrefText)
                                       document.write(enroll,sas[i])
                                       document.write("'>") 
                                      document.write("<img border=\"0\" src=\"",onlineI,"\" alt=\"Online Enrol:",x,"\"></a>")
                                       foundU=true;
                               }
                               else{

                                       document.write(hrefText)
                                       document.write(enroll,sas[i])
                                       document.write("'>")
                                       document.write("<img border=\"0\" src=\"",onlineIc,"\" alt=\"網上報名:",x,"\"></a>")
                                       foundU=true;
                            }//end if y==ture

                            i=sas.length;
                          }//if !foundU

                     }//if sas==x

        if (!foundU) {
              if(y==true)
                      document.write("Online Enrol is not applicable (TEST for:",x,")")
              else
                      document.write("本課程不提供網上報名 (TEST for:",x,")")
       }

}//if (location.search.indexOf("&sastest=true") >=0
}
