// JavaScript Document

			// ---------------------------------------------
			// ---------------------------------------------
			// ---------------------------------------------	
			
			$(document).ready(function() {
				$('.quoteAnimation').cycle({ // .slideshow
					    fx:     'fade', 
						width: 400, // 450
						height: 150,
						timeout: 6000, 
						delay:  -2000  // choose your transition type, ex: fade, scrollUp, shuffle, etc...
				});
			});
					
					
					
			// ---------------------------------------------
			// ---------------------------------------------
			// ---------------------------------------------		
					



			$(document).ready(function() { // NB. wait till the document has loaded before executing this
			
			
									   
						// $('#loading').hide(); // hide AJAX loading animation
						   
									   
						// Focus first element ----------------------------------
						// $("#searchUTILITY :input:visible:enabled:first").focus(); // focus on first field in form on load
						   
						// ---------------------------------------------
						// ESCAPE strings for URL query string
						// ---------------------------------------------
			
						function queryESC(qs) { 
						
							// This function, takes a querystring, breaks it into an array, 
							// escapes values, joins into and returns new 'escaped' string
							// NB. > hu = window.location.search.substring(1); // standard DOM method
						
							gy = qs.split("&");
							
							var escArray = [];
							count = 0;
							for (i=0;i<gy.length;i++) {
								ft = gy[i].split("=");
								var keyname = ft[0];
								var keyvalue = escape(ft[1]); // escape value
								escArray[count] = (keyname + "=" + keyvalue);
								count=count+1;
							}
							var escString = escArray.join('&'); // concat array into string
							return escString;
						}
			
				
				
			
				
					// ---------------------------------------------
					// for AJAX GET calls 				
					// ---------------------------------------------
					
					// PART ONE doAjax - obtains links from specified DOM target
					// PART TWO callGETAJAX - returns data or failed message and adds this html to taget div
					// PART THREE - the calling arguments to PART ONE doAjax function 
					
					// NB. NEEDS queryESC FUNCTION 			   
									
					function doAjax(target,targetDiv) {
						
					// $('#loading').show(); // show AJAX loading animation	
						
					//alert(target);
					//alert(targetDiv);
			
													 
								// var val = $(this).find('a').attr('href'); // obtain original hyperlink & querystring
								// var val = $(this).attr('href');
								
								var val = $(target).attr('href');
								
								// var callServerScript = 'search_module_SERVER.php';
								
			
					  
								var callServerScript = val.substr(0, [val.indexOf('?')]); // split + obtain server page	      
								var ref = val.slice(val.indexOf('?')+1); // split + obtain query string
								var rand = ((new Date()).getTime()); // generate random number (prevent GET cache problem)
								var querystring = (ref + '&rnd=' + rand);
								
			
								
								var querystringESC = queryESC(querystring); // returns escaped values
								
										 //alert(callServerScript);
										 //alert(querystringESC);
									   
										callGETAJAX(callServerScript, querystringESC, targetDiv); // make ajax call
										
										
										
										
				
						
						} // end doAjax
						
						// ---------------------------------------------------	
						// PART TWO 
						// ---------------------------------------------------	
						
						function callGETAJAX(callServerScript, querystringESC, targetDiv){
						
							$.get(callServerScript, querystringESC, function(data,status){ // callback function	  
									 
								if (status=="success") {
								
									$(targetDiv).html(data); // target DIV for ourput from server
									
									$('#loading').hide(); // hide AJAX loading animation
										
									//holder(); // reapply functions after ajax update
																													
								} else {
								
									var instructs = '<p class="itemIntro">Sorry, info not available at this time, please try again later.</p>';
									$(targetDiv).html(instructs); // target DIV for ourput from server  //.before
									
									$('#loading').hide(); // hide AJAX loading animation
									
									 // holder(); // reapply functions after ajax update
																		
								} // end of status						  
									  
							}); // end get & callback function	
							
								
												
						} // end callAJAX
						
						// ---------------------------------------------------	

						
						// ----------------------
						
						
					$('#blockOne ul.sideListing li a').click(function(e) {
																															   
							e.preventDefault(); // prevent hyperlink							   
															   
							var val = this;		// calling hyperlink						
													 							 
							var targetScript = ('<a href="'+ val +'"></a>');
			
							var target = targetScript;		// calling hyperlink
							var targetDiv = '#answersFAQ1'; // destination div for ajax update						   
							
							doAjax(target,targetDiv);		
							
							//$('.searchField1').val('ALL'); // set form value
							//$('.searchField2').val('ALL'); // set form value
														 
						
						});	
						
					$('#blockTwo ul.sideListing li a').click(function(e) {
																															   
							e.preventDefault(); // prevent hyperlink							   
															   
							var val = this;		// calling hyperlink						
													 							 
							var targetScript = ('<a href="'+ val +'"></a>');
			
							var target = targetScript;		// calling hyperlink
							var targetDiv = '#answersFAQ2'; // destination div for ajax update						   
							
							doAjax(target,targetDiv);		
							
							//$('.searchField1').val('ALL'); // set form value
							//$('.searchField2').val('ALL'); // set form value
														 
						
						});							
						
						// ----------------------
						

						
			}); // end document ready							
					

			

