window.addEvent('domready',function(){

	var startItem = 3;
	var thumbnail_mask = $('thumbnail_mask').setStyle('left',(startItem*60-570)+'px').set('opacity',0.6);
	var fxOptions7 = {property: 'left',duration: 1000, transition: Fx.Transitions.Back.easeOut, wait: false}
	var thumbsFx = new Fx.Tween(thumbnail_mask,fxOptions7);
	var nS7 = new noobSlide({
		box: $('image_box'),
		items: [0,1,2,3,4,5,6,7],
		handle: $$('#thumbnail_handles span'),
		fxOptions: fxOptions7,
		onWalk: function(currentItem){
			thumbsFx.start(currentItem*60-570);
		},
		startItem: startItem
	});
	nS7.walk(0);

	var handle_more = $$('#handle_more span');
	var nS = new noobSlide({
		box: $('directory_box'),
		items: $$('#directory_box h3'),
		size: 760,
		handle: $$('#handle span'),
		addButtons: { previous: $('prev'), play: $('play'), stop: $('stop'), playback: $('playback'), next: $('next') },
		onWalk: function(currentItem,currentHandle){
		$$(this.handle).removeClass('active');
		$$(currentHandle).addClass('active');
		}
	});
	nS.addActionButtons('previous',$$('#mask .prev'));
	nS.addActionButtons('next',$$('#mask .next'));
});

// switch display

function switchDisplay(id) {
	switch (document.getElementById(id).style.display) {
	case "block":
		document.getElementById(id).style.display = "none";
		break;
	case "none":
		document.getElementById(id).style.display = "block";
		break;
	}
}

// popup window

function popupWindow(strUrl, strWindowName, intWindowWidth, intWindowHeight, blnShowMenuBar) {

	switch (strWindowName) {
		case "PageWindow":
			intWindowWidth = 640;
			intWindowHeight = 640;
			blnShowMenuBar = 0;
			break;
	}
	var intLeftPos = (screen.width) ? (screen.width - intWindowWidth) / 2 : 0;
	var intTopPos = (screen.height) ? ((screen.height - intWindowHeight) / 2) - 30 : 0;
	var strProperty = "width=" + intWindowWidth + ",height=" + intWindowHeight + ",left=" + intLeftPos + ",top=" + intTopPos + ",menubar=" + blnShowMenuBar + ",toolbar=0,location=0,directories=0,status=1,scrollbars=1,resizable=1";
	strWindowName = window.open(strUrl, strWindowName, strProperty);
	self.onBlur = strWindowName.focus();
}

// page scroll

function Scroll() {
	var xScrollSpeed = 1;
	var yScrollSpeed = 1.1;
	
	var x1 = x2 = 0;
	var y1 = y2 = 0;
	if (document.documentElement) {
		x1 = document.documentElement.scrollLeft || 0;
		y1 = document.documentElement.scrollTop || 0;
	}
	if (document.body) {
		x2 = document.body.scrollLeft || 0;
		y2 = document.body.scrollTop || 0;
	}
	var x = Math.max(x1, x2);
	var y = Math.max(y1, y2);
	window.scrollTo(Math.floor(x/xScrollSpeed), Math.floor(y/yScrollSpeed));
	if (x>0 || y>0) {
		window.setTimeout("Scroll()", 10);
	}
}