var Site = {

	Init: function() {
        Site.SetFocus();
		Site.ImageRotater();		
		Site.RolloverEffects();
	},

	SetFocus: function() {
		if ($('txtUsername') != null) $('txtUsername').focus();
		if ($('txtFirstName') != null) $('txtFirstName').focus();
	}, 

	ImageRotater: function() {
		if ($(document.body).getElement('div.imageRotater')) {
			var scroller = new ContentScroller({slideDuration: 4500, fadeDuration: 500});
			scroller.addSlides($$('div.imageRotater img').setStyle('z-index', 1));
			scroller.start();
		}
	},	
	
	RolloverEffects: function() {
		$$('.rollover').each(function(el) {
			if (el.src.test(/\.(gif|jpg|jpeg|png)$/i)) {
				var preload = new Image();
				preload.src = el.src.replace(/\.(gif|jpg|jpeg|png)/, '-over.$1');
				
				el.addEvents({
					mouseover: function() {
						this.src = this.src.replace(/\.(gif|jpg|jpeg|png)/, '-over.$1');
					},
					
					mouseout: function() {
						this.src = this.src.replace(/-over\.(gif|jpg|jpeg|png)/, '.$1');
					}
				});
			}
		});
	},
        
	ChangeImage: function (element, image, title) {
		if ($(element) != null) {
			$(element).src = image;
			$(element).title = title;
			
			$('mainLink').href = image;
			$('mainLink').title = title;		
		}
	},
	
    FadeImages: function() {
        $$('img.fade').each(function(el) {
            el.addEvent('mouseover', function() {
                el.fade(0.5);  
            });
              
            el.addEvent('mouseout', function() {
                el.fade(1);
            });
        });    
    }
		
};

window.addEvent('domready', Site.Init);
