
Cufon.replace('h1');
Cufon.replace('#banner_book_a_vehicle_now');
Cufon.replace('#banner_02072720272');
(function($) {
    $(document).ready(function() {

        $('#Form_AlertForm_Email').bind('blur',function(e){
           $.ajax({
           type: "GET",
           url: "/ajax.php",
           data: "action=check_email&email="+(this).value,
           success: function(msg){
                if (msg != 0) {
                    $('#Form_AlertForm_Email').css('color: red;');
                    $('#Form_AlertForm_Email').after('<span class="message required" id="tmp_notice" style="display: block;">'+msg+'' +'</span>');
                    $('.Actions input').hide();
                } else {
                    $('.Actions input').show();                    
                }
           }
         });
        });

        $('#cam_dd').bind('change',function () {
            $('#cam_img').attr('src',$('#cam_dd :selected').val());
        });

//        document.getElementById(\'cam_img\').src = this.value

        $('.alertButton').click(function(e) {
           $("#messages").text('');
            $widgetCount = 0;
            var allCheckbox = $(".widget_count:checked").each(function(index) {
                    $widgetCount ++;
                    $("#messages").append(index+':'+$(this).attr('id')+" checked <br/>");

            });
            $(".widget_count option:selected").each(function(index) {
                $("#messages").append(index+':'+$(this).val());
                if ($(this).val() != 'HW_NA' && $(this).val() != 'cam_NA') {
                    $widgetCount ++;
                } else {
                }

            });
            if ($widgetCount < 6) {
                $("#messages").text('Please select 6 feeds for your home page');
                return false;
            } else if ($widgetCount > 6) {
                $("#messages").text('Please select no more than six feeds for your homepage - you can amend them at any time through the \'Preferences\' page.');
                return false;
            } else {
                $("#messages").text('');

            }

            return true;
        });

        // @TODO REPLACE WITH THE FINAL DOMAIN NAME WHEN IT GETS RELEASED
        $("a[href^=http]").each(
            function(){
                if(this.href.indexOf(location.hostname) == -1) {
                    $(this).attr('target', '_blank');
                }
            }
       );
    // Standard jQuery footer
    });
})(jQuery);