// JavaScript Document


$(document).ready(function(){
	$('#search').focus(function(){
		if(this.value=='SEARCH') this.value='';
	});
	$('#search').blur(function(){
		if(this.value=='') this.value='SEARCH';
	});
	
	$('#slides li a').each(function(){
		$(this).mouseover(function(){
			$('.homepage-slide').css('display','none').css('left','-200px');
			//$('#'+this.parentNode.id+'_slide').css('display','block');
			//$('#'+this.parentNode.id+'_slide').animate({left:'0'},500);
			$('#'+$(this).parent().attr('id')+'_slide').css('display','block');
			$('#'+$(this).parent().attr('id')+'_slide').animate({left:'0'},500);
		});
	});


	$('#vision-link').hover(function(){
		$('#vision-tooltips').toggle('slow');
		var offset=$(this).offset();
		$('#vision-tooltips').css('top',(offset['top']-284)+'px');
		$('#vision-tooltips').css('left',(offset['left']-390)+'px');
	},
	
	function(){
		$('#vision-tooltips').toggle('slow');
	});

	$('#velocity-link').hover(function(){
		$('#velocity-tooltips').toggle('slow');
		var offset=$(this).offset();
		$('#velocity-tooltips').css('top',(offset['top']-284)+'px');
		$('#velocity-tooltips').css('left',(offset['left']-380)+'px');
	},
	function(){
		$('#velocity-tooltips').toggle('slow');
	});

	$('#value-link').hover(function(){
		$('#value-tooltips').toggle('slow');
		var offset=$(this).offset();
		$('#value-tooltips').css('top',(offset['top']-284)+'px');
		$('#value-tooltips').css('left',(offset['left']-390)+'px');
	},
	
	function(){
		$('#value-tooltips').toggle('slow');
	});
	//alert($('#flash-switcher').attr('rel'));
	$('#flash-switcher').attr('rel',($('#flash2top>P').height()+5)+'px');
	//alert($('#flash-switcher').attr('rel'));
	$('#flash-switcher').click(function(){
		var new_height=this.rel;
		this.rel=$('#flash2top').css('height');

		$('#flash2top').animate({height: new_height},1000);
		
		if(parseInt(new_height)>parseInt(this.rel)){
			$(this).attr('class','opened');
		}
		else{
			$(this).attr('class','closed');
		}
	});


});

