// Making the homepage my marionette with Mouvement...

	var slider;
	var direction = true;
	var tweets = 6;
	
	Page.onReady = function() {
		// Set up input watching for the comment field. (Mobile browsers only - this variable is fed through PHP).
		var hifi = false;
		var OSString = navigator.appVersion;
		if (OSString.indexOf("Win") != -1 || OSString.indexOf("Mac") != -1 || OSString.indexOf("X11") != -1 || OSString.indexOf("Linux") != -1) {
			hifi = true;
		}

		if (hifi) { /* High-fidelity mode activates only on a desktop browser as these effects are more resource intensive */
			kLogo = Page.preShine('kashmaniacLogo', true);
		}
		
		slider = Page.grabItem('slider');
		tweets = slider.domElement.getElementsByTagName('div');
		tweets = tweets.length - 3;

		setInterval(moveCDs, 10000);
		slider.move(0, 0, 0.5, 0, 0, 0);
		
		setTimeout(function() {Page.play();}, Page.heartbeat);
	}
	
	var moveCDs = function() {
		x = slider.display.x;
		if (direction) {
			slider.move(slider.display.x - 268, 0, 1);	
			x -= 268;
		} else {
			slider.move(slider.display.x + 268, 0, 1);
			x += 268;
		}

		if (x === 0 || x === (0 - tweets) * 268) {
			direction = !direction;
		}
	}