jQuery(document).ready(function() {
/*****************NIGHTS*****************/
            jQuery(".nights img.flag").addClass("flagvisibility");

            jQuery(".nights dt a").click(function() {
                jQuery(".nights dd ul").toggle();
            });
                        
            jQuery(".nights dd ul li a").click(function() {
                var text = jQuery(this).html();
                jQuery(".nights dt a span").html(text);
                jQuery(".nights dd ul").hide();
								document.getElementById("nghts").value = text;
                jQuery("#result").html("Selected value is: " + getSelectedValue("nights"));
            });
                        

            jQuery(document).bind('click', function(e) {
                var jQueryclicked = jQuery(e.target);
                if (! jQueryclicked.parents().hasClass("nights"))
                    jQuery(".nights dd ul").hide();
            });


            jQuery("#flagSwitcher").click(function() {
                jQuery(".nights img.flag").toggleClass("flagvisibility");
            });
/*****************NIGHTS*****************/

/*****************card_type*****************/
            jQuery(".card_type_dl img.flag").addClass("flagvisibility");

            jQuery(".card_type_dl dt a").click(function() {
                jQuery(".card_type_dl dd ul").toggle();
            });
                        
            jQuery(".card_type_dl dd ul li a").click(function() {
                var text = jQuery(this).html();
								
                jQuery(".card_type_dl dt a span").html(text);
                jQuery(".card_type_dl dd ul").hide();
								//document.getElementById("card_type").value = text;
								//checkcardtype(text)
								
            });
                        

            jQuery(document).bind('click', function(e) {
                var jQueryclicked = jQuery(e.target);
                if (! jQueryclicked.parents().hasClass("card_type_dl"))
                    jQuery(".card_type_dl dd ul").hide();
            });


            jQuery("#flagSwitcher").click(function() {
                jQuery(".card_type_dl img.flag").toggleClass("flagvisibility");
            });
/*****************card_type*****************/


/*****************start_month*****************/
            jQuery(".start_month_dl img.flag").addClass("flagvisibility");

            jQuery(".start_month_dl dt a").click(function() {
                jQuery(".start_month_dl dd ul").toggle();
            });
                        
            jQuery(".start_month_dl dd ul li a").click(function() {
                var text = jQuery(this).html();
                jQuery(".start_month_dl dt a span").html(text);
                jQuery(".start_month_dl dd ul").hide();
								document.getElementById("start_month").value = text;
            });
                        

            jQuery(document).bind('click', function(e) {
                var jQueryclicked = jQuery(e.target);
                if (! jQueryclicked.parents().hasClass("start_month_dl"))
                    jQuery(".start_month_dl dd ul").hide();
            });


            jQuery("#flagSwitcher").click(function() {
                jQuery(".start_month_dl img.flag").toggleClass("flagvisibility");
            });
/*****************start*****************/



/*****************start_year*****************/
            jQuery(".start_year_dl img.flag").addClass("flagvisibility");

            jQuery(".start_year_dl dt a").click(function() {
                jQuery(".start_year_dl dd ul").toggle();
            });
                        
            jQuery(".start_year_dl dd ul li a").click(function() {
                var text = jQuery(this).html();
                jQuery(".start_year_dl dt a span").html(text);
                jQuery(".start_year_dl dd ul").hide();
								document.getElementById("start_year").value = text;
            });
                        

            jQuery(document).bind('click', function(e) {
                var jQueryclicked = jQuery(e.target);
                if (! jQueryclicked.parents().hasClass("start_year_dl"))
                    jQuery(".start_year_dl dd ul").hide();
            });


            jQuery("#flagSwitcher").click(function() {
                jQuery(".start_year_dl img.flag").toggleClass("flagvisibility");
            });
/*****************start*****************/

/*****************expiry_month*****************/
            jQuery(".expiry_month_dl img.flag").addClass("flagvisibility");

            jQuery(".expiry_month_dl dt a").click(function() {
                jQuery(".expiry_month_dl dd ul").toggle();
            });
                        
            jQuery(".expiry_month_dl dd ul li a").click(function() {
                var text = jQuery(this).html();
                jQuery(".expiry_month_dl dt a span").html(text);
                jQuery(".expiry_month_dl dd ul").hide();
								document.getElementById("expiry_month").value = text;
            });
                        

            jQuery(document).bind('click', function(e) {
                var jQueryclicked = jQuery(e.target);
                if (! jQueryclicked.parents().hasClass("expiry_month_dl"))
                    jQuery(".expiry_month_dl dd ul").hide();
            });


            jQuery("#flagSwitcher").click(function() {
                jQuery(".expiry_month_dl img.flag").toggleClass("flagvisibility");
            });
/*****************start*****************/



/*****************expiry_year*****************/
            jQuery(".expiry_year_dl img.flag").addClass("flagvisibility");

            jQuery(".expiry_year_dl dt a").click(function() {
                jQuery(".expiry_year_dl dd ul").toggle();
            });
                        
            jQuery(".expiry_year_dl dd ul li a").click(function() {
                var text = jQuery(this).html();
                jQuery(".expiry_year_dl dt a span").html(text);
                jQuery(".expiry_year_dl dd ul").hide();
								document.getElementById("expiry_year").value = text;
            });
                        

            jQuery(document).bind('click', function(e) {
                var jQueryclicked = jQuery(e.target);
                if (! jQueryclicked.parents().hasClass("expiry_year_dl"))
                    jQuery(".expiry_year_dl dd ul").hide();
            });


            jQuery("#flagSwitcher").click(function() {
                jQuery(".expiry_year_dl img.flag").toggleClass("flagvisibility");
            });
/*****************start*****************/


/*****************PERSONS*****************/
						jQuery(".persons img.flag").addClass("flagvisibility");

            jQuery(".persons dt a").click(function() {
                jQuery(".persons dd ul").toggle();
            });
                        
            jQuery(".persons dd ul li a").click(function() {
                var text = jQuery(this).html();
                var testthis = jQuery(".persons dt a span").html(text);
								//alert(testthis)
                jQuery(".persons dd ul").hide();
								document.getElementById("ppl").value = text;
                jQuery("#result").html("Selected value is: " + getSelectedValue("persons"));
            });
                        
            function getSelectedValue(id) {
                return jQuery("#" + id).find("dt a span.value").html();
            }

            jQuery(document).bind('click', function(e) {
                var jQueryclicked = jQuery(e.target);
                if (! jQueryclicked.parents().hasClass("persons"))
                    jQuery(".persons dd ul").hide();
            });


            jQuery("#flagSwitcher").click(function() {
                jQuery(".persons img.flag").toggleClass("flagvisibility");
            });
/*****************PERSONS*****************/


/*****************pref_contact_dl*****************/
						jQuery(".pref_contact_dl img.flag").addClass("flagvisibility");

            jQuery(".pref_contact_dl dt a").click(function() {
                jQuery(".pref_contact_dl dd ul").toggle();
            });
                        
            jQuery(".pref_contact_dl dd ul li a").click(function() {
                var text = jQuery(this).html();
                var testthis = jQuery(".pref_contact_dl dt a span").html(text);
								//alert(testthis)
                jQuery(".pref_contact_dl dd ul").hide();
								document.getElementById("pref_contact").value = text;
              
            });
                    

            jQuery(document).bind('click', function(e) {
                var jQueryclicked = jQuery(e.target);
                if (! jQueryclicked.parents().hasClass("pref_contact_dl"))
                    jQuery(".pref_contact_dl dd ul").hide();
            });


            jQuery("#flagSwitcher").click(function() {
                jQuery(".pref_contact_dl img.flag").toggleClass("flagvisibility");
            });
/*****************PERSONS*****************/


/*****************contact_time_dl*****************/
						jQuery(".contact_time_dl img.flag").addClass("flagvisibility");

            jQuery(".contact_time_dl dt a").click(function() {
                jQuery(".contact_time_dl dd ul").toggle();
            });
                        
            jQuery(".contact_time_dl dd ul li a").click(function() {
                var text = jQuery(this).html();
                var testthis = jQuery(".contact_time_dl dt a span").html(text);
								//alert(testthis)
                jQuery(".contact_time_dl dd ul").hide();
								document.getElementById("contact_time").value = text;
              
            });
                    

            jQuery(document).bind('click', function(e) {
                var jQueryclicked = jQuery(e.target);
                if (! jQueryclicked.parents().hasClass("contact_time_dl"))
                    jQuery(".contact_time_dl dd ul").hide();
            });


            jQuery("#flagSwitcher").click(function() {
                jQuery(".contact_time_dl img.flag").toggleClass("flagvisibility");
            });
/*****************contact_time_dl*****************/

        });
