$(document).ready(function(){
	//INPUT ELEMENTS	
		var st = '#263035';
		var en = '#636a6e';
		var fn = '#999da0';
		
		$('input[type=hidden]').each(function(){
			$(this).css('display', 'none');
		});
			
		$(':input').focus(function(){
			if($(this).val() == $(this).attr('rel')){
				$(this).css('color', en);
				$(this).keydown(function(){
					if($(this).val() == $(this).attr('rel')){					
						$(this).val('');
						$(this).css('color', st);
					}
				});
			}
		}).blur(function(){
			if($(this).val() == '' || $(this).val() == $(this).attr('rel')){
				var atty = $(this).attr('rel');
				$(this).val(atty).css('color', fn);
			}
		});
		
		//CHECKBOX
		$('input[type=checkbox]').each(function(){
			$(this).css({'display' : 'inline', 'width' : 'auto', 'padding' : '0px', 'margin-right' : '5px'});
		});
	//INPUT ELEMENTS
	
	//FIND LOGO
	$('#logo').css('cursor', 'pointer').bind({
		click: function(){
			window.location = './?page=home';	
		},
		mouseenter: function(){
			$(this).fadeTo(500, 0.5);
		},
		mouseleave: function(){
			$(this).fadeTo(500, 1.0);
		}
	});
	
	$('#foot_logo').css('cursor', 'pointer').bind({
		click: function(){
			window.location = './?page=home';	
		},
		mouseenter: function(){
			$(this).fadeTo(500, 0.5);
		},
		mouseleave: function(){
			$(this).fadeTo(500, 1.0);
		}
	});	
	
	//FADE
	$('#fader').innerfade({
		speed: 4500,
		timeout: 5500,
		type: 'sequence',
		containerwidth: '940px',
		containerheight: '420px'
	});

	//SHOW DESCRIPTION
	$('.bps_button').hover(function(){
		$(this).css('border-color', '#d9d9d9');
	},function(){
		$(this).css('border-color', '#ffffff');
	});
	
	$('.bps_button').click(function(){
		window.location = $(this).attr('rel');
		return false;
	});
	
	
	$('#QL').change(function(){
		if($(this).val() != 'Null'){
			window.location = $(this).val();	
		}		
	});
	
	$('.hideStuff').next().css('display', 'none');
	$('.hideStuff').toggle(function(){
		$(this).next().slideDown('slow');
	},function(){
		$(this).next().slideUp('slow');	
	});
	
	$('.showMore').css('cursor', 'pointer').next().css('display', 'none').end().toggle(function(){
		$(this).next().slideDown('slow');
	},function(){
		$(this).next().slideUp('fast');	
	});

	//PRELOAD IMAGES
	(function($){
		var cache = [];
		// Arguments are image paths relative to the current page.
		$.preLoadImages = function() {
			var args_len = arguments.length;
			for (var i = args_len; i--;) {
				var cacheImage = document.createElement('img');
				cacheImage.src = arguments[i];
				cache.push(cacheImage);
			}
		}
	})(jQuery)
	
	$.preLoadImages('images/nav_bg_alt.png', 'images/cancer/mound_over_alt.png', 'images/cancer/base_over_alt.png', 'images/cancer/seat_over_alt.png');

	//TEAM BUTTONS
	$('#buttons div img').bind({
		click: function(){
			window.location = './?page='+$(this).attr('alt');	
		},
		mouseenter: function(){
			$(this).fadeTo(500, 1.0);
		},
		mouseleave: function(){
			$(this).fadeTo(500, 0.7);
		}
	});
	
	//inner nav margins
	$('#inner a:last').css({
		'border-bottom' : 'none',
		'padding-bottom' : '0px',
		'margin-bottom' : '0px'
	});
});
