﻿
        $(document).ready(function () {
            $(".cb-form").colorbox({ href: "/modal/", iframe: true, innerWidth: 730, innerHeight: 680, opacity: 0.6, onClosed: function () {
                $.ajax({
                    url: '/optimizer/session-reset.aspx',
                    success: function (data) {
                    }
                });

                $.ajax({
                    url: '/optimizer/social/call-pop-up.aspx',
                    success: function (data) {
                        if (data.trim().toString() == "true") {
                            $(document).oneTime(2000, 'shortTerm', function (i) {
                                callSocialPopUp();
                            });
                        }
                    }
                });
            }
            });
        });


    //Modal - Populate Zip Code
        var obj;
        function goModal(inObj) {
            var zipcode = $(".populate-zip").val().replace("Enter Zip Code", "");
            inObj.colorbox({ iframe: true, href: "/modal/?zipcode=" + zipcode, innerWidth: 730, innerHeight: 680, opacity: 0.6, onClosed: function () {

                $.ajax({
                    url: '/optimizer/session-reset.aspx',
                    success: function (data) {
                    }
                });

                $.ajax({
                    url: '/optimizer/social/call-pop-up.aspx',
                    success: function (data) {

                        if (data.trim().toString() == "true") {
                            $(document).oneTime(2000, 'shortTerm', function (i) {
                                callSocialPopUp();
                            });
                        }
                    }
                });

            }
            });
        }
        $(document).ready(function () {
            $(".get-local-deals-med-btn").click(function () { obj = $(this); goModal(obj); });
        });


    //Social Pop Up
        function callSocialPopUp() {
            $().colorbox({ open: true, href: '/modal/social-pop-up.aspx', iframe: true, innerWidth: 730, innerHeight: 430 });
            $(".header-holder").addClass("social-class");
            $(".header-holder .social").show();
        }
    //Jquery Colorbox ends
