$(document).ready(function(){

	if ($('#Slider .item').length > 0) {
		$('#Slider').cycle({ 
		    fx:      'scrollHorz', 
		    speed:   600, 
		    timeout: 8000, 
		    next:    '.item .next',
		    prev:    '.item .previous', 
		    pause:   1
		});
	}
	
	if ($('.logIn').length > 0) {
	
		var dPassword = $('.logIn input[type=password]');

		dPassword.hide().after('<input class="chl2_textbox logInProxy" type="text" value="Password" />');
		
		var proxy = $('.logIn .logInProxy');
		
		proxy.bind({
			'focus' : function(){
				proxy.hide();
				dPassword.val('').show().focus();
			}
		});
	
		dPassword.bind({
			'blur' : function() {
				if (dPassword.val() == '') {
					dPassword.hide();
					proxy.show();
				}
			}
		});
		
		toggleDefaultText($('.logInUser'));
	}
	
	toggleDefaultText($('#Search input'));
});

function toggleDefaultText(input) {
	input.bind({
		'focus' : function() {
	        if (this.value == this.defaultValue) {
	        	this.value = '';
	    	}
	        if (this.value != this.defaultValue) {
		    	this.select();
	        }
		},
		'blur' : function() {
	        if (this.value == ''){
	        	this.value = (this.defaultValue ? this.defaultValue : '');
	    	}				
		}
	});
}
