PageSourceSearch

https://www.online-health-insurance.com/wordpress/wp-content/theme…/html5-boilerplate/js/functions.js

js online-health-insurance.com collected 2026-09-26 11:02:08 UTC 8,959 bytes, 270 lines download raw bytes

1jQuery(document).ready(function(){
2								
3		jQuery('.post_preview').toggle(
4			function(){
5				var element = jQuery(this);
6				showPostPreview(element);									   
7			},
8			function(){
9				var element = jQuery(this);
10				hidePostPreview(element);									   
11			}
12		);
13		jQuery('#GetInsForm').live('submit',function(e){
14			var elemID = jQuery(this).attr('id');
15			zipForm('#'+elemID);
16			e.preventDefault();
17		});
18		init_basic_form_binding();
19});
20
21function showPostPreview(passedElement){
22	var parentElementSiblings = passedElement.parent().siblings('.entry-content');
23	passedElement.addClass('active');
24	parentElementSiblings.children('p').fadeIn(200);
25	
26}
27
28function hidePostPreview(passedElement){
29	var parentElementSiblings = passedElement.parent().siblings('.entry-content');
30	passedElement.removeClass('active');
31	parentElementSiblings.children('p').fadeOut(200);
32	
33}
34
35function init_basic_form_binding() {
36	//fake radio button behvaior
37	jQuery('.faux_radio').click(function(e){
38		e.stopPropagation();
39		var siblingRadios = jQuery(this).parents('label').find('.faux_radio');
40		var checkedVal = jQuery(this).attr('title');
41		jQuery(siblingRadios).removeClass("checked");
42		jQuery(this).addClass("checked");
43		jQuery(this).parent().siblings('.hidden').attr('value',checkedVal);
44		if(jQuery(this).parent().parent().hasClass('errorField')){
45			jQuery(this).parent().parent().removeClass('errorField').addClass('errorFixed');
46		}
47	});
48	jQuery('input[type="radio"]').customInput();
49	//give the submit button a hover state
50	jQuery('#quick_submit, #form_submit_step2').hover(
51		function(){
52			jQuery(this).addClass('submit_over');
53		},
54		function(){
55			jQuery(this).removeClass('submit_over');
56		}
57	);
58	
59	// prevent event propogation up to the form click
60	jQuery('input, .faux_radio').not('.hidden').click(function(e){
61		e.stopPropagation();
62		jQuery('.faux_dropdown').each(function(){
63			if(jQuery(this).hasClass('clicked')){
64				jQuery(this).trigger('click');
65			}
66		});
67	});
68}
69
70var formSubmitted = false;
71// !!!WARNING!!! HEY YOU! READ THIS!
72// !!!WARNING!!! HEY YOU! READ THIS!
73// !!!WARNING!!! HEY YOU! READ THIS!
74// function is mirrored in /wordpress/themes/news_and_articles/scripts/functions.js AND
75// function is mirrored in /includes/FreeQuoteBody.php
76function zipForm(formID){
77	var isSenior = 0;
78	
79	switch(formID){
80		case '#GetInsForm':
81			var processing_container = '#quick-processing';
82			var error_container = '#error_validate';
83		break;
84		case '#freeQuote_GetInsForm':
85			var processing_container = '#freeQuote_quick-processing';
86			var error_container = '#freeQuote_error_validate';
87		break;
88	}
89	
90	// this is step 1
91	var isValid = jQuery(formID).validate({
92		errorPlacement: function(error,element) { 
93			return true; 
94		},
95		rules: {
96			older_than_65: { required: true },
97			zip: { required: true, minlength: 5, maxlength: 5, number: true }
98		},
99		highlight: function(element){
100			var elemName = jQuery(element).attr('name');
101			if(elemName == 'older_than_65') var elemParent = jQuery(element).parent().parent();
102			else var elemParent = jQuery(element).parent();
103			if(elemParent.hasClass('errorFixed')){
104				elemParent.removeClass('errorFixed');
105			}
106			elemParent.addClass('errorField');
107		},
108		unhighlight: function(element){
109			var elemName = jQuery(element).attr('name');
110			if(elemName == 'older_than_65') var elemParent = jQuery(element).parent().parent();
111			else var elemParent = jQuery(element).parent();
112			if(elemParent.hasClass('errorField')){
113				elemParent.removeClass('errorField');
114			}
115			elemParent.addClass('errorFixed');
116		}
117	}).form();
118	
119	if(isValid && !formSubmitted){
120		formSubmitted = true;
121		
122		jQuery(processing_container).show();
123		var data = 'ajax=1&step=0&'+jQuery(formID).serialize();
124		var hioId = 0;
125		var state = '';
126		var qs = '';
127		var resp = '';
128	  	jQuery.ajax({
129	  		async: false,
130	  		type: "post",
131	  		url: "index.php",
132	  		dataType: "text",
133	  		data: data,
134	  		success: function(msg){
135	  			resp = jQuery.evalJSON(msg);
136	  			qs = 'zip='+resp.zip+'&state='+resp.state+'&senior='+resp.senior;
137	  			if(resp.error){
138	  				isValid = false;
139					jQuery(processing_container).hide();
140	  				jQuery(error_container).html(resp.errormsg).show();
141					if(resp.highlight != ""){
142						if(resp.highlight == 'zip'){
143							var elemParent = jQuery("input[name='zip']").parent();
144							elemParent.addClass('errorField');	
145							elemParent.removeClass('errorFixed');
146						}
147					}
148	  			} else {
149		  			hioId = resp.hio_id;
150		  			isSenior = resp.senior;
151		  			state = resp.state;
152		  			hn_state = resp.hn_state;
153		  			if(resp.showListings>0){
154//	  					isValid = false;
155//	  					if(window.location.pathname.indexOf('/seniors/') >= 0){
156//		  					window.location.href = '/seniors/listings.php?'+qs;
157//	  					} else if(window.location.pathname.indexOf('/freequotes/') >= 0){
158//		  					window.location.href = '/freequotes/listings.php?'+qs;
159//	  					} else {
160//		  					window.location.href = '/listings.php?'+qs;
161//	  					}
162	  					isValid = false;
163	  					window.location.href=listingsPage+'?'+qs;
164	  				} else if(resp.step2>0){
165	  					jQuery(formID).attr("action",step1action);
166	  				} else if(resp.thank_you){
167	  					isValid = false;
168	  					qs = 'Subreferrer='+resp.Subreferrer+'&HN_State='+hn_state+'&state='+state+'&senior='+resp.senior+'&hio_id='+resp.hio_id;
169	  					window.location.href = step3action+'?'+qs;
170	  				}
171	  			}
172	  		}
173	  	});
174	  	if(isValid){
175	  		/*if(resp.iframe){
176	  			//if(resp.track) jQuery.get(resp.track);
177	  			formSubmitted = false; 
178	  			jQuery.get('/includes/form_processing/insert_thirdparty_form.php', function(data){
179					// jQuery for showing the third party form
180		  				jQuery('#logo').after(data);
181			  			if(resp.track) {
182			  				//console.log(resp.track);
183			  				jQuery('#third_party_iframe iframe').attr('src',resp.track).load(function(){zipForm_setIframe(resp.iframe, formID);});
184			  			} else {
185			  				zipForm_setIframe(resp.iframe, formID);
186			  			}
187		  			},"html");
188		  	}*/
189	  		//else {
190	  			//if we are in the /seniors/ or /freequotes/ don't show the abandonment
191	  			if(window.location.pathname.indexOf('/seniors/') == -1 && window.location.pathname.indexOf('/freequotes/') ==-1){
192	  				if(resp.state != 'AZ' && resp.state != 'FL') {
193	  		  			var popURL = step1action+'?'+qs;
194	  		  			var popListings = window.open(popURL,'new_window','fullscreen=yes,toolbar=yes,location=yes, menubar=yes,status=yes,scrollbars=yes,resizable=yes');
195	  				}
196	  				//append query string if set
197				  	if(qs){ window.location.href = '/listings.php?'+qs; }
198				  	else { window.location.href = '/listings.php?'+qs; }
199	  			}else {
200	  				if(qs){ window.location.href = step1action+'?'+qs; }
201				  	else { window.location.href = step1action+'?'+qs; }
202	  			}
203		  		
204	  		//}
205	  	} else {
206	  		formSubmitted = false;
207	  	}
208
209	} else { //isValid = false;
210		var inputSelectFields = jQuery('.errorField').children().children().filter('input,select');	
211		if(inputSelectFields.length != 0) { inputSelectFields.first().focus(); }
212	}
213	return false;
214}
215/*-------------------------------------------------------------------------------------------------------------- */
216jQuery.fn.customInput = function(){
217	jQuery(this).each(function(i){	
218		if(jQuery(this).is('[type=checkbox],[type=radio]')){
219			var input = jQuery(this);
220			
221			// get the associated label using the input's id
222			var label = jQuery('label[for='+input.attr('id')+']');
223			
224			//get type, for classname suffix 
225			var inputType = (input.is('[type=checkbox]')) ? 'checkbox' : 'radio';
226			
227			// wrap the input + label in a div 
228			jQuery('<div class="custom-'+ inputType +'"></div>').insertBefore(input).append(input, label);
229			
230			// find all inputs in this set using the shared name attribute
231			var allInputs = jQuery('input[name='+input.attr('name')+']');
232			
233			// necessary for browsers that don't support the :hover pseudo class on labels
234			label.hover(
235				function(){ 
236					jQuery(this).addClass('hover'); 
237					if(inputType == 'checkbox' && input.is(':checked')){ 
238						jQuery(this).addClass('checkedHover'); 
239					} 
240				},
241				function(){ jQuery(this).removeClass('hover checkedHover'); }
242			);
243			
244			//bind custom event, trigger it, bind click,focus,blur events					
245			input.bind('updateState', function(){	
246				if (input.is(':checked')) {
247					if (input.is(':radio')) {				
248						allInputs.each(function(){
249							jQuery('label[for='+jQuery(this).attr('id')+']').removeClass('checked');
250						});		
251					};
252					label.addClass('checked');
253				}
254				else { label.removeClass('checked checkedHover checkedFocus'); }
255										
256			})
257			.trigger('updateState')
258			.click(function(){ 
259				jQuery(this).trigger('updateState'); 
260			})
261			.focus(function(){ 
262				label.addClass('focus'); 
263				if(inputType == 'checkbox' && input.is(':checked')){ 
264					jQuery(this).addClass('checkedFocus'); 
265				} 
266			})
267			.blur(function(){ label.removeClass('focus checkedFocus'); });
268		}
269	});
270};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.