// ! -- jQuery Common Functions --
// --------------------------------------------
jQuery(document).ready(function($){


	// ! -- Generic Uses --
	// --------------------------------------------
		
		//
		$("input[type=text], textarea").focus(function(){
    	$(this).val("");
    	});

		// Popup Window
		$('a.popup').click(function(){
			window.open(this.href);
			return false;
		});
			
		// Add multiple columns to page
		$('#columnizer').columnize({ columns:2, lastNeverTallest: true });
		$('.columnize').columnize({ columns:3, lastNeverTallest: true });
		
		// Select Text on focus
		$("form input[type=text], form textarea").focus(function(){
		    this.select();
		});
	
	
	// ! -- Home Page List --
	// --------------------------------------------
		
		if($('#home_list').length) {
			
			$('#home_list').css('position', 'absolute');
			$('#home_list').wrap('<div id="home_list_hldr"></div>');
			$('#home_list_hldr').appendTo('#content p:eq(0)');
			
			var move_a = new Array();
			$('#home_list li').each(function(index){
					move_a[index] = -index * 50;
			});
			
			var move_list = function(){
				var random = Math.floor(Math.random()*move_a.length);
				$('#home_list').animate({ 
	        top: move_a[random]
	      }, 'slow' );
			}
			
			window.setInterval(move_list, 5000);
			
		}
		
	// ! -- Home Page List 2 --
	// --------------------------------------------
		
		if($('#home_list2').length) {
			
			$('#home_list2').css('position', 'absolute');
			$('#home_list2').wrap('<div id="home_list2_hldr"></div>');
			$('#home_list2_hldr').appendTo('#content p:eq(0)');
			
			var move_a = new Array();
			$('#home_list2 li').each(function(index){
					move_a[index] = -index * 50;
			});
			
			var move_list = function(){
				var random = Math.floor(Math.random()*move_a.length);
				$('#home_list2').animate({ 
	        top: move_a[random]
	      }, 'slow' );
			}
			
			window.setInterval(move_list, 5025);
			
		}
		
		
	// ! -- Home Page List 3 --
	// --------------------------------------------
		
		if($('#home_list3').length) {
			
			$('#home_list3').css('position', 'absolute');
			$('#home_list3').wrap('<div id="home_list3_hldr"></div>');
			$('#home_list3_hldr').appendTo('#content p:eq(0)');
			
			var move_a = new Array();
			$('#home_list3 li').each(function(index){
					move_a[index] = -index * 50;
			});
			
			var move_list = function(){
				var random = Math.floor(Math.random()*move_a.length);
				$('#home_list3').animate({ 
	        top: move_a[random]
	      }, 'slow' );
			}
			
			window.setInterval(move_list, 5050);
			
		}
		
		
	// ! -- Home Page List 4 --
	// --------------------------------------------
		
		if($('#home_list4').length) {
			
			$('#home_list4').css('position', 'absolute');
			$('#home_list4').wrap('<div id="home_list4_hldr"></div>');
			$('#home_list4_hldr').appendTo('#content p:eq(0)');
			
			var move_a = new Array();
			$('#home_list4 li').each(function(index){
					move_a[index] = -index * 50;
			});
			
			var move_list = function(){
				var random = Math.floor(Math.random()*move_a.length);
				$('#home_list4').animate({ 
	        top: move_a[random]
	      }, 'slow' );
			}
			
			window.setInterval(move_list, 5100);
			
		}
		
	// ! -- Sub Page List --
	// --------------------------------------------
		
		if($('#sub_list').length) {
			
			$('#sub_list').css('position', 'absolute');
			$('#sub_list').wrap('<div id="sub_list_hldr"></div>');
			$('#sub_list_hldr').appendTo('#content p:eq(0)');
			
			var move_a = new Array();
			$('#sub_list li').each(function(index){
					move_a[index] = -index * 50;
			});
			
			var move_list = function(){
				var random = Math.floor(Math.random()*move_a.length);
				$('#sub_list').animate({ 
	        top: move_a[random]
	      }, 'slow' );
			}
			
			window.setInterval(move_list, 5100);
			
		}	

	// ! -- Inspiration List --
	// --------------------------------------------
		
		if($('#inspire_list').length) {
			
			$('#inspire_list').css('position', 'absolute');
			$('#inspire_list').wrap('<div id="inspire_list_hldr"></div>');
			$('#inspire_list_hldr').appendTo('#content p:eq(0)');
			
			var move_a = new Array();
			$('#inspire_list li').each(function(index){
					move_a[index] = -index * 50;
			});
			
			var move_list = function(){
				var random = Math.floor(Math.random()*move_a.length);
				$('#inspire_list').animate({ 
	        top: move_a[random]
	      }, 'slow' );
			}
			
			window.setInterval(move_list, 5100);
			
		}	

});
