﻿/*
<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://vis90prd.ouhk.edu.hk/psc/s90prdp/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]="DH006"
sas[15]="DH002"
sas[16]="DH001"
sas[17]="CA001"
sas[18]="DB007"
sas[19]="DB002"
sas[20]="DB002"
sas[21]="DA009"
sas[22]="DA007"
sas[23]="DA006"
sas[24]="DA005"
sas[25]="DA004"
sas[26]="DA003"
sas[27]="DA002"
sas[28]="DA001"
sas[29]="DA001"
sas[30]="CH019"
sas[31]="CH000"
//sas[31]="CH018"
sas[32]="CH013"
sas[33]="CH012"
sas[34]="CH011"
sas[35]="CH011"
sas[36]="CH006"
sas[37]="CH005"
sas[38]="CH004"
sas[39]="CH003"
sas[40]="CH002"
sas[41]="CH001"
sas[42]="CB014"
sas[43]="CB011"
sas[44]="CB009"
sas[45]="CB008"
sas[46]="CB006"
sas[47]="CB004"
sas[48]="CB003"
sas[49]="CB001"
sas[50]="CA033"
sas[51]="CA029"
sas[52]="CA027"
sas[53]="CA026"
sas[54]="CA025"
sas[55]="CA024"
sas[56]="CA023"
sas[57]="CA022"
sas[58]="CA021"
sas[59]="CA020"


sas[60]="CA010"
sas[61]="CA009"
sas[62]="CA009"
sas[63]="CA008"
sas[64]="CA007"
sas[65]="CA006"
sas[66]="CA005"
sas[67]="CA004"
sas[68]="CA004"
sas[69]="CA003"
sas[70]="CA002"
sas[71]="SB015"
sas[72]="CA036"
sas[73]="SA002"
sas[74]="DA014"
sas[75]="DA015"
//******
sas[76]="DA015"
sas[77]="CA054"
sas[78]="CA037"
sas[79]="SA005"
sas[80]="SA005"
sas[81]="SA006"
sas[82]="SA010"
sas[83]="SA004"
sas[84]="SA009"
sas[85]="SA007"
sas[86]="SH006"
sas[87]="SB016"
sas[88]="SB016"
sas[89]="CA058"
sas[90]="SA011"
sas[91]="CA028"
sas[92]="CA061"
sas[93]="CA065"
sas[94]="CH024"  
sas[95]="SA013"  
sas[96]="CBMP"
sas[97]="SH010"
sas[98]="SB020"
sas[99]="SB019"
sas[100]="SB018"
sas[101]="SB021"
sas[102]="CA057"
sas[103]="EAOU"

sas[104]="CA055"
sas[105]="CA060"
sas[106]="CA059"
sas[107]="SH011"
sas[108]="SH012"
sas[109]="CA067"

//sas[104]="CH018"
//sas[61]="CA019"
//sas[62]="CA018"
//sas[63]="CA017"
//sas[64]="CA016"
//sas[66]="CA015"
//sas[67]="CA014"
//sas[68]="CA013"
//sas[69]="CA012"
//sas[22]="DA008"
//sas[70]="CA011"










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\">Not applicable</font>")
//                      document.write("<font color=\"#FF0000\">Online Enrol is not applicable</font>")
              else
                      document.write("<font color=\"#FF0000\">不提供</font>")
//                      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
}

