
CD3.Behaviors({
    '#index_image': function(){
        
        var images = $('index_image');

        var timer = new PeriodicalExecuter(nextSelected, 4);

        function select(img){
            images.down('img.selected').removeClassName('selected').hide();
            img.addClassName('selected').show();
        }

        function nextSelected(){
            select(images.down('img.selected').next('img') || images.down('img'));
        }
    }
});




CD3.Behaviors({
	'body': {
		'focus:in': {
			'input[type=text]': function(){
				if(this.getValue() == this.getAttribute('title')){
					this.setValue('');
					this.addClassName('oppp');
				} else {
					this.addClassName('oppp');

				}
			}
		},
		'focus:out': {
			'input[type=text]': function(){
				if(this.getValue().length == 0){
					this.setValue(this.getAttribute('title'));
					this.removeClassName('oppp');
				}
			}
		}
	},
    '.img_link': {
        mouseover: function(){
            this.setStyle({opacity: '0.7'});
        },
        mouseout: function(){
            this.setStyle({opacity: '1'});
        }
    },
    '.menu li': {
        mouseover: function(){
            this.addClassName('hover');
        },
        mouseout: function(){
            this.removeClassName('hover');
        }
    }
});

CD3.Behaviors({
	'#step1_btn:click': function(s1b){
		//try{$('err').hide();}catch(err){}
		
			if($('err')){
				$('err').hide();
			}
		
			$('step1').hide();
			$('step2').show();
			$('step2').value = 'Skriv din epost adresse her';
			$('step1_btn').hide();
			$('step2_btn').show();
	},
	'#step1_btn:mouseover': function(){
			this.setStyle({
				background: 'url(images/newsletter-btn.gif) no-repeat bottom left'
			});	
	},
	'#step2_btn:mouseover': function(){
			this.setStyle({
				background: 'url(images/newsletter-btn.gif) no-repeat bottom left'
			});	
	},
	'#step1_btn:mouseout': function(){
			this.setStyle({
				background: 'url(images/newsletter-btn.gif) no-repeat top left'
			});	
	},
	'#step2_btn:mouseout': function(){
			this.setStyle({
				background: 'url(images/newsletter-btn.gif) no-repeat top left'
			});	
	},
	'#subscribe input[type=text]:click':function(){
		if (this.getValue() == this.getAttribute('title')) this.setValue('');
	},
	'#subscribe input[type=text]:blur':function(){
		if (this.getValue() == '') this.setValue(this.getAttribute('title'));
	}
	
});

