$(document).ready(function(){

	// links in new window
	
	$('#content a[href^="http://"]').attr("target", "_blank");
	$('#content a[href^="https://"]').attr("target", "_blank");


	// HIDE LABELS IF PLACEHOLDER WORKS
	
	if (Modernizr.input.placeholder && $('#newsletter').length > 0) {
		$('#newsletter fieldset').each(function(){
			$(this).children('input').attr('placeholder', $(this).children('label').html());
			$(this).children('label').hide();
		});
	} else {
		$('#newsletter fieldset').each(function(){
			$(this).children('input').attr('value', $(this).children('label').html());

			$(this).children('input').attr('rel', $(this).children('input').attr('value')); // store label
			$(this).children('input').focus(function(){ if($(this).attr('value') == $(this).attr('rel')) $(this).attr('value',''); }); // hide label if no other input
			$(this).children('input').blur(function(){ if($(this).attr('value') == '') $(this).attr('value', $(this).attr('rel')) }); // show label if no input

			
			$(this).children('label').hide();
		});	
	}
	
	// IE6 Menu fix
	$('#navigation ul li').hover(
		function(){ $(this).children('ul').show(); },
		function(){ $(this).children('ul').hide(); }
	);




	if($('#gallery').length > 0) {

		$('#gallery').cycle({ 
			prev:   $('.prev'), 
			next:   $('.next'), 
			timeout: 0,
			speed: 333,
			fx: 'scrollHorz',
			before: onBefore
		});


		$('#nav span.total').html($('#gallery').children().length);
		$('#nav span.no').html('1');

	}

		function onBefore(curr, next, opts) {
			$('#nav span.no').html(opts.nextSlide + 1);
		};
	



});
