//=====================================================//
var LoadReadyLocal = {

    /*event: function(){
        $(window).load(function(){
           $(".centered").cp_center();
        });
    },*/

    registerForm: function(){
        $(function() {
            Member.setupRegisterForm();
        });
    },

    unsubscribe: function(){
        $(function() {
            Member.setupUnsubscribeForm();
        });
    },

    printLocationMap: function(){
        $(function() {

            $("#divId").dialog({
                autoOpen: false,
                modal: true,
                height: 600,
                width: 850
            });

            $('#largeMap').click(function(e){
                e.preventDefault();
                Dialog.showDialog.call(this);
            });
        });
    }

};

LoadReady = $.extend(LoadReady, LoadReadyLocal);


$(function() {

    $('ul.sf-menu').superfish();

    $('.list li:nth-child(1)').css({'border-top': '5px solid #D973B5'});
    $('#list li:nth-child(even)').css({'background-color': 'none'});
    $('div.shoppeList:nth-child(even)').css({'background-color': '#f3f3f3'});
    $('.shopList table.full tr.row:nth-child(odd)').css({'background-color': '#F9E9F4'});
    $('.siteSearchResult tr:nth-child(odd)').css({'background-color': '#F9E9F4'});
    $('#lang li:last').css({'border-right': '0px solid #000'});

    $('#siteSearch, #storeFinder').submit(function(e){
        e.preventDefault();
        Util.clearPrepopulatedTextbox($(this));
        $(this).unbind('submit');
        $(this).trigger('submit');
    });


    $('.btnSubmit').click(function(e){
        e.preventDefault();
        $(this).closest('form').trigger('submit');
    });

    $('#group_websites').change(function() {
        if ($(this).val() != ''){
            window.open($(this).val());
        }
    });

    $('select#fld_country').change( function() {
        var countryVal = ($(this).val());
		var url = '/index.php?_spAction=countryCode&showHTML=0';
        
		if (countryVal == 'OTHER'){
            $('#country_other_wrap').show();
            $('#fld_country_other').seekAttention();
		} else{
            $('#country_other_wrap').hide();
		    $.get(url, {country: countryVal}, function (data) {
		    	$('#fld_mobile').val(data);
		    });
		}
	});
});