var slider = new Array(
	'slide3.jpg',
	'slide9.jpg',
	'slide5.jpg',
	'slide8.jpg',
	'slide2.jpg',
	'slide1.jpg',
	'slide6.jpg',
	'slide7.jpg',
	'slide4.jpg'
	
);

var sliderText = new Array(
	'Having managed over a <b class="bigBold">billion dollars</b> in retail marketing spend,<br>we know a thing or two about turning shoppers into buyers<br><img src="images/0spacer.gif" width="1" height="10"><br><span class="bullets">&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;</span> <span class="tagline">the point is purchase<sup>TM</sup></span>',
	'<b class="bigBold">Over 13,000 Successful</b> shopper marketing programs <br>planned and executed.<br><img src="images/0spacer.gif" width="1" height="10"><br><span class="bullets">&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;</span> <span class="tagline">the point is purchase<sup>TM</sup></span>',
	'Weekly coverage in over <b class="bigBold">150,000</b> retail storefronts.<br><img src="images/0spacer.gif" width="1" height="10"><br><span class="bullets">&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;</span> <span class="tagline">the point is purchase<sup>TM</sup></span>',
	'Over 40,000 <b class="bigBold">Experiential Marketing</b> <Br>Programs activated for <b class="bigBold">1,200+ Clients</b><br><img src="images/0spacer.gif" width="1" height="10"><br><span class="bullets">&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;</span> <span class="tagline">the point is purchase<sup>TM</sup></span>',
	'<b class="bigBold">30,000+</b> Sales and Marketing <b class="bigBold">Professionals</b> <br>across the U.S. and Canada.<br><img src="images/0spacer.gif" width="1" height="10"><br><span class="bullets">&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;</span> <span class="tagline">the point is purchase<sup>TM</sup></span>',
	'Having managed over a <b class="bigBold">billion dollars</b> in retail marketing spend, <br>we know a thing or two about turning shoppers into buyers<br><img src="images/0spacer.gif" width="1" height="10"><br><span class="bullets">&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;</span> <span class="tagline">the point is purchase<sup>TM</sup></span>',
	'<b class="bigBold">Over 13,000 Successful</b> shopper marketing programs <br>planned and executed.<br><img src="images/0spacer.gif" width="1" height="10"><br><span class="bullets">&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;</span> <span class="tagline">the point is purchase<sup>TM</sup></span>',
	'Over 40,000 <b class="bigBold">Experiential Marketing</b> <Br>Programs activated for <b class="bigBold">1,200+ Clients</b><br><img src="images/0spacer.gif" width="1" height="10"><br><span class="bullets">&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;</span> <span class="tagline">the point is purchase<sup>TM</sup></span>',
	'<b class="bigBold">30,000+</b> Sales and Marketing <b class="bigBold">Professionals</b> <br>across the U.S. and Canada.<br><img src="images/0spacer.gif" width="1" height="10"><br><span class="bullets">&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;&bull;</span> <span class="tagline">the point is purchase<sup>TM</sup></span>'
);

var slider2 = new Array(
	'logo_1.png',
	'logo_2.png',
	'logo_3.png',
	'logo_4.png',
	'logo_5.png',
	'logo_6.png',
	'logo_7.png',
	'logo_8.png',
	'logo_9.png',
	'logo_10.png',
	'logo_11.png',
	'logo_12.png',
	'logo_13.png'
);

function autoSlide(){
	var alive = $("#autoSlide").val();
	if(alive == "yes"){
		slideRight();
	}
}

function setSource(id,slide){
	//alert(id);
	var source = slider[id];
	var text = sliderText[id];
	$('#stageText'+slide).html(text);
	$('#slide'+slide).attr('src', 'images/slider/'+source);
	//alert("slide" + slide + " :: plugins/slider/images/" + source);
}

function slideLeft(){
	//Disable button
	//$('#arrowLeft').hide();

	var current = $("#currentSlide").val();
	current = current*1;
	var currentStage = $("#currentStage").val();
	currentStage = currentStage*1;
	var maxNum = slider.length;
	maxNum = maxNum*1;
	var nextSlide = current - 1;
	if(nextSlide < 1){
		nextSlide = maxNum;
	}
	var arrSlide = nextSlide - 1;
	
	if(currentStage == 1){
		var nextStage = 2;
	}else{
		var nextStage = 1;
	}

	//alert(current + " --- " + nextSlide);
	
	// get next slide into position, set it's opacity to 0 and show it;
	var one = $("#stage"+nextStage).css("left","-700px");
	setSource(arrSlide,nextStage);
	
	//Animate current slide off the stage and the next slide onto the page
	var four = $("#stage"+nextStage).animate({ left: "0px"}, 2000 );
	var five = $("#stage"+currentStage).animate({ left: "700px"}, 2000 );
	
	// Update current slide variable to be the slide we just moved onto the stage
	$("#currentSlide").val(nextSlide);
	$("#currentStage").val(nextStage);
	//Enable button
	//setTimeout("showButton('left')", 2000);
}

function slideRight(){
	//Disable button
	$('#arrowRight').hide();

	var current = $("#currentSlide").val();
	current = current*1;
	var currentStage = $("#currentStage").val();
	currentStage = currentStage*1;
	var maxNum = slider.length;
	maxNum = maxNum*1;
	var nextSlide = current + 1;
	if(nextSlide > maxNum){
		nextSlide = 1;
	}
	var arrSlide = nextSlide - 1;
	
	if(currentStage == 1){
		var nextStage = 2;
	}else{
		var nextStage = 1;
	}
	
	//alert(current + " --- " + nextSlide);
	
	// get next slide into position, set it's opacity to 0 and show it;
	var one = $("#stage"+nextStage).css("left","700px");
	setSource(arrSlide,nextStage);

	//Animate current slide off the stage and the next slide onto the page
	var four = $("#stage"+nextStage).animate({ left: "0px", opacity: 1}, 2000 );
	var five = $("#stage"+currentStage).animate({ left: "-700px", opacity: 0}, 2000 );

	// Update current slide variable to be the slide we just moved onto the stage
	$("#currentSlide").val(nextSlide);
	$("#currentStage").val(nextStage);
	
	//Enable button
	setTimeout("showButton('right')", 2000);
}


function showButton(dir){
	/*if(dir == 'right'){
		$('#arrowRight').show();
	}else{
		$('#arrowLeft').show();
	}*/
}

