//var httpsUrl = "https://192.168.1.14/";
//var httpsUrl = "https://211.219.15.101/";
var httpsUrl = "https://www.local114.co.kr/SSL/Counia/";
 
function SSL()
{
    this.Name;
    this.Regno1;
    this.Regno2;
    this.ID;
    this.Password;
    this.ZIpCode;
    this.Address;
    this.DetailAddress;
    this.Tel1;
    this.Tel2;
    this.Tel3;
    this.Mobile1;
    this.Mobile2;
    this.Mobile3;
    this.IsSMSReceive;
    this.Email;
    this.IsEmailReceive;
    this.Region;
    this.Part;
    
    this.TargetPath;
    
    this.ReturnUrl;
    this.RedirectUrl;
    
    this.Send = function()
    {   
        if(this.TargetPath != null)
        {
            // 보낼?을 ?성 
            var sslForm = document.createElement("FORM");

            // ?명
            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));
                
            // 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));
                
            // Region
            if(this.Region != null)
                sslForm.appendChild(AddSSLFormObject("Region",this.Region));
                
            // Part
            if(this.Part != null)
                sslForm.appendChild(AddSSLFormObject("Part",this.Part));                
                
            // 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));
            
            // ?을 ?송            
            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;
}
