﻿/*
 * JavaScript Code
 *
 * Copyright (c) 2010 Александр Кузнецов aka Regent(http://vl.vg/)
 *
 */
(
	function( $ ){
		$(
			function(){
				// Счётчики - эффекты при наведении
				$( '#counters img' )
				.css( 'opacity', 0.75 )
				.hover(
					function(){
						$( this )
						.stop( true )
						.fadeTo( 500, 1 );
					},
					function(){
						$( this )
						.stop( true )
						.fadeTo( 500, 0.75 );
					}
				);
				// Links
				$( 'a[title^="to:"]' )
				.each(
					function(){
						var
							$this = $( this );
						$this
						.attr( 'href', $this.attr( 'title' ).substring( 3 ) )
						.removeAttr( 'title' );
					}
				);
				////
				$( '.autoInput' )
				.focus(
					function(){
						this.value == this.defaultValue ? this.value = '' : '';
					}
				)
				.blur(
					function(){
						this.value == '' ? this.value = this.defaultValue : '';
					}
				);							 
				$( 'input:button, input:submit, input:checkbox' )
				.click(
					function(){
						this.blur();
					}
				);
				$( '#searchform' )
				.submit(
					function(){
						var
							text = $( this ).find( 'input:submit' ).prev(),
							tmp = text.val(),
							defaultValue = text.get( 0 ).defaultValue;
						if( tmp == defaultValue || tmp == '' ){
							alert( defaultValue + '!' );
							text.focus();
							return false;
						}
					}
				);
			}
		);
	}
)( jQuery );