$(function() {

	if ($('body').is('.home')) {

		$('div.masthead').flash(
			{src:'flash/masthead.swf',
			 width:757,
			 height:258,
			 wmode:'transparent',
			 quality:'high'},
			 {version:"7"});
//new version of jcarousel
/*		$('div#scroll-wrapper ul').jcarousel({
			vertical: true,
			visible: 2,
			scroll: 2,
			animation: 'slow',
			buttonPrevHTML: '<span id="scroll-up"><a href="#" title="Scroll Up"><em class="alt">Scroll Up</em></a></span>',
			buttonNextHTML: '<span id="scroll-down"><a title="Scroll Down"><em class="alt">Scroll Down</em></a></span>'
		});
		
*/
//this worked fine - old version
		$('div#scroll-wrapper').jcarousel({
			orientation: 'vertical',
			itemVisible: 2,
			itemScroll: 2,
			scrollAnimation: 'slow',
			wrapPrev: true,
			wrap: true,
			buttonPrevHTML: '<span id="scroll-up"><a href="#" title="Scroll Up"><em class="alt">Scroll Up</em></a></span>',
			buttonNextHTML: '<span id="scroll-down"><a href="#" title="Scroll Down"><em class="alt">Scroll Down</em></a></span>'
		}
		);
		$('body').append('<script type="text/javascript" src="http://cetrk.com/pages/scripts/0004/3605.js" defer="defer"> </script>');
	}
	else {
		//jQuery('div#content h2').sifr( { strSWF: 'flash/franklin-gothic-med-cond.swf', strColor: '#0e368b' } );
		$('div#content h1').sifr( { strSWF: 'flash/franklin-gothic-med-cond.swf', strColor: '#182A36', strWmode: 'transparent' } );
		$('div#content h2').sifr( { strSWF: 'flash/franklin-gothic-med-cond.swf', strColor: '#5C839D', strWmode: 'transparent' } );
		$('div.push-row h3').sifr( { strSWF: 'flash/franklin-gothic-med-cond.swf', strColor: '#5C839D', strCase: 'upper', strWmode: 'transparent' } );
		$('div#content h3').sifr( { strSWF: 'flash/franklin-gothic-med-cond.swf', strColor: '#182A36', strCase: 'upper', strWmode: 'transparent' } );
		//$('ul#nav-primary ul li').sifr( { strSWF: 'flash/swiss721-cn-bt-bold.swf', strBgColor: '#6a91ab', strColor: '#ffffff', strLinkColor: '#ffffff', strHoverColor: '#ffffff' } );

		$('div#slideshow').flash(
			{src:'flash/photo_gallery.swf',
			 width:521,
			 height:420,
			 wmode:'transparent',
			 quality:'high'},
			 {version:"7"});
		$('div#flash-clients').flash(
			{src:'flash/map.swf',
			 width:519,
			 height:269,
			 wmode:'transparent',
			 quality:'high'},
			 {version:"7"});

		//form buttons hover states
		$('div.buttons button').hover(function(){$(this).css("background-position","bottom left");},function(){$(this).css("background-position","top left");});

		//case studies
		$('div.push-details').hide();

		//awards pages expand/collapse
		$('div.awards-details dl').hide();
		
		$('div.awards-details dt').append('<span class="link-more"><a href="#">View case study&hellip;</a></span>');
		$("a.expand-awards").click(function() {
			$('div.awards-details dl').slideToggle("slow");
			$('div.awards-details dl dd').hide();
			$('div.awards-details dl dd:eq(0)').show().addClass('active');
			return false;
		});
		$('div.awards-details dt a').click(function() {
			//turn off active class from current actives, hide them, add class to clicked and show it
			var toShow = $(this);
			//alert(toShow.parent().css('top'));
			toShow.parents('dl').children('dd.active').slideUp('slow',function(){ 
					//alert(toShow.html());
					$(this).removeClass('active');
					toShow.parent().parent().next().slideDown('slow',function(){$(this).addClass('active');});
				});
			
			return false;
		});

	}


	//code to rotate push marketing
	$('div#push-two h2').sifr( { strSWF: 'flash/franklin-gothic-med-cond.swf', strColor: '#ffffff', strLinkColor: '#ffffff', strHoverColor: '#B7CAD6', strWmode: 'transparent' } );
	$('div.push h2').sifr( { strSWF: 'flash/franklin-gothic-med-cond.swf', strColor: '#2D4250', strLinkColor: '#2D4250', strHoverColor: '#1B4C6D', strWmode: 'transparent' } );
	$('ul#push-list li').not(':first').hide();
	$('ul#push-list li:first').addClass('current');

	$('.link-refresh a').click(function() {
		var h = $('div#push-loading').parent().height(); //ie6 won't fill the push box by default
		$('div#push-loading').addClass('loading').height(h);
//		alert($('ul#push-list li.current').next().html());
		var nextItem = ($('ul#push-list li.current').next().html()) ? $('ul#push-list li.current').next() : $('ul#push-list li:eq(0)');
		$('ul#push-list li.current').removeClass('current').fadeOut('slow', function() {nextItem.addClass('current').fadeIn('slow', function() {$('div#push-loading').removeClass('loading')});})
		return false;
	});
});

