/* ========================================================================= */
/* BE SURE TO COMMENT CODE/IDENTIFY PER PLUGIN CALL                          */
/* ========================================================================= */
$(document).ready(function(){
	
	$('input.txt, .txt input').clearField();
	
	$('#menu-bar ul ul.sub-menu').append('<li class="last"></li>');
	$('#menu-bar ul li:last-child').addClass('last-menu-item');
		
	//Splash Banner Cycle 
	if($('#splash .bi-slides img').length>1) {
		
		$('#splash .bi-slides').cycle({
			fx: 'none',
			speed: '1000',
			timeout: '10000',
			pause: 1,
			cssBefore: {display: 'block', overflow: 'visible'},
			before: function(){
				$(this).parent().find('.slide-img').removeClass('current');
			},
			after: function(){
				$(this).addClass('current');
			} 
		});
	}
	
	//Sites Banner Cycle 
	if($('.banner-slide .slide').length>1) {
	var transition = $.browser.msie && $.browser.version < 10 ? 'none' : 'fade';
	$('#sites .banner-slide').cycle({
		fx: transition,
		speed: '1000',
		timeout: '10000',
		cssBefore: {display: 'none'},
		cleartype: true,
		cleartypeNoBg: true,
		before: function(){
			$(this).parent().find('div.slide').removeClass('current');
		},
		after: function(){
			$(this).addClass('current');
		} 
	});
	} else {
		$('.banner-slide .slide').css('display', 'block');
	}
	
	// Resize Textarea
	$('.generic-content .content-main form textarea').autoResize({
	    // On resize:
	    onResize : function() {
	        $(this).css({opacity:0.8});
	    },
	    // After resize:
	    animateCallback : function() {
	        $(this).css({opacity:1});
	    },
	    // Quite slow animation:
	    animateDuration : 300,
	    // More extra space:
	    extraSpace : 40
	});
	
	/* Accordion list */
	$('.accordion-head').click(function(){
		if($(this).hasClass('inactive')) {
			$(this).next('.accordion-data').slideDown(200);
			$(this).addClass('active');
			$(this).removeClass('inactive');
			$(this).children('.bttn-toggle').text('Collapse');
		}
		else {
			$(this).next('.accordion-data').slideUp(100);
			$(this).addClass('inactive');
			$(this).removeClass('active');
			$(this).children('.bttn-toggle').text('Expand');
		}
	});
	
	
	// Tab Content 
	$('.tab-content').tabs();
	
    
    //Privacy Policy in Colorbox
    $('.cb-page').colorbox({
    	inline: true,
    	width: '600px',
    	opacity: '0.8'
    });
	
	
});
