/* --- Start /home/httpd/arch/public/app_frame/webroot/js/nhBestOf.js --- */


            	try {
            		$(document).ready(function() {

    var loading = false;

    $('.bestOfMarketPickerToggle').click(function(){
        if (!loading) {
            $('.market-picker').toggle();
        }
        return false;
    });

    $('.boWinnerMoreInfo').click(function() {
        if (!loading) {
            return true;
        }
        else {
            return false;
        }
    });

    $('.boCastVote').click(function() {
        if ($(this).attr('href') == '') {
            return false;
        }

        return true;

    });

    $('.bestOf-select-market').click(function() {

        $('.boWinnerName').html('');
        $('.boWinnerBlurb').html('Loading...');
        $('.boAwardName').html('');

        $('.bestOfMarketPickerToggle').css('cursor', 'default');
        $('.boWinnerMoreInfo').css('cursor', 'default');
        $('.boCastVote').css('cursor', 'default').attr('href', '');

        loading = true;

        var bestOfMarket = $(this).html();
        var bestOfMarketShortname = $(this).attr('name');

        $('span.selectedMarket').html(bestOfMarket);
        //Request random bestof award using the selected market and update widget
        $.ajax({
            url:'/bestOf/getBestOfAwardWinnersAjax/market:' + bestOfMarketShortname +'/',
            dataType:'json',
            success:function(bestOfWinner) {
                //console.debug(bestOfWinner);
                $('.boWinnerImg').html("<a href=\"" + bestOfWinner.url + "\" target=\"_blank\">" + "<img src=\"" + bestOfWinner.image_url + "\" class=\"framed\" height=\"75\" width=\"100\" alt=\"" + bestOfWinner.place.name + "\"/></a>");
                $('.boWinnerName').html("<a href=\"" + bestOfWinner.url + "\" target=\"_blank\">" + bestOfWinner.award + "</a>");
                $('.boWinnerBlurb').html(bestOfWinner.blurb);
                $('.boAwardName').html("<a href=\"" + bestOfWinner.url + "\" target=\"_blank\">" + bestOfWinner.place.name + "</a>");
                $('.boWinnerMoreInfo').attr('href', bestOfWinner.url);
                $('.boCastVote').attr('href', bestOfWinner.url);
                loading = false;
                $('.bestOfMarketPickerToggle').css('cursor', 'pointer');
                $('.boWinnerMoreInfo').css('cursor', 'pointer');
                $('.boCastVote').css('cursor', 'pointer');
            },
            error:function(){
                loading = false;
                $('.boWinnerBlurb').html('No Best Of data found.');
                $('.bestOfMarketPickerToggle').css('cursor', 'pointer');
            }
        });

        $('.market-picker').toggle();

        return false;
    });

});


    			}
    			catch(e){
    				VVM.debug.error(e);
        		}
            

/* --- End /home/httpd/arch/public/app_frame/webroot/js/nhBestOf.js --- */
/* --- Start /home/httpd/arch/public/app_frame/webroot/js/NowTrending.js --- */


            	try {
            		var nowTrending = {
    init: function (listSelector) {
        var $container = $(document.getElementById('nowTrendingWidget')),
            $stories = $container.children('ul.stories'),
            $convs = $container.children('ul.convs'),
            $footer = $container.children('.footer');

        // remove the lists children from the dom, and random re-insert them
        // until the count is reached or the list is empty
        function shuffleList($list, count) {
            var i, r, items = $.makeArray($list.children().show().remove()),
                currentHref = window.location.href,
                thisHref;
            for (i = 0; i < count && items.length; i++) {
                r = Math.floor(Math.random() * items.length);
                thisHref = $(items[r]).find('a[href]').get(0).href;
                // check that the item doesn't link to the current page
                if (!thisHref || currentHref.indexOf(thisHref.split('?').shift()) !== -1) {
                    i--;
                } else {
                    $list.append(items[r]);
                }
                items.splice(r, 1);
            }
        }

        if ($container.hasClass('Story')) {
            $convs.hide();
            shuffleList($stories, 3);
        }
        else if ($container.hasClass('LargeStory')) {
            $convs.hide();
            shuffleList($stories, 2);
        }
        else if ($container.hasClass('Hybrid')) {
            shuffleList($stories, 3);
            $convs.children().show();
            // shuffleList($convs, 3);
            $convs.hide();
            $footer.delegate('a', 'click', function() {
                var $this = $(this);
                if (!$this.hasClass('active')) {
                    $this.siblings().removeClass('active');
                    $stories.toggle($this.hasClass('stories'));
                    $convs.toggle($this.hasClass('convs'));
                    $this.addClass('active');
                }
            });
        }
        else if ($container.hasClass('Conv')) {
            $stories.hide();
            $convs.children().show();
            // shuffleList($convs, 3);
        }
    },
    fetchCommentCounts: function (network) {
        if (!window.LF || !LF.CommentCount) {
            this.requireCommentCountScript(network, this.fetchCommentCounts);
        } else {
            $('.livefyre-commentcount').not($('#nowTrendingWidget .livefyre-commentcount')).removeClass('livefyre-commentcount');
            LF.CommentCount({
                replacer: function(el, count) {
                    $(el).html(count +' Comment'+ (count === 1 ? '' : 's'));
                }
            });
        }
    },
    requireCommentCountScript: function (network, cb) {
        var tag = document.createElement('script');
        tag.type="text/javascript"; tag.src="http://zor.livefyre.com/wjs/v1.0/javascripts/CommentCount.js";
        tag.setAttribute('data-lf-domain', network);
        $(tag).bind("load", cb);
        document.head.appendChild(tag);
    }
};
    			}
    			catch(e){
    				VVM.debug.error(e);
        		}
            

/* --- End /home/httpd/arch/public/app_frame/webroot/js/NowTrending.js --- */
/* --- Start /home/httpd/arch/public/app_frame/webroot/js/VillageRailWidget.js --- */


            	try {
            		
    			}
    			catch(e){
    				VVM.debug.error(e);
        		}
            

/* --- End /home/httpd/arch/public/app_frame/webroot/js/VillageRailWidget.js --- */
/* --- Start /home/httpd/arch/public/app_frame/webroot/js/SearchEventsMusic.js --- */


            	try {
            		$(document).ready( function() {
    
    if ( $( "#homecal_datepicker_element").length > 0 ) {
        $( "#homecal_datepicker_element" ).datepicker( datepickerConfig );
    }

                 // Calendar
    var datepickerConfig = {
        dateFormat: "yy-m-d",
        changeMonth: true,
        changeYear: true,
        nextText: "&nbsp;",
        prevText: "&nbsp;",
        showOn: 'button',
        buttonImageOnly: true,
        buttonImage: '/img/icon-calendar.gif',
        onSelect: function( dateText, inst ) {
            var url = $( this ).attr( "name" ) + dateText;
            document.location.href = url;
        }   
    }
});
// New Stuff
function sfc_autocomplete() {
	if ($('#searchFormMusic input[name="near"]').autocomplete !== undefined) {
		$('#searchFormMusic input[name="near"]').autocomplete({
			source: "/search/autosuggest/",
			minLength: 3,
			select: function(e,u) {
				if ( u.item.region ) {
					$('#searchFormMusic input[name="region"]').val(u.item.region);
				}
			} 
		});
	}
}
function sfc_doSearch() {
    
        var myFilters = $('#searchFormMusic').serialize().replace(/\%2F/g,'%7C').replace(/=/g,':').replace(/&/g,'/').replace(/\%26/g,'%2526')+'/';
        myFilters = myFilters.replace(/region\:\//,'');
        document.location = '/search/results/'+myFilters;
    
}

    			}
    			catch(e){
    				VVM.debug.error(e);
        		}
            

/* --- End /home/httpd/arch/public/app_frame/webroot/js/SearchEventsMusic.js --- */
/* --- Start /home/httpd/arch/public/app_frame/webroot/js/SearchFilms.js --- */


            	try {
            		$(document).ready(function() {
    var defaultKeywords = 'Keywords';
    var defaultZipCode  = 'Zip Code';

    $('.search_keywords').val(defaultKeywords);
    $('.search_zipcode').val(defaultZipCode);

    $('.search_keywords').focus(function() {
        if ($('.search_keywords').val() == defaultKeywords) {
            $('.search_keywords').val('');
        }
    });
    
    $('.search_zipcode').focus(function() {
        if ($('.search_zipcode').val() == defaultZipCode) {
            $('.search_zipcode').val('');
        }
    });
    
    $('#movieSelect').change(function() {
        $('.movieSubmit').attr('disabled','disabled');
        $('.movieText').val('');
    });
    
     $('#theaterSelect').change(function() {
        $('.movieSubmit').attr('disabled','disabled');
        $('.movieText').val('');
    });
    
    $('.movieText').focus(function() {
        $('.movieSubmit').removeAttr('disabled');
    });
    
    
    $('.search_form').submit(function() {
        if ($('.movieText').val() == defaultKeywords) {
            $('.movieText').val('');
        }
        if ($('.search_zipcode').val() == defaultZipCode) {
            $('.search_zipcode').val('');
        }
        // if we have a zip, we go to /movies/showtimes/now-showing regardless of
        // presence of keyword
        if ($('.search_zipcode').val() != '' && $('.movieText').val() != defaultKeywords && $('.movieText').val() != '') {
            $('.search_form').attr('action', '/movies/showtimes/now-showing');
            $('.search_form').attr('method', 'get');
        }

        return true;
    });
});
// New Stuff
function sfm_autocomplete() {
	if ($('#searchFormMovies input[name="near"]').autocomplete !== undefined) {
		$('#searchFormMovies input[name="near"]').autocomplete({
			source: "/search/autosuggest/",
			minLength: 3,
			select: function(e,u) {
				if ( u.item.region ) {
					$('#searchFormMovies input[name="region"]').val(u.item.region);
				}
			} 
		});
	}
}
function sfm_doSearch() {
    if ($('.movieText').val() != 'Keywords' && $('.movieText').val() != '') {
        var myFilters = $('#searchFormMovies').serialize().replace(/\%2F/g,'%7C').replace(/=/g,':').replace(/&/g,'/').replace(/\%26/g,'%2526')+'/';
        myFilters = myFilters.replace(/region\:\//,'');
        document.location = '/search/results/'+myFilters;
    } else {
        document.getElementById('movieSubmit').disabled = 1;
    }
    
}

    			}
    			catch(e){
    				VVM.debug.error(e);
        		}
            

/* --- End /home/httpd/arch/public/app_frame/webroot/js/SearchFilms.js --- */
/* --- Start /home/httpd/arch/public/app_frame/webroot/js/SearchDining.js --- */


            	try {
            		$(document).ready(function() {
	var defaultKeywords = 'Keywords';
	var invalidKeywords = 'Enter Keywords';
	var defaultZipCode  = 'Zip Code';
	
	$('.search_keywords').val(defaultKeywords);
	$('.search_zipcode').val(defaultZipCode);
	
	$('.search_keywords').focus(function() {
		if ($('.search_keywords').val() == defaultKeywords || $('.search_keywords').val() == invalidKeywords ) {
			$('.search_keywords').val('').removeClass( 'invalid' );
		}
	});
	$('.search_zipcode').focus(function() {
		if ($('.search_zipcode').val() == defaultZipCode) {
			$('.search_zipcode').val('');
		}
		$('.search_keywords').val('').removeClass( 'invalid' );
	});

    $('.search_form').submit(function() {
        if ($('.search_keywords').val() == defaultKeywords) {
            $('.search_keywords').val('');
        }
        if ($('.search_zipcode').val() == defaultZipCode) {
            $('.search_zipcode').val('');
        }        
        // if we have a zip, we go to /locations/map regardless of 
        // presence of keyword
        if ($('.search_zipcode').val() != '') {
            $('.search_form').attr('action', '/locations/map');
            $('.search_form').attr('method', 'get');
        }
        if( $('.search_keywords').val() == '' && 
            $('.search_zipcode').val() == '' && 
            $('select[name=neighborhood]').attr('selectedIndex') == 0 && 
            $('#cuisineSelector').attr('selectedIndex') == 0 ) {
                $('.search_keywords').val( invalidKeywords ).addClass( 'invalid' );
                return false;   
        }
        
        return true;
    });
});
// New Stuff
function sfd_autocomplete() {
	if ($('#searchFormDining input[name="near"]').autocomplete !== undefined) {
		$('#searchFormDining input[name="near"]').autocomplete({
			source: "/search/autosuggest/",
			minLength: 3,
			select: function(e,u) {
				if ( u.item.region ) {
					$('#searchFormDining input[name="region"]').val(u.item.region);
				}
			} 
		});
	}
}
function sfd_doSearch() {
    
        var myFilters = $('#searchFormDining').serialize().replace(/\%2F/g,'%7C').replace(/=/g,':').replace(/&/g,'/').replace(/\%26/g,'%2526')+'/';
        myFilters = myFilters.replace(/region\:\//,'');
        document.location = '/search/results/'+myFilters;
    
}

    			}
    			catch(e){
    				VVM.debug.error(e);
        		}
            

/* --- End /home/httpd/arch/public/app_frame/webroot/js/SearchDining.js --- */
/* --- Start /home/httpd/arch/public/app_frame/webroot/js/SearchTheater.js --- */


            	try {
            		$(document).ready(function() {
	var defaultKeywords = 'Keywords';
	var defaultZipCode  = 'Zip Code';
	
	$('.search_keywords').val(defaultKeywords);
	$('.search_zipcode').val(defaultZipCode);
	
	$('.search_keywords').focus(function() {
		if ($('.search_keywords').val() == defaultKeywords) {
			$('.search_keywords').val('');
		}
	});
	$('.search_zipcode').focus(function() {
		if ($('.search_zipcode').val() == defaultZipCode) {
			$('.search_zipcode').val('');
		}
	});

    $('.search_form').submit(function() {
        if ($('.search_keywords').val() == defaultKeywords) {
            $('.search_keywords').val('');
        }
        if ($('.search_zipcode').val() == defaultZipCode) {
            $('.search_zipcode').val('');
        }
        
        
        return true;
    });
});

    			}
    			catch(e){
    				VVM.debug.error(e);
        		}
            

/* --- End /home/httpd/arch/public/app_frame/webroot/js/SearchTheater.js --- */
/* --- Start /home/httpd/arch/public/app_frame/webroot/js/HomeCalendarTabs.js --- */


            	try {
            		$(document).ready(function(){    
    /*   VVM.HomeCalTabCache
     *   (param) id  (string: id for tab)
     *   (param) url (string: main widget url for the request)
     *   Note: Cache object bound to each calendar tab. 
     *   Objectives: A container to hold and manage html returned from ajax requests for one calendar widget tab
     *   by: jasonc - 7/22/10
     *   Todo: bitches :/
     */        
    VVM.HomeCalTabCache = function(id, url){
        this.init(id, url);
    }    
    VVM.HomeCalTabCache.prototype = {
        /* An array of data that i stored in the date tabs */
        shit:[],
        /* The widget Url */
        url:'',
        /* The id of the tab (name) */
        myId:'',
        init:function(id, url){
            this.myId = id;
            this.url  = url;
            /* A surprisingly critical line... Apparently defining shit:[] in the prototype doesnt set it as an array (horseshit)*/
            this.shit = new Array();              
        },
        /* This loads the the initial widget HTML (by default if there is a date tab it will be the 1st tab which is dateTabsHtml[0]) */
        load:function(tabNumber){
            VVM.debug.p('In Load for id('+this.myId+') loading tab('+tabNumber+')');
           /* If we've already got the data from an ajax call... just display it */
           VVM.CalTabs.changeActiveDateTabToTabIndex(tabNumber);
           if(this.shit[tabNumber]){
               VVM.debug.p('Returning cached html for '+this.myId+' tab number: '+tabNumber);                    
               return this.handleSuccess(this.shit[tabNumber], tabNumber);
           } 
           var url  = this.url;           
           if(parseInt(tabNumber) > 0){
               url += '/'+tabNumber+'/';
           }
           else {
               url += '/';
           }
           VVM.debug.p('CalTabCache id('+this.myId+'): Loading url: '+url);               
           var me   = this;
           $.ajax({
              type:'GET',
              url:url,
              success:function(responseText){
                  VVM.debug.p('Got response from backend... Handling success');
                  me.handleSuccess(responseText, tabNumber);             
              } 
           });
        },
        handleSuccess:function(responseText, tabNumber){
            this.shit[tabNumber] = responseText;                
            VVM.CalTabs.fillInterfaceWithHtml(responseText);
            this.assignClickEventsToDateTabsInDOM(); 
        },
        assignClickEventsToDateTabsInDOM:function(){             
            var me = this;
             $('.daymonth LI.tab').each(function(index){
                $(this).click(function(){
                   VVM.debug.p('Tab Number '+index+' clicked.') ;
                   VVM.CalTabs.showLoadFeedbackForDateTabs();
                   me.load(index);
                });
             });

             var datepickerConfig = {
                dateFormat: "yy-mm-dd",
                changeMonth: true,
                changeYear: true,
                nextText: "&nbsp;",
                prevText: "&nbsp;",
                showOn: 'button',
                buttonImageOnly: true,
                buttonImage: '/img/text-calendar-660000.png',
                onSelect: function( dateText ) {
                    var url = $( this ).attr( "name" ) + dateText;
                    document.location.href = url;
                }
            }

            // if we are more than half way through the month, show next month as well
            if (new Date().getDate() > VVM.daysInThisMonth() / 2) {
                datepickerConfig['numberOfMonths'] = 2;
            }

            $("#homecal_datepicker_element2").datepicker(datepickerConfig);
        }                    
    };    
    
    /*   VVM.HomepageCalendarController
     *   Note: Main Controller for the Home Calendar javascript widget.
     *         This object gets its information from the hometabs controller via a 
     *          json associative array blah blah yeah yeah.
     *   Objectives: 
     *               
     *   by: jasonc - 7/22/10
     *   Todo: yomomma
     */    
    VVM.HomepageCalendarController = function(){
        this.init();
    };
    var tabName = "";
    VVM.HomepageCalendarController.prototype = {
        tabs:null,
        /* The ajax requests cached */
        localHtmlCache:{},
        currentTab:null,
        init:function(){
            /* This is set in the hometabs.ctp via the /calendar/hometabs widget */
          this.tabs = window.caltabs;
          /* Iterate through the tabs and assign the events and instanciate a cache object for each tab */
          this.initializeCalendarTabs();
          /* We load the events tab from the initial HTML request... so manually assign the click events to the date tabs in the widget */
          this.localHtmlCache['events'].assignClickEventsToDateTabsInDOM();             
          VVM.debug.p('Home Calandar tabs have been initted');  
        },
        initializeCalendarTabs:function(){
            var me = this;
            for(i in this.tabs){
                this.localHtmlCache[i] = new VVM.HomeCalTabCache(i, this.tabs[i].widget);    
                var me = this;
                /* Main click handler for each tab... loads the cache objects initial request and change active tabs */
                $('#CALTabHeader_'+this.tabs[i].name).click(function(){
                    var tabIndex = this.id.substring(13);                    
                    me.changeToTab(tabIndex);
                });                              
            }
        },
        changeToTab:function(tabId){
            VVM.debug.p('ChangeToTab: id(' +tabId+')');
            this.showLoadFeedbackForCalendarTabs();           
            $('.homecalendar_tabs_holder .tab').removeClass('active');
            $('#CALTabHeader_'+this.tabs[tabId].name).addClass('active');
            this.localHtmlCache[tabId].load(0); 
            tabName = this.tabs[tabId].name;      
        },
        showLoadFeedbackForCalendarTabs:function(){
            VVM.debug.p('Showing Feedback');
            var html = '<div class="feedback">&nbsp;</div>';
            $('#CALTabData').html(html);
            return;
        },
        showLoadFeedbackForDateTabs:function(){
            VVM.debug.p('Showing Feedback');
            var html = '<div class="feedback">&nbsp;</div>';
            $('#CALTabData .lower').html(html);
            return;            
        },
        changeActiveDateTabToTabIndex:function(tabIndex){
            var jQueryIndex = tabIndex+1;
            if($('.daymonth LI.tab').length){
                $('.daymonth LI.tab').removeClass('todayClass');
                $('.daymonth LI.tab:nth-child('+jQueryIndex+')').addClass('todayClass');                
            }
        },
        fillInterfaceWithHtml:function(html){
            $('#CALTabData').html(html);    
            
            /* js to initialize form elements needs to be called as new tab forms are displayed */
             
            switch(tabName){
                   case "music":
                       initMusic();
                       break;
                   case "events":                   
                       break;
                   case "art":
                       initArts();
                       break;
                   case "dining":
                       initDining();
                       break;    
                   case "theater":
                       initTheater();
                       break;   
                   case "movies":
                       initFilm();
                       break;
                   default:
                       break;              
             } 
      }
    };
    VVM.CalTabs = new VVM.HomepageCalendarController();    
    
    
});

function initDining(){
    var defaultKeywords = 'Keywords';
	var defaultZipCode  = 'Zip Code';
	
	$('.search_keywords').val(defaultKeywords);
	$('.search_zipcode').val(defaultZipCode);
	
	$('.search_keywords').focus(function() {
		if ($('.search_keywords').val() == defaultKeywords) {
			$('.search_keywords').val('');
		}
	});
	$('.search_zipcode').focus(function() {
		if ($('.search_zipcode').val() == defaultZipCode) {
			$('.search_zipcode').val('');
		}		
	});

    $('.search_dining').submit(function() {
        if ($('.search_keywords').val() == defaultKeywords) {
            $('.search_keywords').val('');
        }
        if ($('.search_zipcode').val() == defaultZipCode) {
            $('.search_zipcode').val('');
        }
        
        // if we have a zip, we go to /locations/map regardless of 
        // presence of keyword

        if ($('.search_zipcode').val() != '') {
            $('#search_dining').attr('action', '/locations/map');
            $('#search_dining').attr('method', 'get');
        }
        return true;
    });
}

function initMusic(){
   var defaultKeywords = 'Keywords';
	var defaultZipCode  = 'Zip Code';
	
	$('.search_keywords').val(defaultKeywords);
	$('.search_zipcode').val(defaultZipCode);
	
	$('.search_keywords').focus(function() {
		if ($('.search_keywords').val() == defaultKeywords) {
			$('.search_keywords').val('');
		}
	});
	$('.search_zipcode').focus(function() {
		if ($('.search_zipcode').val() == defaultZipCode) {
			$('.search_zipcode').val('');
		}
	});

    $('.search_form').submit(function() {
        if ($('.search_keywords').val() == defaultKeywords) {
            $('.search_keywords').val('');
        }
        if ($('.search_zipcode').val() == defaultZipCode) {
            $('.search_zipcode').val('');
        }
        
        
        return true;
    }); 
}

function initTheater(){
    var defaultKeywords = 'Keywords';
	var defaultZipCode  = 'Zip Code';
	
	$('.search_keywords').val(defaultKeywords);
	$('.search_zipcode').val(defaultZipCode);
	
	$('.search_keywords').focus(function() {
		if ($('.search_keywords').val() == defaultKeywords) {
			$('.search_keywords').val('');
		}
	});
	$('.search_zipcode').focus(function() {
		if ($('.search_zipcode').val() == defaultZipCode) {
			$('.search_zipcode').val('');
		}
	});

    $('.search_form').submit(function() {
        if ($('.search_keywords').val() == defaultKeywords) {
            $('.search_keywords').val('');
        }
        if ($('.search_zipcode').val() == defaultZipCode) {
            $('.search_zipcode').val('');
        }
        
        
        return true;
    });
}

function initFilm(){
    var defaultKeywords = 'Keywords';
    var defaultZipCode  = 'Zip Code';

    $('.search_keywords').val(defaultKeywords);
    $('.search_zipcode').val(defaultZipCode);

    $('.search_keywords').focus(function() {
        if ($('.search_keywords').val() == defaultKeywords) {
            $('.search_keywords').val('');
        }
    });
    $('.search_zipcode').focus(function() {
        if ($('.search_zipcode').val() == defaultZipCode) {
            $('.search_zipcode').val('');
        }
    });

    $('.search_form').submit(function() {
        if ($('.search_keywords').val() == defaultKeywords) {
            $('.search_keywords').val('');
        }
        if ($('.search_zipcode').val() == defaultZipCode) {
            $('.search_zipcode').val('');
        }

        // if we have a zip, we go to /movies/showtimes/now-showing regardless of
        // presence of keyword
        if ($('.search_zipcode').val() != '') {
            $('.search_form').attr('action', '/movies/showtimes/now-showing');
            $('.search_form').attr('method', 'get');
        }

        return true;
    });
}

function initArts(){
    var defaultKeywords = 'Keywords';
	var defaultZipCode  = 'Zip Code';
	
	$('.search_keywords').val(defaultKeywords);
	$('.search_zipcode').val(defaultZipCode);
	
	$('.search_keywords').focus(function() {
		if ($('.search_keywords').val() == defaultKeywords) {
			$('.search_keywords').val('');
		}
	});
	$('.search_zipcode').focus(function() {
		if ($('.search_zipcode').val() == defaultZipCode) {
			$('.search_zipcode').val('');
		}
	});

    $('.search_form').submit(function() {
        if ($('.search_keywords').val() == defaultKeywords) {
            $('.search_keywords').val('');
        }
        if ($('.search_zipcode').val() == defaultZipCode) {
            $('.search_zipcode').val('');
        }
        
        
        return true;
    });
}
    			}
    			catch(e){
    				VVM.debug.error(e);
        		}
            

/* --- End /home/httpd/arch/public/app_frame/webroot/js/HomeCalendarTabs.js --- */
/* --- Start /home/httpd/arch/public/app_frame/webroot/js/jquery.lazyload.js --- */


            	try {
            		/*
 * Lazy Load - jQuery plugin for lazy loading images
 *
 * Copyright (c) 2007-2012 Mika Tuupola
 *
 * Licensed under the MIT license:
 *   http://www.opensource.org/licenses/mit-license.php
 *
 * Project home:
 *   http://www.appelsiini.net/projects/lazyload
 *
 * Version:  1.7.2
 *
 */
(function($, window) {

    $window = $(window);

    $.fn.lazyload = function(options) {
        var elements = this;
        var settings = {
            threshold       : 0,
            failure_limit   : 0,
            event           : "scroll",
            effect          : "show",
            container       : window,
            data_attribute  : "original",
            skip_invisible  : true,
            appear          : null,
            load            : null
        };

        function update() {
            var counter = 0;
      
            elements.each(function() {
                var $this = $(this);
                if (settings.skip_invisible && !$this.is(":visible")) {
                    return;
                }
                if ($.abovethetop(this, settings) ||
                    $.leftofbegin(this, settings)) {
                        /* Nothing. */
                } else if (!$.belowthefold(this, settings) &&
                    !$.rightoffold(this, settings)) {
                        $this.trigger("appear");
                } else {
                    if (++counter > settings.failure_limit) {
                        return false;
                    }
                }
            });

        }

        if(options) {
            /* Maintain BC for a couple of versions. */
            if (undefined !== options.failurelimit) {
                options.failure_limit = options.failurelimit; 
                delete options.failurelimit;
            }
            if (undefined !== options.effectspeed) {
                options.effect_speed = options.effectspeed; 
                delete options.effectspeed;
            }

            $.extend(settings, options);
        }

        /* Cache container as jQuery as object. */
        $container = (settings.container === undefined ||
                      settings.container === window) ? $window : $(settings.container);

        /* Fire one scroll event per scroll. Not one scroll event per image. */
        if (0 === settings.event.indexOf("scroll")) {
            $container.bind(settings.event, function(event) {
                return update();
            });
        }

        this.each(function() {
            var self = this;
            var $self = $(self);

            self.loaded = false;

            /* When appear is triggered load original image. */
            $self.one("appear", function() {
                if (!this.loaded) {
                    if (settings.appear) {
                        var elements_left = elements.length;
                        settings.appear.call(self, elements_left, settings);
                    }
                    $("<img />")
                        .bind("load", function() {
                            $self
                                .hide()
                                .attr("src", $self.data(settings.data_attribute))
                                [settings.effect](settings.effect_speed);
                            self.loaded = true;

                            /* Remove image from array so it is not looped next time. */
                            var temp = $.grep(elements, function(element) {
                                return !element.loaded;
                            });
                            elements = $(temp);

                            if (settings.load) {
                                var elements_left = elements.length;
                                settings.load.call(self, elements_left, settings);
                            }
                        })
                        .attr("src", $self.data(settings.data_attribute));
                }
            });

            /* When wanted event is triggered load original image */
            /* by triggering appear.                              */
            if (0 !== settings.event.indexOf("scroll")) {
                $self.bind(settings.event, function(event) {
                    if (!self.loaded) {
                        $self.trigger("appear");
                    }
                });
            }
        });

        /* Check if something appears when window is resized. */
        $window.bind("resize", function(event) {
            update();
        });

        /* Force initial check if images should appear. */
        update();
        
        return this;
    };

    /* Convenience methods in jQuery namespace.           */
    /* Use as  $.belowthefold(element, {threshold : 100, container : window}) */

    $.belowthefold = function(element, settings) {
        var fold;
        
        if (settings.container === undefined || settings.container === window) {
            fold = $window.height() + $window.scrollTop();
        } else {
            fold = $container.offset().top + $container.height();
        }

        return fold <= $(element).offset().top - settings.threshold;
    };
    
    $.rightoffold = function(element, settings) {
        var fold;

        if (settings.container === undefined || settings.container === window) {
            fold = $window.width() + $window.scrollLeft();
        } else {
            fold = $container.offset().left + $container.width();
        }

        return fold <= $(element).offset().left - settings.threshold;
    };
        
    $.abovethetop = function(element, settings) {
        var fold;
        
        if (settings.container === undefined || settings.container === window) {
            fold = $window.scrollTop();
        } else {
            fold = $container.offset().top;
        }

        return fold >= $(element).offset().top + settings.threshold  + $(element).height();
    };
    
    $.leftofbegin = function(element, settings) {
        var fold;
        
        if (settings.container === undefined || settings.container === window) {
            fold = $window.scrollLeft();
        } else {
            fold = $container.offset().left;
        }

        return fold >= $(element).offset().left + settings.threshold + $(element).width();
    };

    $.inviewport = function(element, settings) {
         return !$.rightofscreen(element, settings) && !$.leftofscreen(element, settings) && 
                !$.belowthefold(element, settings) && !$.abovethetop(element, settings);
     };

    /* Custom selectors for your convenience.   */
    /* Use as $("img:below-the-fold").something() */

    $.extend($.expr[':'], {
        "below-the-fold" : function(a) { return $.belowthefold(a, {threshold : 0, container: window}); },
        "above-the-top"  : function(a) { return !$.belowthefold(a, {threshold : 0, container: window}); },
        "right-of-screen": function(a) { return $.rightoffold(a, {threshold : 0, container: window}); },
        "left-of-screen" : function(a) { return !$.rightoffold(a, {threshold : 0, container: window}); },
        "in-viewport"    : function(a) { return !$.inviewport(a, {threshold : 0, container: window}); },
        /* Maintain BC for couple of versions. */
        "above-the-fold" : function(a) { return !$.belowthefold(a, {threshold : 0, container: window}); },
        "right-of-fold"  : function(a) { return $.rightoffold(a, {threshold : 0, container: window}); },
        "left-of-fold"   : function(a) { return !$.rightoffold(a, {threshold : 0, container: window}); }
    });

})(jQuery, window);

    			}
    			catch(e){
    				VVM.debug.error(e);
        		}
            

/* --- End /home/httpd/arch/public/app_frame/webroot/js/jquery.lazyload.js --- */
