// JavaScript Document

$(document).ready(function(){
	
	if( $("input#ref").length > 0 ) {
		//alert( $("input#ref").val() );
		$('select#howhear option[value=website]').attr("selected", "selected"); 
		$('select#howhear').attr("disabled", "disabled");
		$('input#specify').val($("input#ref").val());
		$('input#specify').attr("disabled", "disabled");
	}
	
	if( $("input#redirect").length > 0 ) {
		document.location = $("input#redirect").val(); 
	}
	
	
	$('#homeFeatures #images').cycle({
		cleartype: true, 
		cleartypeNoBg: true,
    	before:   onBefore 
	}); 
	
	$('#homeFeatures #captions').cycle({
		cleartype: true, 
		cleartypeNoBg: true,
		timeout: 0
	}); 
	
	function onBefore() { 
		var leNum = this.id
		var moveTo = 20 + (leNum)*60;
		movePointer(moveTo);
		var slideNum = (leNum)*1;
		$('#homeFeatures #captions').cycle(slideNum);
	};
	
	function movePointer(to) {		
		$('#homeFeatures #pointer').animate({
				top: to
		  	}, 
			200
			);	
	}
	
	$('#homeFeatures li').click(function() {
		var leNum = this.id
		var moveTo = 20 + (leNum)*60;
		var slideNum = (leNum)*1;
		movePointer(moveTo);
		$('#homeFeatures #images').cycle(slideNum);
		$('#homeFeatures #captions').cycle(slideNum);
		$('#homeFeatures #images').cycle('pause');
		$('#homeFeatures #captions').cycle('pause');
	});	
	
	$('#header input#q').focus(function() {
		if (($(this).val()) == $(this).attr('rel')) {
			$(this).val('');
			$(this).css('color', '#EEE');
		}
	});
	
	$('#header input#q').blur(function() {
		if (($(this).val()) == '') {
			$(this).val($(this).attr('rel'));
			$(this).css('color', '#666');								
		}							
	});
	
	
});


