var httpsUrl = "https://Login.mcircle.co.kr/hidocTFT/";

function SSL() {
    this.RecommendName;
    this.RecommendEmailID;
    this.RecommendEmailHost;
    this.Name;
    this.Regno1;
    this.Regno2;
    this.Type;
    this.ID;
    this.Password;
    this.PasswordQ;
    this.PasswordA;
    this.NickName;
    this.EmailID;
    this.EmailHost;
    this.ZipCode;
    this.Address;
    this.DetailAddress;
    this.AddressType;
    this.Tel1;
    this.Tel2;
    this.Tel3;
    this.Mobile1;
    this.Mobile2;
    this.Mobile3;
    this.IsSMSReceive;
    this.Email;
    this.IsEmailReceive;
    this.TargetPath;
    this.Job;
    this.Route;
    this.BornYear;
    this.BornMonth;
    this.BornDay;
    this.BornType;
    this.WeddingYear;
    this.WeddingMonth;
    this.WeddingDay;
    this.WeddingType;

    this.Content;
    this.Title;
    this.File;
    this.RegisteredName;

    this.ReturnUrl;
    this.RedirectUrl;

    this.Send = function() {
        if (this.TargetPath != null) {
            // º¸³¾ÆûÀ» »ý¼º 
            var sslForm = document.createElement("FORM");
            
            // ¼º¸í
            if (this.RecommendName != null)
                sslForm.appendChild(AddSSLFormObject("RecommendName", this.RecommendName));
            // Email
            if (this.RecommendEmailID != null)
                sslForm.appendChild(AddSSLFormObject("RecommendEmailID", this.RecommendEmailID));
            // Email
            if (this.RecommendEmailHost != null)
                sslForm.appendChild(AddSSLFormObject("RecommendEmailHost", this.RecommendEmailHost));
                                                
            // ¼º¸í
            if (this.Name != null)
                sslForm.appendChild(AddSSLFormObject("Name", this.Name));

            // ÁÖ¹Î¹øÈ£1
            if (this.Regno1 != null)
                sslForm.appendChild(AddSSLFormObject("Regno1", this.Regno1));

            // ÁÖ¹Î¹øÈ£2
            if (this.Regno2 != null)
                sslForm.appendChild(AddSSLFormObject("Regno2", this.Regno2));

            // ¾ÆÀÌµð
            if (this.ID != null)
                sslForm.appendChild(AddSSLFormObject("ID", this.ID));

            // Password
            if (this.Password != null)
                sslForm.appendChild(AddSSLFormObject("Password", this.Password));

            if (this.AddressType != null)
                sslForm.appendChild(AddSSLFormObject("AddressType", this.AddressType));

            // ZIpCode
            if (this.ZipCode != null)
                sslForm.appendChild(AddSSLFormObject("ZipCode", this.ZipCode));

            // Address
            if (this.Address != null)
                sslForm.appendChild(AddSSLFormObject("Address", this.Address));

            // DetailAddress
            if (this.DetailAddress != null)
                sslForm.appendChild(AddSSLFormObject("DetailAddress", this.DetailAddress));

            // Tel1
            if (this.Tel1 != null)
                sslForm.appendChild(AddSSLFormObject("Tel1", this.Tel1));

            // Tel2
            if (this.Tel2 != null)
                sslForm.appendChild(AddSSLFormObject("Tel2", this.Tel2));

            // Tel3
            if (this.Tel3 != null)
                sslForm.appendChild(AddSSLFormObject("Tel3", this.Tel3));

            // Mobile1
            if (this.Mobile1 != null)
                sslForm.appendChild(AddSSLFormObject("Mobile1", this.Mobile1));

            // Mobile2
            if (this.Mobile2 != null)
                sslForm.appendChild(AddSSLFormObject("Mobile2", this.Mobile2));

            // Mobile3
            if (this.Mobile3 != null)
                sslForm.appendChild(AddSSLFormObject("Mobile3", this.Mobile3));

            // Email
            if (this.Email != null)
                sslForm.appendChild(AddSSLFormObject("Email", this.Email));

            // Type
            if (this.Type != null)
                sslForm.appendChild(AddSSLFormObject("Type", this.Type));

            // IsSMSReceive
            if (this.IsSMSReceive != null)
                sslForm.appendChild(AddSSLFormObject("IsSMSReceive", this.IsSMSReceive));

            // IsEmailReceive
            if (this.IsEmailReceive != null)
                sslForm.appendChild(AddSSLFormObject("IsEmailReceive", this.IsEmailReceive));

            // ¸®ÅÏ URL¼³Á¤
            if (this.ReturnUrl == null)
                sslForm.appendChild(AddSSLFormObject("ReturnUrl", location.href));
            else
                sslForm.appendChild(AddSSLFormObject("ReturnUrl", "http://" + location.host + this.ReturnUrl));

            // RedirectUrl
            if (this.RedirectUrl != null)
                sslForm.appendChild(AddSSLFormObject("RedirectUrl", this.RedirectUrl));

            if (this.PasswordQ != null)
                sslForm.appendChild(AddSSLFormObject("PasswordQ", this.PasswordQ));

            if (this.PasswordA != null)
                sslForm.appendChild(AddSSLFormObject("PasswordA", this.PasswordA));

            if (this.NickName != null)
                sslForm.appendChild(AddSSLFormObject("NickName", this.NickName));

            if (this.EmailID != null)
                sslForm.appendChild(AddSSLFormObject("EmailID", this.EmailID));

            if (this.EmailHost != null)
                sslForm.appendChild(AddSSLFormObject("EmailHost", this.EmailHost));

            if (this.TargetPath != null)
                sslForm.appendChild(AddSSLFormObject("TargetPath", this.TargetPath));

            if (this.Job != null)
                sslForm.appendChild(AddSSLFormObject("Job", this.Job));

            if (this.Route != null)
                sslForm.appendChild(AddSSLFormObject("Route", this.Route));

            if (this.BornYear != null)
                sslForm.appendChild(AddSSLFormObject("BornYear", this.BornYear));

            if (this.BornMonth != null)
                sslForm.appendChild(AddSSLFormObject("BornMonth", this.BornMonth));

            if (this.BornDay != null)
                sslForm.appendChild(AddSSLFormObject("BornDay", this.BornDay));

            if (this.BornType != null)
                sslForm.appendChild(AddSSLFormObject("BornType", this.BornType));

            if (this.WeddingYear != null)
                sslForm.appendChild(AddSSLFormObject("WeddingYear", this.WeddingYear));

            if (this.WeddingMonth != null)
                sslForm.appendChild(AddSSLFormObject("WeddingMonth", this.WeddingMonth));

            if (this.WeddingDay != null)
                sslForm.appendChild(AddSSLFormObject("WeddingDay", this.WeddingDay));

            if (this.WeddingType != null)
                sslForm.appendChild(AddSSLFormObject("WeddingType", this.WeddingType));

            if (this.Gender != null)
                sslForm.appendChild(AddSSLFormObject("Gender", this.Gender));

            if (this.Title != null)
                sslForm.appendChild(AddSSLFormObject("Title", this.Title));

            if (this.Content != null)
                sslForm.appendChild(AddSSLFormObject("Content", this.Content));

            if (this.File != null)
                sslForm.appendChild(AddSSLFormObject("File", this.File));

            if (this.RegisteredName != null)
                sslForm.appendChild(AddSSLFormObject("RegisteredName", this.RegisteredName));

            // ÆûÀ» Àü¼Û            
            var lastFormIndex = document.forms.length;

            document.appendChild(sslForm);

            document.forms[lastFormIndex].action = httpsUrl + this.TargetPath;

            document.forms[lastFormIndex].method = "post";

            document.forms[lastFormIndex].submit();

            return false;
        }
        else {
            alert("SSL°´Ã¼¿¡ TargetPath °ªÀÌ ÁöÁ¤µÇÁö ¾Ê¾Ò½À´Ï´Ù.");
            location.reload();
            return false;
        }
    }
}

function AddSSLFormObject(name, value) {
    var sslParam = document.createElement("INPUT");

    sslParam.type = "hidden";
    sslParam.name = name;
    sslParam.value = value;

    return sslParam;
}