	  $(document).ready(function(){
		  

			// here is my changes
			$('#id_xxxx_how, #id_gender').selectbox();
			$('#content input[type=radio]').hide();
			$('#id_dob').datepicker({ dateFormat: 'dd-mm-yy', changeMonth: true, changeYear: true, yearRange: '1900:2010' });
			if(!$('#id_dob').val()) {
				$('#id_dob').val('DD-MM-YY').addClass('fade').focus(function() {
					$(this).removeClass('fade').val('');
				});
			}
			
			//reset validator messages
			jQuery.validator.messages.required = "";
			jQuery.validator.messages.equalTo = "";
			$('#membership').validate({

				invalidHandler: function(e, validator){
					var errors = validator.numberOfInvalids();
					if (errors) {
						$('.errors').show();
						var $fields = $('.required');
						var i = 0;
						$.each($fields, function() {

							if($(this).val() =='' || $(this).val() == "DD-MM-YY") {

								i++;
								if(i == 1){
									$(this).focus();
								}
								
								// special fix the safari
								if($(this).attr('id') == "id_privacy"){
									
									var checked = $(this).is(':checked');
									if(checked == false){
										$(this).next(".ui-checkbox").css('border', '3px #e31a00 solid');
										$(this).next(".ui-checkbox").addClass("ui-corner-all");
									}else{
										$(this).next(".ui-checkbox").css('border', '0px');
										$(this).next(".ui-checkbox").removeClass("ui-corner-all");
									}
								}else{
									$(this).parent().css('background', '#e31a00');
									$('label[for='+$(this).attr('id')+']').css('color', '#e31a00');
								}
								
							}else{


								// Part for check box terms and condition
								if($(this).attr('id') == "id_privacy"){
								
									var checked = $(this).is(':checked');
									if(checked == false){
										$(this).next(".ui-checkbox").css('border', '3px #e31a00 solid');
										$(this).next(".ui-checkbox").addClass("ui-corner-all");
									}else{
										$(this).next(".ui-checkbox").css('border', '0px');
										$(this).next(".ui-checkbox").removeClass("ui-corner-all");
									}
								}else{
									$(this).parent().css('background', '#EAC300');
									$('label[for='+$(this).attr('id')+']').css('color', '#4C3E00');									
								}
								
								
							}
						});
					}
				}
			});
			
			
			
			$('input').focus(function() {
				var $div = $(this).parents('.holder');
				var $help = $div.find('.help');
				if (!$div.hasClass('hilight')) {
					$('.holder').removeClass('hilight');
					$('.help').hide();
					$div.addClass('hilight');
					$help.show();
				} 
			});
			
			$('#content input[type=checkbox]').checkBox().click(function() {
				var $div = $(this).parents('.holder');
				var $help = $div.find('.help');
				$('.help').hide();
				$help.show();
				if (!$div.hasClass('hilight')) {
					$('.holder').removeClass('hilight');
					$div.addClass('hilight');
				}
				if($(this).attr('id') == 'id_interest1') {
					if($(this).attr('checked')) { 
						$('#subscriptions input[type=checkbox]').attr('checked', true).checkBox('reflectUI');
						$('.dropdown').show();
					} else {
						$('#subscriptions input[type=checkbox]').attr('checked', false).checkBox('reflectUI');
						$('.dropdown').hide();
					}
					
				}
			});
			
			if(!$('#id_interest7').attr('checked')) {
				$('.dropdown').hide();
			}
			$('#id_interest7').click(function() {
				if($(this).attr('checked')) {
					$('.dropdown').show();
				} else {
					$('.dropdown').hide();
				}
			});
			
			
			var choices_one = ['id_choice_1_0', 'id_choice_1_1', 'id_choice_1_2', 'id_choice_1_3', 'id_choice_1_4',
			                   'id_choice_1_5', 'id_choice_1_6', 'id_choice_1_7'];
			var choices_two = ['id_choice_2_0', 'id_choice_2_1', 'id_choice_2_2', 'id_choice_2_3', 'id_choice_2_4',
			                   'id_choice_2_5', 'id_choice_2_6', 'id_choice_2_7'];
			var choices_three = ['id_choice_3_0', 'id_choice_3_1', 'id_choice_3_2', 'id_choice_3_3', 'id_choice_3_4',
			                   'id_choice_3_5', 'id_choice_3_6', 'id_choice_3_7'];
			
			var $slider = $("#slider_one").slider({ min: 0, max: 7, step: 1, change: function(ev, ui) {
				$('#choice-one > li > label.on').removeClass('on');
				$('#choice-one input[type=radio]').attr('checked', '');
				$('#'+choices_one[ui.value]).prev().addClass('on');
				$('#'+choices_one[ui.value]).attr('checked', 'checked');
				$('.help').hide();
				}
			});
			$("#slider_two").slider({ min: 0, max: 7, step: 1, change: function(ev, ui) {
				$('#choice-two > li > label.on').removeClass('on');
				$('#choice-two input[type=radio]').attr('checked', '');
				$('#'+choices_two[ui.value]).prev().addClass('on');
				$('#'+choices_two[ui.value]).attr('checked', 'checked');
				$('.help').hide();
				}
			});
			$("#slider_three").slider({ min: 0, max: 7, step: 1, change: function(ev, ui) {
				$('#choice-three > li > label.on').removeClass('on');
				$('#choice-three input[type=radio]').attr('checked', '');
				$('#'+choices_three[ui.value]).prev().addClass('on');
				$('#'+choices_three[ui.value]).attr('checked', 'checked');
				$('.help').hide();
				}
			});
			
			$("#slider_two a").attr("id", "handlerOne");
			$("#slider_one a").attr("id", "handlerTwo");
			$("#slider_three a").attr("id", "handlerThree");
			
			if ($.browser.msie && $.browser.version.substr(0,1)<7) {
				DD_belatedPNG.fix('#tipBg, #tipBgTwo, #tipBgThree, #handlerOne, #handlerTwo, #handlerThree');
			}
			
			//$('#slider').append('<ul id="slider_list"><li class="initial"></li><li></li><li class="odd"></li><li></li><li class="odd"></li><li class="final"></li></ul>');
		  });

