SF.GENFORMCUSTOM = {
        
    setupForm: function() 
    {
        var $checkTitleRow = SF.ENQUIRY.$wrapper.find('#titleRowGeneral');
        SF.ENQUIRY.$form.find('.ef-submit').attr('disabled', false);
            
        if (SF.getUrlVars != '') 
        {
            var refUrl = SF.getUrlVars('','pageUrl');
            var strDestination = SF.getUrlVars('','destination')
            if (refUrl !='') 
            {
                SF.ENQUIRY.$form.find('input[name="refUrl"]').val(refUrl);    
            };
            
            if (strDestination != '' || window.location.href.indexOf('.html') >-1) 
            {
                strDestination = strDestination.replace('+',' ');
                strDestination = strDestination.slice(0,1).toUpperCase() + strDestination.slice(1) ;
                
                SF.ENQUIRY.$wrapper.find('.productName').text(strDestination)
                SF.ENQUIRY.$form.find('#travelDestination').val(strDestination)
            }
            else 
            {
                if ($checkTitleRow.length != 1)
                {
                    SF.ENQUIRY.$wrapper.find('#titleRowProduct')
                                    .remove()
                                        .end()
                                    .prepend('<div id="titleRowGeneral"><span class="general">General Enquiry</span></div>')    
                }
                

            };
        
            if( $('#store').length > 0 )
            {
                var postCode = SF.getUrlVars('','postCode');
                $('#postCode').val(postCode);
            }
                
        };

        var $departureDate = $('#departureDate');
        var $returnDate = $('#returnDate');
        
        $departureDate.val('dd/mm/yyyy');
        $returnDate.val('dd/mm/yyyy');
        
        $departureDate.datepicker({
            minDate: new Date(),
            dateFormat: 'dd/mm/yy',
            showOn: 'both',
            buttonImage: '/images/sf-mini-cali.png',
            buttonImageOnly: true
        });
        
        $returnDate.datepicker({
            minDate: new Date(),
            dateFormat: 'dd/mm/yy',
            showOn: 'both',
            buttonImage: '/images/sf-mini-cali.png',
            buttonImageOnly: true 
        });
    }
}

SF.GENERALENQ = $.extend(true, SF.ENQUIRY, SF.GENFORMCUSTOM);

SF.GENERALENQ.init();

