
    var consumerNewQuoteURL = 'https://direct.markeluk.com/DirectAuthentication/ConsumerQuoteNew.aspx';

    $(document).ready
	(
		function() {


            // Enable the 'Quote and Buy' buttons to have the highlighted arrow
		    // when the mouse hovers over them.
		    $(".quote_buy").bind("mouseenter mouseleave", function(e) {
		        var src = $(this).attr('src');
		        // alert(src); 
		        if (src.lastIndexOf("quote_buy.png") != -1) {
		            $(this).attr('src', src.replace("quote_buy.png", "quote_buy_hover.png"));
		        } else {
		            $(this).attr('src', src.replace("quote_buy_hover.png", "quote_buy.png"));
		        }
		    });


		    $(".cg_quote_buy").bind("mouseenter mouseleave", function (e) {
		        var src = $(this).attr('src');
		        // alert(src); 
		        if (src.lastIndexOf("more-info.png") != -1) {
		            $(this).attr('src', src.replace("more-info.png", "more-info-hover.png"));
		        } else {
		            $(this).attr('src', src.replace("more-info-hover.png", "more-info.png"));
		        }
		    });

		    // Enable the 'My Area' button to have the highlighted arrow
		    // when the mouse hovers over them.
		    $(".MyAreaLoginButton").bind("mouseenter mouseleave", function (e) {
		        var src = $(this).attr('src');
		        // alert(src); 
		        if (src.lastIndexOf("my-area.png") != -1) {
		            $(this).attr('src', src.replace("my-area.png", "my-area-hover.png"));
		        } else {
		            $(this).attr('src', src.replace("my-area-hover.png", "my-area.png"));
		        }
		    });

            
            // Bind the jQuery accordion the html div element.
		    $("#accordion").accordion({
		        header: 'h4',
		        active: false,
		        collapsible: true
		    });

	
	
		    // Build the array of professions from the professions.xml file
            // held in the root directory
		    var professionsArray = new Array();
		    var HTML_FILE_URL = '/professions.xml';
		    $.get(HTML_FILE_URL, function(data) {
		        var fileDom = $(data);
		        var i = 0;
		        fileDom.find('profession').each(function() {
		            professionsArray[i] = $(this).text();
		            i++;
		        });
		    });
		    
		    
		    // Bind the jQuery autoComplete to the selected inputs
		    $(".ac_input").autocomplete(professionsArray, { selectFirst: false, matchContains: true, scrollHeight: 400, width: 250 });

            // Bind the start-up message for the auto-complete inputs
		    $(".ac_input").each(function() {
		        $(this).val('type your profession here');
		    });


		    // Bind the click function for the 'Quote and Buy' buttons. Opens a new window to the DCT quotation system.
            // The jQuery auto-complete file handles the user either tabbing, hitting return or clicking on the 
            // selection from the drop-down box.
		    $(".quote_buy").click(function(e) {

		        var professionInputID = $(this).attr('inputid');
		        if (professionInputID != null)
		        {
					var profession = document.getElementById(professionInputID).value;
					var markelProfession = false;
					for (i = 0; i < professionsArray.length; i++) {
						if (professionsArray[i].toUpperCase() == profession.toUpperCase()) {
							markelProfession = true;
							profession = professionsArray[i];
						}
					}
					if (markelProfession == false)
						profession = "";
				}
				else
				{profession = "";}
		        window.open(consumerNewQuoteURL + '?profession=' + profession, "", "toolbar=1,menubar=1,resizable=1,location=1,status=1,scrollbars=1,width=1265,height=900");
		    });
		}
	);
 
