	var i=1,o=10;
	var c;
	var clock;
	var pt;
	var newimg;

	pt = "start";
	
	var d1,d2;
	
	function startRotator() {
		clock = setInterval('pictureRotate()',0);
	}
	
	// clockIn = setInterval('fadeIn()',100);
	//clockOut = setInterval('fadeOut()',100);
	
	//clock = setInterval('swapPics()', 2000);
	
	function swapPics() {
		clearInterval(clock);

		d1 = document.getElementById('div1');
		d2 = document.getElementById('div2');
		d2.style.left = ixf.getRealPosition(d1, 'x') + 'px';
		d2.style.top = ixf.getRealPosition(d1, 'y') + 'px';		
	

		clockIn = setInterval('fadeIn()',100);
		clockOut = setInterval('fadeOut()',100);
	}
	
	function fadeIn() {
		
		document.getElementById('div2').style.visibility = "Visible";
		document.getElementById('div2').style.zindex = "-1";
		document.getElementById('div2').style.filter = "Alpha(Opacity=" + (i * 10) + ")";
		
		if (i == 10) {
			clearInterval(clockIn);
		}
		i++;
	}
	
	function fadeOut() {
		document.getElementById('div1').style.filter = "Alpha(Opacity=" + (o * 10) + ")";
		
		if (o == 0) {
			clearInterval(clockOut);
		}
		o--;
	}
	
	function pictureRotate() {
		clearInterval(clock);
		
		c = 1;
		while (c < 6) {
			if (c == i) {
				document.getElementById('thumb' + c).style.background = "#000000";
			} else {
				document.getElementById('thumb' + c).style.background = "#FFFFFF";
			}
			c++;
		}
		
		if (pt != 'start') {
			crossfade(document.getElementById('main_picture'), 'images/index_rotator/' + i + '.jpg', '1', 'Text' + i);
		}
				
		if (pt == 'auto' || pt == 'start') {
			clock = setInterval('pictureRotate()', 5000);
		} else {
			clock = setInterval('pictureRotate()', 10000);
		}
	
		pt = "auto";
		
		if (i < 5) {
			i++;
		} else {
			i = 1;
		}	
	}

	function changePicture(number) {
		i = number;
		pt = "man";
		pictureRotate();
	}
	
	function clearBox(boxID) {
		if (boxID.value == "Search") {
			boxID.value = "";
		}
	}
	function fillBox(boxID) {
		if (boxID.value == "") {
			boxID.value = "Search";
		}
	}

