// default

$(function(){

	try{
		if(form_values != null){
			for(var i in form_values){
				$('input[name='+i+']').val(form_values[i]);
				$('textarea[name='+i+']').val(form_values[i]);
			}
		}
	}catch(err){
		
	}
	
	if($('.leftnav').height() + 40 > $('.internal').height()){
		$('.internal').height($('.leftnav').height() + 40);
	}
	
	$('#profiles').cycle({
        fx:      	'fade',
        timeout:  	10000,
        prev:    	'#prev',
        next:    	'#next',
		pause:		true,
		random:		true
	});
	
	// event tracker for file downloads
	$('a').each(function(){
		var path = $(this).attr('href');
		var ext = /[^/].(?:doc|eps|jpg|png|svg|xls|ppt|pdf|xls|zip|txt|vsd|vxd|js|css|rar|exe|wma|mov|avi|wmv|mp3|mp4)/i;
		if(path.match(ext)){
			$(this).click(function(){
				//pageTracker._trackEvent('File', 'Download', $(this).attr('href'));
				_gaq.push(['_trackEvent', 'File', 'Download', $(this).attr('href')]);
			});	
		}
	});
	
	// billboard
	$('#billboard>#items').cycle({ 
		fx:				'fade', 
		speed:			1000,
		timeout:		6500,
		pause:	0,
		pauseOnPagerHover: 0,
		pager: '.buttons',
		pagerAnchorBuilder: function(idx, slide) { 
                return '<li><a href="#">&nbsp;</a></li>';
        },
		updateActivePagerLink: function(container, slide) {
			$(container+'>li>a').removeClass('sel');
			$(container+'>li:eq('+slide+')>a').addClass('sel');	
		},
		cleartype:		1,
		cleartypeNoBg:	1,
		prev:			'#previous',
		next:			'#next'
	 });
	 
	 $('#pp>a#play').bind('click', function(){
	 	$('#billboard>#items').cycle('toggle');
		if($('#pp>a#play>img').attr('src') == '/images/pause.gif'){
			$('#pp>a#play>img').attr('src', '/images/play.gif');
		} else {
			$('#pp>a#play>img').attr('src', '/images/pause.gif');
		}
		return false;
	 });

	
});
