$(document).ready(function() {
    $('.photo_show').cycle({
		fx:    'scrollUp', 
    	sync:   1, 
    	delay: -4000 

	});
	$('#left_doc').cycle({
		fx:    'curtainX', 
    	sync:   3, 
    	delay: -7000
	});
	window.onload = function(){$('.resetbtn').click();$("#index_top").focus();}
		$('form :text').focus(clears).blur(refill);
		$('textarea').focus(clears_textarea).blur(refill_textarea);
		$('form :text').keydown(unbind_clears_refill);
		$('textarea').keydown(unbind_clears_refill_textarea);
		$('.resetbtn :reset').click(rebindone);	
		$('#form_three').click(function(){$('#form_three select').css('color','#222')});
});


	var hide_keep_txt = "";
	function clears(){
		var id = $('form :text').index(this);
		hide_keep_txt = $('form :text').eq(id).val();
		$('form :text').eq(id).attr('val_keeper',hide_keep_txt).val("").addClass('focus_text');
	};		
	function clears_textarea(){
		var id = $('textarea').index(this);
		hide_keep_txt = $('textarea').eq(id).text();
		$('textarea').eq(id).attr('val_keeper',hide_keep_txt).val('').addClass('focus_text');
	}	
	function draw_focus_class(){
		$(this).addClass('focus_text');
	}
	function refill(){
		var id = $('form :text').index(this);		
		if($('form :text').eq(id).val()==""){
		hide_keep_txt = $('form :text').eq(id).attr('val_keeper');
		$('form :text').eq(id).val(hide_keep_txt).removeClass('focus_text').addClass('text').bind('focus',clears).css('color','#aaa');
		}else{

		}					
	}
	function refill_textarea(){
		var id = $('textarea').index(this);
		if($('textarea').eq(id).val()==""){
		hide_keep_txt = $('textarea').eq(id).attr('val_keeper');
		$('textarea').eq(id).val(hide_keep_txt).removeClass('focus_text').addClass('text').bind('focus',clears_textarea).css('color','#aaa');
		}else{

		}
	}
	function unbind_clears_refill(){
		var id = $('form :text').index(this);
		$('form :text').eq(id).unbind('focus',clears).focus(draw_focus_class).css("color","#222");	
	}
	function unbind_clears_refill_textarea(){
		var id = $('textarea').index(this);	
		$('textarea').eq(id).unbind('focus',clears_textarea).focus(draw_focus_class).css("color","#222");
	}		
	function rebindone(){
		$('form :text').bind('focus',clears).bind('blur',refill).bind('keydown',unbind_clears_refill);
		$('textarea').bind('focus',clears_textarea).bind('blur',refill_textarea).bind('keydown',unbind_clears_refill_textarea);		
	}