/* SWEEB.NET
 * =========
 *
 * All HTML / CSS / JAVASCRIPT (C) Alexander Shepherd 2009
 *
 * Page Built by SWEEB
 * Alexander.Shepherd@Gmail.com
 *
 * VALID XHTML
 * http://validator.w3.org/check?uri=http%3A%2F%2Fwww.sweeb.net
 *
 * VALID CSS 2.1
 * http://jigsaw.w3.org/css-validator/validator?uri=http%3A%2F%2Fwww.sweeb.net
 *
 */
if (navigator.appName=='Microsoft Internet Explorer') {
	var _ADD = 0.1;
	var _TIMES = 10;
} else {
	var _ADD = 0.01;
	var _TIMES = 1;
}

var _FadeIn = 0;
var _FadeOut = 1;

var _Speed = 20 * _TIMES;

var _logo_mode = false;

var _over = false;
var _current = 1;

var _Limit = 6;

function _fadeIn(_id) {
	
	_FadeIn = _FadeIn*1 + _ADD;
	_ieFade = _FadeIn * 100;
	
	img = document.getElementById(_id);
	
	img.style.visibility = 'visible';
	img.style.position = 'static';
	img.style.opacity = _FadeIn;
	img.style.filter = 'alpha(opacity='+_ieFade+')';
	
	if (1<=_FadeIn) {
		_FadeIn = 0;
		_load_logo();
		
		return;
	}
	
	setTimeout('_fadeIn(\''+_id+'\');', _Speed);
	
}

function _fadeOut(_id) {
	
	_FadeOut = _FadeOut*1 - _ADD;
	_ieFade = _FadeOut * 100;
	
	img = document.getElementById(_id);
	
	img.style.opacity = _FadeOut;
	img.style.filter = 'filter: alpha(opacity='+_ieFade+')';
	
	if (_FadeOut<=0) {
		_FadeOut = 1;
		_load_logo();
		return;
	}
	
	setTimeout('_fadeOut(\''+_id+'\');', _Speed);
	
}

function _load_logo() {
	
	_current = _current + 1;
	
	if (_current==(_Limit+1)) {
		_current = 1;
	}
	
	if (_over===true) {
		document.getElementById('logo').style.backgroundImage = 'url(\'/images/logo/'+_current+'.jpg\')';
		_over=false;
		setTimeout('_fadeOut(\'over_logo\')', _Speed);
	} else {
		document.getElementById('over_logo').src = '/images/logo/'+_current+'.jpg';
		_over=true;
		setTimeout('_fadeIn(\'over_logo\')', _Speed);
	}
}
