$(document).ready(function() {	
//	$("#home-slideshow").cycle({
//			fx: 'fade',
//			timeout: 5000,
//			pause: 1
//	});
	$('#side-testimonials ul li').append('<a class="btn-sm-blue" style="margin-top: 20px;" href="/testimonials">Additional Testimonials</a>');
	$("#side-testimonials ul").cycle({
			timeout: 0,
			random: 1				
	});
		
	$('#news .repeatable h2:first-child').prepend('<img src="/images/icons/new.png" style="float: left; margin: -6px 10px 0 -15px;" class="no-border" />');
	
	var quickLinksExpand = '<span id="toggle-expand" class="t11 arial" style="font-weight: normal; margin-left: 10px;">[+] EXPAND</span>';
	var quickLinksCollapse = '<span id="toggle-collapse" class="t11 arial" style="font-weight: normal; margin-left: 10px; display: none;">[x] CLOSE</span>';
	
	$("#quick-links-toggler").css('cursor','pointer').next('div:first').hide();
	$("#quick-links-toggler").append(quickLinksExpand).append(quickLinksCollapse);
//	$(".sub-nav").find('ul').hide();
	$("#quick-links-toggler").click(function(){
	   $(this).next('div:first').slideToggle();
	   $('#toggle-expand').toggle();
	   $('#toggle-collapse').toggle();
	   $('#side-testimonials').fadeToggle('fast');
	});
	
	
	// FAQ
	$("#faqs p, #faqs ul, #faq ol").hide();
	$("#faqs h3").css('cursor','pointer');
	$("#faqs h3").click(function(){
		$(this).toggleClass('active');
		$(this).nextUntil("h3").slideToggle(200)		
		return false;		
	});
	
//	$(".sub-nav li:has(ul) a").click(function(){
//	   $(this).toggleClass('open');
//	   $(this).next('ul').slideToggle();
//	});

	
	$("a[rel^='lightbox']").slimbox({}, null, function(el) {
			return (this == el) || ((this.rel.length > 8) && (this.rel == el.rel));
		});
	
	// VALIDATION
	$("#contact-form").validate();
	
	// PRELOAD CSS IMAGES
	$.preloadCssImages();

    // DROPDOWN
	
//	function NavOver () {
//			$('a:first', this).addClass('active');
//			$('ul:first', this).fadeIn(200);
//		}
//	function NavOff () {
//			$('a:first', this).removeClass('active');
//			$('ul:first', this).fadeOut(100);			
//		}
//		var config = {    
//		 sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)    
//		 interval: 100, // number = milliseconds for onMouseOver polling interval    
//		 over: NavOver, // function = onMouseOver callback (REQUIRED)    
//		 timeout: 300, // number = milliseconds delay before onMouseOut    
//		 out: NavOff // function = onMouseOut callback (REQUIRED)    
//	};
//	$("ul#nav li").hoverIntent(config);
	
		$('#nav li').hover(
		function () {
			$('a:first', this).stop(true,true).addClass('active');
			$('ul:first', this).stop(true,true).fadeIn(200);
		}, 
		function () {
			$('a:first', this).stop(true,true).removeClass('active');
			$('ul:first', this).stop(true,true).fadeOut(100);	
		}
	);
	
	
	// STYLE LINKS
	$("a[href$='.pdf']").addClass("pdf");
	$("a[href$='.zip'], a[href$='.rar']").addClass("zip"); 
	$("a[href^='mailto:']").addClass("email");
	$('a').filter(function() {
	    return this.hostname && this.hostname !== location.hostname;
	  }).addClass("external").attr("target", "_blank");

  });
