            function GetCookieVal(offset) {
                var endstr = document.cookie.indexOf(";", offset);
                if (endstr == -1) { endstr = document.cookie.length; }
                return unescape(document.cookie.substring(offset, endstr));
            } 

            function GetCookie(name) {
                
                var arg = name + "=";
                var alen = arg.length;
                var clen = document.cookie.length;
                var i = 0;
                while (i < clen) {
                    var j = i + alen;
                    if (document.cookie.substring(i, j) == arg) {
                        return GetCookieVal(j);
                    }
                    i = document.cookie.indexOf(" ", i) + 1;
                    if (i == 0) break;
                }
                return null;
            }

            function DeleteCookie(name, path, domain) {
                if (GetCookie(name)) {
                    document.cookie = name + "=" +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-2000 00:00:01 GMT";
                }
            }
            function SetCookie(name, value, expires, path, domain, secure) {

              
window.opener.document.cookie = name + "=" + escape(value) +
    ((expires) ? "; expires=" + expires.toGMTString() : "") +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    ((secure) ? "; secure" : "");
                
            }


            function signOutEvent(UserDetailsLable) {
                $('[id*=rowSignOut]').hide();
                document.getElementById(UserDetailsLable).innerHTML = "";
                
                //for setting cookie value null
                if (-1) {
                    var date = new Date();
                    date.setTime(date.getTime() + (-1 * 24 * 60 * 60 * 1000));
                    var expires = "; expires=" + date.toGMTString();
                }
                else var expires = "";
                document.cookie = "REMUSERFIRSTNAME" + "=" + "" + expires + "; path=/";
                
                
            }

            function SignOut() {
                
                $.ajax({
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    url: "DesktopModules/TravelerProfile/TravelerService.asmx/SignOut",
                    data: "",
                    success: function (response) {
                        var jSonResult = eval('(' + response.d + ')');
                        if (jSonResult != null && jSonResult != 'undefined') {
                            if (jSonResult.SessionExpired == false) {
                                if (jSonResult.IsSucceed == true) {
                                }
                                else {
                                    var errors = jSonResult.ErrorInfo.split('.');
                                    var errorHtml = "";
                                    $(errors).each(function () { if (this.trim() != "") errorHtml += "<li>" + this + "</li>"; });

                                }
                            }
                        }

                    },
                    error: function (xmlHttpRequest, status, err) {

                    }
                });
            }

            function UserSignIn(isAuthenticated, rowSignOutId, rowSignInId, IsPaymentPage,tabId) {

                var userFirstName;
                if (document.getElementById('sepaSignIn') != null) {
                    $('[id*=sepaSignIn]').show();
                }
                if (isAuthenticated == "True") {
                    if (IsPaymentPage == "false") {
                        document.getElementById(rowSignOutId).style.display = 'inline';
                    }
                    if (document.getElementById(rowSignInId) != null) {
                        document.getElementById(rowSignInId).style.display = 'none';
                    }
                    document.getElementById('sepaMyAcc').style.display = 'inline';
                    if (document.getElementById('sepaSignOut') != null) {
                        document.getElementById('sepaSignOut').style.display = 'inline';
                    }
                    if (document.cookie.length > 0) {
                        userFirstName = GetCookie('REMUSERNAME');
                        $('#lblUserDetail').html("Welcome " + userFirstName + ", ");
                        document.getElementById('hypMyAccount').style.display = 'inline';
                        document.getElementById('hypMyAccount').setAttribute('href', '/default.aspx?tabid='+ tabId);
                    }
                }
                else {
                    if (document.getElementById('hypMyAccount') != null) {
                        document.getElementById('hypMyAccount').style.display = 'none';
                    }
                    if (document.getElementById('sepaSignOut') != null) {
                        document.getElementById('sepaSignOut').style.display = 'none';
                    }
                }
            }

            function signOutClick() {
                signOutEvent("lblUserDetail");
                window.location = "/Admin/Security/logoff.aspx";
                //document.getElementById('<%=rowSignIn.ClientID%>').style.display = 'inline';
            }


