
/***********************************************
**********  CUFON REPLACEMENTS  ****************
************************************************/

	$(document).ready(function(){
							   
		Cufon.replace('h1');
		Cufon.replace('h3');
		Cufon.replace('#featureBoxesSmall h2');
		Cufon.replace('.newsItem h2');
		Cufon.replace('span.tagline');
		Cufon.replace('#banner .wrapper p');
	});
	


/***********************************************
************  HOMEPAGE BANNER   ****************
************************************************/
$(document).ready(function() {
		$('.slider').DDSlider({
			trans:'fading',
			waitTime: '5000',
			selector: '.slider_selector'
		});
});



/***********************************************
************ PRETTY PHOTO PLUGIN ***************
************************************************/ 

$(document).ready(function(){
	$("a[rel^='prettyPhoto']").prettyPhoto({
			theme: 'pp_default',
			ie6_fallback: true,
			social_tools: false
	});
});



/***********************************************
***  BUTTON ROLLOVER & PRELOAD  ****************
************************************************/

$(document).ready(function() {
	// button rollover
	if ($('.imgBtn') != null) {
		$('.imgBtn').hover(function(){
				if(!$(this).is('.disabled'))
					$(this).attr("src", $(this).attr("src").replace(/^(.*?)(?:-hover)?(\..*?)$/i,'$1-hover$2'));
			},
			function(){
					if(!$(this).is('.disabled'))
						$(this).attr("src", $(this).attr("src").replace(/^(.*)-hover(\..*?)$/i, '$1$2'));
				});
	}
	// preload image rollovers
	if ($("img.imgBtn, img[src^='images/buttons/btn'], input[src^='images/buttons/btn']") != null) {
	    $("img.imgBtn, img[src^='images/buttons/btn'], input[src^='images/buttons/btn']").each(function(){
			    $("<img>").attr("src", $(this).attr("src").replace(/(btn-.*)(\..*?)/i, '$1-hover$2'));
		    });
	}

/***********************************************
***  EXTERNAL LINKS  ***************************
************************************************/

	$("a[rel=external]").each(function() {
		$(this).addClass('external');
		$(this).attr({
			target: "_blank"
		});
	})
});

/***********************************************
********  ANIMATED SCROLLING   *****************
************************************************/

$(document).ready(function(){
		$('.GoTop').click(function(){
				var id = $(this).attr('href');
				if(id.length === 1) return;
				var ele = $(id);
				if(ele.length) {
					var destination = ele.offset().top;
					$('html:not(:animated), body:not(:animated)').animate({
							scrollTop: destination -20
						}, 700, 'easeOutQuint');
				}
			});
});

/***********************************************
***  COMPACT FORM (LABEL OVER INPUT)  **********
************************************************/

$(function(){
	$('form.compact input, form.compact select, form.compact textarea').focus(function(){
			$('label[for=' + $(this).attr('id') + ']').hide();
		});
	$('form.compact input, form.compact select, form.compact textarea').each(function(ele){
			if($(this).val().length > 0)
				$('label[for=' + $(this).attr('id') + ']').css({ display: "none" });
		});
	$('form.compact input, form.compact select, form.compact textarea').blur(function(){
			if($(this).val().length == 0)
				$('label[for=' + $(this).attr('id') + ']').show();
		});
	$('form.compact').removeClass('compact');
});


/***********************************************
******** FEATURE PANEL BUTTON ANIMATION ********
************************************************/  

$(document).ready(function() {
	jQuery.each(jQuery.browser, function(i) {
	   if($.browser.msie){
		// start
		$('#featureBoxes .image span').hide();
		$('#featureBoxes .about180Group a.btn, #featureBoxes .productsAndServices a.btn, #featureBoxes .choose180Group a.btn').css('opacity', '0');
		$('#featureBoxes .about180Group, #featureBoxes .productsAndServices, #featureBoxes .choose180Group').hover(
	 	 function () {
			$(this).find('a.btn').stop().animate({
				opacity: 1,
				bottom: 39
			  }, 250, function(){});
	 	 },
	 	 function () {
	 		$(this).find('a.btn').stop().animate({
				opacity: 0,
				bottom: 36
			  }, 150, function(){});
	 		}
		);
		//end
		
	   }else{
		// start
		$('#featureBoxes .about180Group a.btn, #featureBoxes .productsAndServices a.btn, #featureBoxes .choose180Group a.btn').css('opacity', '0');
		$('#featureBoxes .about180Group, #featureBoxes .productsAndServices, #featureBoxes .choose180Group').hover(
	 	 function () {
			$(this).find('.image span').stop().animate({opacity: 0},250);
			$(this).find('a.btn').stop().animate({
				opacity: 1,
				bottom: 39
			  }, 250, function(){});
	 	 },
	 	 function () {
			$(this).find('.image span').stop().animate({opacity: 1},250);
	 		$(this).find('a.btn').stop().animate({
				opacity: 0,
				bottom: 36
			  }, 150, function(){});
	 		}
		);
		
		//end

	   }
	});
});



/***********************************************
******** SMALL ANIMATIONS AND EFFECTS **********
************************************************/  


$(document).ready(function() {

		// Testimoanial Panel / TV Ad
		$('#testimonialPanel, .tvAd').hover(function(){
		$(this).find('a img').stop().animate({
			opacity: 0.85
			}, 250, function(){});
	 	 },
	 	 function () {
			$(this).find('a img').stop().animate({
			opacity: 1
			  }, 150, function(){});
	 		}
		);
		
	// Left Menu Links Animation
		$('#contentWrapper .leftMenu ul li').hover(function(){
		$(this).find('a').stop().animate({color:'#fff'},350);
		$(this).stop().animate({
			backgroundPosition: '0px -175px'
			}, 350, function(){});
	 	 },
	 	 function () {
			 $(this).find('a').stop().animate({color:'#555'},250);
			$(this).stop().animate({
			backgroundPosition: '0px 0px'
			  }, 250, function(){});
	 		}
		);
		
	// Main Navigation Animation
		$('#navigation ul li a').hover(function(){
		$(this).stop().animate({
			color:'#5fa8d6'
			},350);
	 	 },
	 	 function () {
			$(this).stop().animate({
			color:'#555'
			},350);
	 		}
		);
		
		// A Link Animation
		$('a.animated').hover(function(){
		$(this).stop().animate({
			backgroundColor: '#5fa8d6',
			color:'#fff'
			},200);
	 	 },
	 	 function () {
			$(this).stop().animate({
			backgroundColor: '#fff',
			color:'#00578d'
			},150);
	 		}
		);
		
		
		// Testimonial Block Animation
		$('.testimonialBlock').hover(function(){
		$(this).stop().animate({
			backgroundColor: '#e5e5e5'
			},300);
		$(this).find('.main').css({height: 'auto'});
		$(this).find('.name, .position, .company').css({display: 'block'});
	 	 },
	 	 function () {
			 $(this).stop().animate({
			backgroundColor: '#f5f5f5'
			},150);
			$(this).find('.main').css({height: '35px'});
			$(this).find('.name, .position, .company').css({display: 'none'});
	 		}
		);
	
	
		// Meet The Team Page Detailed Biography button
		$('.teamMember1 a').click(function(){
			$(this).hide();
			$('.teamMember1 .teaser').hide();
			$('.teamMember1').css('padding-bottom','5px');
			$('.teamMember1 .detailed').fadeIn('fast');
	     });
		
		// Meet The Team Page Detailed Biography button
		$('.teamMember2 a').click(function(){
			$(this).hide();
			$('.teamMember2 .teaser').hide();
			$('.teamMember2').css('padding-bottom','5px');
			$('.teamMember2 .detailed').fadeIn('fast');
	     });
		
		// Obligation Free Quote
		$('#getAFreeQuote a.btnObliFreeQuote').click(function(){
			$(this).hide();
			$('#getAFreeQuote .hiddenQuoteForm').fadeIn('fast');
	     });
		

		
});


/***********************************************
********* FINANCIAL CHART ANIMATION ************
************************************************/ 


$(function(){
		var delay = 6000;
		var fadeTime = 150;

		var curr = 1;
		var isFading = false;

		function intFunc(){
			var prev = curr;
			curr++;
			if ($('#framePagination li:nth-child(' + curr + ') a').length == 0){
				curr = 1;
			}
			$('#framePagination a.activeBtn').removeClass('activeBtn');
			$('#framePagination > li:nth-child(' + curr + ') a').addClass('activeBtn');

			isFading = true;
			$('#chartAnimation').addClass('anim');
			$('.chartGallery > li:nth-child(' + prev + ')').fadeOut(fadeTime, function(){
					$('.chartGallery > li:nth-child(' + curr + ')').fadeIn(fadeTime, function(){
							isFading = false;
							$('#chartAnimation').removeClass('anim');
						});
				});
		}
		var interval = window.setInterval(intFunc, delay);

		$('#framePagination li a').click(function(){
				if($(this).is('.activeBtn') || isFading)
					return false;
				clearInterval(interval);
				var ind = $('#framePagination li a').index(this) +1;
				$('#framePagination a.activeBtn').removeClass('activeBtn');
				$('#framePagination > li:nth-child(' + ind + ') a').addClass('activeBtn');

				isFading = true;
				$('#chartAnimation').addClass('anim');
				$('.chartGallery > li:nth-child(' + curr + ')').fadeOut(fadeTime, function(){
						$('.chartGallery > li:nth-child(' + ind + ')').fadeIn(fadeTime, function(){
								isFading = false;
								$('#chartAnimation').removeClass('anim');
							});
					});
				curr = ind;
				interval = window.setInterval(intFunc, delay)
				return false;
			});
	});




/***********************************************
************** BROWSER CONDITION ***************
************************************************/ 

/*$(document).ready(function() {
	jQuery.each(jQuery.browser, function(i) {
	   if($.browser.msie){
		
		
		
	   }else{
		
		
		
		
		
		
		
	   }
	 });
	 });
*/


