// Place your application-specific JavaScript functions and classes here
// This file is automatically included by javascript_include_tag :defaults

var prompt = "Your mobile number";
Event.observe( window, 'load', function() {  
	$$('#account_mobile_number').each( function( element ) {
		if( element.value == "" ) {
			element.value = prompt;
			element.addClassName( "faded" );
		} 
		element.observe( "focus", function( event ) {
			event.target.removeClassName("faded");
			if ( element.value == prompt ) {
				element.value = "";
			}
		});
	})
	
	$$('#friends img').each( function( friend_img ) {
		friend_img.observe( "click", function( event ) {
			img = event.target;
			if ( img.hasClassName("friend_fade") ) {
				img.removeClassName("friend_fade");
			} else {
				img.addClassName( "friend_fade");
			}	
		});
	});
	
	/**
	 * Hid the UL's with the tweets in them and rotate them
	 */
	testimonials = $$('#testimonial');
	testimonials.each( function( testimonial ) {
		testimonial.hide();
	});
	
	max = testimonials.size();
	if (max > 0)
		testimonials[Math.floor(Math.random()*max)].show();
	
	
	$$('#purchase_form').each( function( form ) {
		form.submit();
	});
});
