﻿//*******************************************************//
//  程式代碼: CommonGo.js                                //
//  程式名稱: Gordon 共用 javascript                     //
//  撰寫日期: 2010.05.03                                 //
//  撰寫人員: Gordon                                     //
//*******************************************************//
//  修改日期:                                            //
//  修改人員:                                            //
//*******************************************************//

/****************************************
     我們的服務>>我的症狀要預約哪類
*****************************************/

//搜尋功能
var OurService = {
    "Service3_Search" : function(sQuestion){
        //alert(sQuestion);
        MyAjax.Service3_Search(sQuestion,OurService.Service3_Search_Progress);
    }
   ,"Service3_Search_Progress": function(response) {
        //xslt - Page_OurService01.xslt
        document.getElementById("div_OurService01").innerHTML = response.value;
        document.getElementById("div_OurService02").innerHTML = "";
   }
   ,"Service3_GoodsDetail" : function(sCatID){
        //alert(sQuestion);
        MyAjax.Service3_GoodsDetail(sCatID,OurService.Service3_GoodsDetail_Progress);
    }
   ,"Service3_GoodsDetail_Progress": function(response) {
        //xslt - Page_OurService02.xslt
        document.getElementById("div_OurService02").innerHTML = response.value;
   }
   ,"Service3_Order" : function(sGoodID,sHospitalID){
        //alert(sQuestion);
        //確認是否已登入
        var Result = MyAjax.CheckLogin().value;
        if(Result == "0")
        {   
            if(confirm("尚未登入系統，是否現在登入?"))
            {
                MyAjax.RememberUrl("ContentDetail.aspx?mid=OurService&cid=4");                    
                location.href = "ContentDetail.aspx?mid=Login";
            }
        }
        else
        {
            MyAjax.Service3_Order(sGoodID,sHospitalID,OurService.Service3_Order_Progress);
        }
        
    }
   ,"Service3_Order_Progress": function(response) {
        if(response.value == "")
        {
            location.href("./ContentDetail.aspx?mid=search_onlineservice_order");
        }
   }
   ,"Service1_Order" : function(sHospitalGoodID,sHospitalID,sGoodID){
        //alert(sQuestion);
        //確認是否已登入
        var Result = MyAjax.CheckLogin().value;
        if(Result == "0")
        {               
            if("尚未登入系統，是否現在登入?")
            {
                MyAjax.RememberUrl("ContentDetail.aspx?mid=Goods&cid=" + sGoodID);                    
                location.href = "ContentDetail.aspx?mid=Login";
            }
        }
        else
        {
            MyAjax.Service3_Order(sHospitalGoodID,sHospitalID,OurService.Service1_Order_Progress);
        }
        
    }
   ,"Service1_Order_Progress": function(response) {
        if(response.value == "")
        {
            location.href("./ContentDetail.aspx?mid=search_onlineservice_order");
        }
   }
}

/****************************************
     會員登入 >> 忘記密碼
*****************************************/

//忘記密碼
var Password = {
    "Password_Send" : function(){
        //alert(sQuestion);
        if(document.getElementById("LoginID").value == "")
        {
            alert("請輸入帳號");
            document.getElementById("LoginID").focus();
            return;
        }
        if(document.getElementById("EmailAddress").value == "")
        {
            alert("請輸入E-Mail");
            document.getElementById("EmailAddress").focus();
            return;
        }
        var sLoginID = document.getElementById("LoginID").value;
        var sEmailAddress = document.getElementById("EmailAddress").value;
        MyAjax.SendPassword(sLoginID,sEmailAddress,Password.Password_Send_Progress);
    }
    ,"Password_Send_Progress": function(response) {
        if(response.value == "")
        {
            alert("已成功寄出，請至E-Mail信箱收取信件");
            location.href("./ContentDetail.aspx?mid=Login");
        }
        else
        {
            alert(response.value);
        }
   }
}

/****************************************
     醫療服務
*****************************************/
var HospitalService = {
    "GetGoodsDetail" : function(sHospitalID,sNewsID){
        //alert(sHospitalID);

        MyAjax.HospitalService_GetGoodsDetail(sHospitalID,sNewsID,HospitalService.GetGoodsDetail_Progress);
    }
    ,"GetGoodsDetail_Progress": function(response) {
        //alert(response.value);
        if(response.value != "")
        {
            document.getElementById("DivServiceDetail").innerHTML = response.value;
        }
   }
}
