$(function() {//PAGELOAD
    $(function() {
        $("#contact-content, #comments-content").accordion({
            collapsible: true,
            autoHeight: false
        });
        $("#value_added_options, #mechanical_features, #interior_features, #exterior_features, #safety_features, #after_market_options").accordion({
            collapsible: true,
            active: false,
            autoHeight: false,
            event: 'mouseover'
        });
    });
    //$('#comments div').show();//do this for any accordion section you want displayed on page load
    //$("#mechanical_features").accordion('activate',0);
	
    /*$('#contact-content div').show();*/
    //$(".ui-accordion-content-active").css({padding:'4px'});
    //	$('#contactSeller div').hide();
    //$('.shadow').dropShadow({left: 2, top: 2, opacity: .3});
	
    //remove comments box if empty
    $myContent = $('#comments-content div').html();
    var $match=new RegExp("[a-zA-Z0-9]");
    if ($match.test($myContent) === false) {
        $('#comments-content').hide();
    }//remove comments box if empty
	
    //	$('#carDetail input[type=text], textarea').emptyonclick();//remove/restore default text
    if($('#CarFirstName').val() == 'First Name') {
        $('#CarFirstName').emptyonclick();//remove/restore default text
    }
    if($('#CarLastName').val() == 'Last Name') {
        $('#CarLastName').emptyonclick();//remove/restore default text
    }
    if($('#CarPhone').val() == 'Phone') {
        $('#CarPhone').emptyonclick();//remove/restore default text
    }
    if($('#CarEmail').val() == 'Email') {
        $('#CarEmail').emptyonclick();//remove/restore default text
    }
    if($('#CarComments').val() == 'Comments') {
        $('#CarComments').emptyonclick();//remove/restore default text
    }
    if($('#CarSecurityCode').val() == '?') {
        $('#CarSecurityCode').emptyonclick();//remove/restore default text
    }
    //contact_seller_form
    $("#contact_seller_form").validate();

    /* This fixes a problem where Chrome keeps the form input where it shouldn't
     * because of the cache directives
     */
    if ($.browser.safari) {
        if(/chrome/.test( navigator.userAgent.toLowerCase() )){
            $('#CarSecurityCode').val('?');
        }
    }
});//PAGELOAD

//FUNCTIONS
$(function(){
    //carType resize
    $('#carType').css({
        fontSize: '70%'
    });
    $("#carType").hover(
        function () {
            $(this).animate({
                fontSize: '100%'
            },400);
        },
        function () {
            $(this).animate({
                fontSize: '70%'
            },400);
        }
        );//carType resize
	  
    $('.shadow').dropShadow({
        left: 2,
        top: 2,
        opacity: .3
    });
	  
    $('.prev, .next').hover(
        function() {
            $(this).addClass('ui-state-hover').css({
                cursor: 'pointer'
            });
        },
        function() {
            $(this).removeClass('ui-state-hover').css({
                cursor: 'default'
            });
        }
        );
	  
    $('#first_name, #last_name, #email, #phone').hover(
        function() {
            $(this).addClass('ui-state-hover');
        },
        function() {
            $(this).removeClass('ui-state-hover').css({
                cursor: 'default'
            });
        }
        );
});