﻿/// <reference path="jquery-1.4.1-vsdoc.js" />

if (window.console == undefined) {
    window.console = function () { };
}
if (window.console.log == undefined) {
    window.console.log = function () { };
}

$(function () {
    $(".tabs-content:first").show();
    $(".tabs-nav li:first a").addClass("active");
    $(".tabs-nav a").click(function () {
        var tab = $(this).attr("href");
        $(".tabs-content").hide();
        $(this).addClass("active").parent().siblings().find("a").removeClass("active");
        $(tab).show();
        return false;
    });
});

// equal height body columns - http://www.cssnewbie.com/equal-height-columns-with-jquery/.  May need to switch to a CSS approach if this is visually noticeable
$(function () {
    function equalHeight(group) {
        var tallest = 0;
        group.each(function () {
            var thisHeight = $(this).height();
            if (thisHeight > tallest) {
                tallest = thisHeight;
            }
        });
        group.height(tallest);
    }
    // this technique of getting the columns to be equal-height is breaking the text sizing
    // equalHeight($(".body-container > div"));
});


// search box label
$(function () {
    $(".searchbox").hint("searchboxBlur");
});

// print
$(function () {
    $(".tools-links a.print").click(function () {
        // Record click in Omniture
        s.linkTrackVars = "events";
        s.linkTrackEvents = "event4";
        s.events = "event4";
        s.tl(this, 'o', 'Print');

        // Print page
        window.print();
        return false;
    });
});

// stylesheet switching
$(function () {
    $.stylesheetInit();

    $("#txtSmall").bind("click", function () {
        // Record click in Omniture
        s.linkTrackVars = "events";
        s.linkTrackEvents = "event5";
        s.events = "event5";
        s.tl(this, 'o', 'Text Resize');

        // Adjust stylesheet
        var currStyle = readCookie('style');
        if (currStyle == undefined || currStyle == "XLarge")
            $.stylesheetSwitch("Large")
        else if (currStyle == "Large")
            $.stylesheetSwitch("Small");
    });
    $("#txtLarge").bind("click", function () {
        // Record click in Omniture
        s.linkTrackVars = "events";
        s.linkTrackEvents = "event5";
        s.events = "event5";
        s.tl(this, 'o', 'Text Resize');

        // Adjust stylesheet
        var currStyle = readCookie('style');
        if (currStyle == undefined || currStyle == "Small")
            $.stylesheetSwitch("Large");
        else if (currStyle == "Large")
            $.stylesheetSwitch("XLarge");
    });
});


// image lightbox
$(function () {
    $(".floorplan-thumbnail a[rel='floorplan'], .floorplan-thumbnail a#view-floorplan").colorbox({
        transition: 'none',
        width: "850px",
        height: "725px",
        scalePhotos: true,
        preloading: true,
        onComplete: function () {
            // add share links to lightbox
            $("#cboxShare").detach();
            $("#cboxContent").append("<a id='cboxShare' class='share a2a_dd' href='http://www.addtoany.com/share_save' alt='Share'>Share</a>");

            // add callout, if specified
            var ctaUrl = $.trim($.colorbox.element().parent().attr("href"));
            if (ctaUrl != '' && ctaUrl != 'undefined') {
                $("#cboxContent").addClass("cboxContentWithAction")
                                 .prepend("<div id='cboxActionbar'><span class='linkdesc-floorplan'>Personalize this floor plan using our interactive tool. You can share your customized layout immediately or save and return for future edits.</span><a href='" + ctaUrl + "' class='linkcta-floorplan' target='_blank'>Customize</a></span></div>")
            }
            else {
            $("#cboxContent").removeClass("cboxContentWithAction")
            $("#cboxActionbar").remove();
            }

            // configure share url
            var url = document.location.protocol + "//" + document.location.host + document.location.pathname;
            if ($(this).attr("rel") == "floorplan") {
                url += "?plan=" + $(this).attr("planid");

                //add print link
                $("#cboxPrint").detach();
                if ($(this).attr("id") == 'view-floorplan') {
                    var printUrl = $(this).parent().find("#print-floorplan").attr("href");
                }
                else {
                    var printUrl = $(this).siblings(".floorplan-thumbnail-cta").find("#print-floorplan").attr("href");
                }
                if (printUrl != '' && printUrl != undefined) {
                    $("<a id='cboxPrint' class='share a2a_dd' href='" + printUrl + "' alt='PrintPDF' target='_blank'>Print</a>").appendTo("#cboxContent");
                }
            }

            // wire it all up
            a2a_config.linkurl = url;
            a2a_init('page');
            FixAddToAnyEmail();
        }
    });
});

// community pricing disclaimer toggle
$(function () {
    $(".community-pricing").toggle(function () {
        $(this).find(".disclaimer").fadeIn("slow");
        _gaq.push(['_trackEvent', 'Pricing Box', 'Open', $(this).attr("community")]);
    }, function () {
        $(this).find(".disclaimer").fadeOut("slow");
        _gaq.push(['_trackEvent', 'Pricing Box', 'Close', $(this).attr("community")]);
    });
});

// http://www.htmldog.com/articles/suckerfish/dropdowns/ - fix up hover menus for IE 6
sfHover = function () {
    var sfEls = document.getElementById("nav").getElementsByTagName("UL")[0].getElementsByTagName("LI");
    for (var i = 0; i < sfEls.length; i++) {
        sfEls[i].onmouseover = function () {
            this.className += " sfhover";
        }
        sfEls[i].onmouseout = function () {
            this.className = this.className.replace(new RegExp(" sfhover\\b"), "");
        }
    }
}
if (window.attachEvent) window.attachEvent("onload", sfHover);


// http://remysharp.com/2007/01/25/jquery-tutorial-text-box-hints/
jQuery.fn.hint = function (blurClass) {
    if (!blurClass) {
        blurClass = 'blur';
    }

    return this.each(function () {
        // get jQuery version of 'this'
        var $input = jQuery(this),

        // capture the rest of the variable to allow for reuse
      title = $input.attr('title'),
      $form = jQuery(this.form),
      $win = jQuery(window);

        function remove() {
            if ($input.val() === title && $input.hasClass(blurClass)) {
                $input.val('').removeClass(blurClass);
            }
        }

        // only apply logic if the element has the attribute
        if (title) {
            // on blur, set value to title attr if text is blank
            $input.blur(function () {
                if (this.value === '') {
                    $input.val(title).addClass(blurClass);
                }
            }).focus(remove).blur(); // now change all inputs to title

            // clear the pre-defined text when form is submitted
            $form.submit(remove);
            $win.unload(remove); // handles Firefox's autocomplete
        }
    });
};


// community picker
$(function () {
    $("#community-picker").change(function () {
        var href = $(this).val();
        var hrefSuffix = ($(this).attr("hrefsuffix") == null) ? "" : $(this).attr("hrefsuffix");

        if (href != "0") {
            // Record click in Omniture
            s.linkTrackVars = 'prop9';
            s.prop9 = $(this).filter(":selected").text();
            s.tl(this, 'o', 'Community Picker');

            // Redirect user
            window.location = href + hrefSuffix;
        }
    });
});


// resident stories
$(function () {
    // full story
    $(".residentstory-subnav .full").click(function (e) {
        e.preventDefault();
        $(".residentstory-text-summary").hide();
        $(".residentstory-text-full").show();
    });

    $(".residentstory-text-full .back").click(function (e) {
        e.preventDefault();
        $(".residentstory-text-full").hide();
        $(".residentstory-text-summary").show();
    });

    // words
    $(".residentstory-subnav .words")
		.click(function () { $("#residentstory-words").show(); })
		.colorbox({
		    inline: true,
		    href: "#residentstory-words",
		    onOpen: function () {
		        if ($("#residentstory-words").length == 0) {
		            $.colorbox.close();
		        }
		    },
		    onCleanup: function () { $("#residentstory-words").hide(); }
		});

    // photos
    $(".residentstory-subnav .photos").click(function (e) {
        e.preventDefault();
        $("#residentstory-photos a:first").click();
    });

    $("#residentstory-photos a").colorbox({
        transition: 'none',
        width: "90%",
        height: "90%",
        scalePhotos: true,
        preloading: true
    });
});


// landing page: Region
$(function () {
    // random location (first load)
    if ($("promo-region-list").length) {
        setPromoRegion(Math.floor(Math.random() * $("#promo-region-list .group").size()));
    }

    // group box rollover
    $("#promo-region-list .group").hoverIntent(
		{
		    over: function () { setPromoRegion(parseInt($(this).find(".num").text()) - 1); },
		    timeout: 0,
		    interval: 130,
		    out: function () { }
		});


    // number box rollover
    $("#promo-region-overview .left a").hoverIntent(
		{
		    over: function () { setPromoRegion(parseInt($(this).text()) - 1); },
		    timeout: 0,
		    interval: 130,
		    out: function () { }
		});

    function setPromoRegion(i) {
        // Get data from grouping blocks
        var main = $("#promo-region-overview");
        var grp = $("#promo-region-list .group").eq(i);

        // Animate out
        //$(main).find(".right").fadeOut(0);

        // Copy data to overview block
        $(main).find(".title").text($(grp).find(".title").text());
        $(main).find(".name").text($(grp).find(".name").text());
        $(main).find(".subtitle").text($(grp).find(".subtitle").text());
        $(main).find(".details").html($(grp).find(".details").html());
        $(main).find(".linkname").text($(grp).find(".title").text());
        $(main).find(".bigpic").attr("src", $(grp).find(".bigpic").attr("src"));
        $(main).find(".taketour").attr("href", $(grp).find(".taketour").attr("href"))
		                         .attr("title", $(grp).find(".taketour").attr("title"));

        // Animate in
        //$(main).find(".right").fadeIn(400);

        // Reset styling
        $("#promo-region-list .group").removeClass("selected");
        $("#promo-region-overview .left a").removeClass("selected");
        $(grp).addClass("selected");
        $(main).find(".left a").eq(i).addClass("selected");
    }
});


// community dining
$(function () {
    // faqs
    var list = $(".community-dining-center .faq-list");
    $(list).find("dt:gt(2)").hide();
    $(list).find("dd:gt(2)").hide();

    $(".community-dining-readmore").click(function () {
        $(list).find("dt:gt(2)").show();
        $(list).find("dd:gt(2)").show();
        $(this).hide();
        return false;
    });
});


// simple photo gallery
$(function () {
    $(".photo-gallery").each(function () {
        var gallery = $(this);
        gallery.find(".photo-gallery-images").cycle({
            timeout: 4000,
            prev: gallery.find(".photo-gallery-control-prev"),
            next: gallery.find(".photo-gallery-control-next"),
            fit: 1,
            pause: 1
        });
        /*
        var images = gallery.find(".photo-gallery-images > img");
        var activeImage = 0;
        var fadeDelay = 2000;

        images.each(function () {
        $(this).css("position", "absolute");
        $(this).offset(gallery.offset());
        });

        .click(function () { ChangeActiveImageBy(-1); });
        .click(function () { ChangeActiveImageBy(1); });

        function ChangeActiveImageBy(offset) {
        activeImage = (activeImage + offset) % images.size();

        images.each(function (i, img) {
        img = $(img);
        if (i == activeImage) {
        img.show().animate({ opacity: 1 }, fadeDelay);
        } else if (img.filter(":visible").size() > 0) {
        img.animate({ opacity: 0 }, fadeDelay, function () { img.hide(); });
        }
        });

        }
        */
    });
});


// Add-to-Any button re-build
function UpdateAddToAnyButton() {
    var oldShare = $("a.share");
    var newShare = $("<a href='http://www.addtoany.com/share_save' class='share a2a_dd'>Share</a>");
    oldShare.hide();
    newShare.insertBefore(oldShare);
    oldShare.detach();
    a2a_config.linkurl = document.location.href;
    a2a_init('page');
    FixAddToAnyEmail();
}


// Audio Player
var audioPlayerIsSetUp = false;
function SetupAudioPlayer() {
    if (!audioPlayerIsSetUp) {
        AudioPlayer.setup("/assets/player.swf", {
            width: 300,
            transparentpagebg: 'yes'
        });
        audioPlayerIsSetUp = true;
    }
}


// Alerts
$(function () {
    $("#alert .alert-message")
        .css("margin-top", "-10px")
        .animate({
            marginTop: 18
        }, 2500);
    $("#alert .alert-instructions")
        .css("margin-top", "-15px")
        .animate({
            marginTop: 3
        }, 2000);
});



/*
// sIFR
var whitney = {
src: '/assets/whitney.swf', 
fitExactly: true,
wmode: 'transparent',
transparent: true,
ratios: [8, 1.41, 10, 1.33, 14, 1.31, 16, 1.26, 20, 1.27, 24, 1.26, 25, 1.24, 26, 1.25, 35, 1.24, 49, 1.23, 74, 1.22, 75, 1.21, 79, 1.22, 80, 1.21, 81, 1.22, 1.21]
};
sIFR.activate(whitney);
sIFR.replace(whitney, {
selector: 'h1',
css: ['.sIFR-root { background-color: #EEF1F3; color: #3B3B3B; }'],
filters: {
DropShadow: {
distance: 1,
color: '#CCCCCC',
strength: 2
}
}
});

sIFR.replace(whitney, {
selector: '#community-home-header h1',
css: ['.sIFR-root { background-color: #E7ECEF; color: #3B3B3B; }']
});

sIFR.replace(whitney, {
selector: 'h2',
css: ['.sIFR-root { background-color: #EEF1F3; color: #333333; }']
});

DoH3Replace({ selector: "h3" });
function DoH3Replace(mergeArgs) {
var args = {
css: [
'a { color: #0077c0; text-decoration: none; }',
'a:hover { color: #005E97; }',
'.sIFR-root { background-color: #EEF1F3; color: #1B1B1B; }'
]
};
for(i in mergeArgs) { args[i] = mergeArgs[i];}
sIFR.replace(whitney, args);
}
*/

// http://allinthehead.com/retro/338/supersleight-jquery-plugin - IE6 transparent PNG fix
jQuery.fn.supersleight = function (settings) {
    settings = jQuery.extend({
        imgs: true,
        backgrounds: true,
        shim: '/images/transparent.gif',
        apply_positioning: true
    }, settings);

    return this.each(function () {
        if (jQuery.browser.msie && parseInt(jQuery.browser.version, 10) < 7 && parseInt(jQuery.browser.version, 10) > 4) {
            jQuery(this).find('*').andSelf().each(function (i, obj) {
                var self = jQuery(obj);
                // background pngs
                if (settings.backgrounds && self.css('background-image').match(/\.png/i) !== null) {
                    var bg = self.css('background-image');
                    var src = bg.substring(5, bg.length - 2);
                    var mode = (self.css('background-repeat') == 'no-repeat' ? 'crop' : 'scale');
                    var styles = {
                        'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='" + mode + "')",
                        'background-image': 'url(' + settings.shim + ')'
                    };
                    self.css(styles);
                };
                // image elements
                if (settings.imgs && self.is('img[src$=png]')) {
                    var styles = {
                        'width': self.width() + 'px',
                        'height': self.height() + 'px',
                        'filter': "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + self.attr('src') + "', sizingMethod='scale')"
                    };
                    self.css(styles).attr('src', settings.shim);
                };
                // apply position to 'active' elements
                if (settings.apply_positioning && self.is('a, input') && (self.css('position') === '' || self.css('position') == 'static')) {
                    self.css('position', 'relative');
                };
            });
        };
    });
};

// Supersleight
$(function () {
    $(".homepage-resident-story").supersleight();
    $(".community-home-resident-story").supersleight();
});

$(function () {
    $("#a2amail_any_email,#a2apage_email_client").live("click", function () {
        //alert("aldsasdf");
        //return false;
    });
});

function FixAddToAnyEmail() {

    // Demonstration of how overriding the AddToAny email logic would work
    // Since this is not using their public API, it very well could quick working at any time.

    /** 
    $("#a2apage_email_client").attr("customserviceuri", "mailto:?subject=A2A_LINKNAME_ENC&body=Custom text before A2A_LINKURL_ENC and after");
    $("#a2apage_any_email").click(function () {
    $("#a2apage_dropdown").hide();
    var div = $("<div id='thingToShare'/>");
    div.append("<p>some random text</p>");
    div.dialog({ autoOpen: true, modal: true, title: 'E-mail' });

    return false;
    });
    **/
}

$(function () {
    $(".lightbox-popup a").click(function () {
        var e = $(this);
        var id = e.attr("embedid");
        var embed = $("#" + id);
        if (embed.length) {
            var args = { html: embed.text(), open: true, height: "80%", width: "80%" };
            var height = e.attr("popuph");
            if (height) {
                args.height = null;
                args.innerHeight = height + "px";
            }
            var width = e.attr("popupw");
            if (width) {
                args.width = null;
                args.innerWidth = height + "px";
            }
            $.fn.colorbox(args);
        }
        return false;
    });
});

$(function () {
    $(".clickable").click(function () {
        var href = $(this).attr("href");
        if (href) {
            window.location = href;
            return false;
        }
    });
});

// flowplayer configuration
var flowplayerConfig =
{
    key: "#$12394f2160e2e4615d5",
    screen: {
        height: "100pct",
        top: 0
    },
    clip: {
        autoPlay: false,
        autoBuffering: true
    },
    plugins: {
        controls: {
            timeColor: "#ffffff",
            borderRadius: "0px",
            slowForward: true,
            bufferGradient: "none",
            backgroundColor: "rgba(99, 99, 99, 0.2)",
            volumeSliderGradient: "none",
            slowBackward: false,
            timeBorderRadius: 0,
            time: true,
            progressGradient: "none",
            height: 20,
            tooltips: {
                marginBottom: 5,
                scrubber: true,
                volume: true,
                buttons: false
            },
            fastBackward: false,
            opacity: 1,
            volumeSliderColor: "#000000",
            bufferColor: "#0a0a0a",
            border: "0px",
            buttonColor: "#000000",
            mute: false,
            autoHide: {
                enabled: true,
                hideDelay: 500,
                mouseOutDelay: 500,
                hideStyle: "fade",
                hideDuration: 400,
                fullscreenOnly: true
            },
            backgroundGradient: "medium",
            width: "100pct",
            display: "block",
            buttonOverColor: "#FF0000",
            url: "flowplayer.controls-tube-3.2.1.swf",
            fullscreen: false,
            timeBgColor: "rgba(0, 0, 0, 1)",
            borderWidth: 2,
            scrubberBarHeightRatio: "0.22",
            bottom: 0,
            stop: true,
            sliderColor: "#cccccc",
            zIndex: 1,
            scrubberHeightRatio: "0.8",
            tooltipTextColor: "#D00000",
            sliderGradient: "none",
            timeBgHeightRatio: 0,
            volumeSliderHeightRatio: "0.4",
            name: "controls",
            volumeBarHeightRatio: "0.5",
            left: "50pct",
            tooltipColor: "#C9C9C9",
            playlist: false,
            durationColor: "#333333",
            play: true,
            fastForward: true,
            progressColor: "#ffffff",
            timeBorder: "none",
            volumeBorderRadius: 0,
            scrubberBorderRadius: 0,
            volume: true,
            scrubber: true,
            builtIn: false
        },
        gatracker: {
            url: "flowplayer.analytics-3.2.0.swf",
            trackingMode: "AS3",
            googleId: googleAnalyticsId
        }
    }
};
$(function () {
    flowplayer("a.video-player-link", { src: "/assets/flowplayer.commercial-3.2.2.swf", wmode: "transparent" }, flowplayerConfig);
    $(".video-list a").click(function () {
        //lookup video, play
        var vid = jQuery.data(document.body, "video_" + $(this).attr("href").replace("#", ""));
        $(".video-player-link").css("width", vid.width + "px").css("height", vid.height + "px");
        $f().play(vid.videoUrl);

        //set styling
        $(".video-list a").removeClass("nowplaying");
        $(this).addClass("nowplaying")
        return false;
    });
});

// querystring helper
$.urlParam = function (name) {
    var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);
    if (!results) { return 0; }
    return results[1] || 0;
}

// Community Home Banner
$(function () {
    $("div.community-home-gallery div.gallery").cycle({
        fx: 'fade',
        speed: '2000',
        timeout: '6000',
        pause: 1,
        pauseOnPagerHover: 1,
        pager: ".chicklets",
        before: function (curr, next, opts, flag) {
            //move banner desc to main desc
            var html = $(next).find("span").html();
            $(".community-desc-block").html(html);
        }
    });

    //set first chicklet
    $("div.chicklets a:first-child").addClass("activeSlide");
});



/*** ITEMS PER PAGE ***/
var itemsPerPage = 3;
var newsArticles = ".news-article-container .news-article";

// Community News Pager
$(function () {

    //get total stories and remainder
    var total = $(newsArticles).length;

    //start paging logic if length is greater than itemsPerPage
    if (total > itemsPerPage) {
        var remainder = total % itemsPerPage;
        var startIndex = 1;
        var perfectTotal = -1;
        var pageNumbers = -1;

        //Get page numbers
        if (remainder > 0) {

            var perfectTotal = total - remainder;
            var perfectPagerNumbers = perfectTotal / itemsPerPage;
            var pageNumbers = perfectPagerNumbers + 1
        }
        else {
            perfectTotal = total;
            pageNumbers = perfectTotal = itemsPerPage;
        }

        //add previous tag
        var prevTag = "<a id='prev' class='pager-prev' href='#'> &lt; Prev</a>";
        $(prevTag).appendTo(".news-article-container");
        $("#prev").bind("click", function () {
            GetNewsItemsHidden("prev");
            return false;
        });

        //Write out pager numbers
        var i = 1;
        for (i = 1; i <= pageNumbers; i++) {
            var pagerTag = "<a id='pager_" + i + "' class='pager-number' onclick='GetNewsItems(" + i + "); return false;' href='#'>" + i + "</a>;" // pass in page number to GetItems
            $(pagerTag).appendTo(".news-article-container");
        }

        //next/hidden field for current pager anchor tags go here
        var hiddenTag = "<input id='hiddenPager' name='hiddenPager' type='hidden' />";
        var nextTag = "<a id='next' class='pager-next' href='#'>Next &gt;</a>";
        $(nextTag).appendTo(".news-article-container");
        $(hiddenTag).appendTo(".news-article-container");
        $("#next").bind("click", function () {
            GetNewsItemsHidden("next");
            return false;
        });
        $("#hiddenPager").val(startIndex);

        //Always start off at the first page number
        GetNewsItems(startIndex);
    }
});

function GetNewsItems(start) {
    //hide all articles and num of articles
    $(newsArticles).hide();
    $(".pager-number").removeClass("selected");
    var num = $(".pager-number").length;

    if (start == 1) {
        //get first three items and show
        $(newsArticles).slice(0, itemsPerPage).show();

        //hide prev button, show next
        $("#prev").hide();
        $("#next").show();
    }
    else if(start > 1 && start <= num){
        //get index and remove selected
        var index = Number(((start - 1) * itemsPerPage) - 1);
        //show news articles and select a tag
        $(".news-article-container .news-article:gt(" + index + "):lt(" + itemsPerPage + ")").show();

        //hide if we're at the end of the list, show prev
        $("#prev").show();

        if (start == num) {
            $("#next").hide();
        }
        else {
            $("#next").show();
        }
    }

    //set new pager
    $("#hiddenPager").val(start);
    $("#pager_" + start).addClass("selected");
}

function GetNewsItemsHidden(command) {

    //get current pager
    var pagerNum = Number($("#hiddenPager").val());

    switch (command) {
        case 'next':         
            //get hidden field and add
            pagerNum = Number(pagerNum + 1);
            GetNewsItems(pagerNum);
            break;
        case 'prev':
            //get hidden field and subtract
            pagerNum = Number(pagerNum - 1);
            GetNewsItems(pagerNum);
            break;
        default:
            break;
    }
}

//ticket forms
$(function () {

    //get info block and ticket one block
    var yourInfoBlock = $(".eventinfo-left .ticketdata-border:first-child");
    var ticketOneBlock = $(yourInfoBlock).next();

    //move first/last name and email address to ticket one
    MoveValue(yourInfoBlock, ticketOneBlock, "input[id*='txtYourInfoFirstName']", "input[id*='txtFirstName']");
    MoveValue(yourInfoBlock, ticketOneBlock, "input[id*='txtYourInfoLastName']", "input[id*='txtLastName']");
    MoveValue(yourInfoBlock, ticketOneBlock, "input[id*='txtYourInfoEmailAddress']", "input[id*='txtEmailAddress']");

    //move first/last name and email address to your info
    MoveValue(ticketOneBlock, yourInfoBlock, "input[id*='txtFirstName']", "input[id*='txtYourInfoFirstName']");
    MoveValue(ticketOneBlock, yourInfoBlock, "input[id*='txtLastName']", "input[id*='txtYourInfoLastName']");
    MoveValue(ticketOneBlock, yourInfoBlock, "input[id*='txtEmailAddress']", "input[id*='txtYourInfoEmailAddress']");
});

function MoveValue(sourceEl, targetEl, sourceId, targetId) {
    
    //implement blur event
    $(sourceEl).find(sourceId).blur(function () {
        if ($(this).attr("value") != '' || $(this).attr("value") != undefined) {
            //get value and set to target element
            var value = $(this).attr("value");
            $(targetEl).find(targetId).attr("value", value);
        }
    });
}
