﻿var currentslide=1;
var intplaypause=0;
var captions=new Array();
var interval = 5000;
var t;

function timedCount()
{
	if(currentslide<3)
	{
		changeslide(currentslide+1,true);
	}
	else
	{
		changeslide(1,true);
	}
	t=setTimeout("timedCount()",interval);
}
					
captions[1]="<h1>Great Shot!</h1><p>Kedai lets your friends upload their pictures at your event, not after they get home, so they'll be sure to remember.<br /><a href='howitworks.php' id='learnhow'>See how it works</a></p>";
captions[2]="<h1>Show Time!</h1><p>Kedai displays your guests’ photos on a high definition screen, as they are uploaded, so everyone can enjoy them.<br /><a href='howitworks.php' id='learnhow'>See how it works</a></p>";
//captions[3]="Everyone Can Share<p class=\"caption\">Kedai's sharing process is so streamlined that all generations can seamlessly share photos (and photography tips)!</p>";
//captions[4]="More Fun Than A Photobooth<p class=\"caption\">Invite your guests to be your photographers. If you're passionate about the photobooth concept, bring a colorful backdrop and watch your guests get creative.</p>";
captions[3]="<h1>Get Kedai!</h1><p>Starting at just $299, the Kedai Upload Station<span id='trademark'>TM</span> and 24” HD display guarantee that your friend's photos will be a memorable part of your event.<br /><a href='howitworks.php' id='learnhow'>See how it works</a></p>";

function changeimage(currentslide,x)
{
	crossfade('slideshowimage'+currentslide.toString(),'slideshowimage'+x.toString());
//	document.getElementById('slideshowimage'+currentslide.toString()).id='slideshowimage'+x.toString();
}

function changeslide(x,timerchange)
{
    if(!timerchange)
    {

        //pause the slideshow
        //pause();
    }

	//change image
	changeimage(currentslide,x);
	
	//change caption
	changecaption(x);
	//change selection
	deselectitem(currentslide);
	selectitem(x);
}

function changecaption(x)
{
	document.getElementById('caption').innerHTML=captions[x];
}


function selectitem(x)
{
	currentslide=x;
	document.getElementById("slide"+x.toString()).id='selected';
}

function deselectitem(x)
{
	document.getElementById('selected').id="slide"+x.toString();
}

function playpause()
{
	//if paused
	if(intplaypause==0)
	{
		play();
	}
	else
	{
		pause();
	}
}

function play()
{
	//change text of play pause
	document.getElementById('playpause').innerHTML="<strong>ll</strong> Pause";
	//change variable
	intplaypause = 1;
	//start ticker
	timedCount();
}

function pause()
{
	//change text of play pause
	document.getElementById('playpause').innerHTML="► Play";
	//change variable
	intplaypause = 0;
	//stop ticker
	clearTimeout(t);
}

function startslideshowonload()
{
	//wait interval and start the slideshow
	setTimeout("playpause()",interval);
}