var si=2700;
	var so=3000;
	var i=0;
	function setupArticle(n){
		//use a before callback to close video window if oopen:
		//$("#article"+n).cycle({before:videoOff, timeout: 0,fx: "scrollHorz",speedIn:si,speedOut:so,easing:"easeOutQuint",next: "#next"+n,prev: "#prev"+n});
		$("#article"+n).cycle({timeout: 0,fx: "scrollHorz",speedIn:si,speedOut:so,easing:"easeOutQuint",next: "#next"+n,prev: "#prev"+n});
		$("#descr"+n).cycle({cleartype: 1, timeout: 0,fx: "fade",speedIn:si/8,speedOut:so/8,easing:"easeOutQuad",next: "#next"+n,prev: "#prev"+n});
		$("#skills"+n).cycle({cleartype: 1, timeout: 0,fx: "fade",speedIn:si/8,speedOut:so/8,easing:"easeOutQuad",next: "#next"+n,prev: "#prev"+n});
		$("#mo"+n).cycle({timeout: 0,fx: "fade",speedIn:si,speedOut:so,easing:"easeOutQuint",next: "#next"+n,prev: "#prev"+n});
		$("#article"+n).touchwipe({wipeLeft: function() {$("#article"+n).cycle("next");$("#descr"+n).cycle("next");$("#skills"+n).cycle("next");$("#mo"+n).cycle("next");},wipeRight: function() {$("#article"+n).cycle("prev");$("#descr"+n).cycle("prev");$("#skills"+n).cycle("prev");$("#mo"+n).cycle("prev")},min_move_x: 20,preventDefaultEvents: true});
		
	}
	
	
	function videoOn(){
		$("#video").show();
		//$("#player")[0].sendEvent('PLAY');
		//$("#video").removeAttr("style");
	}
	
	function videoOff(){
		if($("#video").is(":visible")){
			$("#player")[0].sendEvent('STOP');//the [0] is a method of recoveriing the raw DOM object from the wrapper JQ object so we can call functions of it.
			$("#video").hide();
		}
	}
	
	
	//future use with HTML5 'standards'
	function supports_h264_baseline_video() {
		if (!supports_video()) { return false; }
		var v = document.createElement("video");
		return v.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"');
	}

	function setupVideo(){
		var s1 = new SWFObject('./flash/player.swf','player','100%','100%','9','#ffffff');
		s1.addParam('allowfullscreen','true');
		s1.addParam('allowscriptaccess','always');
		s1.addParam('flashvars','file=../content/video/leannefinal.flv&smoothing=true&bufferlength=3&volume=70&controlbar=over&config=./flash/jwconfig.xml');
		//s1.addVariable('image','../img/white.gif');
		s1.write("video");
	}
	
	function handleTilt( event ) 
	{
		var accel = event.accelerationIncludingGravity;
		if(accel.y<-1) $('html, body').animate({scrollTop:0}, 'slow');
		else if (accel.y>1) $('html, body').animate({scrollTop:800}, 'slow');
		//$('#footer').append("<pre>Y="+accel.y+"</pre>"  );

	}
	
	$(document).ready(function() {
		//setupVideo();
		$("#video1").toggle(videoOn,videoOff);
		$("#video").hide();
		for (i=1;i<=1;i++) setupArticle(i);
		//window.addEventListener("devicemotion", handleTilt, true);

	});
