var Site = {

	Init: function() {
		Site.ImageRotater();
		Site.NewsRotater();
		Site.Reorder();
		
		if ($('txtUsername')) $('txtUsername').focus();
		if ($('txtTitle')) $('txtTitle').focus();
		if ($('txtHeadline')) $('txtHeadline').focus();
		if ($('txaData')) $('txaData').focus();
		if ($('txtName')) $('txtName').focus();
		if ($('txtFirstName')) $('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();
		}
	},
	
	NewsRotater: function() {
		if ($(document.body).getElement('div.newsRotater')) {
			$(document.body).getElement('div.newsRotater').setStyle('display', 'block');
			
			var scroller = new ContentScroller({slideDuration: 4500, fadeDuration: 500});
			scroller.addSlides($$('div.newsRotater div').setStyle('z-index', 1));
			scroller.start();
		}
	},
	
	ChangeImage: function(element, image, title) {
		if ($(element)) {
			$(element).src = image;
			$(element).title = title;		
		}
	},
	
	Reorder: function() {
		if ($('itemList')) {
			var sortableLists = new Sortables($('itemList'), {
				clone: true,
				handle: '.handle', 
				revert: {
					duration: 50
				},
				opacity: .1,
				onStart: function(el){
				/*	el.highlight('#F3F865');*/	
				},
				onSort: function(el) {
				},
				onComplete: function(el) {
					$('hdnPostionIDs').value = this.serialize(0); 
				}
			}).attach();
		}
	}
		
};

window.addEvent("domready", Site.Init);